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.

38 lines
1.2 KiB

  1. DESIGN_NAME := blink
  2. WORK_FILES := ../../lib/user_components.vhd ../rtl/blink.vhd
  3. GM_FILES := ../../lib/rtl_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. ghdl --synth ${GHDL_FLAGS} ${DESIGN_NAME} > ${DESIGN_NAME}.vhd
  19. yosys -m ghdl -p 'ghdl ${GHDL_FLAGS} --no-formal ${DESIGN_NAME}; synth_gatemate -top $(DESIGN_NAME) ${YOSYSPIPE} -vlog $@' \
  20. 2>&1 | tee build/yosys-report.txt
  21. ${DESIGN_NAME}.bit: ${DESIGN_NAME}.v ${DESIGN_NAME}.ccf
  22. cd build && \
  23. ${PNRTOOL} -i ../${DESIGN_NAME}.v -o $@ --ccf ../${DESIGN_NAME}.ccf $(PNRFLAGS) \
  24. 2>&1 | tee p_r-report.txt && \
  25. mv ${DESIGN_NAME}*.bit ../$@
  26. prog: ${DESIGN_NAME}.bit
  27. openFPGALoader -b gatemate_evb_jtag $<
  28. clean :
  29. echo "# Cleaning files"
  30. rm -rf build ${DESIGN_NAME}.v ${DESIGN_NAME}.vhd ${DESIGN_NAME}.bit