From 5cf02e9490d00237c7fb2f30d43af4a15367832c Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sun, 22 Jan 2023 16:26:35 -0500 Subject: [PATCH] Support building actual bitstreams In addition to PNR-ing for per-module, post-placement simulation, we also want to be able to do PNR for the purposes of generating a bitstream. Refactor things a bit so we can (mostly) reuse the same command line. Signed-off-by: Sean Anderson --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9e689ff..604da4a 100644 --- a/Makefile +++ b/Makefile @@ -64,9 +64,24 @@ endef %.place.vvp: %.place.v rtl/iverilog_dump.v $(run-icarus) -%.asc %.sdf %.place.json &: %.synth.json | log - $(PNR) -q --pcf-allow-unconstrained --freq 125 --hx8k --package ct256 --json $< \ - --write $*.place.json --sdf $*.sdf --asc $*.asc --log log/$(*F).place +PNRARGS := --freq 125 --hx8k --package ct256 --pcf-allow-unconstrained --no-promote-globals + +define run-pnr = + $(PNR) -q $(PNRARGS) --json $< --log log/$(*F).$(LOG_EXT) +endef + +%.sdf %.place.json &: PNRARGS += --write $*.place.json --sdf $*.sdf +%.sdf %.place.json &: LOG_EXT := place +%.sdf %.place.json &: %.synth.json | log + $(run-pnr) + +%.asc: PNRARGS += --pcf $*.pcf --asc $@ -r +%.asc: LOG_EXT := asc +%.asc: %.synth.json %.pcf | log + $(run-pnr) + +%.bin: rtl/%.asc + $(ICEPACK) $< $@ -include $(wildcard rtl/*.d) @@ -123,4 +138,4 @@ asc: $(addprefix rtl/,$(addsuffix .asc,$(MODULES))) clean: rm -f *.fst rm -rf log - cd rtl && rm -f *.json *.asc *.pre *.vvp *.d *.synth.v *.place.v + cd rtl && rm -f *.json *.asc *.pre *.vvp *.d *.synth.v *.place.v *.sdf