Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. GHDL = ghdl
  2. VIEWER = gtkwave
  3. WAVEFILE = simulation/waves.vcd
  4. VIEWERTCL = simulation/gtkwave.tcl
  5. #TOP_DESIGN = top.vhd # Not used when not synthesizing..
  6. # Add design files to this row
  7. DESIGN_FILES = generic_counter.vhd ha.vhd generic_prescaler.vhd async_8n1_tx_v2.vhd async_8n1_tx.vhd
  8. DESIGN_FILES_DIR = hdl_design
  9. DESIGN_FILES_FULL_PATH = $(addprefix $(DESIGN_FILES_DIR)/,$(DESIGN_FILES))
  10. WORK_DIR = simulation
  11. WORK_LIBRARY = work
  12. GHDL_OPTIONS = --work=$(WORK_LIBRARY) --workdir=$(WORK_DIR)
  13. # Name of the testbench entity to simulate
  14. TOP_TESTBENCH = async_8n1_tx_tb
  15. # Add all testbench-related files on this row
  16. TEST_BENCHES = generic_prescaler_tb.vhd generic_counter_tb.vhd async_8n1_tx_tb.vhd
  17. TEST_BENCHES_DIR = testbench
  18. TEST_BENCHES_FULL_PATH = $(addprefix $(TEST_BENCHES_DIR)/,$(TEST_BENCHES))
  19. .PHONY: all clean analyze elaborate run view debug
  20. all: analyze elaborate run view
  21. analyze: $(DESIGN_FILES_FULL_PATH) $(TEST_BENCHES_FULL_PATH)
  22. $(GHDL) -a $(GHDL_OPTIONS) $(DESIGN_FILES_FULL_PATH) $(TEST_BENCHES_FULL_PATH)
  23. elaborate: analyze
  24. $(GHDL) -e $(GHDL_OPTIONS) $(TOP_TESTBENCH)
  25. run: elaborate
  26. $(GHDL) -r $(GHDL_OPTIONS) $(TOP_TESTBENCH) --vcd=$(WAVEFILE)
  27. view: run
  28. $(VIEWER) $(WAVEFILE) -S $(VIEWERTCL)
  29. clean:
  30. $(GHDL) --remove $(GHDL_OPTIONS)
  31. debug:
  32. echo $(DESIGN_FILES_FULL_PATH)