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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [xilinx/] [ml501/] [rtl/] [verilog/] [xilinx_ddr2/] [ddr2_mig.v] - Blame information for rev 480

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

Line No. Rev Author Line
1 412 julius
//*****************************************************************************
2
// DISCLAIMER OF LIABILITY
3
//
4
// This file contains proprietary and confidential information of
5
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
6
// from Xilinx, and may be used, copied and/or disclosed only
7
// pursuant to the terms of a valid license agreement with Xilinx.
8
//
9
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION
10
// ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
11
// EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT
12
// LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT,
13
// MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx
14
// does not warrant that functions included in the Materials will
15
// meet the requirements of Licensee, or that the operation of the
16
// Materials will be uninterrupted or error-free, or that defects
17
// in the Materials will be corrected. Furthermore, Xilinx does
18
// not warrant or make any representations regarding use, or the
19
// results of the use, of the Materials in terms of correctness,
20
// accuracy, reliability or otherwise.
21
//
22
// Xilinx products are not designed or intended to be fail-safe,
23
// or for use in any application requiring fail-safe performance,
24
// such as life-support or safety devices or systems, Class III
25
// medical devices, nuclear facilities, applications related to
26
// the deployment of airbags, or any other applications that could
27
// lead to death, personal injury or severe property or
28
// environmental damage (individually and collectively, "critical
29
// applications"). Customer assumes the sole risk and liability
30
// of any use of Xilinx products in critical applications,
31
// subject only to applicable laws and regulations governing
32
// limitations on product liability.
33
//
34
// Copyright 2006, 2007, 2008 Xilinx, Inc.
35
// All rights reserved.
36
//
37
// This disclaimer and copyright notice must be retained as part
38
// of this file at all times.
39
//*****************************************************************************
40
//   ____  ____
41
//  /   /\/   /
42
// /___/  \  /    Vendor: Xilinx
43
// \   \   \/     Version: 3.0
44
//  \   \         Application: MIG
45
//  /   /         Filename: ddr2_mig.v
46
// /___/   /\     Date Last Modified: $Date: 2009/02/03 18:46:29 $
47
// \   \  /  \    Date Created: Wed Aug 16 2006
48
//  \___\/\___\
49
//
50
//Device: Virtex-5
51
//Design Name: DDR2
52
//Purpose:
53
//   Top-level  module. Simple model for what the user might use
54
//   Typically, the user will only instantiate MEM_INTERFACE_TOP in their
55
//   code, and generate all backend logic (test bench) separately.
56
//   In addition to the memory controller, the module instantiates:
57
//     1. Clock generation/distribution, reset logic
58
//     2. IDELAY control block
59
//Reference:
60
//Revision History:
61
//   Rev 1.1 - Parameter USE_DM_PORT added. PK. 6/25/08
62
//   Rev 1.2 - Parameter HIGH_PERFORMANCE_MODE added. PK. 7/10/08
63
//   Rev 1.3 - Parameter IODELAY_GRP added. PK. 11/27/08
64
//*****************************************************************************
65
 
