-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.v
403 lines (390 loc) · 9.92 KB
/
build.v
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
/* Automatically generated by Amaranth 0.4.dev33+gdb24a14. Do not edit. */
/* Generated by Amaranth Yosys 0.10.0 (PyPI ver 0.10.0.dev47, git sha1 dca8fb54a) */
module litex_soc(soc_clk, sdram_clk, uart_0__rx__i, uart_0__tx__o, sdram_0__clk__io, sdram_0__clk_en__io, sdram_0__cs__io, sdram_0__we__io, sdram_0__ras__io, sdram_0__cas__io, sdram_0__ba__io, sdram_0__a__io, sdram_0__dqm__io, sdram_0__dq__io, led);
output led;
output [12:0] sdram_0__a__io;
output [1:0] sdram_0__ba__io;
output sdram_0__cas__io;
output sdram_0__clk__io;
output sdram_0__clk_en__io;
output sdram_0__cs__io;
inout [15:0] sdram_0__dq__io;
output [1:0] sdram_0__dqm__io;
output sdram_0__ras__io;
output sdram_0__we__io;
input sdram_clk;
input soc_clk;
input uart_0__rx__i;
output uart_0__tx__o;
qmtech_5cefa2 litex_soc (
.clk105(soc_clk),
.clk105_ram(sdram_clk),
.sdram_a(sdram_0__a__io),
.sdram_ba(sdram_0__ba__io),
.sdram_cas_n(sdram_0__cas__io),
.sdram_cke(sdram_0__clk_en__io),
.sdram_clock(sdram_0__clk__io),
.sdram_cs_n(sdram_0__cs__io),
.sdram_dm(sdram_0__dqm__io),
.sdram_dq(sdram_0__dq__io),
.sdram_ras_n(sdram_0__ras__io),
.sdram_we_n(sdram_0__we__io),
.serial_rx(uart_0__rx__i),
.serial_tx(uart_0__tx__o),
.user_led0(led)
);
endmodule
module pin_button_0(button_0__io, button_0__i);
wire \$1 ;
output button_0__i;
wire button_0__i_neg;
input button_0__io;
assign \$1 = ~ button_0__i_neg;
altiobuf_in #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE")
) button_0 (
.datain(button_0__io),
.dataout(button_0__i_neg)
);
assign button_0__i = \$1 ;
endmodule
module pin_button_1(button_1__io, button_1__i);
wire \$1 ;
output button_1__i;
wire button_1__i_neg;
input button_1__io;
assign \$1 = ~ button_1__i_neg;
altiobuf_in #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE")
) button_1 (
.datain(button_1__io),
.dataout(button_1__i_neg)
);
assign button_1__i = \$1 ;
endmodule
module pin_clk50_0(clk50_0__io, clk50_0__i);
(* keep = "true" *)
output clk50_0__i;
input clk50_0__io;
altiobuf_in #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE")
) clk50_0 (
.datain(clk50_0__io),
.dataout(clk50_0__i)
);
endmodule
module pin_led_0(led_0__io, led_0__o);
output led_0__io;
input led_0__o;
altiobuf_out #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE"),
.use_oe("FALSE")
) led_0 (
.datain(led_0__o),
.dataout(led_0__io)
);
endmodule
module pin_led_1(led_1__io, led_1__o);
output led_1__io;
input led_1__o;
altiobuf_out #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE"),
.use_oe("FALSE")
) led_1 (
.datain(led_1__o),
.dataout(led_1__io)
);
endmodule
module pin_uart_0__rx(uart_0__rx__io, uart_0__rx__i);
output uart_0__rx__i;
input uart_0__rx__io;
altiobuf_in #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE")
) uart_0__rx (
.datain(uart_0__rx__io),
.dataout(uart_0__rx__i)
);
endmodule
module pin_uart_0__tx(uart_0__tx__io, uart_0__tx__o);
output uart_0__tx__io;
input uart_0__tx__o;
altiobuf_out #(
.enable_bus_hold("FALSE"),
.number_of_channels(32'd1),
.use_differential_mode("FALSE"),
.use_oe("FALSE")
) uart_0__tx (
.datain(uart_0__tx__o),
.dataout(uart_0__tx__io)
);
endmodule
module pll(clk, soc_clk, sdram_clk, clk50_0__i, rst);
wire \$1 ;
wire \$2 ;
output clk;
(* keep = "true" *)
input clk50_0__i;
wire main_clock;
wire reset_sync_sync_reset;
output rst;
output sdram_clk;
wire [1:0] sdram_clocks;
wire sdram_locked;
output soc_clk;
wire sys_locked;
assign \$2 = sys_locked & sdram_locked;
assign \$1 = ~ \$2 ;
altera_pll #(
.fractional_vco_multiplier("true"),
.number_of_clocks("2"),
.operation_mode("normal"),
.output_clock_frequency0("109.226666 MHz"),
.output_clock_frequency1("109.226666 MHz"),
.phase_shift1("253 ps"),
.pll_subtype("General"),
.pll_type("General"),
.reference_clock_frequency("60.0 MHz")
) audiopll (
.locked(sdram_locked),
.outclk(sdram_clocks),
.refclk(main_clock)
);
altera_pll #(
.fractional_vco_multiplier("false"),
.number_of_clocks("1"),
.operation_mode("normal"),
.output_clock_frequency0("60.000000 MHz"),
.pll_subtype("General"),
.pll_type("General"),
.reference_clock_frequency("50.0 MHz")
) mainpll (
.locked(sys_locked),
.outclk(main_clock),
.refclk(clk50_0__i)
);
reset_sync_sdram reset_sync_sdram (
.reset(reset_sync_sync_reset),
.sdram_clk(sdram_clk)
);
reset_sync_soc reset_sync_soc (
.reset(reset_sync_sync_reset),
.soc_clk(soc_clk)
);
reset_sync_sync reset_sync_sync (
.clk(clk),
.reset(reset_sync_sync_reset),
.rst(rst)
);
assign sdram_clk = sdram_clocks[1];
assign soc_clk = sdram_clocks[0];
assign clk = main_clock;
assign reset_sync_sync_reset = \$1 ;
endmodule
module reset_sync_sdram(sdram_clk, reset);
wire \$1 ;
wire \$3 ;
input reset;
input sdram_clk;
wire sdram_rst;
wire sync_output;
assign \$1 = ~ reset;
assign \$3 = ~ sync_output;
altera_std_synchronizer #(
.depth(32'd2)
) \U$$0 (
.clk(sdram_clk),
.din(1'h1),
.dout(sync_output),
.reset_n(\$1 )
);
assign sdram_rst = \$3 ;
endmodule
module reset_sync_soc(soc_clk, reset);
wire \$1 ;
wire \$3 ;
input reset;
input soc_clk;
wire soc_rst;
wire sync_output;
assign \$1 = ~ reset;
assign \$3 = ~ sync_output;
altera_std_synchronizer #(
.depth(32'd2)
) \U$$0 (
.clk(soc_clk),
.din(1'h1),
.dout(sync_output),
.reset_n(\$1 )
);
assign soc_rst = \$3 ;
endmodule
module reset_sync_sync(clk, reset, rst);
wire \$1 ;
wire \$3 ;
input clk;
input reset;
output rst;
wire sync_output;
assign \$1 = ~ reset;
assign \$3 = ~ sync_output;
altera_std_synchronizer #(
.depth(32'd2)
) \U$$0 (
.clk(clk),
.din(1'h1),
.dout(sync_output),
.reset_n(\$1 )
);
assign rst = \$3 ;
endmodule
module top(led_0__io, led_1__io, button_0__io, button_1__io, clk50_0__io, sdram_0__clk__io, sdram_0__clk_en__io, sdram_0__cs__io, sdram_0__we__io, sdram_0__ras__io, sdram_0__cas__io, sdram_0__ba__io, sdram_0__a__io, sdram_0__dqm__io, uart_0__rx__io, uart_0__tx__io, sdram_0__dq__io);
reg \initial = 0;
wire [1:0] \$1 ;
wire [25:0] \$10 ;
wire [25:0] \$11 ;
wire \$13 ;
wire [1:0] \$15 ;
wire \$2 ;
wire \$4 ;
wire [1:0] \$6 ;
wire \$8 ;
input button_0__io;
input button_1__io;
wire clk;
input clk50_0__io;
reg [1:0] flops = 2'h0;
reg [1:0] \flops$next ;
output led_0__io;
output led_1__io;
wire litex_soc_led;
wire litex_soc_uart_0__rx__i;
wire litex_soc_uart_0__tx__o;
wire pin_button_0_button_0__i;
wire pin_button_1_button_1__i;
wire pin_led_0_led_0__o;
wire pin_led_1_led_1__o;
(* keep = "true" *)
wire pll_clk50_0__i;
wire pll_sdram_clk;
wire pll_soc_clk;
wire rst;
output [12:0] sdram_0__a__io;
output [1:0] sdram_0__ba__io;
output sdram_0__cas__io;
output sdram_0__clk__io;
output sdram_0__clk_en__io;
output sdram_0__cs__io;
inout [15:0] sdram_0__dq__io;
output [1:0] sdram_0__dqm__io;
output sdram_0__ras__io;
output sdram_0__we__io;
reg [24:0] timer = 25'h17d783f;
reg [24:0] \timer$next ;
input uart_0__rx__io;
output uart_0__tx__io;
assign \$11 = timer - 1'h1;
assign \$13 = ! timer;
assign \$15 = ~ flops;
always @(posedge clk)
timer <= \timer$next ;
always @(posedge clk)
flops <= \flops$next ;
assign \$6 = flops ^ { \$4 , \$2 };
assign \$8 = ! timer;
litex_soc litex_soc (
.led(litex_soc_led),
.sdram_0__a__io(sdram_0__a__io),
.sdram_0__ba__io(sdram_0__ba__io),
.sdram_0__cas__io(sdram_0__cas__io),
.sdram_0__clk__io(sdram_0__clk__io),
.sdram_0__clk_en__io(sdram_0__clk_en__io),
.sdram_0__cs__io(sdram_0__cs__io),
.sdram_0__dq__io(sdram_0__dq__io),
.sdram_0__dqm__io(sdram_0__dqm__io),
.sdram_0__ras__io(sdram_0__ras__io),
.sdram_0__we__io(sdram_0__we__io),
.sdram_clk(pll_sdram_clk),
.soc_clk(pll_soc_clk),
.uart_0__rx__i(litex_soc_uart_0__rx__i),
.uart_0__tx__o(litex_soc_uart_0__tx__o)
);
pin_button_0 pin_button_0 (
.button_0__i(pin_button_0_button_0__i),
.button_0__io(button_0__io)
);
pin_button_1 pin_button_1 (
.button_1__i(pin_button_1_button_1__i),
.button_1__io(button_1__io)
);
pin_clk50_0 pin_clk50_0 (
.clk50_0__i(pll_clk50_0__i),
.clk50_0__io(clk50_0__io)
);
pin_led_0 pin_led_0 (
.led_0__io(led_0__io),
.led_0__o(pin_led_0_led_0__o)
);
pin_led_1 pin_led_1 (
.led_1__io(led_1__io),
.led_1__o(pin_led_1_led_1__o)
);
pin_uart_0__rx pin_uart_0__rx (
.uart_0__rx__i(litex_soc_uart_0__rx__i),
.uart_0__rx__io(uart_0__rx__io)
);
pin_uart_0__tx pin_uart_0__tx (
.uart_0__tx__io(uart_0__tx__io),
.uart_0__tx__o(litex_soc_uart_0__tx__o)
);
pll pll (
.clk(clk),
.clk50_0__i(pll_clk50_0__i),
.rst(rst),
.sdram_clk(pll_sdram_clk),
.soc_clk(pll_soc_clk)
);
always @* begin
if (\initial ) begin end
(* full_case = 32'd1 *)
casez (\$8 )
1'h1:
\timer$next = 25'h17d783f;
default:
\timer$next = \$11 [24:0];
endcase
casez (rst)
1'h1:
\timer$next = 25'h17d783f;
endcase
end
always @* begin
if (\initial ) begin end
\flops$next = flops;
casez (\$13 )
1'h1:
\flops$next = \$15 ;
endcase
casez (rst)
1'h1:
\flops$next = 2'h0;
endcase
end
assign \$1 = \$6 ;
assign \$10 = \$11 ;
assign pin_led_0_led_0__o = litex_soc_led;
assign pin_led_1_led_1__o = \$6 [0];
assign \$2 = pin_button_0_button_0__i;
assign \$4 = pin_button_1_button_1__i;
endmodule