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.

34 lines
1.1 KiB

  1. DESIGN_NAME := blink
  2. WORK_FILES := ../rtl/blink.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 3 -cdf off -pin off -plc off -cCP on
  7. PNRTOOL := $(shell which p_r)
  8. .PHONY: all syn imp
  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. ${DESIGN_NAME}.bit: ${DESIGN_NAME}.v ${DESIGN_NAME}.ccf
  21. cd build && \
  22. ${PNRTOOL} -i ../${DESIGN_NAME}.v -o $@ --ccf ../${DESIGN_NAME}.ccf $(PNRFLAGS) \
  23. 2>&1 | tee p_r-report.txt && \
  24. mv ${DESIGN_NAME}*.bit ../$@
  25. clean :
  26. echo "# Cleaning files"
  27. rm -rf build ${DESIGN_NAME}.v ${DESIGN_NAME}.bit