Guest User

Untitled

a guest
May 20th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. # vhdl files
  2. FILES = src/*
  3. VHDLEX = .vhd
  4.  
  5. # testbench
  6. TESTBENCHPATH = testbench/${TESTBENCH}$(VHDLEX)
  7.  
  8. #GHDL CONFIG
  9. GHDL_CMD = ghdl
  10. GHDL_FLAGS = --ieee=synopsys --warn-no-vital-generic
  11.  
  12. SIMDIR = simulation
  13. # Simulation break condition
  14. #GHDL_SIM_OPT = --assert-level=error
  15. GHDL_SIM_OPT = --stop-time=10000ms
  16.  
  17. WAVEFORM_VIEWER = gtkwave
  18.  
  19. all: compile run view
  20.  
  21. new :
  22. echo "Setting up project ${PROJECT}"
  23. mkdir src testbench simulation
  24.  
  25. compile :
  26. ifeq ($(strip $(TESTBENCH)),)
  27. @echo "TESTBENCH not set. Use TESTBENCH=value to set it."
  28. @exit 2
  29. endif
  30.  
  31. mkdir -p simulation
  32. $(GHDL_CMD) -i $(GHDL_FLAGS) --workdir=simulation --work=work $(TESTBENCHPATH) $(FILES)
  33. $(GHDL_CMD) -m $(GHDL_FLAGS) --workdir=simulation --work=work $(TESTBENCH)
  34. @mv $(TESTBENCH) simulation/$(TESTBENCH)
  35.  
  36. run :
  37. @$(SIMDIR)/$(TESTBENCH) $(GHDL_SIM_OPT) --vcdgz=$(SIMDIR)/$(TESTBENCH).vcdgz
  38.  
  39. view :
  40. gunzip --stdout $(SIMDIR)/$(TESTBENCH).vcdgz | $(WAVEFORM_VIEWER) --vcd
  41.  
  42. clean :
  43. $(GHDL_CMD) --clean --workdir=simulation
Add Comment
Please, Sign In to add comment