OpenCores
URL https://opencores.org/ocsvn/openarty/openarty/trunk

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [fasttop.v] - Blame information for rev 33

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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 12 dgisselq
`define FULLCLOCK
112 3 dgisselq
        // Build our master clock
113 25 dgisselq
        wire    s_clk_pll, s_clk, clk_for_ddr, mem_serial_clk, mem_serial_clk_inv,
114 24 dgisselq
                enet_clk, clk_halfspeed, clk_feedback, clk_locked, clk_unused;
115 3 dgisselq
        PLLE2_BASE      #(
116
                .BANDWIDTH("OPTIMIZED"),        // OPTIMIZED, HIGH, LOW
117 25 dgisselq
                .CLKFBOUT_PHASE(0.0),   // Phase offset in degrees of CLKFB, (-360-360)
118 24 dgisselq
                .CLKIN1_PERIOD(10.0),   // Input clock period in ns resolution
119 25 dgisselq
                // CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: divide amount for each CLKOUT(1-128)
120 3 dgisselq
                .CLKFBOUT_MULT(8),      // Multiply value for all CLKOUT (2-64)
121
                .CLKOUT0_DIVIDE(5),     // 160 MHz
122 25 dgisselq
                .CLKOUT1_DIVIDE(10),    //  80 MHz      (Unused)
123
                .CLKOUT2_DIVIDE(16),    //  50 MHz      (Unused)
124
                .CLKOUT3_DIVIDE(32),    //  25 MHz      (Unused/Ethernet clock)
125
                .CLKOUT4_DIVIDE(16),    //  50 MHz      (Unused clock?)
126
                .CLKOUT5_DIVIDE(24),
127 3 dgisselq
                // CLKOUT0_DUTY_CYCLE -- Duty cycle for each CLKOUT
128
                .CLKOUT0_DUTY_CYCLE(0.5),
129
                .CLKOUT1_DUTY_CYCLE(0.5),
130
                .CLKOUT2_DUTY_CYCLE(0.5),
131
                .CLKOUT3_DUTY_CYCLE(0.5),
132
                .CLKOUT4_DUTY_CYCLE(0.5),
133
                .CLKOUT5_DUTY_CYCLE(0.5),
134
                // CLKOUT0_PHASE -- phase offset for each CLKOUT
135
                .CLKOUT0_PHASE(0.0),
136 25 dgisselq
                .CLKOUT1_PHASE(0.0),
137 3 dgisselq
                .CLKOUT2_PHASE(0.0),
138 25 dgisselq
                .CLKOUT3_PHASE(0.0),
139 3 dgisselq
                .CLKOUT4_PHASE(0.0),
140 24 dgisselq
                .CLKOUT5_PHASE(0.0),
141 3 dgisselq
                .DIVCLK_DIVIDE(1),      // Master division value , (1-56)
142 24 dgisselq
                .REF_JITTER1(0.0),      // Ref. input jitter in UI (0.000-0.999)
143
                .STARTUP_WAIT("TRUE")   // Delay DONE until PLL Locks, ("TRUE"/"FALSE")
144 3 dgisselq
        ) genclock(
145
                // Clock outputs: 1-bit (each) output
146 25 dgisselq
                .CLKOUT0(s_clk_pll),
147
                .CLKOUT1(mem_clk),
148
                .CLKOUT2(clk2_unused),
149
                .CLKOUT3(enet_clk),
150
                .CLKOUT4(clk4_unused),
151
                .CLKOUT5(clk5_unused),
152 3 dgisselq
                .CLKFBOUT(clk_feedback), // 1-bit output, feedback clock
153
                .LOCKED(clk_locked),
154
                .CLKIN1(i_clk_100mhz),
155
                .PWRDWN(1'b0),
156
                .RST(1'b0),
157 25 dgisselq
                .CLKFBIN(clk_feedback_bufd)     // 1-bit input, feedback clock
158 3 dgisselq
        );
159 25 dgisselq
 
160
        // Help reduce skew ...
161
        BUFG    sys_clk_buffer( .I(s_clk_pll), .O(s_clk));
162
        BUFG    feedback_buffer(.I(clk_feedback),.O(clk_feedback_bufd));
163
 
164 3 dgisselq
        // UART interface
165
        wire    [29:0]   bus_uart_setup;
166 25 dgisselq
        assign          bus_uart_setup = 30'h10000028; // 4MBaud, 7 bits
167 3 dgisselq
 
168
        wire    [7:0]    rx_data, tx_data;
169
        wire            rx_break, rx_parity_err, rx_frame_err, rx_stb;
170
        wire            tx_stb, tx_busy;
171
 
172 24 dgisselq
        //
173
        // RESET LOGIC
174
        //
175
        // Okay, so this looks bad at a first read--but it's not really that
176
        // bad.  If you look close, there are two parts to the reset logic.
177
        // The first is the "PRE"-reset.  This is a wire, set from the external
178
        // reset button.  In good old-fashioned asynch-logic to synchronous
179
        // logic fashion, we synchronize this wire by registering it first
180
        // to pre_reset, and then to pwr_reset (the actual reset wire).
181
        //
182 3 dgisselq
        reg     pwr_reset, pre_reset;
183 24 dgisselq
        //
184
        // Logic description starts with the PRE-reset, so as to make certain
185
        // we include the reset button
186 3 dgisselq
        initial pre_reset = 1'b0;
187 25 dgisselq
        always @(posedge s_clk)
188 3 dgisselq
                pre_reset <= ~i_reset_btn;
189 24 dgisselq
        //
190
        // and then continues with the actual reset, now that we've
191
        // synchronized our reset button wire.
192
        initial pwr_reset = 1'b1;
193 25 dgisselq
        always @(posedge s_clk)
194 3 dgisselq
                pwr_reset <= pre_reset;
195
 
196
        wire    w_ck_uart, w_uart_tx;
197 25 dgisselq
        rxuart  rcv(s_clk, pwr_reset, bus_uart_setup, i_uart_rx,
198 3 dgisselq
                                rx_stb, rx_data, rx_break,
199
                                rx_parity_err, rx_frame_err, w_ck_uart);
200 25 dgisselq
        txuart  txv(s_clk, pwr_reset, bus_uart_setup, 1'b0,
201 3 dgisselq
                                tx_stb, tx_data, o_uart_tx, tx_busy);
202
 
203
 
204
 
205
 
206 24 dgisselq
`ifdef  SDRAM_ACCESS
207
///
208
///
209
/// The following lines are included from ddr3insert.v.
210
///
211
        wire            w_ddr_reset_n, w_ddr_cke, w_ddr_bus_oe;