66
`timescale 1ns/1ps
67
 
68
(* X_CORE_INFO = "mig_v3_0_ddr2_v5, Coregen 11.1" , CORE_GENERATION_INFO = "ddr2_v5,mig_v3_0,{component_name=ddr2_mig, BANK_WIDTH=2, CKE_WIDTH=1, CLK_WIDTH=2, COL_WIDTH=10, CS_NUM=1, CS_WIDTH=1, DM_WIDTH=8, DQ_WIDTH=64, DQ_PER_DQS=8, DQS_WIDTH=8, ODT_WIDTH=1, ROW_WIDTH=13, ADDITIVE_LAT=0, BURST_LEN=4, BURST_TYPE=0, CAS_LAT=4, ECC_ENABLE=0, MULTI_BANK_EN=1, TWO_T_TIME_EN=1, ODT_TYPE=1, REDUCE_DRV=0, REG_ENABLE=0, TREFI_NS=7800, TRAS=40000, TRCD=15000, TRFC=105000, TRP=15000, TRTP=7500, TWR=15000, TWTR=7500, DDR2_CLK_PERIOD=3750, RST_ACT_LOW=1}" *)
69
module ddr2_mig #
70
  (
71
   parameter BANK_WIDTH              = 2,
72
                                       // # of memory bank addr bits.
73
   parameter CKE_WIDTH               = 1,
74
                                       // # of memory clock enable outputs.
75
   parameter CLK_WIDTH               = 2,
76
                                       // # of clock outputs.
77
   parameter COL_WIDTH               = 10,
78
                                       // # of memory column bits.
79
   parameter CS_NUM                  = 1,
80
                                       // # of separate memory chip selects.
81
   parameter CS_WIDTH                = 1,
82
                                       // # of total memory chip selects.
83
   parameter CS_BITS                 = 0,
84
                                       // set to log2(CS_NUM) (rounded up).
85
   parameter DM_WIDTH                = 8,
86
                                       // # of data mask bits.
87
   parameter DQ_WIDTH                = 64,
88
                                       // # of data width.
89
   parameter DQ_PER_DQS              = 8,
90
                                       // # of DQ data bits per strobe.
91
   parameter DQS_WIDTH               = 8,
92
                                       // # of DQS strobes.
93
   parameter DQ_BITS                 = 6,
94
                                       // set to log2(DQS_WIDTH*DQ_PER_DQS).
95
   parameter DQS_BITS                = 3,
96
                                       // set to log2(DQS_WIDTH).
97
   parameter ODT_WIDTH               = 1,
98
                                       // # of memory on-die term enables.
99
   parameter ROW_WIDTH               = 13,
100
                                       // # of memory row and # of addr bits.
101
   parameter ADDITIVE_LAT            = 0,
102
                                       // additive write latency.
103
   parameter BURST_LEN               = 4,
104
                                       // burst length (in double words).
105
   parameter BURST_TYPE              = 0,
106
                                       // burst type (=0 seq; =1 interleaved).
107
   parameter CAS_LAT                 = 4,
108
                                       // CAS latency.
109
   parameter ECC_ENABLE              = 0,
110
                                       // enable ECC (=1 enable).
111
   parameter APPDATA_WIDTH           = 128,
112
                                       // # of usr read/write data bus bits.
113
   parameter MULTI_BANK_EN           = 1,
114
                                       // Keeps multiple banks open. (= 1 enable).
115
   parameter TWO_T_TIME_EN           = 1,
116
                                       // 2t timing for unbuffered dimms.
117
   parameter ODT_TYPE                = 1,
118
                                       // ODT (=0(none),=1(75),=2(150),=3(50)).
119
   parameter REDUCE_DRV              = 0,
120
                                       // reduced strength mem I/O (=1 yes).
121
   parameter REG_ENABLE              = 0,
122
                                       // registered addr/ctrl (=1 yes).
123
   parameter TREFI_NS                = 7800,
124
                                       // auto refresh interval (ns).
125
   parameter TRAS                    = 40000,
126
                                       // active->precharge delay.
127
   parameter TRCD                    = 15000,
128
                                       // active->read/write delay.
129
   parameter TRFC                    = 105000,
130
                                       // refresh->refresh, refresh->active delay.
131
   parameter TRP                     = 15000,
132
                                       // precharge->command delay.
133
   parameter TRTP                    = 7500,
134
                                       // read->precharge delay.
135
   parameter TWR                     = 15000,
136
                                       // used to determine write->precharge.
137
   parameter TWTR                    = 7500,
138
                                       // write->read delay.
139
   parameter HIGH_PERFORMANCE_MODE   = "TRUE",
140
                              // # = TRUE, the IODELAY performance mode is set
141
                              // to high.
142
                              // # = FALSE, the IODELAY performance mode is set
143
                              // to low.
144
   parameter SIM_ONLY                = 0,
145
                                       // = 1 to skip SDRAM power up delay.
146
   parameter DEBUG_EN                = 0,
147
                                       // Enable debug signals/controls.
148
                                       // When this parameter is changed from 0 to 1,
149
                                       // make sure to uncomment the coregen commands
150
                                       // in ise_flow.bat or create_ise.bat files in
151
                                       // par folder.
152
   parameter CLK_PERIOD              = 3750,
153
                                       // Core/Memory clock period (in ps).
154
   parameter CLK_TYPE                = "SINGLE_ENDED",
155
                                       // # = "DIFFERENTIAL " ->; Differential input clocks ,
156
                                       // # = "SINGLE_ENDED" -> Single ended input clocks.
157
   parameter DLL_FREQ_MODE           = "HIGH",
158
                                       // DCM Frequency range.
159
   parameter RST_ACT_LOW             = 1
160
                                       // =1 for active low reset, =0 for active high.
161
   )
162
  (
163
   inout  [DQ_WIDTH-1:0]              ddr2_dq,
164
   output [ROW_WIDTH-1:0]             ddr2_a,
165
   output [BANK_WIDTH-1:0]            ddr2_ba,
166
   output                             ddr2_ras_n,
167
   output                             ddr2_cas_n,
168
   output                             ddr2_we_n,
169
   output [CS_WIDTH-1:0]              ddr2_cs_n,
170
   output [ODT_WIDTH-1:0]             ddr2_odt,
171
   output [CKE_WIDTH-1:0]             ddr2_cke,
172
   output [DM_WIDTH-1:0]              ddr2_dm,
173
   input                              sys_clk,
174
   input                              idly_clk_200,
175
   input                              sys_rst_n,
176
   output                             phy_init_done,
177
   output                             rst0_tb,
178
   output                             clk0_tb,
179
   input usr_clk, // jb
180
   output                             app_wdf_afull,
181
   output                             app_af_afull,
182
   output                             rd_data_valid,
183
   input                              app_wdf_wren,
184
   input                              app_af_wren,
185
   input  [30:0]                      app_af_addr,
186
   input  [2:0]                       app_af_cmd,
187
   output [(APPDATA_WIDTH)-1:0]                rd_data_fifo_out,
188
   input  [(APPDATA_WIDTH)-1:0]                app_wdf_data,
189
   input  [(APPDATA_WIDTH/8)-1:0]              app_wdf_mask_data,
190
   inout  [DQS_WIDTH-1:0]             ddr2_dqs,
191
   inout  [DQS_WIDTH-1:0]             ddr2_dqs_n,
192
   output [CLK_WIDTH-1:0]             ddr2_ck,
193
   output [CLK_WIDTH-1:0]             ddr2_ck_n
194
   );
195
 
196
  //***************************************************************************
197
  // IODELAY Group Name: Replication and placement of IDELAYCTRLs will be
198
  // handled automatically by software tools if IDELAYCTRLs have same refclk,
199
  // reset and rdy nets. Designs with a unique RESET will commonly create a
200
  // unique RDY. Constraint IODELAY_GROUP is associated to a set of IODELAYs
201
  // with an IDELAYCTRL. The parameter IODELAY_GRP value can be any string.
202
  //***************************************************************************
203
 
204
  localparam IODELAY_GRP = "IODELAY_MIG";
205
 
206
   initial
207
     $display("Xilinx DDR2 MIGed controller at %m\n");
208
 
209
 
210
 
211
 
212
  wire                              sys_clk_p;
213
  wire                              sys_clk_n;
214
  wire                              clk200_p;
215
  wire                              clk200_n;
216
  wire                              rst0;
217
  wire                              rst90;
218
  wire                              rstdiv0;
219
  wire                              rst200;
220
  wire                              clk0;
221
  wire                              clk90;
222
  wire                              clkdiv0;
223
  wire                              clk200;
224
  wire                              idelay_ctrl_rdy;
225
 
226
 
227
  //Debug signals
228
 
229
 
230
  wire [3:0]                        dbg_calib_done;
231
  wire [3:0]                        dbg_calib_err;
232
  wire [(6*DQ_WIDTH)-1:0]           dbg_calib_dq_tap_cnt;
233
  wire [(6*DQS_WIDTH)-1:0]          dbg_calib_dqs_tap_cnt;
234
  wire [(6*DQS_WIDTH)-1:0]          dbg_calib_gate_tap_cnt;
235
  wire [DQS_WIDTH-1:0]              dbg_calib_rd_data_sel;
236
  wire [(5*DQS_WIDTH)-1:0]          dbg_calib_rden_dly;
237
  wire [(5*DQS_WIDTH)-1:0]          dbg_calib_gate_dly;
238
  wire                              dbg_idel_up_all;
239
  wire                              dbg_idel_down_all;
240
  wire                              dbg_idel_up_dq;
241
  wire                              dbg_idel_down_dq;
242
  wire                              dbg_idel_up_dqs;
243
  wire                              dbg_idel_down_dqs;
244
  wire                              dbg_idel_up_gate;
245
  wire                              dbg_idel_down_gate;
246
  wire [DQ_BITS-1:0]                dbg_sel_idel_dq;
247
  wire                              dbg_sel_all_idel_dq;
248
  wire [DQS_BITS:0]                 dbg_sel_idel_dqs;
249
  wire                              dbg_sel_all_idel_dqs;
250
  wire [DQS_BITS:0]                 dbg_sel_idel_gate;
251
  wire                              dbg_sel_all_idel_gate;
252
 
253
 
254
    // Debug signals (optional use)
255
 
256
  //***********************************
257
  // PHY Debug Port demo
258
  //***********************************
259
  wire [35:0]                        cs_control0;
260
  wire [35:0]                        cs_control1;
261
  wire [35:0]                        cs_control2;
262
  wire [35:0]                        cs_control3;
263
  wire [191:0]                       vio0_in;
264
  wire [95:0]                        vio1_in;
265
  wire [99:0]                        vio2_in;
266
  wire [31:0]                        vio3_out;
267
 
268
 
269
 
270
 
271
  //***************************************************************************
272
 
273
  assign  rst0_tb = rst0;
274
  assign  clk0_tb = clk0;
275
  assign sys_clk_p = 1'b1;
276
  assign sys_clk_n = 1'b0;
277
  assign clk200_p = 1'b1;
278
  assign clk200_n = 1'b0;
279
 
280
   ddr2_idelay_ctrl #
281
   (
282
    .IODELAY_GRP         (IODELAY_GRP)
283
   )
284
   u_ddr2_idelay_ctrl
285
   (
286
   .rst200                 (rst200),
287
   .clk200                 (clk200),
288
   .idelay_ctrl_rdy        (idelay_ctrl_rdy)
289
   );
290
 
291
 ddr2_infrastructure #
292
 (
293
   .CLK_PERIOD             (CLK_PERIOD),
294
   .CLK_TYPE               (CLK_TYPE),
295
   .DLL_FREQ_MODE          (DLL_FREQ_MODE),
296
   .RST_ACT_LOW            (RST_ACT_LOW)
297
   )
298
u_ddr2_infrastructure
299
 (
300
   .sys_clk_p              (sys_clk_p),
301
   .sys_clk_n              (sys_clk_n),
302
   .sys_clk                (sys_clk),
303
   .clk200_p               (clk200_p),
304
   .clk200_n               (clk200_n),
305
   .idly_clk_200           (idly_clk_200),
306
   .sys_rst_n              (sys_rst_n),
307
   .rst0                   (rst0),
308
   .rst90                  (rst90),
309
   .rstdiv0                (rstdiv0),
310
   .rst200                 (rst200),
311
   .clk0                   (clk0),
312
   .clk90                  (clk90),
313
   .clkdiv0                (clkdiv0),
314
   .clk200                 (clk200),
315
   .idelay_ctrl_rdy        (idelay_ctrl_rdy)
316
   );
317
 
318
 ddr2_top #
319
 (
320
   .BANK_WIDTH             (BANK_WIDTH),
321
   .CKE_WIDTH              (CKE_WIDTH),
322
   .CLK_WIDTH              (CLK_WIDTH),
323
   .COL_WIDTH              (COL_WIDTH),
324
   .CS_NUM                 (CS_NUM),
325
   .CS_WIDTH               (CS_WIDTH),
326
   .CS_BITS                (CS_BITS),
327
   .DM_WIDTH               (DM_WIDTH),
328
   .DQ_WIDTH               (DQ_WIDTH),
329
   .DQ_PER_DQS             (DQ_PER_DQS),
330
   .DQS_WIDTH              (DQS_WIDTH),
331
   .DQ_BITS                (DQ_BITS),
332
   .DQS_BITS               (DQS_BITS),
333
   .ODT_WIDTH              (ODT_WIDTH),
334
   .ROW_WIDTH              (ROW_WIDTH),
335
   .ADDITIVE_LAT           (ADDITIVE_LAT),
336
   .BURST_LEN              (BURST_LEN),
337
   .BURST_TYPE             (BURST_TYPE),
338
   .CAS_LAT                (CAS_LAT),
339
   .ECC_ENABLE             (ECC_ENABLE),
340
   .APPDATA_WIDTH          (APPDATA_WIDTH),
341
   .MULTI_BANK_EN          (MULTI_BANK_EN),
342
   .TWO_T_TIME_EN          (TWO_T_TIME_EN),
343
   .ODT_TYPE               (ODT_TYPE),
344
   .REDUCE_DRV             (REDUCE_DRV),
345
   .REG_ENABLE             (REG_ENABLE),
346
   .TREFI_NS               (TREFI_NS),
347
   .TRAS                   (TRAS),
348
   .TRCD                   (TRCD),
349
   .TRFC                   (TRFC),
350
   .TRP                    (TRP),
351
   .TRTP                   (TRTP),
352
   .TWR                    (TWR),
353
   .TWTR                   (TWTR),
354
   .HIGH_PERFORMANCE_MODE  (HIGH_PERFORMANCE_MODE),
355
   .IODELAY_GRP            (IODELAY_GRP),
356
   .SIM_ONLY               (SIM_ONLY),
357
   .DEBUG_EN               (DEBUG_EN),
358
   .CLK_PERIOD             (CLK_PERIOD),
359
   .FPGA_SPEED_GRADE       (1),
360
   .USE_DM_PORT            (1)
361
   )
362
u_ddr2_top_0
363
(
364
   .ddr2_dq                (ddr2_dq),
365
   .ddr2_a                 (ddr2_a),
366
   .ddr2_ba                (ddr2_ba),
367
   .ddr2_ras_n             (ddr2_ras_n),
368
   .ddr2_cas_n             (ddr2_cas_n),
369
   .ddr2_we_n              (ddr2_we_n),
370
   .ddr2_cs_n              (ddr2_cs_n),
371
   .ddr2_odt               (ddr2_odt),
372
   .ddr2_cke               (ddr2_cke),
373
   .ddr2_dm                (ddr2_dm),
374
   .phy_init_done          (phy_init_done),
375
   .rst0                   (rst0),
376
   .rst90                  (rst90),
377
   .rstdiv0                (rstdiv0),
378
   .clk0                   (clk0),
379
   .usr_clk (usr_clk), // jb
380
   .clk90                  (clk90),
381
   .clkdiv0                (clkdiv0),
382
   .app_wdf_afull          (app_wdf_afull),
383
   .app_af_afull           (app_af_afull),
384
   .rd_data_valid          (rd_data_valid),
385
   .app_wdf_wren           (app_wdf_wren),
386
   .app_af_wren            (app_af_wren),
387
   .app_af_addr            (app_af_addr),
388
   .app_af_cmd             (app_af_cmd),
389
   .rd_data_fifo_out       (rd_data_fifo_out),
390
   .app_wdf_data           (app_wdf_data),
391
   .app_wdf_mask_data      (app_wdf_mask_data),
392
   .ddr2_dqs               (ddr2_dqs),
393
   .ddr2_dqs_n             (ddr2_dqs_n),
394
   .ddr2_ck                (ddr2_ck),
395
   .rd_ecc_error           (),
396
   .ddr2_ck_n              (ddr2_ck_n),
397
 
398
   .dbg_calib_done         (dbg_calib_done),
399
   .dbg_calib_err          (dbg_calib_err),
400
   .dbg_calib_dq_tap_cnt   (dbg_calib_dq_tap_cnt),
401
   .dbg_calib_dqs_tap_cnt  (dbg_calib_dqs_tap_cnt),
402
   .dbg_calib_gate_tap_cnt  (dbg_calib_gate_tap_cnt),
403
   .dbg_calib_rd_data_sel  (dbg_calib_rd_data_sel),
404
   .dbg_calib_rden_dly     (dbg_calib_rden_dly),
405
   .dbg_calib_gate_dly     (dbg_calib_gate_dly),
406
   .dbg_idel_up_all        (dbg_idel_up_all),
407
   .dbg_idel_down_all      (dbg_idel_down_all),
408
   .dbg_idel_up_dq         (dbg_idel_up_dq),
409
   .dbg_idel_down_dq       (dbg_idel_down_dq),
410
   .dbg_idel_up_dqs        (dbg_idel_up_dqs),
411
   .dbg_idel_down_dqs      (dbg_idel_down_dqs),
412
   .dbg_idel_up_gate       (dbg_idel_up_gate),
413
   .dbg_idel_down_gate     (dbg_idel_down_gate),
414
   .dbg_sel_idel_dq        (dbg_sel_idel_dq),
415
   .dbg_sel_all_idel_dq    (dbg_sel_all_idel_dq),
416
   .dbg_sel_idel_dqs       (dbg_sel_idel_dqs),
417
   .dbg_sel_all_idel_dqs   (dbg_sel_all_idel_dqs),
418
   .dbg_sel_idel_gate      (dbg_sel_idel_gate),
419
   .dbg_sel_all_idel_gate  (dbg_sel_all_idel_gate)
420
   );
421
 
422
 
423
   //*****************************************************************
424
  // Hooks to prevent sim/syn compilation errors (mainly for VHDL - but
425
  // keep it also in Verilog version of code) w/ floating inputs if
426
  // DEBUG_EN = 0.
427
  //*****************************************************************
428
 
429
  generate
430
    if (DEBUG_EN == 0) begin: gen_dbg_tie_off
431
      assign dbg_idel_up_all       = 'b0;
432
      assign dbg_idel_down_all     = 'b0;
433
      assign dbg_idel_up_dq        = 'b0;
434
      assign dbg_idel_down_dq      = 'b0;
435
      assign dbg_idel_up_dqs       = 'b0;
436
      assign dbg_idel_down_dqs     = 'b0;
437
      assign dbg_idel_up_gate      = 'b0;
438
      assign dbg_idel_down_gate    = 'b0;
439
      assign dbg_sel_idel_dq       = 'b0;
440
      assign dbg_sel_all_idel_dq   = 'b0;
441
      assign dbg_sel_idel_dqs      = 'b0;
442
      assign dbg_sel_all_idel_dqs  = 'b0;
443
      assign dbg_sel_idel_gate     = 'b0;
444
      assign dbg_sel_all_idel_gate = 'b0;
445
    end else begin: gen_dbg_enable
446
`ifdef XILINX_DDR2_CHIPSCOPE
447
      //*****************************************************************
