Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # run `make help` for explanation of the important targets!
  2. VCOM_ARGS=-2008 -work work -explicit
  3. VSIM_ARGS=-msgmode both
  4. # The order is important!
  5. VHDL_FILES1 = \
  6. ../math/src/math_pkg.vhd\
  7. ../ram/src/ram_pkg.vhd\
  8. ../ram/src/dp_ram_1c1r1w.vhd\
  9. ../ram/src/fifo_1c1r1w.vhd\
  10. ../lcd_graphics_controller/src/gfx_if_pkg.vhd\
  11. ../gfx_util/src/gfx_util_pkg.vhd\
  12. ../gfx_util/src/gfx_circle.vhd\
  13. ../gfx_util/src/gfx_line.vhd\
  14. ../gfx_util/src/gfx_rect.vhd\
  15. ./src/rasterizer.vhd
  16. VHDL_FILES2 = \
  17. ../math/src/math_pkg.vhd\
  18. ../lcd_graphics_controller/src/gfx_if_pkg.vhd\
  19. ./src/tpg.vhd\
  20. ./src/vbs_graphics_controller_pkg.vhd\
  21. ./src/dac.vhd
  22. TB_FILES1 = \
  23. ./tb/rasterizer_tb.vhd
  24. TB_FILES2 = \
  25. ./tb/dac_tb.vhd
  26. TIME_RESOLUTION = 1ps
  27. TB1 = rasterizer_tb
  28. TB2 = dac_tb
  29. # For the simulation time -all can also be selected. Questa then simulates until no more singal changes occour.
  30. SIM_TIME = -all
  31. WAVE_FILE1 = scripts/wave-rasterizer.do
  32. WAVE_FILE2 = scripts/wave-dac.do
  33. compile1: log1
  34. compile2: log2
  35. log1: $(VHDL_FILES1) $(TB_FILES1)
  36. rm -f log
  37. vlib work | tee log
  38. for i in $(VHDL_FILES1); do \
  39. vcom $(VCOM_ARGS) $$i | tee -a log;\
  40. done;
  41. for i in $(TB_FILES1); do \
  42. vcom $(VCOM_ARGS) $$i | tee -a log;\
  43. done;
  44. @echo "--------------------------------------------------------------"
  45. @echo "-- Error and Warning Summary --"
  46. @echo "--------------------------------------------------------------"
  47. @cat log | grep 'Warning\|Error'
  48. @if [[ $$(grep "Error:" -m 1 log) ]]; then \
  49. echo "Compilation had errors!" \
  50. exit 1; \
  51. fi;
  52. log2: $(VHDL_FILES2) $(TB_FILES2)
  53. rm -f log
  54. vlib work | tee log
  55. for i in $(VHDL_FILES2); do \
  56. vcom $(VCOM_ARGS) $$i | tee -a log;\
  57. done;
  58. for i in $(TB_FILES2); do \
  59. vcom $(VCOM_ARGS) $$i | tee -a log;\
  60. done;
  61. @echo "--------------------------------------------------------------"
  62. @echo "-- Error and Warning Summary --"
  63. @echo "--------------------------------------------------------------"
  64. @cat log | grep 'Warning\|Error'
  65. @if [[ $$(grep "Error:" -m 1 log) ]]; then \
  66. echo "Compilation had errors!" \
  67. exit 1; \
  68. fi;
  69. list_sources1:
  70. @for i in $(VHDL_FILES1) $(TB_FILES1); do \
  71. echo $$i;\
  72. done;
  73. list_sources2:
  74. @for i in $(VHDL_FILES2) $(TB_FILES2); do \
  75. echo $$i;\
  76. done;
  77. sim1: compile1
  78. vsim -c -do "vsim $(TB1) -t $(TIME_RESOLUTION) $(VSIM_ARGS); run $(SIM_TIME)"
  79. sim2: compile2
  80. vsim -c -do "vsim $(TB2) -t $(TIME_RESOLUTION) $(VSIM_ARGS); run $(SIM_TIME)"
  81. sim_gui1: compile1
  82. vsim -do "vsim $(TB1) -t $(TIME_RESOLUTION) $(VSIM_ARGS); do $(WAVE_FILE1); run $(SIM_TIME)"
  83. sim_gui2: compile2
  84. vsim -do "vsim $(TB2) -t $(TIME_RESOLUTION) $(VSIM_ARGS); do $(WAVE_FILE2); run $(SIM_TIME)"
  85. clean:
  86. rm -f transcript
  87. rm -f vsim.wlf
  88. rm -f log
  89. rm -fr work
  90. help:
  91. # available commands are:
  92. # make (clean|compile1|compile2|sim1|sim2|sim_gui1|sim_gui2|help)"
  93. #
  94. # targets suffixed with 1 target the rasterizer module
  95. # targets suffixed with 2 target the rasterizer module
  96. .PHONY: clean
  97. .PHONY: compile1
  98. .PHONY: compile2
  99. .PHONY: sim1
  100. .PHONY: sim2
  101. .PHONY: sim_gui1
  102. .PHONY: sim_gui2
  103. .PHONY: help