212
        wire    [26:0]   w_ddr_cmd_a, w_ddr_cmd_b;
213
        wire    [63:0]   wi_ddr_data, wo_ddr_data;
214
        wire    [127:0]  wide_ddr_data;
215 3 dgisselq
 
216 24 dgisselq
        //
217
        //
218
        // Wires for setting up the DDR3 memory
219
        //
220
        //
221 3 dgisselq
 
222 24 dgisselq
        // First, let's set up the clock(s)
223
        xoddrserdesb ddrclk(mem_serial_clk, i_clk, pwr_reset, 8'h66,
224
                o_ddr_ck_p, o_ddr_ck_n);
225
 
226
        wire    [7:0]    w_udqs_in, w_ldqs_in;
227
 
228
        xioddrserdesb ddrudqs(mem_serial_clk, mem_serial_clk_inv, i_clk,
229
                        ~w_ddr_reset_n, w_ddr_cmd_a[0],
230
                        (w_ddr_cmd_b[0])? 8'h66 : 8'h06,
231
                        w_udqs_in,
232
                        io_ddr_dqs_p[1], io_ddr_dqs_n[1]);
233
 
234
        xioddrserdesb ddrldqs(mem_serial_clk, mem_serial_clk_inv, i_clk,
235
                        ~w_ddr_reset_n, w_ddr_cmd_a[0],
236
                        (w_ddr_cmd_b[0])? 8'h66 : 8'h06,
237
                        w_ldqs_in,
238
                        io_ddr_dqs_p[0], io_ddr_dqs_n[0]);
