summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 4cd937d8e704feba80a75c1caa50340f120fb78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
PROJ = uart_loopback_improved
DEVICE = hx1k
PKG = tq144
PCF = pins.pcf

FILES = top.v

.PHONY: all clean burn

all: $(PROJ).bin

%.json: $(FILES)
	# Lint to catch mistakes
	verilator --lint-only $(FILES)
	# synthesize using Yosys
	yosys -ql yosys.log -p "synth_ice40 -top top -json $(PROJ).json" $(FILES)

%.asc: %.json
	# Place and route using nextpnr
	nextpnr-ice40 --$(DEVICE) --package $(PKG) --pcf $(PCF) --json $< --asc $@

%.rpt: %.asc
	# Timing
	icetime -d $(DEVICE) -mtr $@ $<

%.bin: %.asc
	# Convert to bitstream using IcePack
	icepack $< $@

burn:   $(PROJ).bin
	iceprog $<

clean:
	rm -f *.json *.asc *.bin *.vcd *.log