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.

72 lines
2.2 KiB

  1. DESIGN_NAME := uart_aes
  2. AES_DIR := ../../cryptocores/aes/rtl/vhdl
  3. CRYPTO_SRC := \
  4. $(AES_DIR)/aes_pkg.vhd \
  5. $(AES_DIR)/aes_enc.vhd \
  6. $(AES_DIR)/aes_dec.vhd \
  7. $(AES_DIR)/aes.vhd \
  8. $(AES_DIR)/../../../ctraes/rtl/vhdl/ctraes.vhd
  9. WORK_FILES := \
  10. ../rtl/uart_aes_types.vhd \
  11. ../rtl/uart_tx.vhd \
  12. ../rtl/uart_rx.vhd \
  13. ../rtl/uart_ctrl.vhd \
  14. ../rtl/${DESIGN_NAME}.vhd
  15. GM_FILES := ../../lib/rtl_components.vhd
  16. GHDL_FLAGS := --std=08 --workdir=build -Pbuild
  17. ICARUSFLAGS := -Wall -Winfloop -g2012 -gspecify -Ttyp
  18. YOSYSPIPE := -nomx8
  19. PNRFLAGS := -om 3 -cCP on
  20. PNRTOOL := $(shell which p_r)
  21. .PHONY: all syn imp prog syn_sim imp_sim
  22. all: imp
  23. syn: ${DESIGN_NAME}.v
  24. imp: ${DESIGN_NAME}.bit
  25. build/work-obj08.cf: ${WORK_FILES} build/gatemate-obj08.cf build/cryptocores-obj08.cf
  26. ghdl -a ${GHDL_FLAGS} --work=work ${WORK_FILES}
  27. build/cryptocores-obj08.cf: ${CRYPTO_SRC}
  28. ghdl -a $(GHDL_FLAGS) --work=cryptocores ${CRYPTO_SRC}
  29. build/gatemate-obj08.cf: ${GM_FILES}
  30. mkdir -p build
  31. ghdl -a ${GHDL_FLAGS} --work=gatemate ${GM_FILES}
  32. # Synthesis target for implementation
  33. ${DESIGN_NAME}.v: build/work-obj08.cf
  34. yosys -m ghdl -p 'ghdl ${GHDL_FLAGS} --warn-no-binding --no-formal ${DESIGN_NAME}; synth_gatemate -top $(DESIGN_NAME) ${YOSYSPIPE} -vlog $@' \
  35. 2>&1 | tee build/yosys-report.txt
  36. # Implementation target for FPGA
  37. ${DESIGN_NAME}.bit: ${DESIGN_NAME}.v ${DESIGN_NAME}.ccf
  38. cd build && \
  39. ${PNRTOOL} -i ../${DESIGN_NAME}.v -o $@ --ccf ../${DESIGN_NAME}.ccf $(PNRFLAGS) \
  40. 2>&1 | tee p_r-report.txt && \
  41. mv ${DESIGN_NAME}*.bit ../$@
  42. # Post-synthesis simulation target
  43. syn_sim: ${DESIGN_NAME}.v
  44. iverilog ${ICARUSFLAGS} -o tb_${DESIGN_NAME}_syn.vvp ${DESIGN_NAME}.v tb_${DESIGN_NAME}.v /usr/local/share/yosys/gatemate/cells_sim.v
  45. vvp -N tb_${DESIGN_NAME}_syn.vvp -fst
  46. # Post-implementation simulation target
  47. imp_sim: ${DESIGN_NAME}.bit
  48. iverilog ${ICARUSFLAGS} -o tb_${DESIGN_NAME}_imp.vvp build/${DESIGN_NAME}_00.v tb_${DESIGN_NAME}.v /opt/cc-toolchain-linux/bin/p_r/cpelib.v
  49. vvp -N tb_${DESIGN_NAME}_imp.vvp -fst
  50. # FPGA FW load per JTAG
  51. prog: ${DESIGN_NAME}.bit
  52. openFPGALoader -b gatemate_evb_jtag $<
  53. clean :
  54. echo "# Cleaning files"
  55. rm -rf build ${DESIGN_NAME}.v ${DESIGN_NAME}_sim.v ${DESIGN_NAME}.vhd ${DESIGN_NAME}.bit *.vvp *.fst