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.

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