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.18/] [memfifo.srcs/] [sources_1/] [ip/] [mig_7series_0/] [mig_7series_0/] [user_design/] [rtl/] [mig_7series_0_mig_sim.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
//*****************************************************************************
2
// (c) Copyright 2009 - 2013 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            : 2.3
53
//  \   \         Application        : MIG
54
//  /   /         Filename           : mig_7series_0_mig.v
55
// /___/   /\     Date Last Modified : $Date: 2011/06/02 08:35:03 $
56
// \   \  /  \    Date Created       : Tue Sept 21 2010
57
//  \___\/\___\
58
//
59
// Device           : 7 Series
60
// Design Name      : DDR3 SDRAM
61
// Purpose          :
62
//   Top-level  module. This module can be instantiated in the
63
//   system and interconnect as shown in user design wrapper file (user top module).
64
//   In addition to the memory controller, the module instantiates:
65
//     1. Clock generation/distribution, reset logic
66
//     2. IDELAY control block
67
//     3. Debug logic
68
// Reference        :
69
// Revision History :
70
//*****************************************************************************
71
 
72
`timescale 1ps/1ps
73
 
74
module mig_7series_0_mig #
75
  (
76
 
77
   //***************************************************************************
78
   // The following parameters refer to width of various ports
79
   //***************************************************************************
80
   parameter BANK_WIDTH            = 3,
81
                                     // # of memory Bank Address bits.
82
   parameter CK_WIDTH              = 1,
83
                                     // # of CK/CK# outputs to memory.
84
   parameter COL_WIDTH             = 10,
85
                                     // # of memory Column Address bits.
86
   parameter CS_WIDTH              = 1,
87
                                     // # of unique CS outputs to memory.
88
   parameter nCS_PER_RANK          = 1,
89
                                     // # of unique CS outputs per rank for phy
90
   parameter CKE_WIDTH             = 1,
91
                                     // # of CKE outputs to memory.
92
   parameter DATA_BUF_ADDR_WIDTH   = 5,
93
   parameter DQ_CNT_WIDTH          = 4,
94
                                     // = ceil(log2(DQ_WIDTH))
95
   parameter DQ_PER_DM             = 8,
96
   parameter DM_WIDTH              = 2,
97
                                     // # of DM (data mask)
98
   parameter DQ_WIDTH              = 16,
99
                                     // # of DQ (data)
100
   parameter DQS_WIDTH             = 2,
101
   parameter DQS_CNT_WIDTH         = 1,
102
                                     // = ceil(log2(DQS_WIDTH))
103
   parameter DRAM_WIDTH            = 8,
104
                                     // # of DQ per DQS
105
   parameter ECC                   = "OFF",
106
   parameter DATA_WIDTH            = 16,
107
   parameter ECC_TEST              = "OFF",
108
   parameter PAYLOAD_WIDTH         = (ECC_TEST == "OFF") ? DATA_WIDTH : DQ_WIDTH,
109
   parameter MEM_ADDR_ORDER        = "BANK_ROW_COLUMN",
110
                                      //Possible Parameters
111
                                      //1.BANK_ROW_COLUMN : Address mapping is
112
                                      //                    in form of Bank Row Column.
113
                                      //2.ROW_BANK_COLUMN : Address mapping is
114
                                      //                    in the form of Row Bank Column.
115
                                      //3.TG_TEST : Scrambles Address bits
116
                                      //            for distributed Addressing.
117
 
118
   parameter nBANK_MACHS           = 4,
119
   parameter RANKS                 = 1,
120
                                     // # of Ranks.
121
   parameter ODT_WIDTH             = 1,
122
                                     // # of ODT outputs to memory.
123
   parameter ROW_WIDTH             = 14,
124
                                     // # of memory Row Address bits.
125
   parameter ADDR_WIDTH            = 28,
126
                                     // # = RANK_WIDTH + BANK_WIDTH
127
                                     //     + ROW_WIDTH + COL_WIDTH;
128
                                     // Chip Select is always tied to low for
129
                                     // single rank devices
130
   parameter USE_CS_PORT          = 0,
131
                                     // # = 1, When Chip Select (CS#) output is enabled
132
                                     //   = 0, When Chip Select (CS#) output is disabled
133
                                     // If CS_N disabled, user must connect
134
                                     // DRAM CS_N input(s) to ground
135
   parameter USE_DM_PORT           = 1,
136
                                     // # = 1, When Data Mask option is enabled
137
                                     //   = 0, When Data Mask option is disbaled
138
                                     // When Data Mask option is disabled in
139
                                     // MIG Controller Options page, the logic
140
                                     // related to Data Mask should not get
141
                                     // synthesized
142
   parameter USE_ODT_PORT          = 1,
143
                                     // # = 1, When ODT output is enabled
144
                                     //   = 0, When ODT output is disabled
145
                                     // Parameter configuration for Dynamic ODT support:
146
                                     // USE_ODT_PORT = 0, RTT_NOM = "DISABLED", RTT_WR = "60/120".
147
                                     // This configuration allows to save ODT pin mapping from FPGA.
148
                                     // The user can tie the ODT input of DRAM to HIGH.
149
   parameter IS_CLK_SHARED          = "FALSE",
150
                                      // # = "true" when clock is shared
151
                                      //   = "false" when clock is not shared
152
 
153
   parameter PHY_CONTROL_MASTER_BANK = 0,
154
                                     // The bank index where master PHY_CONTROL resides,
155
                                     // equal to the PLL residing bank
156
   parameter MEM_DENSITY           = "2Gb",
157
                                     // Indicates the density of the Memory part
158
                                     // Added for the sake of Vivado simulations
159
   parameter MEM_SPEEDGRADE        = "125",
160
                                     // Indicates the Speed grade of Memory Part
161
                                     // Added for the sake of Vivado simulations
162
   parameter MEM_DEVICE_WIDTH      = 16,
163
                                     // Indicates the device width of the Memory Part
164
                                     // Added for the sake of Vivado simulations
165
 
166
   //***************************************************************************
167
   // The following parameters are mode register settings
168
   //***************************************************************************
169
   parameter AL                    = "0",
170
                                     // DDR3 SDRAM:
171
                                     // Additive Latency (Mode Register 1).
172
                                     // # = "0", "CL-1", "CL-2".
173
                                     // DDR2 SDRAM:
174
                                     // Additive Latency (Extended Mode Register).
175
   parameter nAL                   = 0,
176
                                     // # Additive Latency in number of clock
177
                                     // cycles.
178
   parameter BURST_MODE            = "8",
179
                                     // DDR3 SDRAM:
180
                                     // Burst Length (Mode Register 0).
181
                                     // # = "8", "4", "OTF".
182
                                     // DDR2 SDRAM:
183
                                     // Burst Length (Mode Register).
184
                                     // # = "8", "4".
185
   parameter BURST_TYPE            = "SEQ",
186
                                     // DDR3 SDRAM: Burst Type (Mode Register 0).
187
                                     // DDR2 SDRAM: Burst Type (Mode Register).
188
                                     // # = "SEQ" - (Sequential),
189
                                     //   = "INT" - (Interleaved).
190
   parameter CL                    = 6,
191
                                     // in number of clock cycles
192
                                     // DDR3 SDRAM: CAS Latency (Mode Register 0).
193
                                     // DDR2 SDRAM: CAS Latency (Mode Register).
194
   parameter CWL                   = 5,
195
                                     // in number of clock cycles
196
                                     // DDR3 SDRAM: CAS Write Latency (Mode Register 2).
197
                                     // DDR2 SDRAM: Can be ignored
198
   parameter OUTPUT_DRV            = "HIGH",
199
                                     // Output Driver Impedance Control (Mode Register 1).
200
                                     // # = "HIGH" - RZQ/7,
201
                                     //   = "LOW" - RZQ/6.
202
   parameter RTT_NOM               = "40",
203
                                     // RTT_NOM (ODT) (Mode Register 1).
204
                                     //   = "120" - RZQ/2,
205
                                     //   = "60"  - RZQ/4,
206
                                     //   = "40"  - RZQ/6.
207
   parameter RTT_WR                = "OFF",
208
                                     // RTT_WR (ODT) (Mode Register 2).
209
                                     // # = "OFF" - Dynamic ODT off,
210
                                     //   = "120" - RZQ/2,
211
                                     //   = "60"  - RZQ/4,
212
   parameter ADDR_CMD_MODE         = "1T" ,
213
                                     // # = "1T", "2T".
214
   parameter REG_CTRL              = "OFF",
215
                                     // # = "ON" - RDIMMs,
216
                                     //   = "OFF" - Components, SODIMMs, UDIMMs.
217
   parameter CA_MIRROR             = "OFF",
218
                                     // C/A mirror opt for DDR3 dual rank
219
 
220
   parameter VDD_OP_VOLT           = "150",
221
                                     // # = "150" - 1.5V Vdd Memory part
222
                                     //   = "135" - 1.35V Vdd Memory part
223
 
224
 
225
   //***************************************************************************
226
   // The following parameters are multiplier and divisor factors for PLLE2.
227
   // Based on the selected design frequency these parameters vary.
228
   //***************************************************************************
229
   parameter CLKIN_PERIOD          = 2500,
230
                                     // Input Clock Period
231
   parameter CLKFBOUT_MULT         = 2,
232
                                     // write PLL VCO multiplier
233
   parameter DIVCLK_DIVIDE         = 1,
234
                                     // write PLL VCO divisor
235
   parameter CLKOUT0_PHASE         = 337.5,
236
                                     // Phase for PLL output clock (CLKOUT0)
237
   parameter CLKOUT0_DIVIDE        = 2,
238
                                     // VCO output divisor for PLL output clock (CLKOUT0)
239
   parameter CLKOUT1_DIVIDE        = 2,
240
                                     // VCO output divisor for PLL output clock (CLKOUT1)
241
   parameter CLKOUT2_DIVIDE        = 32,
242
                                     // VCO output divisor for PLL output clock (CLKOUT2)
243
   parameter CLKOUT3_DIVIDE        = 8,
244
                                     // VCO output divisor for PLL output clock (CLKOUT3)
245
   parameter MMCM_VCO              = 800,
246
                                     // Max Freq (MHz) of MMCM VCO
247
   parameter MMCM_MULT_F           = 8,
248
                                     // write MMCM VCO multiplier
249
   parameter MMCM_DIVCLK_DIVIDE    = 1,
250
                                     // write MMCM VCO divisor
251
 
252
   //***************************************************************************
253
   // Memory Timing Parameters. These parameters varies based on the selected
254
   // memory part.
255
   //***************************************************************************
256
   parameter tCKE                  = 5000,
257
                                     // memory tCKE paramter in pS
258
   parameter tFAW                  = 40000,
259
                                     // memory tRAW paramter in pS.
260
   parameter tPRDI                 = 1_000_000,
261
                                     // memory tPRDI paramter in pS.
262
   parameter tRAS                  = 35000,
263
                                     // memory tRAS paramter in pS.
264
   parameter tRCD                  = 13750,
265
                                     // memory tRCD paramter in pS.
266
   parameter tREFI                 = 7800000,
267
                                     // memory tREFI paramter in pS.
268
   parameter tRFC                  = 160000,
269
                                     // memory tRFC paramter in pS.
270
   parameter tRP                   = 13750,
271
                                     // memory tRP paramter in pS.
272
   parameter tRRD                  = 7500,
273
                                     // memory tRRD paramter in pS.
274
   parameter tRTP                  = 7500,
275
                                     // memory tRTP paramter in pS.
276
   parameter tWTR                  = 7500,
277
                                     // memory tWTR paramter in pS.
278
   parameter tZQI                  = 128_000_000,
279
                                     // memory tZQI paramter in nS.
280
   parameter tZQCS                 = 64,
281
                                     // memory tZQCS paramter in clock cycles.
282
 
283
   //***************************************************************************
284
   // Simulation parameters
285
   //***************************************************************************
286
   parameter SIM_BYPASS_INIT_CAL   = "FAST",
287
                                     // # = "OFF" -  Complete memory init &
288
                                     //              calibration sequence
289
                                     // # = "SKIP" - Not supported
290
                                     // # = "FAST" - Complete memory init & use
291
                                     //              abbreviated calib sequence
292
 
293
   parameter SIMULATION            = "TRUE",
294
                                     // Should be TRUE during design simulations and
295
                                     // FALSE during implementations
296
 
297
   //***************************************************************************
298
   // The following parameters varies based on the pin out entered in MIG GUI.
299
   // Do not change any of these parameters directly by editing the RTL.
300
   // Any changes required should be done through GUI and the design regenerated.
301
   //***************************************************************************
302
   parameter BYTE_LANES_B0         = 4'b1111,
303
                                     // Byte lanes used in an IO column.
304
   parameter BYTE_LANES_B1         = 4'b0000,
305
                                     // Byte lanes used in an IO column.
306
   parameter BYTE_LANES_B2         = 4'b0000,
307
                                     // Byte lanes used in an IO column.
308
   parameter BYTE_LANES_B3         = 4'b0000,
309
                                     // Byte lanes used in an IO column.
310
   parameter BYTE_LANES_B4         = 4'b0000,
311
                                     // Byte lanes used in an IO column.
312
   parameter DATA_CTL_B0           = 4'b0011,
313
                                     // Indicates Byte lane is data byte lane
314
                                     // or control Byte lane. '1' in a bit
315
                                     // position indicates a data byte lane and
316
                                     // a '0' indicates a control byte lane
317
   parameter DATA_CTL_B1           = 4'b0000,
318
                                     // Indicates Byte lane is data byte lane
319
                                     // or control Byte lane. '1' in a bit
320
                                     // position indicates a data byte lane and
321
                                     // a '0' indicates a control byte lane
322
   parameter DATA_CTL_B2           = 4'b0000,
323
                                     // Indicates Byte lane is data byte lane
324
                                     // or control Byte lane. '1' in a bit
325
                                     // position indicates a data byte lane and
326
                                     // a '0' indicates a control byte lane
327
   parameter DATA_CTL_B3           = 4'b0000,
328
                                     // Indicates Byte lane is data byte lane
329
                                     // or control Byte lane. '1' in a bit
330
                                     // position indicates a data byte lane and
331
                                     // a '0' indicates a control byte lane
332
   parameter DATA_CTL_B4           = 4'b0000,
333
                                     // Indicates Byte lane is data byte lane
334
                                     // or control Byte lane. '1' in a bit
335
                                     // position indicates a data byte lane and
336
                                     // a '0' indicates a control byte lane
337
   parameter PHY_0_BITLANES        = 48'hFFF_FFC_3FE_2FF,
338
   parameter PHY_1_BITLANES        = 48'h000_000_000_000,
339
   parameter PHY_2_BITLANES        = 48'h000_000_000_000,
340
 
341
   // control/address/data pin mapping parameters
342
   parameter CK_BYTE_MAP
343
     = 144'h00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_02,
344
   parameter ADDR_MAP
345
     = 192'h000_000_027_031_035_032_026_039_025_038_024_037_02B_03B_034_03A,
346
   parameter BANK_MAP   = 36'h029_033_02A,
347
   parameter CAS_MAP    = 12'h023,
348
   parameter CKE_ODT_BYTE_MAP = 8'h00,
349
   parameter CKE_MAP    = 96'h000_000_000_000_000_000_000_036,
350
   parameter ODT_MAP    = 96'h000_000_000_000_000_000_000_030,
351
   parameter CS_MAP     = 120'h000_000_000_000_000_000_000_000_000_000,
352
   parameter PARITY_MAP = 12'h000,
353
   parameter RAS_MAP    = 12'h022,
354
   parameter WE_MAP     = 12'h028,
355
   parameter DQS_BYTE_MAP
356
     = 144'h00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_01,
357
   parameter DATA0_MAP  = 96'h019_012_017_013_011_014_018_015,
358
   parameter DATA1_MAP  = 96'h004_000_007_005_006_001_002_003,
359
   parameter DATA2_MAP  = 96'h000_000_000_000_000_000_000_000,
360
   parameter DATA3_MAP  = 96'h000_000_000_000_000_000_000_000,
361
   parameter DATA4_MAP  = 96'h000_000_000_000_000_000_000_000,
362
   parameter DATA5_MAP  = 96'h000_000_000_000_000_000_000_000,
363
   parameter DATA6_MAP  = 96'h000_000_000_000_000_000_000_000,
364
   parameter DATA7_MAP  = 96'h000_000_000_000_000_000_000_000,
365
   parameter DATA8_MAP  = 96'h000_000_000_000_000_000_000_000,
366
   parameter DATA9_MAP  = 96'h000_000_000_000_000_000_000_000,
367
   parameter DATA10_MAP = 96'h000_000_000_000_000_000_000_000,
368
   parameter DATA11_MAP = 96'h000_000_000_000_000_000_000_000,
369
   parameter DATA12_MAP = 96'h000_000_000_000_000_000_000_000,
370
   parameter DATA13_MAP = 96'h000_000_000_000_000_000_000_000,
371
   parameter DATA14_MAP = 96'h000_000_000_000_000_000_000_000,
372
   parameter DATA15_MAP = 96'h000_000_000_000_000_000_000_000,
373
   parameter DATA16_MAP = 96'h000_000_000_000_000_000_000_000,
374
   parameter DATA17_MAP = 96'h000_000_000_000_000_000_000_000,
375
   parameter MASK0_MAP  = 108'h000_000_000_000_000_000_000_009_016,
376
   parameter MASK1_MAP  = 108'h000_000_000_000_000_000_000_000_000,
377
 
378
   parameter SLOT_0_CONFIG         = 8'b0000_0001,
379
                                     // Mapping of Ranks.
380
   parameter SLOT_1_CONFIG         = 8'b0000_0000,
381
                                     // Mapping of Ranks.
382
 
383
   //***************************************************************************
384
   // IODELAY and PHY related parameters
385
   //***************************************************************************
386
   parameter IBUF_LPWR_MODE        = "OFF",
387
                                     // to phy_top
388
   parameter DATA_IO_IDLE_PWRDWN   = "ON",
389
                                     // # = "ON", "OFF"
390
   parameter BANK_TYPE             = "HR_IO",
391
                                     // # = "HP_IO", "HPL_IO", "HR_IO", "HRL_IO"
392
   parameter DATA_IO_PRIM_TYPE     = "HR_LP",
393
                                     // # = "HP_LP", "HR_LP", "DEFAULT"
394
   parameter CKE_ODT_AUX           = "FALSE",
395
   parameter USER_REFRESH          = "OFF",
396
   parameter WRLVL                 = "ON",
397
                                     // # = "ON" - DDR3 SDRAM
398
                                     //   = "OFF" - DDR2 SDRAM.
399
   parameter ORDERING              = "NORM",
400
                                     // # = "NORM", "STRICT", "RELAXED".
401
   parameter CALIB_ROW_ADD         = 16'h0000,
402
                                     // Calibration row address will be used for
403
                                     // calibration read and write operations
404
   parameter CALIB_COL_ADD         = 12'h000,
405
                                     // Calibration column address will be used for
406
                                     // calibration read and write operations
407
   parameter CALIB_BA_ADD          = 3'h0,
408
                                     // Calibration bank address will be used for
409
                                     // calibration read and write operations
410
   parameter TCQ                   = 100,
411
   parameter IDELAY_ADJ            = "OFF",
412
   parameter FINE_PER_BIT          = "OFF",
413
   parameter CENTER_COMP_MODE      = "OFF",
414
   parameter PI_VAL_ADJ            = "OFF",
415
   parameter IODELAY_GRP0          = "MIG_7SERIES_0_IODELAY_MIG0",
416
                                     // It is associated to a set of IODELAYs with
417
                                     // an IDELAYCTRL that have same IODELAY CONTROLLER
418
                                     // clock frequency (200MHz).
419
   parameter IODELAY_GRP1          = "MIG_7SERIES_0_IODELAY_MIG1",
420
                                     // It is associated to a set of IODELAYs with
421
                                     // an IDELAYCTRL that have same IODELAY CONTROLLER
422
                                     // clock frequency (300MHz/400MHz).
423
   parameter SYSCLK_TYPE           = "NO_BUFFER",
424
                                     // System clock type DIFFERENTIAL, SINGLE_ENDED,
425
                                     // NO_BUFFER
426
   parameter REFCLK_TYPE           = "NO_BUFFER",
427
                                     // Reference clock type DIFFERENTIAL, SINGLE_ENDED,
428
                                     // NO_BUFFER, USE_SYSTEM_CLOCK
429
   parameter SYS_RST_PORT          = "FALSE",
430
                                     // "TRUE" - if pin is selected for sys_rst
431
                                     //          and IBUF will be instantiated.
432
                                     // "FALSE" - if pin is not selected for sys_rst
433
   parameter FPGA_SPEED_GRADE      = 2,
434
                                     // FPGA speed grade
435
 
436
   parameter CMD_PIPE_PLUS1        = "ON",
437
                                     // add pipeline stage between MC and PHY
438
   parameter DRAM_TYPE             = "DDR3",
439
   parameter CAL_WIDTH             = "HALF",
440
   parameter STARVE_LIMIT          = 2,
441
                                     // # = 2,3,4.
442
   parameter REF_CLK_MMCM_IODELAY_CTRL    = "FALSE",
443
 
444
   //***************************************************************************
445
   // Referece clock frequency parameters
446
   //***************************************************************************
447
   parameter REFCLK_FREQ           = 200.0,
448
                                     // IODELAYCTRL reference clock frequency
449
   parameter DIFF_TERM_REFCLK      = "TRUE",
450
                                     // Differential Termination for idelay
451
                                     // reference clock input pins
452
   //***************************************************************************
453
   // System clock frequency parameters
454
   //***************************************************************************
455
   parameter tCK                   = 2500,
456
                                     // memory tCK paramter.
457
                                     // # = Clock Period in pS.
458
   parameter nCK_PER_CLK           = 4,
459
                                     // # of memory CKs per fabric CLK
460
   parameter DIFF_TERM_SYSCLK      = "TRUE",
461
                                     // Differential Termination for System
462
                                     // clock input pins
463
 
464
 
465
 
466
   //***************************************************************************
467
   // Debug parameters
468
   //***************************************************************************
469
   parameter DEBUG_PORT            = "OFF",
470
                                     // # = "ON" Enable debug signals/controls.
471
                                     //   = "OFF" Disable debug signals/controls.
472
 
473
   //***************************************************************************
474
   // Temparature monitor parameter
475
   //***************************************************************************
476
   parameter TEMP_MON_CONTROL      = "EXTERNAL",
477
                                     // # = "INTERNAL", "EXTERNAL"
478
 
479
   parameter RST_ACT_LOW           = 1
480
                                     // =1 for active low reset,
481
                                     // =0 for active high.
482
   )
483
  (
484
 
485
   // Inouts
486
   inout [DQ_WIDTH-1:0]                         ddr3_dq,
487
   inout [DQS_WIDTH-1:0]                        ddr3_dqs_n,
488
   inout [DQS_WIDTH-1:0]                        ddr3_dqs_p,
489
 
490
   // Outputs
491
   output [ROW_WIDTH-1:0]                       ddr3_addr,
492
   output [BANK_WIDTH-1:0]                      ddr3_ba,
493
   output                                       ddr3_ras_n,
494
   output                                       ddr3_cas_n,
495
   output                                       ddr3_we_n,
496
   output                                       ddr3_reset_n,
497
   output [CK_WIDTH-1:0]                        ddr3_ck_p,
498
   output [CK_WIDTH-1:0]                        ddr3_ck_n,
499
   output [CKE_WIDTH-1:0]                       ddr3_cke,
500
   output [DM_WIDTH-1:0]                        ddr3_dm,
501
   output [ODT_WIDTH-1:0]                       ddr3_odt,
502
 
503
   // Inputs
504
   // Single-ended system clock
505
   input                                        sys_clk_i,
506
   // Single-ended iodelayctrl clk (reference clock)
507
   input                                        clk_ref_i,
508
   // user interface signals
509
   input [ADDR_WIDTH-1:0]                       app_addr,
510
   input [2:0]                                  app_cmd,
511
   input                                        app_en,
512
   input [(nCK_PER_CLK*2*PAYLOAD_WIDTH)-1:0]    app_wdf_data,
513
   input                                        app_wdf_end,
514
   input [((nCK_PER_CLK*2*PAYLOAD_WIDTH)/8)-1:0]  app_wdf_mask,
515
   input                                        app_wdf_wren,
516
   output [(nCK_PER_CLK*2*PAYLOAD_WIDTH)-1:0]   app_rd_data,
517
   output                                       app_rd_data_end,
518
   output                                       app_rd_data_valid,
519
   output                                       app_rdy,
520
   output                                       app_wdf_rdy,
521
   input                                        app_sr_req,
522
   input                                        app_ref_req,
523
   input                                        app_zq_req,
524
   output                                       app_sr_active,
525
   output                                       app_ref_ack,
526
   output                                       app_zq_ack,
527
   output                                       ui_clk,
528
   output                                       ui_clk_sync_rst,
529
   output                                       init_calib_complete,
530
   input  [11:0]                                device_temp_i,
531
                      // The 12 MSB bits of the temperature sensor transfer
532
                      // function need to be connected to this port. This port
533
                      // will be synchronized w.r.t. to fabric clock internally.
534
 
535
 
536
   // System reset - Default polarity of sys_rst pin is Active Low.
537
   // System reset polarity will change based on the option 
538
   // selected in GUI.
539
   input                                        sys_rst
540
   );
541
 
542
  function integer clogb2 (input integer size);
543
    begin
544
      size = size - 1;
545
      for (clogb2=1; size>1; clogb2=clogb2+1)
546
        size = size >> 1;
547
    end
548
  endfunction // clogb2
549
 
550
 
551
  localparam BM_CNT_WIDTH = clogb2(nBANK_MACHS);
552
  localparam RANK_WIDTH = clogb2(RANKS);
553
 
554
  localparam ECC_WIDTH = (ECC == "OFF")?
555
 
556
                            4 : (DATA_WIDTH <= 10)?
557
                             5 : (DATA_WIDTH <= 26)?
558
                              6 : (DATA_WIDTH <= 57)?
559
                               7 : (DATA_WIDTH <= 120)?
560
                                8 : (DATA_WIDTH <= 247)?
561
                                 9 : 10;
562
  localparam DATA_BUF_OFFSET_WIDTH = 1;
563
  localparam MC_ERR_ADDR_WIDTH = ((CS_WIDTH == 1) ? 0 : RANK_WIDTH)
564
                                 + BANK_WIDTH + ROW_WIDTH + COL_WIDTH
565
                                 + DATA_BUF_OFFSET_WIDTH;
566
 
567
  localparam APP_DATA_WIDTH        = 2 * nCK_PER_CLK * PAYLOAD_WIDTH;
568
  localparam APP_MASK_WIDTH        = APP_DATA_WIDTH / 8;
569
  localparam TEMP_MON_EN           = (SIMULATION == "TRUE") ? "ON" : "OFF";
570
                                                 // Enable or disable the temp monitor module
571
  localparam tTEMPSAMPLE           = 10000000;   // sample every 10 us
572
  localparam XADC_CLK_PERIOD       = 5000;       // Use 200 MHz IODELAYCTRL clock
573
 
574
 
575
  localparam TAPSPERKCLK = (56*MMCM_MULT_F)/nCK_PER_CLK;
576
 
577
  // Wire declarations
578
 
579
  wire [BM_CNT_WIDTH-1:0]           bank_mach_next;
580
  wire                              clk;
581
  wire [1:0]                        clk_ref;
582
  wire [1:0]                        iodelay_ctrl_rdy;
583
  wire                              clk_ref_in;
584
  wire                              sys_rst_o;
585
  wire                              freq_refclk ;
586
  wire                              mem_refclk ;
587
  wire                              pll_lock ;
588
  wire                              sync_pulse;
589
  wire                              mmcm_ps_clk;
590
  wire                              poc_sample_pd;
591
  wire                              psen;
592
  wire                              psincdec;
593
  wire                              psdone;
594
  wire                              iddr_rst;
595
  wire                              ref_dll_lock;
596
  wire                              rst_phaser_ref;
597
  wire                              pll_locked;
598
 
599
  wire                              rst;
600
 
601
  wire [(2*nCK_PER_CLK)-1:0]            app_ecc_multiple_err;
602
  wire                                ddr3_parity;
603
 
604
 
605
  wire                              sys_clk_p;
606
  wire                              sys_clk_n;
607
  wire                              mmcm_clk;
608
  wire                              clk_ref_p;
609
  wire                              clk_ref_n;
610
  wire [11:0]                       device_temp;
611
 
612
  // Debug port signals
613
  wire                              dbg_idel_down_all;
614
  wire                              dbg_idel_down_cpt;
615
  wire                              dbg_idel_up_all;
616
  wire                              dbg_idel_up_cpt;
617
  wire                              dbg_sel_all_idel_cpt;
618
  wire [DQS_CNT_WIDTH-1:0]          dbg_sel_idel_cpt;
619
  wire                              dbg_sel_pi_incdec;
620
  wire [DQS_CNT_WIDTH:0]            dbg_byte_sel;
621
  wire                              dbg_pi_f_inc;
622
  wire                              dbg_pi_f_dec;
623
  wire [5:0]                        dbg_pi_counter_read_val;
624
  wire [8:0]                        dbg_po_counter_read_val;
625
 
626
  wire [(6*DQS_WIDTH*RANKS)-1:0]      dbg_cpt_tap_cnt;
627
  wire [(5*DQS_WIDTH*RANKS)-1:0]      dbg_dq_idelay_tap_cnt;
628
  wire [255:0]                      dbg_calib_top;
629
  wire [(6*DQS_WIDTH*RANKS)-1:0]      dbg_cpt_first_edge_cnt;
630
  wire [(6*DQS_WIDTH*RANKS)-1:0]      dbg_cpt_second_edge_cnt;
631
  wire [(6*RANKS)-1:0]                dbg_rd_data_offset;
632
  wire [255:0]                      dbg_phy_rdlvl;
633
  wire [99:0]                       dbg_phy_wrcal;
634
  wire [(6*DQS_WIDTH)-1:0]            dbg_final_po_fine_tap_cnt;
635
  wire [(3*DQS_WIDTH)-1:0]            dbg_final_po_coarse_tap_cnt;
636
  wire [255:0]                      dbg_phy_wrlvl;
637
  wire [255:0]                      dbg_phy_init;
638
  wire [255:0]                      dbg_prbs_rdlvl;
639
  wire [255:0]                      dbg_dqs_found_cal;
640
  wire                              dbg_pi_phaselock_start;
641
  wire                              dbg_pi_phaselocked_done;
642
  wire                              dbg_pi_phaselock_err;
643
  wire                              dbg_pi_dqsfound_start;
644
  wire                              dbg_pi_dqsfound_done;
645
  wire                              dbg_pi_dqsfound_err;
646
  wire                              dbg_wrcal_start;
647
  wire                              dbg_wrcal_done;
648
  wire                              dbg_wrcal_err;
649
  wire [11:0]                       dbg_pi_dqs_found_lanes_phy4lanes;
650
  wire [11:0]                       dbg_pi_phase_locked_phy4lanes;
651
  wire                              dbg_oclkdelay_calib_start;
652
  wire                              dbg_oclkdelay_calib_done;
653
  wire [255:0]                      dbg_phy_oclkdelay_cal;
654
  wire [(DRAM_WIDTH*16)-1:0]         dbg_oclkdelay_rd_data;
655
  wire [DQS_WIDTH-1:0]              dbg_rd_data_edge_detect;
656
  wire [(2*nCK_PER_CLK*DQ_WIDTH)-1:0] dbg_rddata;
657
  wire                              dbg_rddata_valid;
658
  wire [1:0]                        dbg_rdlvl_done;
659
  wire [1:0]                        dbg_rdlvl_err;
660
  wire [1:0]                        dbg_rdlvl_start;
661
  wire [(6*DQS_WIDTH)-1:0]            dbg_wrlvl_fine_tap_cnt;
662
  wire [(3*DQS_WIDTH)-1:0]            dbg_wrlvl_coarse_tap_cnt;
663
  wire [5:0]                        dbg_tap_cnt_during_wrlvl;
664
  wire                              dbg_wl_edge_detect_valid;
665
  wire                              dbg_wrlvl_done;
666
  wire                              dbg_wrlvl_err;
667
  wire                              dbg_wrlvl_start;
668
  reg [63:0]                        dbg_rddata_r;
669
  reg                               dbg_rddata_valid_r;
670
  wire [53:0]                       ocal_tap_cnt;
671
  wire [4:0]                        dbg_dqs;
672
  wire [8:0]                        dbg_bit;
673
  wire [8:0]                        rd_data_edge_detect_r;
674
  wire [53:0]                       wl_po_fine_cnt;
675
  wire [26:0]                       wl_po_coarse_cnt;
676
  wire [(6*RANKS)-1:0]                dbg_calib_rd_data_offset_1;
677
  wire [(6*RANKS)-1:0]                dbg_calib_rd_data_offset_2;
678
  wire [5:0]                        dbg_data_offset;
679
  wire [5:0]                        dbg_data_offset_1;
680
  wire [5:0]                        dbg_data_offset_2;
681
 
682
  wire [390:0]                      ddr3_ila_wrpath_int;
683
  wire [1023:0]                     ddr3_ila_rdpath_int;
684
  wire [119:0]                      ddr3_ila_basic_int;
685
  wire [(6*DQS_WIDTH*RANKS)-1:0] dbg_prbs_final_dqs_tap_cnt_r_int;
686
  wire [(6*DQS_WIDTH*RANKS)-1:0] dbg_prbs_first_edge_taps_int;
687
  wire [(6*DQS_WIDTH*RANKS)-1:0] dbg_prbs_second_edge_taps_int;
688
 
689
 
690
//***************************************************************************
691
 
692
 
693
 
694
  assign ui_clk = clk;
695
  assign ui_clk_sync_rst = rst;
696
 
697
  assign sys_clk_p = 1'b0;
698
  assign sys_clk_n = 1'b0;
699
  assign clk_ref_p = 1'b0;
700
  assign clk_ref_n = 1'b0;
701
 
702
 
703
  generate
704
    if (REFCLK_TYPE == "USE_SYSTEM_CLOCK")
705
      assign clk_ref_in = mmcm_clk;
706
    else
707
      assign clk_ref_in = clk_ref_i;
708
  endgenerate
709
 
710
  mig_7series_v2_3_iodelay_ctrl #
711
    (
712
     .TCQ                       (TCQ),
713
     .IODELAY_GRP0              (IODELAY_GRP0),
714
     .IODELAY_GRP1              (IODELAY_GRP1),
715
     .REFCLK_TYPE               (REFCLK_TYPE),
716
     .SYSCLK_TYPE               (SYSCLK_TYPE),
717
     .SYS_RST_PORT              (SYS_RST_PORT),
718
     .RST_ACT_LOW               (RST_ACT_LOW),
719
     .DIFF_TERM_REFCLK          (DIFF_TERM_REFCLK),
720
     .FPGA_SPEED_GRADE          (FPGA_SPEED_GRADE),
721
     .REF_CLK_MMCM_IODELAY_CTRL (REF_CLK_MMCM_IODELAY_CTRL)
722
     )
723
    u_iodelay_ctrl
724
      (
725
       // Outputs
726
       .iodelay_ctrl_rdy (iodelay_ctrl_rdy),
727
       .sys_rst_o        (sys_rst_o),
728
       .clk_ref          (clk_ref),
729
       // Inputs
730
       .clk_ref_p        (clk_ref_p),
731
       .clk_ref_n        (clk_ref_n),
732
       .clk_ref_i        (clk_ref_in),
733
       .sys_rst          (sys_rst)
734
       );
735
  mig_7series_v2_3_clk_ibuf #
736
    (
737
     .SYSCLK_TYPE      (SYSCLK_TYPE),
738
     .DIFF_TERM_SYSCLK (DIFF_TERM_SYSCLK)
739
     )
740
    u_ddr3_clk_ibuf
741
      (
742
       .sys_clk_p        (sys_clk_p),
743
       .sys_clk_n        (sys_clk_n),
744
       .sys_clk_i        (sys_clk_i),
745
       .mmcm_clk         (mmcm_clk)
746
       );
747
  // Temperature monitoring logic
748
 
749
  generate
750
    if (TEMP_MON_EN == "ON") begin: temp_mon_enabled
751
 
752
      mig_7series_v2_3_tempmon #
753
        (
754
         .TCQ              (TCQ),
755
         .TEMP_MON_CONTROL (TEMP_MON_CONTROL),
756
         .XADC_CLK_PERIOD  (XADC_CLK_PERIOD),
757
         .tTEMPSAMPLE      (tTEMPSAMPLE)
758
         )
759
        u_tempmon
760
          (
761
           .clk            (clk),
762
           .xadc_clk       (clk_ref[0]),
763
           .rst            (rst),
764
           .device_temp_i  (device_temp_i),
765
           .device_temp    (device_temp)
766
          );
767
    end else begin: temp_mon_disabled
768
 
769
      assign device_temp = 'b0;
770
 
771
    end
772
  endgenerate
773
 
774
  mig_7series_v2_3_infrastructure #
775
    (
776
     .TCQ                (TCQ),
777
     .nCK_PER_CLK        (nCK_PER_CLK),
778
     .CLKIN_PERIOD       (CLKIN_PERIOD),
779
     .SYSCLK_TYPE        (SYSCLK_TYPE),
780
     .CLKFBOUT_MULT      (CLKFBOUT_MULT),
781
     .DIVCLK_DIVIDE      (DIVCLK_DIVIDE),
782
     .CLKOUT0_PHASE      (CLKOUT0_PHASE),
783
     .CLKOUT0_DIVIDE     (CLKOUT0_DIVIDE),
784
     .CLKOUT1_DIVIDE     (CLKOUT1_DIVIDE),
785
     .CLKOUT2_DIVIDE     (CLKOUT2_DIVIDE),
786
     .CLKOUT3_DIVIDE     (CLKOUT3_DIVIDE),
787
     .MMCM_VCO           (MMCM_VCO),
788
     .MMCM_MULT_F        (MMCM_MULT_F),
789
     .MMCM_DIVCLK_DIVIDE (MMCM_DIVCLK_DIVIDE),
790
     .RST_ACT_LOW        (RST_ACT_LOW),
791
     .tCK                (tCK),
792
     .MEM_TYPE           (DRAM_TYPE)
793
     )
794
    u_ddr3_infrastructure
795
      (
796
       // Outputs
797
       .rstdiv0          (rst),
798
       .clk              (clk),
799
       .mem_refclk       (mem_refclk),
800
       .freq_refclk      (freq_refclk),
801
       .sync_pulse       (sync_pulse),
802
       .mmcm_ps_clk      (mmcm_ps_clk),
803
       .poc_sample_pd    (poc_sample_pd),
804
       .psdone           (psdone),
805
       .iddr_rst         (iddr_rst),
806
       .auxout_clk       (),
807
       .ui_addn_clk_0    (),
808
       .ui_addn_clk_1    (),
809
       .ui_addn_clk_2    (),
810
       .ui_addn_clk_3    (),
811
       .ui_addn_clk_4    (),
812
       .pll_locked       (pll_locked),
813
       .mmcm_locked      (),
814
       .rst_phaser_ref   (rst_phaser_ref),
815
       // Inputs
816
       .psen             (psen),
817
       .psincdec         (psincdec),
818
       .mmcm_clk         (mmcm_clk),
819
       .sys_rst          (sys_rst_o),
820
       .iodelay_ctrl_rdy (iodelay_ctrl_rdy),
821
       .ref_dll_lock     (ref_dll_lock)
822
       );
823
 
824
 
825
  mig_7series_v2_3_memc_ui_top_std #
826
    (
827
     .TCQ                              (TCQ),
828
     .ADDR_CMD_MODE                    (ADDR_CMD_MODE),
829
     .AL                               (AL),
830
     .PAYLOAD_WIDTH                    (PAYLOAD_WIDTH),
831
     .BANK_WIDTH                       (BANK_WIDTH),
832
     .BM_CNT_WIDTH                     (BM_CNT_WIDTH),
833
     .BURST_MODE                       (BURST_MODE),
834
     .BURST_TYPE                       (BURST_TYPE),
835
     .CA_MIRROR                        (CA_MIRROR),
836
     .DDR3_VDD_OP_VOLT                 (VDD_OP_VOLT),
837
     .CK_WIDTH                         (CK_WIDTH),
838
     .COL_WIDTH                        (COL_WIDTH),
839
     .CMD_PIPE_PLUS1                   (CMD_PIPE_PLUS1),
840
     .CS_WIDTH                         (CS_WIDTH),
841
     .nCS_PER_RANK                     (nCS_PER_RANK),
842
     .CKE_WIDTH                        (CKE_WIDTH),
843
     .DATA_WIDTH                       (DATA_WIDTH),
844
     .DATA_BUF_ADDR_WIDTH              (DATA_BUF_ADDR_WIDTH),
845
     .DM_WIDTH                         (DM_WIDTH),
846
     .DQ_CNT_WIDTH                     (DQ_CNT_WIDTH),
847
     .DQ_WIDTH                         (DQ_WIDTH),
848
     .DQS_CNT_WIDTH                    (DQS_CNT_WIDTH),
849
     .DQS_WIDTH                        (DQS_WIDTH),
850
     .DRAM_TYPE                        (DRAM_TYPE),
851
     .DRAM_WIDTH                       (DRAM_WIDTH),
852
     .ECC                              (ECC),
853
     .ECC_WIDTH                        (ECC_WIDTH),
854
     .ECC_TEST                         (ECC_TEST),
855
     .MC_ERR_ADDR_WIDTH                (MC_ERR_ADDR_WIDTH),
856
     .REFCLK_FREQ                      (REFCLK_FREQ),
857
     .nAL                              (nAL),
858
     .nBANK_MACHS                      (nBANK_MACHS),
859
     .CKE_ODT_AUX                      (CKE_ODT_AUX),
860
     .nCK_PER_CLK                      (nCK_PER_CLK),
861
     .ORDERING                         (ORDERING),
862
     .OUTPUT_DRV                       (OUTPUT_DRV),
863
     .IBUF_LPWR_MODE                   (IBUF_LPWR_MODE),
864
     .DATA_IO_IDLE_PWRDWN              (DATA_IO_IDLE_PWRDWN),
865
     .BANK_TYPE                        (BANK_TYPE),
866
     .DATA_IO_PRIM_TYPE                (DATA_IO_PRIM_TYPE),
867
     .IODELAY_GRP0                     (IODELAY_GRP0),
868
     .IODELAY_GRP1                     (IODELAY_GRP1),
869
     .FPGA_SPEED_GRADE                 (FPGA_SPEED_GRADE),
870
     .REG_CTRL                         (REG_CTRL),
871
     .RTT_NOM                          (RTT_NOM),
872
     .RTT_WR                           (RTT_WR),
873
     .CL                               (CL),
874
     .CWL                              (CWL),
875
     .tCK                              (tCK),
876
     .tCKE                             (tCKE),
877
     .tFAW                             (tFAW),
878
     .tPRDI                            (tPRDI),
879
     .tRAS                             (tRAS),
880
     .tRCD                             (tRCD),
881
     .tREFI                            (tREFI),
882
     .tRFC                             (tRFC),
883
     .tRP                              (tRP),
884
     .tRRD                             (tRRD),
885
     .tRTP                             (tRTP),
886
     .tWTR                             (tWTR),
887
     .tZQI                             (tZQI),
888
     .tZQCS                            (tZQCS),
889
     .USER_REFRESH                     (USER_REFRESH),
890
     .TEMP_MON_EN                      (TEMP_MON_EN),
891
     .WRLVL                            (WRLVL),
892
     .DEBUG_PORT                       (DEBUG_PORT),
893
     .CAL_WIDTH                        (CAL_WIDTH),
894
     .RANK_WIDTH                       (RANK_WIDTH),
895
     .RANKS                            (RANKS),
896
     .ODT_WIDTH                        (ODT_WIDTH),
897
     .ROW_WIDTH                        (ROW_WIDTH),
898
     .ADDR_WIDTH                       (ADDR_WIDTH),
899
     .APP_DATA_WIDTH                   (APP_DATA_WIDTH),
900
     .APP_MASK_WIDTH                   (APP_MASK_WIDTH),
901
     .SIM_BYPASS_INIT_CAL              (SIM_BYPASS_INIT_CAL),
902
     .BYTE_LANES_B0                    (BYTE_LANES_B0),
903
     .BYTE_LANES_B1                    (BYTE_LANES_B1),
904
     .BYTE_LANES_B2                    (BYTE_LANES_B2),
905
     .BYTE_LANES_B3                    (BYTE_LANES_B3),
906
     .BYTE_LANES_B4                    (BYTE_LANES_B4),
907
     .DATA_CTL_B0                      (DATA_CTL_B0),
908
     .DATA_CTL_B1                      (DATA_CTL_B1),
909
     .DATA_CTL_B2                      (DATA_CTL_B2),
910
     .DATA_CTL_B3                      (DATA_CTL_B3),
911
     .DATA_CTL_B4                      (DATA_CTL_B4),
912
     .PHY_0_BITLANES                   (PHY_0_BITLANES),
913
     .PHY_1_BITLANES                   (PHY_1_BITLANES),
914
     .PHY_2_BITLANES                   (PHY_2_BITLANES),
915
     .CK_BYTE_MAP                      (CK_BYTE_MAP),
916
     .ADDR_MAP                         (ADDR_MAP),
917
     .BANK_MAP                         (BANK_MAP),
918
     .CAS_MAP                          (CAS_MAP),
919
     .CKE_ODT_BYTE_MAP                 (CKE_ODT_BYTE_MAP),
920
     .CKE_MAP                          (CKE_MAP),
921
     .ODT_MAP                          (ODT_MAP),
922
     .CS_MAP                           (CS_MAP),
923
     .PARITY_MAP                       (PARITY_MAP),
924
     .RAS_MAP                          (RAS_MAP),
925
     .WE_MAP                           (WE_MAP),
926
     .DQS_BYTE_MAP                     (DQS_BYTE_MAP),
927
     .DATA0_MAP                        (DATA0_MAP),
928
     .DATA1_MAP                        (DATA1_MAP),
929
     .DATA2_MAP                        (DATA2_MAP),
930
     .DATA3_MAP                        (DATA3_MAP),
931
     .DATA4_MAP                        (DATA4_MAP),
932
     .DATA5_MAP                        (DATA5_MAP),
933
     .DATA6_MAP                        (DATA6_MAP),
934
     .DATA7_MAP                        (DATA7_MAP),
935
     .DATA8_MAP                        (DATA8_MAP),
936
     .DATA9_MAP                        (DATA9_MAP),
937
     .DATA10_MAP                       (DATA10_MAP),
938
     .DATA11_MAP                       (DATA11_MAP),
939
     .DATA12_MAP                       (DATA12_MAP),
940
     .DATA13_MAP                       (DATA13_MAP),
941
     .DATA14_MAP                       (DATA14_MAP),
942
     .DATA15_MAP                       (DATA15_MAP),
943
     .DATA16_MAP                       (DATA16_MAP),
944
     .DATA17_MAP                       (DATA17_MAP),
945
     .MASK0_MAP                        (MASK0_MAP),
946
     .MASK1_MAP                        (MASK1_MAP),
947
     .CALIB_ROW_ADD                    (CALIB_ROW_ADD),
948
     .CALIB_COL_ADD                    (CALIB_COL_ADD),
949
     .CALIB_BA_ADD                     (CALIB_BA_ADD),
950
     .IDELAY_ADJ                       (IDELAY_ADJ),
951
     .FINE_PER_BIT                     (FINE_PER_BIT),
952
     .CENTER_COMP_MODE                 (CENTER_COMP_MODE),
953
     .PI_VAL_ADJ                       (PI_VAL_ADJ),
954
     .SLOT_0_CONFIG                    (SLOT_0_CONFIG),
955
     .SLOT_1_CONFIG                    (SLOT_1_CONFIG),
956
     .MEM_ADDR_ORDER                   (MEM_ADDR_ORDER),
957
     .STARVE_LIMIT                     (STARVE_LIMIT),
958
     .USE_CS_PORT                      (USE_CS_PORT),
959
     .USE_DM_PORT                      (USE_DM_PORT),
960
     .USE_ODT_PORT                     (USE_ODT_PORT),
961
     .MASTER_PHY_CTL                   (PHY_CONTROL_MASTER_BANK),
962
     .TAPSPERKCLK                      (TAPSPERKCLK)
963
     )
964
    u_memc_ui_top_std
965
      (
966
       .clk                              (clk),
967
       .clk_ref                          (clk_ref),
968
       .mem_refclk                       (mem_refclk), //memory clock
969
       .freq_refclk                      (freq_refclk),
970
       .pll_lock                         (pll_locked),
971
       .sync_pulse                       (sync_pulse),
972
       .mmcm_ps_clk                      (mmcm_ps_clk),
973
       .poc_sample_pd                    (poc_sample_pd),
974
       .psdone                           (psdone),
975
       .iddr_rst                         (iddr_rst),
976
       .psen                             (psen),
977
       .psincdec                         (psincdec),
978
       .rst                              (rst),
979
       .rst_phaser_ref                   (rst_phaser_ref),
980
       .ref_dll_lock                     (ref_dll_lock),
981
 
982
// Memory interface ports
983
       .ddr_dq                           (ddr3_dq),
984
       .ddr_dqs_n                        (ddr3_dqs_n),
985
       .ddr_dqs                          (ddr3_dqs_p),
986
       .ddr_addr                         (ddr3_addr),
987
       .ddr_ba                           (ddr3_ba),
988
       .ddr_cas_n                        (ddr3_cas_n),
989
       .ddr_ck_n                         (ddr3_ck_n),
990
       .ddr_ck                           (ddr3_ck_p),
991
       .ddr_cke                          (ddr3_cke),
992
       .ddr_cs_n                         (),
993
       .ddr_dm                           (ddr3_dm),
994
       .ddr_odt                          (ddr3_odt),
995
       .ddr_ras_n                        (ddr3_ras_n),
996
       .ddr_reset_n                      (ddr3_reset_n),
997
       .ddr_parity                       (ddr3_parity),
998
       .ddr_we_n                         (ddr3_we_n),
999
       .bank_mach_next                   (bank_mach_next),
1000
 
1001
// Application interface ports
1002
       .app_addr                         (app_addr),
1003
       .app_cmd                          (app_cmd),
1004
       .app_en                           (app_en),
1005
       .app_hi_pri                       (1'b0),
1006
       .app_wdf_data                     (app_wdf_data),
1007
       .app_wdf_end                      (app_wdf_end),
1008
       .app_wdf_mask                     (app_wdf_mask),
1009
       .app_wdf_wren                     (app_wdf_wren),
1010
       .app_ecc_multiple_err             (app_ecc_multiple_err),
1011
       .app_rd_data                      (app_rd_data),
1012
       .app_rd_data_end                  (app_rd_data_end),
1013
       .app_rd_data_valid                (app_rd_data_valid),
1014
       .app_rdy                          (app_rdy),
1015
       .app_wdf_rdy                      (app_wdf_rdy),
1016
       .app_sr_req                       (app_sr_req),
1017
       .app_sr_active                    (app_sr_active),
1018
       .app_ref_req                      (app_ref_req),
1019
       .app_ref_ack                      (app_ref_ack),
1020
       .app_zq_req                       (app_zq_req),
1021
       .app_zq_ack                       (app_zq_ack),
1022
       .app_raw_not_ecc                  ({2*nCK_PER_CLK{1'b0}}),
1023
       .app_correct_en_i                 (1'b1),
1024
 
1025
       .device_temp                      (device_temp),
1026
 
1027
// Debug logic ports
1028
       .dbg_idel_up_all                  (dbg_idel_up_all),
1029
       .dbg_idel_down_all                (dbg_idel_down_all),
1030
       .dbg_idel_up_cpt                  (dbg_idel_up_cpt),
1031
       .dbg_idel_down_cpt                (dbg_idel_down_cpt),
1032
       .dbg_sel_idel_cpt                 (dbg_sel_idel_cpt),
1033
       .dbg_sel_all_idel_cpt             (dbg_sel_all_idel_cpt),
1034
       .dbg_sel_pi_incdec                (dbg_sel_pi_incdec),
1035
       .dbg_sel_po_incdec                (dbg_sel_po_incdec),
1036
       .dbg_byte_sel                     (dbg_byte_sel),
1037
       .dbg_pi_f_inc                     (dbg_pi_f_inc),
1038
       .dbg_pi_f_dec                     (dbg_pi_f_dec),
1039
       .dbg_po_f_inc                     (dbg_po_f_inc),
1040
       .dbg_po_f_stg23_sel               (dbg_po_f_stg23_sel),
1041
       .dbg_po_f_dec                     (dbg_po_f_dec),
1042
       .dbg_cpt_tap_cnt                  (dbg_cpt_tap_cnt),
1043
       .dbg_dq_idelay_tap_cnt            (dbg_dq_idelay_tap_cnt),
1044
       .dbg_calib_top                    (dbg_calib_top),
1045
       .dbg_cpt_first_edge_cnt           (dbg_cpt_first_edge_cnt),
1046
       .dbg_cpt_second_edge_cnt          (dbg_cpt_second_edge_cnt),
1047
       .dbg_rd_data_offset               (dbg_rd_data_offset),
1048
       .dbg_phy_rdlvl                    (dbg_phy_rdlvl),
1049
       .dbg_phy_wrcal                    (dbg_phy_wrcal),
1050
       .dbg_final_po_fine_tap_cnt        (dbg_final_po_fine_tap_cnt),
1051
       .dbg_final_po_coarse_tap_cnt      (dbg_final_po_coarse_tap_cnt),
1052
       .dbg_rd_data_edge_detect          (dbg_rd_data_edge_detect),
1053
       .dbg_rddata                       (dbg_rddata),
1054
       .dbg_rddata_valid                 (dbg_rddata_valid),
1055
       .dbg_rdlvl_done                   (dbg_rdlvl_done),
1056
       .dbg_rdlvl_err                    (dbg_rdlvl_err),
1057
       .dbg_rdlvl_start                  (dbg_rdlvl_start),
1058
       .dbg_wrlvl_fine_tap_cnt           (dbg_wrlvl_fine_tap_cnt),
1059
       .dbg_wrlvl_coarse_tap_cnt         (dbg_wrlvl_coarse_tap_cnt),
1060
       .dbg_tap_cnt_during_wrlvl         (dbg_tap_cnt_during_wrlvl),
1061
       .dbg_wl_edge_detect_valid         (dbg_wl_edge_detect_valid),
1062
       .dbg_wrlvl_done                   (dbg_wrlvl_done),
1063
       .dbg_wrlvl_err                    (dbg_wrlvl_err),
1064
       .dbg_wrlvl_start                  (dbg_wrlvl_start),
1065
       .dbg_phy_wrlvl                    (dbg_phy_wrlvl),
1066
       .dbg_phy_init                     (dbg_phy_init),
1067
       .dbg_prbs_rdlvl                   (dbg_prbs_rdlvl),
1068
       .dbg_pi_counter_read_val          (dbg_pi_counter_read_val),
1069
       .dbg_po_counter_read_val          (dbg_po_counter_read_val),
1070
       .dbg_prbs_final_dqs_tap_cnt_r     (dbg_prbs_final_dqs_tap_cnt_r_int),
1071
       .dbg_prbs_first_edge_taps         (dbg_prbs_first_edge_taps_int),
1072
       .dbg_prbs_second_edge_taps        (dbg_prbs_second_edge_taps_int),
1073
       .dbg_pi_phaselock_start           (dbg_pi_phaselock_start),
1074
       .dbg_pi_phaselocked_done          (dbg_pi_phaselocked_done),
1075
       .dbg_pi_phaselock_err             (dbg_pi_phaselock_err),
1076
       .dbg_pi_phase_locked_phy4lanes    (dbg_pi_phase_locked_phy4lanes),
1077
       .dbg_pi_dqsfound_start            (dbg_pi_dqsfound_start),
1078
       .dbg_pi_dqsfound_done             (dbg_pi_dqsfound_done),
1079
       .dbg_pi_dqsfound_err              (dbg_pi_dqsfound_err),
1080
       .dbg_pi_dqs_found_lanes_phy4lanes (dbg_pi_dqs_found_lanes_phy4lanes),
1081
       .dbg_calib_rd_data_offset_1       (dbg_calib_rd_data_offset_1),
1082
       .dbg_calib_rd_data_offset_2       (dbg_calib_rd_data_offset_2),
1083
       .dbg_data_offset                  (dbg_data_offset),
1084
       .dbg_data_offset_1                (dbg_data_offset_1),
1085
       .dbg_data_offset_2                (dbg_data_offset_2),
1086
       .dbg_wrcal_start                  (dbg_wrcal_start),
1087
       .dbg_wrcal_done                   (dbg_wrcal_done),
1088
       .dbg_wrcal_err                    (dbg_wrcal_err),
1089
       .dbg_phy_oclkdelay_cal            (dbg_phy_oclkdelay_cal),
1090
       .dbg_oclkdelay_rd_data            (dbg_oclkdelay_rd_data),
1091
       .dbg_oclkdelay_calib_start        (dbg_oclkdelay_calib_start),
1092
       .dbg_oclkdelay_calib_done         (dbg_oclkdelay_calib_done),
1093
       .dbg_dqs_found_cal                (dbg_dqs_found_cal),
1094
       .init_calib_complete              (init_calib_complete)
1095
       );
1096
 
1097
 
1098
 
1099
 
1100
 
1101
 
1102
   //*********************************************************************
1103
   // Resetting all RTL debug inputs as the debug ports are not enabled
1104
   //*********************************************************************
1105
   assign dbg_idel_down_all    = 1'b0;
1106
   assign dbg_idel_down_cpt    = 1'b0;
1107
   assign dbg_idel_up_all      = 1'b0;
1108
   assign dbg_idel_up_cpt      = 1'b0;
1109
   assign dbg_sel_all_idel_cpt = 1'b0;
1110
   assign dbg_sel_idel_cpt     = 'b0;
1111
   assign dbg_byte_sel         = 'd0;
1112
   assign dbg_sel_pi_incdec    = 1'b0;
1113
   assign dbg_pi_f_inc         = 1'b0;
1114
   assign dbg_pi_f_dec         = 1'b0;
1115
   assign dbg_po_f_inc         = 'b0;
1116
   assign dbg_po_f_dec         = 'b0;
1117
   assign dbg_po_f_stg23_sel   = 'b0;
1118
   assign dbg_sel_po_incdec    = 'b0;
1119
 
1120
 
1121
 
1122
endmodule

powered by: WebSVN 2.1.0

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