ice40/hdl/Makefile

42 lines
749 B
Makefile
Raw Normal View History

2021-07-02 00:35:20 -06:00
PROJ = top
PIN_DEF = pins.pcf
DEVICE = hx8k
PACKAGE = ct256
2021-07-02 00:41:37 -06:00
SOURCE_V = $(wildcard *.v)
TESTBENCH_V = $(wildcard tb/*.v)
2021-07-02 00:35:20 -06:00
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v
2021-07-02 00:41:37 -06:00
yosys -p 'synth_ice40 -top top -blif $@' $(SOURCE_V)
2021-07-02 00:35:20 -06:00
# 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 $<
2021-07-02 00:41:37 -06:00
tb.out: $(SOURCE_V) $(TESTBENCH_V)
2021-07-02 00:35:20 -06:00
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