448
      // PHY Debug Port example - see MIG User's Guide, XAPP858 or 
449
      // Answer Record 29443
450
      // This logic supports up to 32 DQ and 8 DQS I/O
451
      // NOTES:
452
      //   1. PHY Debug Port demo connects to 4 VIO modules:
453
      //     - 3 VIO modules with only asynchronous inputs
454
      //      * Monitor IDELAY taps for DQ, DQS, DQS Gate
455
      //      * Calibration status
456
      //     - 1 VIO module with synchronous outputs
457
      //      * Allow dynamic adjustment o f IDELAY taps
458
      //   2. User may need to modify this code to incorporate other
459
      //      chipscope-related modules in their larger design (e.g.
460
      //      if they have other ILA/VIO modules, they will need to
461
      //      for example instantiate a larger ICON module). In addition
462
      //      user may want to instantiate more VIO modules to control
463
      //      IDELAY for more DQ, DQS than is shown here
464
      //*****************************************************************
465
 
466
      icon4 u_icon
467
        (
468
         .control0 (cs_control0),
469
         .control1 (cs_control1),
470
         .control2 (cs_control2),
471
         .control3 (cs_control3)
472
         );
473
 
474
      //*****************************************************************
475
      // VIO ASYNC input: Display current IDELAY setting for up to 32
