Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. VCOM_ARGS=-2008 -work work -suppress 1236 -explicit
  2. VSIM_ARGS=-msgmode both
  3. # The order is important!
  4. VHDL_FILES = \
  5. ../prng/src/prng_pkg.vhd\
  6. ../prng/src/prng.vho
  7. TB_FILES = \
  8. ./tb/prng_tb.vhd
  9. TIME_RESOLUTION = 1ps
  10. TB = prng_tb
  11. # For the simulation time -all can also be selected. Questa then simulates until no more singal changes occour.
  12. SIM_TIME = -all
  13. WAVE_FILE = scripts/wave.do
  14. compile: log
  15. log: $(VHDL_FILES) $(TB_FILES)
  16. rm -f log
  17. vlib work | tee log
  18. for i in $(VHDL_FILES); do \
  19. vcom $(VCOM_ARGS) $$i | tee -a log;\
  20. done;
  21. for i in $(TB_FILES); do \
  22. vcom $(VCOM_ARGS) $$i | tee -a log;\
  23. done;
  24. @echo "--------------------------------------------------------------"
  25. @echo "-- Error and Warning Summary --"
  26. @echo "--------------------------------------------------------------"
  27. @cat log | grep 'Warning\|Error'
  28. @if [[ $$(grep "Error:" -m 1 log) ]]; then \
  29. echo "Compilation had errors!" \
  30. exit 1; \
  31. fi;
  32. list_sources:
  33. @for i in $(VHDL_FILES) $(TB_FILES); do \
  34. echo $$i;\
  35. done;
  36. sim: compile
  37. vsim -c -do "vsim $(TB) -t $(TIME_RESOLUTION) $(VSIM_ARGS); run $(SIM_TIME)"
  38. sim_gui: compile
  39. vsim -do "vsim $(TB) -t $(TIME_RESOLUTION) $(VSIM_ARGS); do $(WAVE_FILE); run $(SIM_TIME)"
  40. clean:
  41. rm -f transcript
  42. rm -f vsim.wlf
  43. rm -f log
  44. rm -fr work
  45. .PHONY: clean
  46. .PHONY: compile
  47. .PHONY: sim_fifo
  48. .PHONY: sim_fifo_cl