summaryrefslogtreecommitdiffstats
path: root/src/evb-yosys-demo/ice40-io-video/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/evb-yosys-demo/ice40-io-video/Makefile')
-rw-r--r--src/evb-yosys-demo/ice40-io-video/Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/evb-yosys-demo/ice40-io-video/Makefile b/src/evb-yosys-demo/ice40-io-video/Makefile
new file mode 100644
index 0000000..8b5a9b1
--- /dev/null
+++ b/src/evb-yosys-demo/ice40-io-video/Makefile
@@ -0,0 +1,52 @@
+PREFIX=../../..
+
+YOSYS=${PREFIX}/bin/yosys
+NEXTPNR=${PREFIX}/bin/nextpnr-ice40
+ICEPACK=${PREFIX}/bin/icepack
+ICETIME=${PREFIX}/bin/icetime
+FLASH=${PREFIX}/bin/flash
+
+BUILDDIR = ./build
+FPGA_TYPE = hx8k
+FPGA_PKG = ct256
+PCF = ice40-io-video.pcf
+RMDIR = rmdir
+
+# Targets
+example: $(BUILDDIR)/example.rpt $(BUILDDIR)/example.bin
+example_0: $(BUILDDIR)/example_0.rpt $(BUILDDIR)/example_0.bin
+example_1: $(BUILDDIR)/example_1.rpt $(BUILDDIR)/example_1.bin
+example_2: $(BUILDDIR)/example_2.rpt $(BUILDDIR)/example_2.bin
+example_3: $(BUILDDIR)/example_3.rpt $(BUILDDIR)/example_3.bin
+example_4: $(BUILDDIR)/example_4.rpt $(BUILDDIR)/example_4.bin
+example_5: $(BUILDDIR)/example_5.rpt $(BUILDDIR)/example_5.bin
+example_6: $(BUILDDIR)/example_6.rpt $(BUILDDIR)/example_6.bin
+example_7: $(BUILDDIR)/example_7.rpt $(BUILDDIR)/example_7.bin
+
+flash: $(BUILDDIR)/example.bin
+ ${FLASH} ${BUILDDIR}/example.bin
+
+
+$(BUILDDIR)/%.json: %.v
+ @mkdir -p $(@D)
+ ${YOSYS} -ql $(subst .json,,$@).log -p 'synth_ice40 -abc9 -device u -top top -json $@' $<
+
+%.asc: %.json
+ ${NEXTPNR} --${FPGA_TYPE} --package ${FPGA_PKG} --json $< --pcf ${PCF} --asc $@
+
+%.bin: %.asc
+ ${ICEPACK} $< $@
+
+%.rpt: %.asc
+ ${ICETIME} -d $(FPGA_TYPE) -mtr $@ $<
+
+all: example example_0 example_1 example_2 example_3 example_4 example_5 example_6 example_7
+
+clean:
+ rm -f $(BUILDDIR)/*.asc $(BUILDDIR)/*.bin $(BUILDDIR)/*.rpt $(BUILDDIR)/*.log $(BUILDDIR)/*.json
+ $(RMDIR) $(BUILDDIR)
+
+# Uncomment this line if you want to keep the intermediate .json and .asc files
+# .PRECIOUS: $(BUILDDIR)/%.json %.asc
+
+.PHONY: all prog clean example example_0 example_1 example_2 example_3 example_4 example_5 example_6 example_7