-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.blackicemx
56 lines (41 loc) · 1.17 KB
/
Makefile.blackicemx
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#PIN_DEF = olimexice40HX8K.pcf
PIN_DEF = blackice-mx.pcf
DEVICE = hx8k
PROJ=top
FILES = top.v \
i2c.v \
i2c_api.v \
gfx_unit.v \
double_dabble.v \
debouncer.v \
alarm_tone.v \
framebuffer.v
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v
yosys -D BUTTONS -D SYNTHESIS -p "synth_ice40 -top top -json $(PROJ).json" $(FILES)
%.asc: $(PIN_DEF) %.blif
# olimex nextpnr-ice40 -r --$(DEVICE) --package ct256 --json $(PROJ).json --asc $(PROJ).asc --opt-timing --pcf $(PIN_DEF)
nextpnr-ice40 -r --$(DEVICE) --package tq144:4k --json $(PROJ).json --asc $(PROJ).asc --opt-timing --pcf $(PIN_DEF)
%.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 '-D SYNTHESIS 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=$@
sim: $(PROJ)_tb.vcd
postsim: $(PROJ)_syntb.vcd
prog: $(PROJ).bin
stty -F /dev/ttyACM0 raw
cat $< > /dev/ttyACM0
clean:
rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin $(PROJ).json
.SECONDARY:
.PHONY: all prog clean