add basic example

This commit is contained in:
2021-07-02 00:35:20 -06:00
parent e46403131f
commit 30dac2760c
7 changed files with 162 additions and 0 deletions

38
hdl/Makefile Normal file
View File

@@ -0,0 +1,38 @@
PROJ = top
PIN_DEF = pins.pcf
DEVICE = hx8k
PACKAGE = ct256
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v
yosys -p 'synth_ice40 -top top -blif $@' $(wildcard *.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: $(wildcard *.v) $(wildcard tb/*.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