239
 
240
        // The command wires: CS_N, RAS_N, CAS_N, and WE_N
241
        xoddrserdes ddrcsn(mem_serial_clk, i_clk, ~w_ddr_reset_n,
242
                { w_ddr_cmd_a[26], w_ddr_cmd_a[26],
243
                  w_ddr_cmd_a[26], w_ddr_cmd_a[26],
244
                  w_ddr_cmd_b[26], w_ddr_cmd_b[26],
245
                  w_ddr_cmd_b[26], w_ddr_cmd_b[26] }, o_ddr_cs_n);
246
 
247
        xoddrserdes ddrrasn(mem_serial_clk, i_clk, ~w_ddr_reset_n,
248
                { w_ddr_cmd_a[25], w_ddr_cmd_a[25],
249
                  w_ddr_cmd_a[25], w_ddr_cmd_a[25],
250
                  w_ddr_cmd_b[25], w_ddr_cmd_b[25],
251
                  w_ddr_cmd_b[25], w_ddr_cmd_b[25] }, o_ddr_ras_n);
252
 
253
        xoddrserdes ddrcasn(mem_serial_clk, i_clk, ~w_ddr_reset_n,
254
                { w_ddr_cmd_a[24], w_ddr_cmd_a[24],
255
                  w_ddr_cmd_a[24], w_ddr_cmd_a[24],
256
                  w_ddr_cmd_b[24], w_ddr_cmd_b[24],
257
                  w_ddr_cmd_b[24], w_ddr_cmd_b[24] }, o_ddr_cas_n);
258
 
259
        xoddrserdes ddrwen(mem_serial_clk, i_clk, ~w_ddr_reset_n,
260
                { w_ddr_cmd_a[23], w_ddr_cmd_a[23],
261
                  w_ddr_cmd_a[23], w_ddr_cmd_a[23],
262
                  w_ddr_cmd_b[23], w_ddr_cmd_b[23],
263
                  w_ddr_cmd_b[23], w_ddr_cmd_b[23] }, o_ddr_we_n);
264
 
265
        // Data mask wires, first the upper byte
266
        xoddrserdes ddrudm(mem_serial_clk, i_clk, ~w_ddr_reset_n,
267
                { w_ddr_cmd_a[4], w_ddr_cmd_a[4],
268
                  w_ddr_cmd_a[2], w_ddr_cmd_a[2],
269
                  w_ddr_cmd_b[4], w_ddr_cmd_b[4],
270
                  w_ddr_cmd_b[2], w_ddr_cmd_b[2] }, o_ddr_dm[1]);
271
        // then the lower byte
272
        xoddrserdes ddrldm(mem_serial_clk, i_clk, ~w_ddr_reset_n,
273
                { w_ddr_cmd_a[3], w_ddr_cmd_a[3],
274
                  w_ddr_cmd_a[1], w_ddr_cmd_a[1],
275
                  w_ddr_cmd_b[3], w_ddr_cmd_b[3],
276
                  w_ddr_cmd_b[1], w_ddr_cmd_b[1] }, o_ddr_dm[0]);
277
 
278
        // and the On-Die termination wire
279
        xoddrserdes ddrodt(mem_serial_clk, i_clk, ~w_ddr_reset_n,
280
                { w_ddr_cmd_a[0], w_ddr_cmd_a[0],
281
                  w_ddr_cmd_a[0], w_ddr_cmd_a[0],
282
                  w_ddr_cmd_b[0], w_ddr_cmd_b[0],
283
                  w_ddr_cmd_b[0], w_ddr_cmd_b[0] }, o_ddr_odt);