476
      // DQ taps (32x6) = 192
477
      //*****************************************************************
478
 
479
      vio_async_in192 u_vio0
480
        (
481
         .control  (cs_control0),
482
         .async_in (vio0_in)
483
         );
484
 
485
      //*****************************************************************
486
      // VIO ASYNC input: Display current IDELAY setting for up to 8 DQS
487
      // and DQS Gate taps (8x6x2) = 96
488
      //*****************************************************************
489
 
490
      vio_async_in96 u_vio1
491
        (
492
         .control  (cs_control1),
493
         .async_in (vio1_in)
494
         );
495
 
496
      //*****************************************************************
497
      // VIO ASYNC input: Display other calibration results
498
      //*****************************************************************
499
 
500
      vio_async_in100 u_vio2
501
        (
502
         .control  (cs_control2),
503
         .async_in (vio2_in)
504
         );
505
 
506
      //*****************************************************************
507
      // VIO SYNC output: Dynamically change IDELAY taps
508
      //*****************************************************************
509
 
510
      vio_sync_out32 u_vio3
511
        (
512
         .control  (cs_control3),
513
         .clk      (clkdiv0),
514
         .sync_out (vio3_out)
515
         );
516
 
517
      //*****************************************************************
518
      // Bit assignments:
519
      // NOTE: Not all VIO, ILA inputs/outputs may be used - these will
