Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. ### ================================================================
  33. ### Commands
  34. ### ================================================================
  35. analysis:
  36. ${QUARTUS_MAP} --read_settings_files=on --write_settings_files=off ${QUARTUS_MACROS} ${PROJECT_NAME} -c ${PROJECT_NAME} --analysis_and_elaboration
  37. modelsim: analysis
  38. ${QUARTUS_SH} -t "${QUARTUS_ROOT_PATH}/quartus/common/tcl/internal/nativelink/qnativesim.tcl" --rtl_sim "${PROJECT_NAME}" "${PROJECT_NAME}"
  39. modelsim_cli:
  40. ${MODELSIM_BIN} -c
  41. sim:
  42. cd ./simulation/modelsim && ${MODELSIM_BIN} -c -do "${do_file}"
  43. sim_gui:
  44. cd ./simulation/modelsim && ${MODELSIM_BIN} -gui -do "${do_file}"
  45. testbench:
  46. ${MODELSIM_BIN} -c -do "vlog -sv +incdir+${tb_dir} {${tb_file}}; vsim -t 1ps ${VSIM_ARGS} ${tb_mod}; run -all"