284
 
285
        //
286
        // Now for the data, bank, and address wires
287
        //
288
        genvar  k;
289
        generate begin
290
        //
291
        for(k=0; k<16; k=k+1)
292
                xioddrserdes ddrdata(mem_serial_clk, mem_serial_clk_inv, i_clk, ~w_ddr_reset_n,
293
                                w_ddr_bus_oe,
294
                        { wo_ddr_data[48+k], wo_ddr_data[48+k],
295
                          wo_ddr_data[32+k], wo_ddr_data[32+k],
296
                          wo_ddr_data[16+k], wo_ddr_data[16+k],
297
                          wo_ddr_data[   k], wo_ddr_data[   k] },
298
                        { wide_ddr_data[112+k], wide_ddr_data[96+k],
299
                          wide_ddr_data[ 80+k], wide_ddr_data[64+k],
300
                          wide_ddr_data[ 48+k], wide_ddr_data[32+k],
301
                          wide_ddr_data[ 16+k], wide_ddr_data[   k] },
302
                        io_ddr_data[k]);
303
        //
304
        for(k=0; k<3; k=k+1)
305
                xoddrserdes ddrbank(mem_serial_clk, i_clk, ~w_ddr_reset_n,
306
                        { w_ddr_cmd_a[20+k], w_ddr_cmd_a[20+k],
307
                          w_ddr_cmd_a[20+k], w_ddr_cmd_a[20+k],
308
                          w_ddr_cmd_b[20+k], w_ddr_cmd_b[20+k],
309
                          w_ddr_cmd_b[20+k], w_ddr_cmd_b[20+k] },
310
                        o_ddr_ba[k]);
311
        //
312
        for(k=0; k<14; k=k+1)
313
                xoddrserdes ddraddr(mem_serial_clk, i_clk, ~w_ddr_reset_n,
314
                        { w_ddr_cmd_a[ 6+k], w_ddr_cmd_a[ 6+k],
315
                          w_ddr_cmd_a[ 6+k], w_ddr_cmd_a[ 6+k],
316
                          w_ddr_cmd_b[ 6+k], w_ddr_cmd_b[ 6+k],
317
                          w_ddr_cmd_b[ 6+k], w_ddr_cmd_b[ 6+k] },
318
                        o_ddr_addr[k]);
319
        //
320
 
321
        for(k=0; k<64; k=k+1)
322
                assign wi_ddr_data[k] = (w_ddr_bus_oe) ? wide_ddr_data[2*k+1]
323
                                        : wide_ddr_data[2*k];
324
        end endgenerate
325
 
326
        assign  o_ddr_reset_n = w_ddr_reset_n;
327
        assign  o_ddr_cke = w_ddr_cke;
328
 
329
 
330
///
331
///
332
///
333
///
334
`else
335
        wire            w_ddr_reset_n, w_ddr_cke, w_ddr_bus_oe;
336
        wire    [26:0]   w_ddr_cmd_a, w_ddr_cmd_b;
337
        wire    [63:0]   wi_ddr_data, wo_ddr_data;
338
        wire    [127:0]  wide_ddr_data;
339
 
340
        //
341
        //
342
        // Wires for setting up the DDR3 memory
343
        //
344
        //
345
 
346
        // Leave the SDRAM in a permanent state of reset
347
        assign  o_ddr_reset_n = 1'b0;
348
        // Leave the SDRAM clock ... disabled
349
        assign  o_ddr_cke = 1'b0;
350
 
351
        // Disable the clock(s)
352
        OBUFDS(.I(1'b0), .O(o_ddr_ck_p), .OB(o_ddr_ck_n));
353
        // And the data strobe
354
        OBUFDS(.I(1'b0), .O(io_ddr_dqs_p[0]), .OB(io_ddr_dqs_n[0]));
355
        OBUFDS(.I(1'b0), .O(io_ddr_dqs_p[1]), .OB(io_ddr_dqs_n[1]));
356
 
357
        // Output ... something, anything, on the address lines
358
        assign  o_ddr_cs_n  = 1'b1;     // Never enable any commands
359
        assign  o_ddr_ras_n = 1'b0;
360
        assign  o_ddr_cas_n = 1'b0;
361
        assign  o_ddr_we_n  = 1'b0;
362
        assign  o_ddr_ba    = 3'h0;
363
        assign  o_ddr_addr  = 14'h0;
364
        assign  o_ddr_dm    = 2'b00;
365
        assign  o_ddr_odt   = 1'b0;
366
 
367
        assign  io_ddr_data = 16'bzzzz_zzzz_zzzz_zzzz;
368
        assign  wi_ddr_data = io_ddr_data;
369
 
370
`endif
371
 
