You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
4.1 KiB

  1. DESIGN_NAME := neorv32_aes
  2. NEORV32_CORE_DIR := ../../neorv32/rtl/core
  3. NEORV32_PKG := $(NEORV32_CORE_DIR)/neorv32_package.vhd
  4. NEORV32_APP_SRC := $(NEORV32_CORE_DIR)/neorv32_application_image.vhd
  5. NEORV32_TEMPLATES := ../../neorv32/rtl/processor_templates
  6. NEORV32_MEM_ENTITIES := \
  7. $(NEORV32_CORE_DIR)/neorv32_dmem.entity.vhd \
  8. $(NEORV32_CORE_DIR)/neorv32_imem.entity.vhd
  9. NEORV32_MEM_SRC := \
  10. $(NEORV32_CORE_DIR)/mem/neorv32_imem.default.vhd \
  11. $(NEORV32_CORE_DIR)/mem/neorv32_dmem.default.vhd
  12. NEORV32_CORE_SRC := \
  13. $(NEORV32_CORE_DIR)/neorv32_bootloader_image.vhd \
  14. $(NEORV32_CORE_DIR)/neorv32_boot_rom.vhd \
  15. $(NEORV32_CORE_DIR)/neorv32_bus_keeper.vhd \
  16. $(NEORV32_CORE_DIR)/neorv32_busswitch.vhd \
  17. $(NEORV32_CORE_DIR)/neorv32_cpu.vhd \
  18. $(NEORV32_CORE_DIR)/neorv32_cpu_alu.vhd \
  19. $(NEORV32_CORE_DIR)/neorv32_cpu_bus.vhd \
  20. $(NEORV32_CORE_DIR)/neorv32_cpu_control.vhd \
  21. $(NEORV32_CORE_DIR)/neorv32_cpu_cp_bitmanip.vhd \
  22. $(NEORV32_CORE_DIR)/neorv32_cpu_cp_cfu.vhd \
  23. $(NEORV32_CORE_DIR)/neorv32_cpu_cp_fpu.vhd \
  24. $(NEORV32_CORE_DIR)/neorv32_cpu_cp_muldiv.vhd \
  25. $(NEORV32_CORE_DIR)/neorv32_cpu_cp_shifter.vhd \
  26. $(NEORV32_CORE_DIR)/neorv32_cpu_decompressor.vhd \
  27. $(NEORV32_CORE_DIR)/neorv32_cpu_regfile.vhd \
  28. $(NEORV32_CORE_DIR)/neorv32_debug_dm.vhd \
  29. $(NEORV32_CORE_DIR)/neorv32_debug_dtm.vhd \
  30. $(NEORV32_CORE_DIR)/neorv32_fifo.vhd \
  31. $(NEORV32_CORE_DIR)/neorv32_gpio.vhd \
  32. $(NEORV32_CORE_DIR)/neorv32_gptmr.vhd \
  33. $(NEORV32_CORE_DIR)/neorv32_icache.vhd \
  34. $(NEORV32_CORE_DIR)/neorv32_mtime.vhd \
  35. $(NEORV32_CORE_DIR)/neorv32_neoled.vhd \
  36. $(NEORV32_CORE_DIR)/neorv32_onewire.vhd \
  37. $(NEORV32_CORE_DIR)/neorv32_pwm.vhd \
  38. $(NEORV32_CORE_DIR)/neorv32_slink.vhd \
  39. $(NEORV32_CORE_DIR)/neorv32_spi.vhd \
  40. $(NEORV32_CORE_DIR)/neorv32_sysinfo.vhd \
  41. $(NEORV32_CORE_DIR)/neorv32_trng.vhd \
  42. $(NEORV32_CORE_DIR)/neorv32_twi.vhd \
  43. $(NEORV32_CORE_DIR)/neorv32_uart.vhd \
  44. $(NEORV32_CORE_DIR)/neorv32_wdt.vhd \
  45. $(NEORV32_CORE_DIR)/neorv32_wishbone.vhd \
  46. $(NEORV32_CORE_DIR)/neorv32_xip.vhd \
  47. $(NEORV32_CORE_DIR)/neorv32_xirq.vhd \
  48. $(NEORV32_CORE_DIR)/neorv32_cfs.vhd \
  49. $(NEORV32_CORE_DIR)/neorv32_cfs_aes.vhd \
  50. $(NEORV32_CORE_DIR)/neorv32_top.vhd
  51. NEORV32_SRC := ${NEORV32_PKG} ${NEORV32_APP_SRC} ${NEORV32_MEM_ENTITIES} \
  52. ${NEORV32_MEM_SRC} ${NEORV32_CORE_SRC}
  53. WORK_FILES := ../rtl/${DESIGN_NAME}.vhd
  54. GM_FILES := ../../lib/rtl_components.vhd
  55. GHDL_FLAGS := --std=08 --workdir=build -Pbuild
  56. YOSYSPIPE := -nomx8
  57. # -retime
  58. PNRFLAGS := -om 3 -cCP on
  59. PNRTOOL := $(shell which p_r)
  60. .PHONY: all syn imp prog syn_sim imp_sim
  61. all: imp
  62. syn: ${DESIGN_NAME}.v
  63. imp: ${DESIGN_NAME}.bit
  64. build/work-obj08.cf: ${WORK_FILES} build/gatemate-obj08.cf build/neorv32-obj08.cf
  65. ghdl -a ${GHDL_FLAGS} --work=work ${WORK_FILES}
  66. build/neorv32-obj08.cf: build/gatemate-obj08.cf ${NEORV32_SRC}
  67. ghdl -a $(GHDL_FLAGS) --work=neorv32 ${NEORV32_SRC}
  68. build/gatemate-obj08.cf: ${GM_FILES}
  69. mkdir -p build
  70. ghdl -a ${GHDL_FLAGS} --work=gatemate ${GM_FILES}
  71. # Synthesis target for implementation
  72. ${DESIGN_NAME}.v: build/work-obj08.cf
  73. yosys -m ghdl -p 'ghdl ${GHDL_FLAGS} --warn-no-binding --no-formal ${DESIGN_NAME}; synth_gatemate -top $(DESIGN_NAME) ${YOSYSPIPE} -vlog $@' \
  74. 2>&1 | tee build/yosys-report.txt
  75. # Implementation target for FPGA
  76. ${DESIGN_NAME}.bit: ${DESIGN_NAME}.v ${DESIGN_NAME}.ccf
  77. cd build && \
  78. ${PNRTOOL} -i ../${DESIGN_NAME}.v -o $@ --ccf ../${DESIGN_NAME}.ccf $(PNRFLAGS) \
  79. 2>&1 | tee p_r-report.txt && \
  80. mv ${DESIGN_NAME}*.bit ../$@
  81. # Post-synthesis simulation target
  82. syn_sim: ${DESIGN_NAME}.v
  83. iverilog -g2012 -o tb_${DESIGN_NAME}_syn.vvp ${DESIGN_NAME}.v tb_${DESIGN_NAME}.v /usr/local/share/yosys/gatemate/cells_sim.v
  84. vvp -N tb_${DESIGN_NAME}_syn.vvp -fst
  85. # Post-implementation simulation target
  86. imp_sim: ${DESIGN_NAME}.bit
  87. iverilog -g2012 -o tb_${DESIGN_NAME}_imp.vvp build/${DESIGN_NAME}_00.v tb_${DESIGN_NAME}.v /opt/cc-toolchain-linux/bin/p_r/cpelib.v
  88. vvp -N tb_${DESIGN_NAME}_imp.vvp -fst
  89. # FPGA FW load per JTAG
  90. prog: ${DESIGN_NAME}.bit
  91. openFPGALoader -b gatemate_evb_jtag $<
  92. clean :
  93. echo "# Cleaning files"
  94. rm -rf build ${DESIGN_NAME}.v ${DESIGN_NAME}_sim.v ${DESIGN_NAME}.vhd ${DESIGN_NAME}.bit *.vvp *.fst