1 |
3 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: toplevel.v
|
4 |
|
|
//
|
5 |
|
|
// Project: OpenArty, an entirely open SoC based upon the Arty platform
|
6 |
|
|
//
|
7 |
|
|
// Purpose: This is the top level Verilog file. It is to be contrasted
|
8 |
|
|
// with the other top level Verilog file in this same project in
|
9 |
|
|
// that *this* top level is designed to create a *safe*, low-speed
|
10 |
|
|
// (100MHz), configuration that can be used to test peripherals and other
|
11 |
|
|
// things on the way to building a full featured high speed configuration.
|
12 |
|
|
//
|
13 |
|
|
// Differences between this file and fasttop.v should be limited to speed
|
14 |
|
|
// related differences (such as the number of counts per UART baud), and
|
15 |
|
|
// the different daughter module: fastmaster.v (for 200MHz designs) vs
|
16 |
|
|
// busmaster.v (for 100MHz designs).
|
17 |
|
|
//
|
18 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
19 |
|
|
// Gisselquist Technology, LLC
|
20 |
|
|
//
|
21 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
22 |
|
|
//
|
23 |
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
24 |
|
|
//
|
25 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
26 |
|
|
// modify it under the terms of the GNU General Public License as published
|
27 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
28 |
|
|
// your option) any later version.
|
29 |
|
|
//
|
30 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
31 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
32 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
33 |
|
|
// for more details.
|
34 |
|
|
//
|
35 |
|
|
// You should have received a copy of the GNU General Public License along
|
36 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
37 |
|
|
// target there if the PDF file isn't present.) If not, see
|
38 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
39 |
|
|
//
|
40 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
41 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
42 |
|
|
//
|
43 |
|
|
//
|
44 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
45 |
|
|
//
|
46 |
|
|
//
|
47 |
|
|
module toplevel(i_clk_100mhz, i_reset_btn,
|
48 |
|
|
i_sw, // Switches
|
49 |
|
|
i_btn, // Buttons
|
50 |
|
|
o_led, // Single color LEDs
|
51 |
|
|
o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3, // Color LEDs
|
52 |
|
|
// RS232 UART
|
53 |
|
|
i_uart_rx, o_uart_tx,
|
54 |
|
|
// Quad-SPI Flash control
|
55 |
|
|
o_qspi_sck, o_qspi_cs_n, io_qspi_dat,
|
56 |
|
|
// Missing: Ethernet
|
57 |
|
|
o_eth_mdclk, io_eth_mdio,
|
58 |
|
|
// Memory
|
59 |
|
|
o_ddr_reset_n, o_ddr_cke, o_ddr_ck_p, o_ddr_ck_n,
|
60 |
|
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
61 |
|
|
io_ddr_dqs_p, io_ddr_dqs_n,
|
62 |
|
|
o_ddr_addr, o_ddr_ba,
|
63 |
|
|
io_ddr_data, o_ddr_dm, o_ddr_odt,
|
64 |
|
|
// SD Card
|
65 |
|
|
o_sd_sck, io_sd_cmd, io_sd, i_sd_cs, i_sd_wp,
|
66 |
|
|
// GPS Pmod
|
67 |
|
|
i_gps_pps, i_gps_3df, i_gps_rx, o_gps_tx,
|
68 |
|
|
// OLED Pmod
|
69 |
|
|
o_oled_sck, o_oled_cs_n, o_oled_mosi, o_oled_dcn, o_oled_reset_n,
|
70 |
|
|
o_oled_vccen, o_oled_pmoden,
|
71 |
|
|
// PMod I/O
|
72 |
|
|
i_aux_rx, i_aux_rts, o_aux_tx, o_aux_cts
|
73 |
|
|
);
|
74 |
|
|
input i_clk_100mhz, i_reset_btn;
|
75 |
|
|
input [3:0] i_sw; // Switches
|
76 |
|
|
input [3:0] i_btn; // Buttons
|
77 |
|
|
output wire [3:0] o_led; // LED
|
78 |
|
|
output wire [2:0] o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3;
|
79 |
|
|
// UARTs
|
80 |
|
|
input i_uart_rx;
|
81 |
|
|
output wire o_uart_tx;
|
82 |
|
|
// Quad SPI flash
|
83 |
|
|
output wire o_qspi_sck, o_qspi_cs_n;
|
84 |
|
|
inout [3:0] io_qspi_dat;
|
85 |
|
|
// Ethernet // Not yet implemented
|
86 |
|
|
// Ethernet control (MDIO)
|
87 |
|
|
output wire o_eth_mdclk;
|
88 |
|
|
inout wire io_eth_mdio;
|
89 |
|
|
// DDR3 SDRAM
|
90 |
|
|
output wire o_ddr_reset_n;
|
91 |
|
|
output wire o_ddr_cke;
|
92 |
|
|
output wire o_ddr_ck_p, o_ddr_ck_n;
|
93 |
|
|
output wire o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n;
|
94 |
|
|
inout [1:0] io_ddr_dqs_p, io_ddr_dqs_n;
|
95 |
|
|
output wire [13:0] o_ddr_addr;
|
96 |
|
|
output wire [2:0] o_ddr_ba;
|
97 |
|
|
inout [15:0] io_ddr_data;
|
98 |
|
|
//
|
99 |
|
|
output wire [1:0] o_ddr_dm;
|
100 |
|
|
output wire o_ddr_odt;
|
101 |
|
|
// SD Card
|
102 |
|
|
output wire o_sd_sck;
|
103 |
|
|
inout io_sd_cmd;
|
104 |
|
|
inout [3:0] io_sd;
|
105 |
|
|
input i_sd_cs;
|
106 |
|
|
input i_sd_wp;
|
107 |
|
|
// GPS PMod
|
108 |
|
|
input i_gps_pps, i_gps_3df, i_gps_rx;
|
109 |
|
|
output wire o_gps_tx;
|
110 |
|
|
// OLEDRGB PMod
|
111 |
|
|
output wire o_oled_sck, o_oled_cs_n, o_oled_mosi,
|
112 |
|
|
o_oled_dcn, o_oled_reset_n, o_oled_vccen,
|
113 |
|
|
o_oled_pmoden;
|
114 |
|
|
// Aux UART
|
115 |
|
|
input i_aux_rx, i_aux_rts;
|
116 |
|
|
output wire o_aux_tx, o_aux_cts;
|
117 |
|
|
|
118 |
|
|
// Build our master clock
|
119 |
|
|
wire i_clk, clk_for_ddr, clk2_unused, enet_clk, clk5_unused,
|
120 |
|
|
clk_feedback, clk_locked;
|
121 |
|
|
PLLE2_BASE #(
|
122 |
|
|
.BANDWIDTH("OPTIMIZED"), // OPTIMIZED, HIGH, LOW
|
123 |
|
|
.CLKFBOUT_PHASE(0.0), // Phase offset in degrees of CLKFB, (-360-360)
|
124 |
|
|
.CLKIN1_PERIOD(10.0), // Input clock period in ns to ps resolution
|
125 |
|
|
// CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: divide amount for each CLKOUT(1-128)
|
126 |
|
|
.CLKFBOUT_MULT(8), // Multiply value for all CLKOUT (2-64)
|
127 |
|
|
.CLKOUT0_DIVIDE(8), // 100 MHz (Main clock)
|
128 |
|
|
.CLKOUT1_DIVIDE(8), // 100 MHz (DDR3 SDRAM clock)
|
129 |
|
|
.CLKOUT2_DIVIDE(16), // 50 MHz (Flash clock, should we need it)
|
130 |
|
|
.CLKOUT3_DIVIDE(32), // 25 MHz (Ethernet clock ?)
|
131 |
|
|
.CLKOUT4_DIVIDE(16), // 50 MHz (Unused clock?)
|
132 |
|
|
.CLKOUT5_DIVIDE(24),
|
133 |
|
|
// CLKOUT0_DUTY_CYCLE -- Duty cycle for each CLKOUT
|
134 |
|
|
.CLKOUT0_DUTY_CYCLE(0.5),
|
135 |
|
|
.CLKOUT1_DUTY_CYCLE(0.5),
|
136 |
|
|
.CLKOUT2_DUTY_CYCLE(0.5),
|
137 |
|
|
.CLKOUT3_DUTY_CYCLE(0.5),
|
138 |
|
|
.CLKOUT4_DUTY_CYCLE(0.5),
|
139 |
|
|
.CLKOUT5_DUTY_CYCLE(0.5),
|
140 |
|
|
// CLKOUT0_PHASE -- phase offset for each CLKOUT
|
141 |
|
|
.CLKOUT0_PHASE(0.0),
|
142 |
|
|
.CLKOUT1_PHASE(90.0),
|
143 |
|
|
.CLKOUT2_PHASE(0.0),
|
144 |
|
|
.CLKOUT3_PHASE(0.0),
|
145 |
|
|
.CLKOUT4_PHASE(0.0),
|
146 |
|
|
.CLKOUT5_PHASE(0.0),
|
147 |
|
|
.DIVCLK_DIVIDE(1), // Master division value , (1-56)
|
148 |
|
|
.REF_JITTER1(0.0), // Reference input jitter in UI (0.000-0.999)
|
149 |
|
|
.STARTUP_WAIT("FALSE") // Delayu DONE until PLL Locks, ("TRUE"/"FALSE")
|
150 |
|
|
) genclock(
|
151 |
|
|
// Clock outputs: 1-bit (each) output
|
152 |
|
|
.CLKOUT0(i_clk),
|
153 |
|
|
.CLKOUT1(clk_for_ddr),
|
154 |
|
|
.CLKOUT2(clk2_unused), // Reserved for flash, should we need it
|
155 |
|
|
.CLKOUT3(enet_clk),
|
156 |
|
|
.CLKOUT4(clk4_unused),
|
157 |
|
|
.CLKOUT5(clk5_unused),
|
158 |
|
|
.CLKFBOUT(clk_feedback), // 1-bit output, feedback clock
|
159 |
|
|
.LOCKED(clk_locked),
|
160 |
|
|
.CLKIN1(i_clk_100mhz),
|
161 |
|
|
.PWRDWN(1'b0),
|
162 |
|
|
.RST(1'b0),
|
163 |
|
|
.CLKFBIN(clk_feedback) // 1-bit input, feedback clock
|
164 |
|
|
);
|
165 |
|
|
|
166 |
|
|
// UART interface
|
167 |
|
|
wire [29:0] bus_uart_setup;
|
168 |
|
|
assign bus_uart_setup = 30'h10000019; // 4MBaud, 7 bits
|
169 |
|
|
|
170 |
|
|
wire [7:0] rx_data, tx_data;
|
171 |
|
|
wire rx_break, rx_parity_err, rx_frame_err, rx_stb;
|
172 |
|
|
wire tx_stb, tx_busy;
|
173 |
|
|
|
174 |
|
|
reg pwr_reset, pre_reset;
|
175 |
|
|
initial pwr_reset = 1'b1;
|
176 |
|
|
initial pre_reset = 1'b0;
|
177 |
|
|
always @(posedge i_clk)
|
178 |
|
|
pre_reset <= ~i_reset_btn;
|
179 |
|
|
always @(posedge i_clk)
|
180 |
|
|
pwr_reset <= pre_reset;
|
181 |
|
|
|
182 |
|
|
wire w_ck_uart, w_uart_tx;
|
183 |
|
|
rxuart rcv(i_clk, pwr_reset, bus_uart_setup, i_uart_rx,
|
184 |
|
|
rx_stb, rx_data, rx_break,
|
185 |
|
|
rx_parity_err, rx_frame_err, w_ck_uart);
|
186 |
|
|
txuart txv(i_clk, pwr_reset, bus_uart_setup, 1'b0,
|
187 |
|
|
tx_stb, tx_data, o_uart_tx, tx_busy);
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
//////
|
195 |
|
|
//
|
196 |
|
|
//
|
197 |
|
|
// The WB bus interconnect, herein called busmaster, which handles
|
198 |
|
|
// just about ... everything. It is in contrast to the other WB bus
|
199 |
|
|
// interconnect, fastmaster, in that the busmaster build permits
|
200 |
|
|
// peripherals that can *only* operate at 100MHz, no faster.
|
201 |
|
|
//
|
202 |
|
|
//
|
203 |
|
|
//////
|
204 |
|
|
wire w_qspi_sck;
|
205 |
|
|
wire [1:0] qspi_bmod;
|
206 |
|
|
wire [3:0] qspi_dat;
|
207 |
|
|
wire [3:0] i_qspi_dat;
|
208 |
|
|
|
209 |
|
|
//
|
210 |
|
|
wire [2:0] w_ddr_dqs;
|
211 |
|
|
wire [31:0] wo_ddr_data, wi_ddr_data;
|
212 |
|
|
//
|
213 |
|
|
wire w_mdio, w_mdwe;
|
214 |
|
|
//
|
215 |
|
|
wire w_sd_cmd;
|
216 |
|
|
wire [3:0] w_sd_data;
|
217 |
|
|
busmaster wbbus(i_clk, pwr_reset,
|
218 |
|
|
// External USB-UART bus control
|
219 |
|
|
rx_stb, rx_data, tx_stb, tx_data, tx_busy,
|
220 |
|
|
// Board lights and switches
|
221 |
|
|
i_sw, i_btn, o_led,
|
222 |
|
|
o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3,
|
223 |
|
|
// Board level PMod I/O
|
224 |
|
|
i_aux_rx, o_aux_tx, o_aux_cts, i_gps_rx, o_gps_tx,
|
225 |
|
|
// Quad SPI flash
|
226 |
|
|
o_qspi_cs_n, w_qspi_sck, qspi_dat, io_qspi_dat, qspi_bmod,
|
227 |
|
|
// DDR3 SDRAM
|
228 |
|
|
o_ddr_reset_n, o_ddr_cke,
|
229 |
|
|
o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
|
230 |
|
|
w_ddr_dqs, o_ddr_addr, o_ddr_ba, wo_ddr_data, wi_ddr_data,
|
231 |
|
|
// SD Card
|
232 |
|
|
o_sd_sck, w_sd_cmd, w_sd_data, io_sd_cmd, io_sd, i_sd_cs,
|
233 |
|
|
// Ethernet control (MDIO) lines
|
234 |
|
|
o_eth_mdclk, w_mdio, w_mdwe, io_eth_mdio,
|
235 |
|
|
// OLEDRGB PMod wires
|
236 |
|
|
o_oled_sck, o_oled_cs_n, o_oled_mosi, o_oled_dcn,
|
237 |
|
|
o_oled_reset_n, o_oled_vccen, o_oled_pmoden,
|
238 |
|
|
// GPS PMod
|
239 |
|
|
i_gps_pps, i_gps_3df
|
240 |
|
|
);
|
241 |
|
|
|
242 |
|
|
//////
|
243 |
|
|
//
|
244 |
|
|
//
|
245 |
|
|
// The rest of this file *should* be identical to fasttop.v. Any
|
246 |
|
|
// differences should be worked out with meld or some such program
|
247 |
|
|
// to keep them to a minimum.
|
248 |
|
|
//
|
249 |
|
|
//
|
250 |
|
|
// Some wires need special treatment, and so are not quite completely
|
251 |
|
|
// handled by the bus master. These are handled below.
|
252 |
|
|
//
|
253 |
|
|
//
|
254 |
|
|
//////
|
255 |
|
|
|
256 |
|
|
//
|
257 |
|
|
//
|
258 |
|
|
// QSPI)BMOD, Quad SPI bus mode, Bus modes are:
|
259 |
|
|
// 0? Normal serial mode, one bit in one bit out
|
260 |
|
|
// 10 Quad SPI mode, going out
|
261 |
|
|
// 11 Quad SPI mode coming from the device (read mode)
|
262 |
|
|
//
|
263 |
|
|
// ?? Dual mode in (not yet)
|
264 |
|
|
// ?? Dual mode out (not yet)
|
265 |
|
|
//
|
266 |
|
|
//
|
267 |
|
|
// assign io_qspi_dat = (~qspi_bmod[1])?({2'b11,1'bz,qspi_dat[0]})
|
268 |
|
|
// :((qspi_bmod[0])?(4'bzzzz):(qspi_dat[3:0]));
|
269 |
|
|
// assign i_qspi_dat = io_qspi_dat;
|
270 |
|
|
//
|
271 |
|
|
wire [3:0] i_qspi_dat_ign;
|
272 |
|
|
ODDR #(.DDR_CLK_EDGE("OPPOSITE_EDGE"), .INIT(1'b1), .SRTYPE("SYNC"))
|
273 |
|
|
qsck(
|
274 |
|
|
.Q(o_qspi_sck),
|
275 |
|
|
.C(i_clk),
|
276 |
|
|
.CE(1'b1),
|
277 |
|
|
.D1(w_qspi_sck),
|
278 |
|
|
.D2(w_qspi_sck),
|
279 |
|
|
.R(1'b0), .S(1'b0));
|
280 |
|
|
xioddr qd0(i_clk, (~qspi_bmod[1])|(~qspi_bmod[0]),
|
281 |
|
|
{ qspi_dat[0], qspi_dat[0] },
|
282 |
|
|
{ i_qspi_dat_ign[0], i_qspi_dat[0] }, io_qspi_dat[0]);
|
283 |
|
|
xioddr qd1(i_clk, (qspi_bmod == 2'b10),
|
284 |
|
|
{ qspi_dat[1], qspi_dat[1] },
|
285 |
|
|
{ i_qspi_dat_ign[1], i_qspi_dat[1] }, io_qspi_dat[1]);
|
286 |
|
|
xioddr qd2(i_clk, (~qspi_bmod[1])||(~qspi_bmod[0]),
|
287 |
|
|
{ qspi_dat[2], qspi_dat[2] },
|
288 |
|
|
{ i_qspi_dat_ign[2], i_qspi_dat[2] }, io_qspi_dat[2]);
|
289 |
|
|
xioddr qd3(i_clk, (~qspi_bmod[1])||(~qspi_bmod[0]),
|
290 |
|
|
{ qspi_dat[3], qspi_dat[3] },
|
291 |
|
|
{ i_qspi_dat_ign[3], i_qspi_dat[3] }, io_qspi_dat[3]);
|
292 |
|
|
|
293 |
|
|
//
|
294 |
|
|
// Proposed QSPI mode select, to allow dual I/O mode
|
295 |
|
|
// 000 Normal SPI mode
|
296 |
|
|
// 001 Dual mode input
|
297 |
|
|
// 010 Dual mode, output
|
298 |
|
|
// 101 Quad I/O mode input
|
299 |
|
|
// 110 Quad I/O mode output
|
300 |
|
|
//
|
301 |
|
|
//
|
302 |
|
|
// assign io_qspi_dat[3:2] = (~qspi_bmod[2]) ? 2'b11
|
303 |
|
|
// : (qspi_bmod[0])?2'bzz : qspi_dat[3:2];
|
304 |
|
|
// assign io_qspi_dat[1] = (~qspi_bmod[1])?qspi_dat[1]:1'bz;
|
305 |
|
|
// assign io_qspi_dat[0] = (qspi_bmod[0])?1'bz : qspi_dat[0];
|
306 |
|
|
|
307 |
|
|
//
|
308 |
|
|
//
|
309 |
|
|
// The following primitive is necessary in order to gain access
|
310 |
|
|
// to the o_qspi_sck pin.
|
311 |
|
|
//
|
312 |
|
|
//
|
313 |
|
|
/*
|
314 |
|
|
wire [3:0] su_nc; // Startup primitive, no connect
|
315 |
|
|
STARTUPE2 #(
|
316 |
|
|
// Leave PROG_USR false to avoid activating the program
|
317 |
|
|
// event security feature. Notes state that such a feature
|
318 |
|
|
// requires encrypted bitstreams.
|
319 |
|
|
.PROG_USR("FALSE"),
|
320 |
|
|
// Sets the configuration clock frequency (in ns) for
|
321 |
|
|
// simulation.
|
322 |
|
|
.SIM_CCLK_FREQ(0.0)
|
323 |
|
|
) STARTUPE2_inst (
|
324 |
|
|
// CFGCLK, 1'b output: Configuration main clock output -- no connect
|
325 |
|
|
.CFGCLK(su_nc[0]),
|
326 |
|
|
// CFGMCLK, 1'b output: Configuration internal oscillator clock output
|
327 |
|
|
.CFGMCLK(su_nc[1]),
|
328 |
|
|
// EOS, 1'b output: Active high output indicating the End Of Startup.
|
329 |
|
|
.EOS(su_nc[2]),
|
330 |
|
|
// PREQ, 1'b output: PROGRAM request to fabric output
|
331 |
|
|
// Only enabled if PROG_USR is set. This lets the fabric know
|
332 |
|
|
// that a request has been made (either JTAG or pin pulled low)
|
333 |
|
|
// to program the device
|
334 |
|
|
.PREQ(su_nc[3]),
|
335 |
|
|
// CLK, 1'b input: User start-up clock input
|
336 |
|
|
.CLK(1'b0),
|
337 |
|
|
// GSR, 1'b input: Global Set/Reset input
|
338 |
|
|
.GSR(1'b0),
|
339 |
|
|
// GTS, 1'b input: Global 3-state input
|
340 |
|
|
.GTS(1'b0),
|
341 |
|
|
// KEYCLEARB, 1'b input: Clear AES Decrypter Key input from BBRAM
|
342 |
|
|
.KEYCLEARB(1'b0),
|
343 |
|
|
// PACK, 1-bit input: PROGRAM acknowledge input
|
344 |
|
|
// This pin is only enabled if PROG_USR is set. This allows the
|
345 |
|
|
// FPGA to acknowledge a request for reprogram to allow the FPGA
|
346 |
|
|
// to get itself into a reprogrammable state first.
|
347 |
|
|
.PACK(1'b0),
|
348 |
|
|
// USRCLKO, 1-bit input: User CCLK input -- This is why I am using this
|
349 |
|
|
// module at all.
|
350 |
|
|
.USRCCLKO(qspi_sck),
|
351 |
|
|
// USRCCLKTS, 1'b input: User CCLK 3-state enable input
|
352 |
|
|
// An active high here places the clock into a high impedence
|
353 |
|
|
// state. Since we wish to use the clock as an active output
|
354 |
|
|
// always, we drive this pin low.
|
355 |
|
|
.USRCCLKTS(1'b0),
|
356 |
|
|
// USRDONEO, 1'b input: User DONE pin output control
|
357 |
|
|
// Set this to "high" to make sure that the DONE LED pin is
|
358 |
|
|
// high.
|
359 |
|
|
.USRDONEO(1'b1),
|
360 |
|
|
// USRDONETS, 1'b input: User DONE 3-state enable output
|
361 |
|
|
// This enables the FPGA DONE pin to be active. Setting this
|
362 |
|
|
// active high sets the DONE pin to high impedence, setting it
|
363 |
|
|
// low allows the output of this pin to be as stated above.
|
364 |
|
|
.USRDONETS(1'b1)
|
365 |
|
|
);
|
366 |
|
|
*/
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
//
|
371 |
|
|
//
|
372 |
|
|
// Wires for setting up the SD Card Controller
|
373 |
|
|
//
|
374 |
|
|
//
|
375 |
|
|
assign io_sd_cmd = w_sd_cmd ? 1'bz:1'b0;
|
376 |
|
|
assign io_sd[0] = w_sd_data[0]? 1'bz:1'b0;
|
377 |
|
|
assign io_sd[1] = w_sd_data[1]? 1'bz:1'b0;
|
378 |
|
|
assign io_sd[2] = w_sd_data[2]? 1'bz:1'b0;
|
379 |
|
|
assign io_sd[3] = w_sd_data[3]? 1'bz:1'b0;
|
380 |
|
|
assign o_sd_wp = 1'b0;
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
//
|
384 |
|
|
//
|
385 |
|
|
// Wire(s) for setting up the MDIO ethernet control structure
|
386 |
|
|
//
|
387 |
|
|
//
|
388 |
|
|
assign io_eth_mdio = (w_mdwe)?w_mdio : 1'bz;
|
389 |
|
|
|
390 |
|
|
//
|
391 |
|
|
//
|
392 |
|
|
// Wires for setting up the DDR3 memory
|
393 |
|
|
//
|
394 |
|
|
//
|
395 |
|
|
wire [31:0] r_ddr_data;
|
396 |
|
|
|
397 |
|
|
xioddr p0(i_clk, ~o_ddr_we_n, { wo_ddr_data[16], wo_ddr_data[0] },
|
398 |
|
|
{ wi_ddr_data[16], wi_ddr_data[0] }, io_ddr_data[0]);
|
399 |
|
|
|
400 |
|
|
xioddr p1(i_clk, ~o_ddr_we_n, { wo_ddr_data[17], wo_ddr_data[1] },
|
401 |
|
|
{ wi_ddr_data[17], wi_ddr_data[1] }, io_ddr_data[1]);
|
402 |
|
|
|
403 |
|
|
xioddr p2(i_clk, ~o_ddr_we_n, { wo_ddr_data[18], wo_ddr_data[2] },
|
404 |
|
|
{ wi_ddr_data[18], wi_ddr_data[2] }, io_ddr_data[2]);
|
405 |
|
|
|
406 |
|
|
xioddr p3(i_clk, ~o_ddr_we_n, { wo_ddr_data[19], wo_ddr_data[3] },
|
407 |
|
|
{ wi_ddr_data[19], wi_ddr_data[3] }, io_ddr_data[3]);
|
408 |
|
|
|
409 |
|
|
xioddr p4(i_clk, ~o_ddr_we_n, { wo_ddr_data[20], wo_ddr_data[4] },
|
410 |
|
|
{ wi_ddr_data[20], wi_ddr_data[4] }, io_ddr_data[4]);
|
411 |
|
|
|
412 |
|
|
xioddr p5(i_clk, ~o_ddr_we_n, { wo_ddr_data[21], wo_ddr_data[5] },
|
413 |
|
|
{ wi_ddr_data[21], wi_ddr_data[5] }, io_ddr_data[5]);
|
414 |
|
|
|
415 |
|
|
xioddr p6(i_clk, ~o_ddr_we_n, { wo_ddr_data[22], wo_ddr_data[6] },
|
416 |
|
|
{ wi_ddr_data[22], wi_ddr_data[6] }, io_ddr_data[6]);
|
417 |
|
|
|
418 |
|
|
xioddr p7(i_clk, ~o_ddr_we_n, { wo_ddr_data[23], wo_ddr_data[7] },
|
419 |
|
|
{ wi_ddr_data[23], wi_ddr_data[7] }, io_ddr_data[7]);
|
420 |
|
|
|
421 |
|
|
xioddr p8(i_clk, ~o_ddr_we_n, { wo_ddr_data[24], wo_ddr_data[8] },
|
422 |
|
|
{ wi_ddr_data[24], wi_ddr_data[8] }, io_ddr_data[8]);
|
423 |
|
|
|
424 |
|
|
xioddr p9(i_clk, ~o_ddr_we_n, { wo_ddr_data[25], wo_ddr_data[9] },
|
425 |
|
|
{ wi_ddr_data[25], wi_ddr_data[9] }, io_ddr_data[9]);
|
426 |
|
|
|
427 |
|
|
xioddr pa(i_clk, ~o_ddr_we_n, { wo_ddr_data[26], wo_ddr_data[10] },
|
428 |
|
|
{ wi_ddr_data[26], wi_ddr_data[10] }, io_ddr_data[10]);
|
429 |
|
|
|
430 |
|
|
xioddr pb(i_clk, ~o_ddr_we_n, { wo_ddr_data[27], wo_ddr_data[11] },
|
431 |
|
|
{ wi_ddr_data[27], wi_ddr_data[11] }, io_ddr_data[11]);
|
432 |
|
|
|
433 |
|
|
xioddr pc(i_clk, ~o_ddr_we_n, { wo_ddr_data[28], wo_ddr_data[12] },
|
434 |
|
|
{ wi_ddr_data[28], wi_ddr_data[12] }, io_ddr_data[12]);
|
435 |
|
|
|
436 |
|
|
xioddr pd(i_clk, ~o_ddr_we_n, { wo_ddr_data[29], wo_ddr_data[13] },
|
437 |
|
|
{ wi_ddr_data[29], wi_ddr_data[13] }, io_ddr_data[13]);
|
438 |
|
|
|
439 |
|
|
xioddr pe(i_clk, ~o_ddr_we_n, { wo_ddr_data[30], wo_ddr_data[14] },
|
440 |
|
|
{ wi_ddr_data[30], wi_ddr_data[14] }, io_ddr_data[14]);
|
441 |
|
|
|
442 |
|
|
xioddr pf(i_clk, ~o_ddr_we_n, { wo_ddr_data[31], wo_ddr_data[15] },
|
443 |
|
|
{ wi_ddr_data[31], wi_ddr_data[15] }, io_ddr_data[15]);
|
444 |
|
|
|
445 |
|
|
OBUFTDS #(.IOSTANDARD("DIFF_SSTL135"), .SLEW("FAST"))
|
446 |
|
|
dqsbuf0(.O(io_ddr_dqs_p[0]), .OB(io_ddr_dqs_n[0]),
|
447 |
|
|
.I(w_ddr_dqs[1]), .T(w_ddr_dqs[2]));
|
448 |
|
|
OBUFTDS #(.IOSTANDARD("DIFF_SSTL135"), .SLEW("FAST"))
|
449 |
|
|
dqsbuf1(.O(io_ddr_dqs_p[1]), .OB(io_ddr_dqs_n[1]),
|
450 |
|
|
.I(w_ddr_dqs[0]), .T(w_ddr_dqs[2]));
|
451 |
|
|
|
452 |
|
|
OBUFDS #(.IOSTANDARD("DIFF_SSTL135"), .SLEW("FAST"))
|
453 |
|
|
clkbuf(.O(o_ddr_ck_p), .OB(o_ddr_ck_n), .I(clk_for_ddr));
|
454 |
|
|
|
455 |
|
|
assign o_ddr_dm = 2'b00;
|
456 |
|
|
assign o_ddr_odt = 1'b0;
|
457 |
|
|
|
458 |
|
|
endmodule
|
459 |
|
|
|