520
      //       be dependent on the user's particular bit width
521
      //*****************************************************************
522
 
523
      if (DQ_WIDTH <= 32) begin: gen_dq_le_32
524
        assign vio0_in[(6*DQ_WIDTH)-1:0]
525
                 = dbg_calib_dq_tap_cnt[(6*DQ_WIDTH)-1:0];
526
      end else begin: gen_dq_gt_32
527
        assign vio0_in = dbg_calib_dq_tap_cnt[191:0];
528
      end
529
 
530
      if (DQS_WIDTH <= 8) begin: gen_dqs_le_8
531
        assign vio1_in[(6*DQS_WIDTH)-1:0]
532
                 = dbg_calib_dqs_tap_cnt[(6*DQS_WIDTH)-1:0];
533
        assign vio1_in[(12*DQS_WIDTH)-1:(6*DQS_WIDTH)]
534
                 =  dbg_calib_gate_tap_cnt[(6*DQS_WIDTH)-1:0];
535
      end else begin: gen_dqs_gt_32
536
        assign vio1_in[47:0]  = dbg_calib_dqs_tap_cnt[47:0];
537
        assign vio1_in[95:48] = dbg_calib_gate_tap_cnt[47:0];
538
      end
539
 
540
//dbg_calib_rd_data_sel
541
 
