ice40/hdl/Makefile

42 lines
749 B
Makefile

PROJ = top
PIN_DEF = pins.pcf
DEVICE = hx8k
PACKAGE = ct256
SOURCE_V = $(wildcard *.v)
TESTBENCH_V = $(wildcard tb/*.v)
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v
yosys -p 'synth_ice40 -top top -blif $@' $(SOURCE_V)
# yosys -p 'synth_ice40 -top top -blif $@' $<
%.asc: $(PIN_DEF) %.blif
arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -P $(PACKAGE) -o $@ -p $^
%.bin: %.asc
icepack $< $@
%.rpt: %.asc
icetime -d $(DEVICE) -mtr $@ $<
prog: $(PROJ).bin
iceprog $<
sudo-prog: $(PROJ).bin
@echo 'Executing prog as root!!!'
sudo iceprog $<
tb.out: $(SOURCE_V) $(TESTBENCH_V)
iverilog $^ -o $@
sim: tb.out
./tb.out
clean:
rm -rf $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin tb.out tb.vcd
.SECONDARY:
.PHONY: all prog clean sim