-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.mk
60 lines (41 loc) · 1.26 KB
/
main.mk
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
57
58
59
60
TABLES_DIR = ../tables
GEN_GAMMA = $(TABLES_DIR)/gen_gamma_table
all: $(PROJ).rpt $(PROJ).bin
%.blif: %.v $(ADD_SRC) $(ADD_DEPS)
yosys -ql $*.log -p 'synth_ice40 -top top -blif $@' $< $(ADD_SRC)
%.json: %.v $(ADD_SRC) $(ADD_DEPS)
yosys -ql $*.log -p 'synth_ice40 -top top -json $@' $< $(ADD_SRC)
ifeq ($(USE_ARACHNEPNR),)
%.asc: $(PIN_DEF) %.json
nextpnr-ice40 -q --$(DEVICE) --json $(filter-out $<,$^) --pcf $< --asc $@
else
%.asc: $(PIN_DEF) %.blif
arachne-pnr -d $(subst up,,$(subst hx,,$(subst lp,,$(DEVICE)))) -o $@ -p $^
endif
%.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 '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=$@
prog: $(PROJ).bin
iceprog $<
sudo-prog: $(PROJ).bin
@echo 'Executing prog as root!!!'
sudo iceprog $<
clean:
rm -f $(PROJ).blif $(PROJ).asc $(PROJ).log $(PROJ).rpt $(PROJ).bin \
$(PROJ).json ../tables/gen_gamma_table *.vcd a.out $(ADD_CLEAN)
%.hex: ../tables/gen_gamma_table
$(GEN_GAMMA): $(TABLES_DIR)/gen_gamma_table.c
$(GEN_GAMMA): LDLIBS += -lm
.SECONDARY:
.PHONY: all prog clean