542
     if (DQS_WIDTH <= 8) begin: gen_rdsel_le_8
543
        assign vio2_in[(DQS_WIDTH)+7:8]
544
                 = dbg_calib_rd_data_sel[(DQS_WIDTH)-1:0];
545
     end else begin: gen_rdsel_gt_32
546
      assign vio2_in[15:8]
547
                 = dbg_calib_rd_data_sel[7:0];
548
     end
549
 
550
//dbg_calib_rden_dly
551
 
552
     if (DQS_WIDTH <= 8) begin: gen_calrd_le_8
553
       assign vio2_in[(5*DQS_WIDTH)+19:20]
554
                 = dbg_calib_rden_dly[(5*DQS_WIDTH)-1:0];
555
     end else begin: gen_calrd_gt_32
556
       assign vio2_in[59:20]
557
                 = dbg_calib_rden_dly[39:0];
558
     end
559
 
560
//dbg_calib_gate_dly
561
 
562
     if (DQS_WIDTH <= 8) begin: gen_calgt_le_8
563
       assign vio2_in[(5*DQS_WIDTH)+59:60]
564
                 = dbg_calib_gate_dly[(5*DQS_WIDTH)-1:0];
565
     end else begin: gen_calgt_gt_32
566
       assign vio2_in[99:60]
