Created
August 6, 2019 12:39
-
-
Save DurandA/15c83f37ee64b185801f88fbe0a0f25c to your computer and use it in GitHub Desktop.
NextPNR makefile for TinyFPGA BX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile borrowed from https://github.com/cliffordwolf/icestorm/blob/master/examples/icestick/Makefile | |
# | |
# The following license is from the icestorm project and specifically applies to this file only: | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
PROJ = top | |
PIN_DEF = pins.pcf | |
DEVICE = lp8k | |
all: $(PROJ).bin | |
%.json: %.v | |
yosys -p 'synth_ice40 -top $(PROJ) -json $@' $< | |
%.asc: %.json $(PIN_DEF) | |
# arachne-pnr -d 8k -P cm81 -o $@ -p $^ | |
nextpnr-ice40 --lp8k --package cm81 --json $< --pcf $(PIN_DEF) --asc $@ --ignore-loops | |
%.bin: %.asc | |
icepack $< $@ | |
%.rpt: %.asc | |
icetime -d $(DEVICE) -mtr $@ $< | |
%_tb: %_tb.v %.v | |
iverilog -o $@ $^ | |
%_tb.vcd: %_tb | |
vvp -N $< +vcd=$@ | |
%_syn.v: %.blif | |
yosys -p 'read_blif -wideports $^; write_verilog $@' | |
%_syntb: %_tb.v %_syn.v | |
iverilog -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` | |
%_syntb.vcd: %_syntb | |
vvp -N $< +vcd=$@ | |
prog: $(PROJ).bin | |
tinyprog -p $< | |
sudo-prog: $(PROJ).bin | |
@echo 'Executing prog as root!!!' | |
sudo tinyprog -p $< | |
clean: | |
rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin | |
.SECONDARY: | |
.PHONY: all prog clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment