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