Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. QUARTUS_DIR = /opt/altera/18.1/quartus
  2. MODELSIM_DIR = /opt/altera/18.1/modelsim_ase
  3. PROJECT_NAME = UCL_project_y3
  4. QUARTUS_MAP = ${QUARTUS_DIR}/bin/quartus_map --read_settings_files=on --write_settings_files=off ${PROJECT_NAME} -c ${PROJECT_NAME}
  5. MODELSIM_GUI = ${QUARTUS_DIR}/bin/quartus_sh -t "${QUARTUS_DIR}/common/tcl/internal/nativelink/qnativesim.tcl" --rtl_sim "${PROJECT_NAME}" "${PROJECT_NAME}"
  6. MODELSIM_BIN = ${MODELSIM_DIR}/bin/vsim
  7. GENTABLE_BIN = python3 tools/gen_sv.py
  8. ASMC = python3 tools/asm_compiler.py
  9. MEMDEP = memory/risc8_test.asm
  10. MEMRES = $(MEMDEP:.asm=.mem)
  11. # Genreate sv case table from csv
  12. GENTABLE_CSV = src/risc/controller.csv
  13. define execute-gentable
  14. $(GENTABLE_BIN) $(1) $(1:.csv=.sv)
  15. endef
  16. analysis: compile_mem
  17. ${QUARTUS_MAP} --analysis_and_elaboration
  18. synthesis:
  19. ${QUARTUS_MAP}
  20. modelsim_cli:
  21. ${MODELSIM_BIN} -c
  22. modelsim_gui:
  23. ${MODELSIM_GUI}
  24. compile:
  25. ${MODELSIM_BIN} -c -do simulation/modelsim/${PROJECT_NAME}_run_msim_rtl_verilog.do -do exit
  26. compile_mem: $(MEMRES)
  27. %.mem: $(MEMDEP)
  28. ${ASMC} -t mem -o $@ -f $<
  29. gentable:
  30. $(foreach x,$(GENTABLE_CSV),$(call execute-gentable,./$(x)))
  31. clean:
  32. rm -f $(MEMRES)
  33. .PHONY: clean