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

Subversion Repositories usb_fpga_2_14

[/] [usb_fpga_2_14/] [trunk/] [examples/] [memfifo/] [fpga-2.04b/] [ipcore_dir/] [mem0/] [user_design/] [rtl/] [mcb_controller/] [mcb_soft_calibration_top.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
//*****************************************************************************
2
// (c) Copyright 2009 Xilinx, Inc. All rights reserved.
3
//
4
// This file contains confidential and proprietary information
5
// of Xilinx, Inc. and is protected under U.S. and
6
// international copyright and other intellectual property
7
// laws.
8
//
9
// DISCLAIMER
10
// This disclaimer is not a license and does not grant any
11
// rights to the materials distributed herewith. Except as
12
// otherwise provided in a valid license issued to you by
13
// Xilinx, and to the maximum extent permitted by applicable
14
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
15
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19
// (2) Xilinx shall not be liable (whether in contract or tort,
20
// including negligence, or under any other theory of
21
// liability) for any loss or damage of any kind or nature
22
// related to, arising under or in connection with these
23
// materials, including for any direct, or any indirect,
24
// special, incidental, or consequential loss or damage
25
// (including loss of data, profits, goodwill, or any type of
26
// loss or damage suffered as a result of any action brought
27
// by a third party) even if such damage or loss was
28
// reasonably foreseeable or Xilinx had been advised of the
29
// possibility of the same.
30
//
31
// CRITICAL APPLICATIONS
32
// Xilinx products are not designed or intended to be fail-
33
// safe, or for use in any application requiring fail-safe
34
// performance, such as life-support or safety devices or
35
// systems, Class III medical devices, nuclear facilities,
36
// applications related to the deployment of airbags, or any
37
// other applications that could lead to death, personal
38
// injury, or severe property or environmental damage
39
// (individually and collectively, "Critical
40
// Applications"). Customer assumes the sole risk and
41
// liability of any use of Xilinx products in Critical
42
// Applications, subject only to applicable laws and
43
// regulations governing limitations on product liability.
44
//
45
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46
// PART OF THIS FILE AT ALL TIMES.
47
//
48
//*****************************************************************************
49
//   ____  ____
50
//  /   /\/   /
51
// /___/  \  /    Vendor: Xilinx
52
// \   \   \/     Version: %version
53
//  \   \         Application: MIG
54
//  /   /         Filename: mcb_soft_calibration_top.v
55
// /___/   /\     Date Last Modified: $Date: 2011/06/02 07:17:25 $
56
// \   \  /  \    Date Created: Mon Feb 9 2009
57
//  \___\/\___\
58
//
59
//Device: Spartan6
60
//Design Name: DDR/DDR2/DDR3/LPDDR
61
//Purpose:  Xilinx reference design top-level simulation
62
//           wrapper file for input termination calibration
63
//Reference:
64
//
65
//  Revision:      Date:  Comment
66
//     1.0:  2/06/09:  Initial version for MIG wrapper.
67
//     1.1:  3/16/09: Added pll_lock port, for using it to gate reset
68
//     1.2: 6/06/09:  Removed MCB_UIDQCOUNT.
69
//     1.3: 6/18/09:  corrected/changed MCB_SYSRST to be an output port
70
//     1.4: 6/24/09:  gave RZQ and ZIO each their own unique ADD and SDI nets
71
//     1.5: 10/08/09: removed INCDEC_TRESHOLD parameter - making it a localparam inside mcb_soft_calibration
72
//     1.6: 02/04/09: Added condition generate statmenet for ZIO pin.      
73
//     1.7: 04/12/10: Added CKE_Train signal to fix DDR2 init wait .
74
//
75
// End Revision
76
//**********************************************************************************
77
 
78
`timescale 1ps/1ps
79
 
80
module mcb_soft_calibration_top  # (
81
  parameter       C_MEM_TZQINIT_MAXCNT  = 10'h512,  // DDR3 Minimum delay between resets
82
  parameter       C_MC_CALIBRATION_MODE = "CALIBRATION", // if set to CALIBRATION will reset DQS IDELAY to DQS_NUMERATOR/DQS_DENOMINATOR local_param values, and does dynamic recal,
83
                                                         // if set to NOCALIBRATION then defaults to hard cal blocks setting of C_MC_CALBRATION_DELAY *and* no dynamic recal will be done 
84
  parameter       SKIP_IN_TERM_CAL  = 1'b0,     // provides option to skip the input termination calibration
85
  parameter       SKIP_DYNAMIC_CAL  = 1'b0,     // provides option to skip the dynamic delay calibration
86
  parameter       SKIP_DYN_IN_TERM  = 1'b0,     // provides option to skip the input termination calibration
87
  parameter       C_SIMULATION      = "FALSE",  // Tells us whether the design is being simulated or implemented
88
  parameter       C_MEM_TYPE        = "DDR"     // provides the memory device used for the design
89
  )
90
  (
91
  input   wire        UI_CLK,                 // Input - global clock to be used for input_term_tuner and IODRP clock
92
  input   wire        RST,                    // Input - reset for input_term_tuner - synchronous for input_term_tuner state machine, asynch for IODRP (sub)controller
93
  input   wire        IOCLK,                  // Input - IOCLK input to the IODRP's
94
  output  wire        DONE_SOFTANDHARD_CAL,   // active high flag signals soft calibration of input delays is complete and MCB_UODONECAL is high (MCB hard calib complete)
95
  input   wire        PLL_LOCK,               // Lock signal from PLL
96
  input   wire        SELFREFRESH_REQ,
97
  input   wire        SELFREFRESH_MCB_MODE,
98
  output  wire         SELFREFRESH_MCB_REQ ,
99
  output  wire         SELFREFRESH_MODE,
100
 
101
 
102
 
103
 
104
  output  wire        MCB_UIADD,              // to MCB's UIADD port
105
  output  wire        MCB_UISDI,              // to MCB's UISDI port
106
  input   wire        MCB_UOSDO,
107
  input   wire        MCB_UODONECAL,
108
  input   wire        MCB_UOREFRSHFLAG,
109
  output  wire        MCB_UICS,
110
  output  wire        MCB_UIDRPUPDATE,
111
  output  wire        MCB_UIBROADCAST,
112
  output  wire  [4:0] MCB_UIADDR,
113
  output  wire        MCB_UICMDEN,
114
  output  wire        MCB_UIDONECAL,
115
  output  wire        MCB_UIDQLOWERDEC,
116
  output  wire        MCB_UIDQLOWERINC,
117
  output  wire        MCB_UIDQUPPERDEC,
118
  output  wire        MCB_UIDQUPPERINC,
119
  output  wire        MCB_UILDQSDEC,
120
  output  wire        MCB_UILDQSINC,
121
  output  wire        MCB_UIREAD,
122
  output  wire        MCB_UIUDQSDEC,
123
  output  wire        MCB_UIUDQSINC,
124
  output  wire        MCB_RECAL,
125
  output  wire        MCB_SYSRST,
126
  output  wire        MCB_UICMD,
127
  output  wire        MCB_UICMDIN,
128
  output  wire  [3:0] MCB_UIDQCOUNT,
129
  input   wire  [7:0] MCB_UODATA,
130
  input   wire        MCB_UODATAVALID,
131
  input   wire        MCB_UOCMDREADY,
132
  input   wire        MCB_UO_CAL_START,
133
 
134
  inout   wire        RZQ_Pin,
135
  inout   wire        ZIO_Pin,
136
  output  wire            CKE_Train
137
 
138
  );
139
 
140
  wire IODRP_ADD;
141
  wire IODRP_SDI;
142
  wire RZQ_IODRP_SDO;
143
  wire RZQ_IODRP_CS;
144
  wire ZIO_IODRP_SDO;
145
  wire ZIO_IODRP_CS;
146
  wire IODRP_SDO;
147
  wire IODRP_CS;
148
  wire IODRP_BKST;
149
  wire RZQ_ZIO_ODATAIN;
150
  wire RZQ_ZIO_TRISTATE;
151
  wire RZQ_TOUT;
152
  wire ZIO_TOUT;
153
  wire [7:0] Max_Value;
154
  wire ZIO_IN;
155
  wire RZQ_IN;
156
  reg     ZIO_IN_R1, ZIO_IN_R2;
157
  reg     RZQ_IN_R1, RZQ_IN_R2;
158
  assign RZQ_ZIO_ODATAIN  = ~RST;
159
  assign RZQ_ZIO_TRISTATE = ~RST;
160
  assign IODRP_BKST       = 1'b0;  //future hook for possible BKST to ZIO and RZQ
161
 
162
 
163
mcb_soft_calibration #(
164
  .C_MEM_TZQINIT_MAXCNT (C_MEM_TZQINIT_MAXCNT),
165
  .C_MC_CALIBRATION_MODE(C_MC_CALIBRATION_MODE),
166
  .SKIP_IN_TERM_CAL     (SKIP_IN_TERM_CAL),
167
  .SKIP_DYNAMIC_CAL     (SKIP_DYNAMIC_CAL),
168
  .SKIP_DYN_IN_TERM     (SKIP_DYN_IN_TERM),
169
  .C_SIMULATION         (C_SIMULATION),
170
  .C_MEM_TYPE           (C_MEM_TYPE)
171
  )
172
mcb_soft_calibration_inst (
173
  .UI_CLK               (UI_CLK),  // main clock input for logic and IODRP CLK pins.  At top level, this should also connect to IODRP2_MCB CLK pins
174
  .RST                  (RST),             // main system reset for both this Soft Calibration block - also will act as a passthrough to MCB's SYSRST
175
  .PLL_LOCK             (PLL_LOCK), //lock signal from PLL
176
  .SELFREFRESH_REQ      (SELFREFRESH_REQ),
177
  .SELFREFRESH_MCB_MODE  (SELFREFRESH_MCB_MODE),
178
  .SELFREFRESH_MCB_REQ   (SELFREFRESH_MCB_REQ ),
179
  .SELFREFRESH_MODE     (SELFREFRESH_MODE),
180
 
181
  .DONE_SOFTANDHARD_CAL (DONE_SOFTANDHARD_CAL),// active high flag signals soft calibration of input delays is complete and MCB_UODONECAL is high (MCB hard calib complete)        .IODRP_ADD(IODRP_ADD),       // RZQ and ZIO IODRP ADD port, and MCB's UIADD port
182
  .IODRP_ADD            (IODRP_ADD),       // RZQ and ZIO IODRP ADD port
183
  .IODRP_SDI            (IODRP_SDI),       // RZQ and ZIO IODRP SDI port, and MCB's UISDI port
184
  .RZQ_IN               (RZQ_IN_R2),         // RZQ pin from board - expected to have a 2*R resistor to ground
185
  .RZQ_IODRP_SDO        (RZQ_IODRP_SDO),   // RZQ IODRP's SDO port
186
  .RZQ_IODRP_CS         (RZQ_IODRP_CS),   // RZQ IODRP's CS port
187
  .ZIO_IN               (ZIO_IN_R2),         // Z-stated IO pin - garanteed not to be driven externally
188
  .ZIO_IODRP_SDO        (ZIO_IODRP_SDO),   // ZIO IODRP's SDO port
189
  .ZIO_IODRP_CS         (ZIO_IODRP_CS),   // ZIO IODRP's CS port
190
  .MCB_UIADD            (MCB_UIADD),      // to MCB's UIADD port
191
  .MCB_UISDI            (MCB_UISDI),      // to MCB's UISDI port
192
  .MCB_UOSDO            (MCB_UOSDO),      // from MCB's UOSDO port (User output SDO)
193
  .MCB_UODONECAL        (MCB_UODONECAL), // indicates when MCB hard calibration process is complete
194
  .MCB_UOREFRSHFLAG     (MCB_UOREFRSHFLAG), //high during refresh cycle and time when MCB is innactive
195
  .MCB_UICS             (MCB_UICS),         // to MCB's UICS port (User Input CS)
196
  .MCB_UIDRPUPDATE      (MCB_UIDRPUPDATE),  // MCB's UIDRPUPDATE port (gets passed to IODRP2_MCB's MEMUPDATE port: this controls shadow latch used during IODRP2_MCB writes).  Currently just trasnparent
197
  .MCB_UIBROADCAST      (MCB_UIBROADCAST),  // to MCB's UIBROADCAST port (User Input BROADCAST - gets passed to IODRP2_MCB's BKST port)
198
  .MCB_UIADDR           (MCB_UIADDR),        //to MCB's UIADDR port (gets passed to IODRP2_MCB's AUXADDR port
199
  .MCB_UICMDEN          (MCB_UICMDEN),       //set to take control of UI interface - removes control from internal calib block
200
  .MCB_UIDONECAL        (MCB_UIDONECAL),
201
  .MCB_UIDQLOWERDEC     (MCB_UIDQLOWERDEC),
202
  .MCB_UIDQLOWERINC     (MCB_UIDQLOWERINC),
203
  .MCB_UIDQUPPERDEC     (MCB_UIDQUPPERDEC),
204
  .MCB_UIDQUPPERINC     (MCB_UIDQUPPERINC),
205
  .MCB_UILDQSDEC        (MCB_UILDQSDEC),
206
  .MCB_UILDQSINC        (MCB_UILDQSINC),
207
  .MCB_UIREAD           (MCB_UIREAD),        //enables read w/o writing by turning on a SDO->SDI loopback inside the IODRP2_MCBs (doesn't exist in regular IODRP2).  IODRPCTRLR_R_WB becomes don't-care.
208
  .MCB_UIUDQSDEC        (MCB_UIUDQSDEC),
209
  .MCB_UIUDQSINC        (MCB_UIUDQSINC),
210
  .MCB_RECAL            (MCB_RECAL),         //when high initiates a hard re-calibration sequence
211
  .MCB_UICMD            (MCB_UICMD        ),
212
  .MCB_UICMDIN          (MCB_UICMDIN      ),
213
  .MCB_UIDQCOUNT        (MCB_UIDQCOUNT    ),
214
  .MCB_UODATA           (MCB_UODATA       ),
215
  .MCB_UODATAVALID      (MCB_UODATAVALID  ),
216
  .MCB_UOCMDREADY       (MCB_UOCMDREADY   ),
217
  .MCB_UO_CAL_START     (MCB_UO_CAL_START),
218
  .MCB_SYSRST           (MCB_SYSRST       ), //drives the MCB's SYSRST pin - the main reset for MCB
219
  .Max_Value            (Max_Value        ),  // Maximum Tap Value from calibrated IOI
220
  .CKE_Train            (CKE_Train)
221
);
222
 
223
 
224
 
225
always@(posedge UI_CLK,posedge RST)
226
if (RST)
227
   begin
228
        ZIO_IN_R1 <= 1'b0;
229
        ZIO_IN_R2 <= 1'b0;
230
 
231
        RZQ_IN_R1 <= 1'b0;
232
        RZQ_IN_R2 <= 1'b0;
233
   end
234
else
235
   begin
236
 
237
        ZIO_IN_R1 <= ZIO_IN;
238
        ZIO_IN_R2 <= ZIO_IN_R1;
239
        RZQ_IN_R1 <= RZQ_IN;
240
        RZQ_IN_R2 <= RZQ_IN_R1;
241
   end
242
 
243
IOBUF IOBUF_RZQ (
244
    .O  (RZQ_IN),
245
    .IO (RZQ_Pin),
246
    .I  (RZQ_OUT),
247
    .T  (RZQ_TOUT)
248
    );
249
 
250
IODRP2 IODRP2_RZQ       (
251
      .DATAOUT(),
252
      .DATAOUT2(),
253
      .DOUT(RZQ_OUT),
254
      .SDO(RZQ_IODRP_SDO),
255
      .TOUT(RZQ_TOUT),
256
      .ADD(IODRP_ADD),
257
      .BKST(IODRP_BKST),
258
      .CLK(UI_CLK),
259
      .CS(RZQ_IODRP_CS),
260
      .IDATAIN(RZQ_IN),
261
      .IOCLK0(IOCLK),
262
      .IOCLK1(1'b1),
263
      .ODATAIN(RZQ_ZIO_ODATAIN),
264
      .SDI(IODRP_SDI),
265
      .T(RZQ_ZIO_TRISTATE)
266
      );
267
 
268
 
269
generate
270
if ((C_MEM_TYPE == "DDR" || C_MEM_TYPE == "DDR2" || C_MEM_TYPE == "DDR3") &&
271
     (SKIP_IN_TERM_CAL == 1'b0)
272
     ) begin : gen_zio
273
 
274
IOBUF IOBUF_ZIO (
275
    .O  (ZIO_IN),
276
    .IO (ZIO_Pin),
277
    .I  (ZIO_OUT),
278
    .T  (ZIO_TOUT)
279
    );
280
 
281
 
282
IODRP2 IODRP2_ZIO       (
283
      .DATAOUT(),
284
      .DATAOUT2(),
285
      .DOUT(ZIO_OUT),
286
      .SDO(ZIO_IODRP_SDO),
287
      .TOUT(ZIO_TOUT),
288
      .ADD(IODRP_ADD),
289
      .BKST(IODRP_BKST),
290
      .CLK(UI_CLK),
291
      .CS(ZIO_IODRP_CS),
292
      .IDATAIN(ZIO_IN),
293
      .IOCLK0(IOCLK),
294
      .IOCLK1(1'b1),
295
      .ODATAIN(RZQ_ZIO_ODATAIN),
296
      .SDI(IODRP_SDI),
297
      .T(RZQ_ZIO_TRISTATE)
298
      );
299
 
300
 
301
end
302
endgenerate
303
 
304
 
305
endmodule

powered by: WebSVN 2.1.0

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