Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. QUARTUS_ROOT := /opt/intelFPGA/* C:/intelFPGA_lite/*
  2. ### Finding quartus dir. If not found, edit QUARTUS_ROOT above
  3. QUARTUS_ROOT_PATH = $(word 1, $(foreach dir, $(QUARTUS_ROOT), $(wildcard $(dir))))
  4. ifeq ($(QUARTUS_ROOT_PATH),)
  5. $(error Failed to find Quartus installation dir, change QUARTUS_ROOT parameter)
  6. endif
  7. ### Finding needed binary files
  8. QUARTUS_SH = $(word 1, $(wildcard $(QUARTUS_ROOT_PATH)/quartus/*/quartus_sh))
  9. QUARTUS_MAP = $(word 1, $(wildcard $(QUARTUS_ROOT_PATH)/quartus/*/quartus_map))
  10. MODELSIM_BIN = $(word 1, $(wildcard $(QUARTUS_ROOT_PATH)/modelsim_ase/*/vsim))
  11. ### Checking if we have everything we need
  12. ifeq ($(QUARTUS_SH),)
  13. $(error Failed to find QUARTUS_SH)
  14. endif
  15. ifeq ($(QUARTUS_MAP),)
  16. $(error Failed to find QUARTUS_MAP)
  17. endif
  18. ifeq ($(MODELSIM_BIN),)
  19. $(error Failed to find MODELSIM_BIN)
  20. endif
  21. $(info QUARTUS_MAP=$(QUARTUS_MAP))
  22. $(info MODELSIM_BIN=$(MODELSIM_BIN))
  23. ### Remaining configurations
  24. PROJECT_NAME = altera_devel
  25. QUARTUS_MACROS = --set VERILOG_MACRO="SYNTHESIS=1"
  26. VSIM_ARGS = -L altera_ver -L lpm_ver -L sgate_ver -L altera_mf_ver -L altera_lnsim_ver -L cycloneive_ver -voptargs="+acc"
  27. ### Optional parameters
  28. tb_file ?=
  29. tb_dir = $(dirname "${testbench_file}")
  30. tb_mod ?=
  31. do_file ?=
  32. SIM_DIR ?= ./simulation/modelsim
  33. ### ================================================================
  34. ### Commands
  35. ### ================================================================
  36. analysis:
  37. ${QUARTUS_MAP} --read_settings_files=on --write_settings_files=off ${QUARTUS_MACROS} ${PROJECT_NAME} -c ${PROJECT_NAME} --analysis_and_elaboration
  38. modelsim: analysis
  39. ${QUARTUS_SH} -t "${QUARTUS_ROOT_PATH}/quartus/common/tcl/internal/nativelink/qnativesim.tcl" --rtl_sim "${PROJECT_NAME}" "${PROJECT_NAME}"
  40. modelsim_cli:
  41. ${MODELSIM_BIN} -c
  42. %.cli: ${SIM_DIR}/%.do
  43. ${MODELSIM_BIN} -c -do "$<"
  44. %.gui: ${SIM_DIR}/%.do
  45. ${MODELSIM_BIN} -gui -do "$<"
  46. testbench:
  47. ${MODELSIM_BIN} -c -do "vlog -sv +incdir+${tb_dir} {${tb_file}}; vsim -t 1ps ${VSIM_ARGS} ${tb_mod}; run -all"
  48. sim_fpa_mod.do:
  49. cd ./simulation/modelsim && ${MODELSIM_BIN} -gui -do $@