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.

45 lines
1.6 KiB

  1. DESIGN_NAME := uart_reg
  2. WORK_FILES := ../rtl/uart_tx.vhd ../rtl/uart_rx.vhd ../rtl/uart_reg.vhd
  3. GM_FILES := ../../lib/components.vhd
  4. GHDL_FLAGS := --std=08 --workdir=build -Pbuild
  5. YOSYSPIPE := -nomx8 -luttree -retime
  6. PNRFLAGS := -sp off -om 2 -cCP on
  7. PNRTOOL := $(shell which p_r)
  8. .PHONY: all syn imp prog
  9. all: imp
  10. syn: ${DESIGN_NAME}.v
  11. imp: ${DESIGN_NAME}.bit
  12. build/work-obj08.cf: ${WORK_FILES} build/gatemate-obj08.cf
  13. ghdl -a ${GHDL_FLAGS} --work=work ${WORK_FILES}
  14. build/gatemate-obj08.cf: ${GM_FILES}
  15. mkdir -p build
  16. ghdl -a ${GHDL_FLAGS} --work=gatemate ${GM_FILES}
  17. ${DESIGN_NAME}.v: build/work-obj08.cf
  18. yosys -m ghdl -p 'ghdl ${GHDL_FLAGS} --no-formal ${DESIGN_NAME}; synth_gatemate -top $(DESIGN_NAME) ${YOSYSPIPE} -vlog $@' \
  19. 2>&1 | tee build/yosys-report.txt
  20. build/${DESIGN_NAME}_00.v ${DESIGN_NAME}.bit: ${DESIGN_NAME}.v ${DESIGN_NAME}.ccf
  21. cd build && \
  22. ${PNRTOOL} -i ../${DESIGN_NAME}.v -o ${DESIGN_NAME}.bit --ccf ../${DESIGN_NAME}.ccf $(PNRFLAGS) \
  23. 2>&1 | tee p_r-report.txt && \
  24. mv ${DESIGN_NAME}*.bit ../${DESIGN_NAME}.bit
  25. syn_sim: ${DESIGN_NAME}.v
  26. iverilog -g2012 -o tb_${DESIGN_NAME}_syn.vvp ${DESIGN_NAME}.v tb_${DESIGN_NAME}.v /usr/local/share/yosys/gatemate/cells_sim.v
  27. vvp -N tb_${DESIGN_NAME}_syn.vvp -fst
  28. imp_sim: build/${DESIGN_NAME}_00.v
  29. 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
  30. vvp -N tb_${DESIGN_NAME}_imp.vvp -fst
  31. prog: ${DESIGN_NAME}.bit
  32. openFPGALoader -b gatemate_evb_jtag $<
  33. clean :
  34. echo "# Cleaning files"
  35. rm -rf build ${DESIGN_NAME}.v ${DESIGN_NAME}.bit *.vvp *.fst