372
 
373 3 dgisselq
        //////
374
        //
375
        //
376
        // The WB bus interconnect, herein called fastmaster, which handles
377
        // just about ... everything.
378
        //
379
        //
380
        //////
381 13 dgisselq
        wire            w_qspi_sck, w_qspi_cs_n;
382 3 dgisselq
        wire    [1:0]    qspi_bmod;
383
        wire    [3:0]    qspi_dat;
384
        wire    [3:0]    i_qspi_dat;
385
 
386
        //
387 25 dgisselq
        wire    [2:0]    w_ddr_dqs;
388
        wire    [31:0]   wo_ddr_data, wi_ddr_data;
389
        //
390 3 dgisselq
        wire            w_mdio, w_mdwe;
391
        //
392
        wire            w_sd_cmd;
393
        wire    [3:0]    w_sd_data;
394 25 dgisselq
        fastmaster      wbbus(s_clk, pwr_reset,
395 3 dgisselq
                // External USB-UART bus control
396
                rx_stb, rx_data, tx_stb, tx_data, tx_busy,
397
                // Board lights and switches
398
                i_sw, i_btn, o_led,
399
                o_clr_led0, o_clr_led1, o_clr_led2, o_clr_led3,
400
                // Board level PMod I/O
401
                i_aux_rx, o_aux_tx, o_aux_cts, i_gps_rx, o_gps_tx,
402
                // Quad SPI flash
403 13 dgisselq
                w_qspi_cs_n, w_qspi_sck, qspi_dat, i_qspi_dat, qspi_bmod,
404 3 dgisselq
                // DDR3 SDRAM
405 24 dgisselq
                w_ddr_reset_n, w_ddr_cke, w_ddr_bus_oe,
406
                w_ddr_cmd_a, w_ddr_cmd_b, wo_ddr_data, wi_ddr_data,
407 3 dgisselq
                // SD Card
408
                o_sd_sck, w_sd_cmd, w_sd_data, io_sd_cmd, io_sd, i_sd_cs,
409
                // Ethernet control (MDIO) lines
410
                o_eth_mdclk, w_mdio, w_mdwe, io_eth_mdio,
411
                // OLEDRGB PMod wires
412
                o_oled_sck, o_oled_cs_n, o_oled_mosi, o_oled_dcn,
413
                o_oled_reset_n, o_oled_vccen, o_oled_pmoden,
414
                // GPS PMod
415
                i_gps_pps, i_gps_3df
416
                );
417
 
418
        //////
419
        //
420
        //
421
        // Some wires need special treatment, and so are not quite completely
422
        // handled by the bus master.  These are handled below.
423
        //
424
        //
425
        //////
426
 
427
        //
428
        //
429
        // QSPI)BMOD, Quad SPI bus mode, Bus modes are:
430
        //      0?      Normal serial mode, one bit in one bit out
431
        //      10      Quad SPI mode, going out
432
        //      11      Quad SPI mode coming from the device (read mode)
433
        //
434
        //      ??      Dual mode in  (not yet)
435
        //      ??      Dual mode out (not yet)
436
        //
437
        //
438 13 dgisselq
        wire    [3:0]    i_qspi_pedge, i_qspi_nedge;
