-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathMakefile
189 lines (136 loc) · 7.4 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
YOSYS ?= yosys
NEXTPNR ?= nextpnr-gowin
.DEFAULT_GOAL := all
# globals router tests
include globals/Makefile.inc
all: attosoc-tec0117.fs nanolcd-tangnano.fs blinky-tec0117.fs blinky-runber.fs \
blinky-tangnano.fs blinky-honeycomb.fs shift-tec0117.fs shift-runber.fs \
shift-tangnano.fs shift-honeycomb.fs \
tonegen-tec0117.fs blinky-tangnano9k.fs blinky-tangnano1k.fs blinky-tangnano4k.fs \
shift-tangnano9k.fs shift-tangnano1k.fs shift-tangnano4k.fs \
tlvds-tangnano4k.fs tlvds-tangnano9k.fs tlvds-tec0117.fs \
tlvds-oddr-tangnano4k.fs tlvds-oddr-tangnano9k.fs tlvds-oddr-tec0117.fs \
blinky-oddr-tec0117.fs blinky-oddr-runber.fs \
blinky-oddr-tangnano.fs blinky-oddr-honeycomb.fs \
blinky-oddr-tangnano4k.fs blinky-oddr-tangnano9k.fs \
blinky-osc-tec0117.fs blinky-osc-runber.fs blinky-osc-tangnano.fs \
blinky-osc-honeycomb.fs \
blinky-osc-tangnano9k.fs blinky-osc-tangnano1k.fs blinky-osc-tangnano4k.fs \
blinky-lw-tangnano.fs blinky-lw-tangnano1k.fs blinky-lw-tangnano4k.fs blinky-lw-tangnano9k.fs \
blinky-lw-honeycomb.fs blinky-lw-tec0117.fs blinky-lw-runber.fs \
globals_all
unpacked: attosoc-tec0117-unpacked.v nanolcd-tangnano-unpacked.v blinky-tec0117-unpacked.v blinky-runber-unpacked.v \
blinky-tangnano-unpacked.v blinky-honeycomb-unpacked.v shift-tec0117-unpacked.v shift-runber-unpacked.v \
shift-tangnano-unpacked.v shift-honeycomb-unpacked.v \
tonegen-tec0117-unpacked.v blinky-tangnano9k-unpacked.v blinky-tangnano1k-unpacked.v blinky-tangnano4k-unpacked.v \
shift-tangnano9k-unpacked.v shift-tangnano1k-unpacked.v shift-tangnano4k-unpacked.v \
tlvds-tangnano4k-unpacked.v tlvds-tangnano9k-unpacked.v tlvds-tec0117-unpacked.v \
tlvds-oddr-tangnano4k-unpacked.v tlvds-oddr-tangnano9k-unpacked.v tlvds-oddr-tec0117-unpacked.v \
blinky-oddr-tec0117-unpacked.v blinky-oddr-runber-unpacked.v \
blinky-oddr-tangnano-unpacked.v blinky-oddr-honeycomb-unpacked.v \
blinky-oddr-tangnano-unpacked.v blinky-oddr-honeycomb-unpacked.v \
blinky-oddr-tangnano4k-unpacked.v blinky-oddr-tangnano9k-unpacked.v \
blinky-osc-tec0117-unpacked.v blinky-osc-runber-unpacked.v blinky-osc-tangnano-unpacked.v \
blinky-osc-honeycomb-unpacked.v \
blinky-osc-tangnano9k-unpacked.v blinky-osc-tangnano1k-unpacked.v blinky-osc-tangnano4k-unpacked.v \
blinky-lw-tangnano-unpacked.v blinky-lw-tangnano1k-unpacked.v blinky-lw-tangnano4k-unpacked.v \
blinky-lw-tangnano9k-unpacked.v \
blinky-lw-honeycomb-unpacked.v blinky-lw-tec0117-unpacked.v blinky-lw-runber-unpacked.v \
globals_unpacked
clean: globals_clean
rm -f *.json *.fs *-unpacked.v
.PHONY: all clean
%-tec0117.fs: %-tec0117.json
gowin_pack -d GW1N-9 -o $@ $<
%-tec0117.json: %-tec0117-synth.json tec0117.cst
$(NEXTPNR) --json $< --write $@ --device GW1NR-LV9QN88C6/I5 --cst tec0117.cst
%-runber.fs: %-runber.json
gowin_pack -d GW1N-4 -o $@ $<
%-runber.json: %-runber-synth.json runber.cst
$(NEXTPNR) --json $< --write $@ --device GW1N-UV4LQ144C6/I5 --cst runber.cst
blinky-oddr-runber.json: blinky-oddr-runber-synth.json runber-tlvds.cst
$(NEXTPNR) --json $< --write $@ --device GW1N-UV4LQ144C6/I5 --cst runber-tlvds.cst
%-tangnano.fs: %-tangnano.json
gowin_pack -d GW1N-1 -o $@ $^
%-tangnano.json: %-tangnano-synth.json tangnano.cst
$(NEXTPNR) --json $< --write $@ --device GW1N-LV1QN48C6/I5 --cst tangnano.cst
%-tangnano1k.fs: %-tangnano1k.json
gowin_pack -d GW1NZ-1 -o $@ $^
%-tangnano1k.json: %-tangnano1k-synth.json tangnano1k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NZ-LV1QN48C6/I5 --family GW1NZ-1 --cst tangnano1k.cst
%-tangnano4k.fs: %-tangnano4k.json
gowin_pack -d GW1NS-4 -o $@ $^
%-tangnano4k.json: %-tangnano4k-synth.json tangnano4k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NSR-LV4CQN48PC7/I6 --cst tangnano4k.cst
%-tangnano9k.fs: %-tangnano9k.json
gowin_pack -d GW1N-9C -o $@ $^
%-tangnano9k.json: %-tangnano9k-synth.json tangnano9k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NR-LV9QN88PC6/I5 --family GW1N-9C --cst tangnano9k.cst
%-honeycomb.fs: %-honeycomb.json
gowin_pack -d GW1NS-2 -o $@ $<
%-honeycomb.json: %-honeycomb-synth.json honeycomb.cst
$(NEXTPNR) --json $< --write $@ --device GW1NS-UX2CQN48C5/I4 --cst honeycomb.cst
attosoc-tec0117-synth.json: attosoc/attosoc.v attosoc/picorv32.v
$(YOSYS) -p "read_verilog $^; synth_gowin -json $@"
lutram-tec0117-synth.json: lutram/lutram.v lutram/prbs.v lutram/top.v
$(YOSYS) -p "read_verilog $^; synth_gowin -nolutram -json $@"
attosoc-tangnano9k-synth.json: attosoc/attosoc.v attosoc/picorv32.v
$(YOSYS) -p "read_verilog $^; synth_gowin -json $@"
tonegen-tec0117-synth.json: tonegen/top.v tonegen/sddac.v tonegen/cordic.v
$(YOSYS) -p "read_verilog $^; synth_gowin -json $@"
nanolcd-tangnano-synth.json: nanolcd/TOP.v nanolcd/VGAMod.v
$(YOSYS) -p "read_verilog $^; synth_gowin -json $@"
%-tec0117-synth.json: %.v
$(YOSYS) -D LEDS_NR=8 -D OSC_TYPE_OSC -p "read_verilog $^; synth_gowin -json $@"
%-runber-synth.json: %.v
$(YOSYS) -D LEDS_NR=8 -D OSC_TYPE_OSC -p "read_verilog $^; synth_gowin -json $@"
%-tangnano-synth.json: %.v
$(YOSYS) -D LEDS_NR=3 -D OSC_TYPE_OSCH -p "read_verilog $^; synth_gowin -json $@"
%-tangnano1k-synth.json: %.v
$(YOSYS) -D LEDS_NR=3 -D OSC_TYPE_OSCZ -p "read_verilog $^; synth_gowin -json $@"
%-tangnano4k-synth.json: %.v
$(YOSYS) -D LEDS_NR=1 -D OSC_TYPE_OSCZ -p "read_verilog $^; synth_gowin -json $@"
%-tangnano9k-synth.json: %.v
$(YOSYS) -D LEDS_NR=6 -D OSC_TYPE_OSC -p "read_verilog $^; synth_gowin -json $@"
%-honeycomb-synth.json: %.v
$(YOSYS) -D LEDS_NR=3 -D OSC_TYPE_OSCF -p "read_verilog $^; synth_gowin -json $@"
%-honeycomb-prog: %-honeycomb.fs
openFPGALoader -b honeycomb $^
%-tec0117-prog: %-tec0117.fs
openFPGALoader -b tec0117 $^
%-runber-prog: %-runber.fs
openFPGALoader -b runber $^
%-tangnano-prog: %-tangnano.fs
openFPGALoader -b tangnano $^
%-tangnano4k-prog: %-tangnano4k.fs
openFPGALoader -b tangnano4k $^
%-tangnano-unpacked.v: %-tangnano.fs
gowin_unpack -d GW1N-1 -o $@ $^
%-tangnano1k-unpacked.v: %-tangnano1k.fs
gowin_unpack -d GW1NZ-1 -o $@ $^
%-tangnano4k-unpacked.v: %-tangnano4k.fs
gowin_unpack -d GW1NS-4 -o $@ $^
%-tangnano9k-unpacked.v: %-tangnano9k.fs
gowin_unpack -d GW1N-9C -o $@ $^
%-runber-unpacked.v: %-runber.fs
gowin_unpack -d GW1N-4 -o $@ $^
%-tec0117-unpacked.v: %-tec0117.fs
gowin_unpack -d GW1N-9 -o $@ $^
%-honeycomb-unpacked.v: %-honeycomb.fs
gowin_unpack -d GW1NS-2 -o $@ $<
#############
# long wires
%-lw-tangnano.json: %-tangnano-synth.json longwires/tangnano.cst
$(NEXTPNR) --json $< --write $@ --device GW1N-LV1QN48C6/I5 --cst longwires/tangnano.cst
%-lw-tangnano1k.json: %-tangnano1k-synth.json longwires/tangnano1k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NZ-LV1QN48C6/I5 --family GW1NZ-1 --cst longwires/tangnano1k.cst
%-lw-tangnano4k.json: %-tangnano4k-synth.json longwires/tangnano4k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NSR-LV4CQN48PC7/I6 --cst longwires/tangnano4k.cst
%-lw-tangnano9k.json: %-tangnano9k-synth.json longwires/tangnano9k.cst
$(NEXTPNR) --json $< --write $@ --device GW1NR-LV9QN88PC6/I5 --family GW1N-9C --cst longwires/tangnano9k.cst
%-lw-runber.json: %-runber-synth.json longwires/runber.cst
$(NEXTPNR) --json $< --write $@ --device GW1N-UV4LQ144C6/I5 --cst longwires/runber.cst
%-lw-tec0117.json: %-tec0117-synth.json longwires/tec0117.cst
$(NEXTPNR) --json $< --write $@ --device GW1NR-LV9QN88C6/I5 --cst longwires/tec0117.cst
%-lw-honeycomb.json: %-honeycomb-synth.json longwires/honeycomb.cst
$(NEXTPNR) --json $< --write $@ --device GW1NS-UX2CQN48C5/I4 --cst longwires/honeycomb.cst