567
                 = dbg_calib_gate_dly[39:0];
568
     end
569
 
570
//dbg_sel_idel_dq
571
 
572
     if (DQ_BITS <= 5) begin: gen_selid_le_5
573
       assign dbg_sel_idel_dq[DQ_BITS-1:0]
574
                 = vio3_out[DQ_BITS+7:8];
575
     end else begin: gen_selid_gt_32
576
       assign dbg_sel_idel_dq[4:0]
577
                 = vio3_out[12:8];
578
     end
579
 
580
//dbg_sel_idel_dqs
581
 
582
     if (DQS_BITS <= 3) begin: gen_seldqs_le_3
583
       assign dbg_sel_idel_dqs[DQS_BITS:0]
584
                 = vio3_out[(DQS_BITS+16):16];
585
     end else begin: gen_seldqs_gt_32
586
       assign dbg_sel_idel_dqs[3:0]
587
                 = vio3_out[19:16];
588
     end
589
 
590
//dbg_sel_idel_gate
591
 
592
     if (DQS_BITS <= 3) begin: gen_gtdqs_le_3
593
       assign dbg_sel_idel_gate[DQS_BITS:0]
594
                 = vio3_out[(DQS_BITS+21):21];
595
     end else begin: gen_gtdqs_gt_32
596
       assign dbg_sel_idel_gate[3:0]
597
                 = vio3_out[24:21];
598
     end
599
 
600
`endif //  `ifdef XILINX_DDR2_CHIPSCOPE
601
      assign vio2_in[3:0]              = dbg_calib_done;
602
      assign vio2_in[7:4]              = dbg_calib_err;
603
 
604
      assign dbg_idel_up_all           = vio3_out[0];
605
      assign dbg_idel_down_all         = vio3_out[1];
606
      assign dbg_idel_up_dq            = vio3_out[2];
607
      assign dbg_idel_down_dq          = vio3_out[3];
608
      assign dbg_idel_up_dqs           = vio3_out[4];
609
      assign dbg_idel_down_dqs         = vio3_out[5];
610
      assign dbg_idel_up_gate          = vio3_out[6];
611
      assign dbg_idel_down_gate        = vio3_out[7];
612
      assign dbg_sel_all_idel_dq       = vio3_out[15];
613
      assign dbg_sel_all_idel_dqs      = vio3_out[20];
614
      assign dbg_sel_all_idel_gate     = vio3_out[25];
615
    end
616
  endgenerate
617
 
618
endmodule

powered by: WebSVN 2.1.0

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