439 12 dgisselq
 
440
        xoddr   xqspi_sck( i_clk, { w_qspi_sck,  w_qspi_sck }, o_qspi_sck);
441 13 dgisselq
        xoddr   xqspi_csn( i_clk, { w_qspi_cs_n, w_qspi_cs_n },o_qspi_cs_n);
442 12 dgisselq
        //
443 25 dgisselq
        xioddr  xqspi_d0(  s_clk, (qspi_bmod != 2'b11),
444 3 dgisselq
                { qspi_dat[0], qspi_dat[0] },
445 13 dgisselq
                { i_qspi_pedge[0], i_qspi_nedge[0] }, io_qspi_dat[0]);
446 25 dgisselq
        xioddr  xqspi_d1(  s_clk, (qspi_bmod==2'b10),
447 3 dgisselq
                { qspi_dat[1], qspi_dat[1] },
448 13 dgisselq
                { i_qspi_pedge[1], i_qspi_nedge[1] }, io_qspi_dat[1]);
449 25 dgisselq
        xioddr  xqspi_d2(  s_clk, (qspi_bmod!=2'b11),
450 12 dgisselq
                (qspi_bmod[1])?{ qspi_dat[2], qspi_dat[2] }:2'b11,
451 13 dgisselq
                { i_qspi_pedge[2], i_qspi_nedge[2] }, io_qspi_dat[2]);
452 25 dgisselq
        xioddr  xqspi_d3(  s_clk, (qspi_bmod!=2'b11),
453 12 dgisselq
                (qspi_bmod[1])?{ qspi_dat[3], qspi_dat[3] }:2'b11,
454 13 dgisselq
                { i_qspi_pedge[3], i_qspi_nedge[3] }, io_qspi_dat[3]);
455
 
456
        assign  i_qspi_dat = i_qspi_pedge;
457 25 dgisselq
        //
458
        // Proposed QSPI mode select, to allow dual I/O mode
459
        //      000     Normal SPI mode
460
        //      001     Dual mode input
461
        //      010     Dual mode, output
462
        //      101     Quad I/O mode input
463
        //      110     Quad I/O mode output
464
        //
465
        //
466 3 dgisselq
 
467 25 dgisselq
 
468 3 dgisselq
        //
469
        //
470
        // Wires for setting up the SD Card Controller
471
        //
472
        //
473
        assign io_sd_cmd = w_sd_cmd ? 1'bz:1'b0;
474
        assign io_sd[0] = w_sd_data[0]? 1'bz:1'b0;
475
        assign io_sd[1] = w_sd_data[1]? 1'bz:1'b0;
476
        assign io_sd[2] = w_sd_data[2]? 1'bz:1'b0;
477
        assign io_sd[3] = w_sd_data[3]? 1'bz:1'b0;
478
 
479
 
480
        //
481
        //
482
        // Wire(s) for setting up the MDIO ethernet control structure
483
        //
484
        //
485
        assign  io_eth_mdio = (w_mdwe)?w_mdio : 1'bz;
486
 
487
        //
488
        //
489
        // Wires for setting up the DDR3 memory
490
        //
491
        //
492
 
493 24 dgisselq
/*
494 12 dgisselq
        wire    w_clk_for_ddr;
495
        ODDR    #(.DDR_CLK_EDGE("SAME_EDGE"))
496
                memclkddr(.Q(w_clk_for_ddr), .C(clk_for_ddr), .CE(1'b1),
497
                        .D1(1'b0), .D2(1'b1), .R(1'b0), .S(1'b0));
498 3 dgisselq
        OBUFDS  #(.IOSTANDARD("DIFF_SSTL135"), .SLEW("FAST"))
499 12 dgisselq
                clkbuf(.O(o_ddr_ck_p), .OB(o_ddr_ck_n), .I(w_clk_for_ddr));
500 24 dgisselq
*/
501 3 dgisselq
 
502
endmodule
503
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.