Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. ### VERILOG SOURCE FILES
  28. ## It finds all verilog files in src/*.sv and
  29. ## also includes subdirectories that has syntax
  30. ## src/{MOD_NAME}/{MOD_NAME}.sv or src/{MOD_NAME}/include.sv
  31. ###
  32. VERILOG_SRC=$(foreach SRC,$(sort $(dir $(wildcard ./src/*/*.sv))),$(wildcard $(SRC)$(shell basename $(SRC)).sv $(SRC)include.sv)) $(wildcard ./src/*.sv)
  33. $(info VERILOG_SRC=$(VERILOG_SRC))
  34. SIM_DIR ?= ./simulation/modelsim
  35. ### ================================================================
  36. ### Commands
  37. ### ================================================================
  38. analysis:
  39. ${QUARTUS_MAP} --read_settings_files=on --write_settings_files=off ${QUARTUS_MACROS} ${PROJECT_NAME} -c ${PROJECT_NAME} --analysis_and_elaboration
  40. modelsim: analysis
  41. ${QUARTUS_SH} -t "${QUARTUS_ROOT_PATH}/quartus/common/tcl/internal/nativelink/qnativesim.tcl" --rtl_sim "${PROJECT_NAME}" "${PROJECT_NAME}"
  42. modelsim_cli:
  43. ${MODELSIM_BIN} -c
  44. %.cli: ${SIM_DIR}/%.do
  45. ${MODELSIM_BIN} -c -do "$<"
  46. %.gui: ${SIM_DIR}/%.do
  47. ${MODELSIM_BIN} -gui -do "$<"
  48. %_tb:
  49. ${MODELSIM_BIN} -gui -do "$(foreach SRC,$(VERILOG_SRC),vlog -sv {${SRC}};) vsim -t 1ps ${VSIM_ARGS} ${@}; if { [file exists ${SIM_DIR}/wave_${@}.do ] == 1} { do ${SIM_DIR}/wave_${@}.do }"
  50. sim_fpa_mod.do:
  51. cd ./simulation/modelsim && ${MODELSIM_BIN} -gui -do $@