1 | //***************************************************************************** |
---|
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.6 |
---|
44 | // \ \ Application: MIG |
---|
45 | // / / Filename: dram.v |
---|
46 | // /___/ /\ Date Last Modified: $Date: 2010/06/29 12:03:43 $ |
---|
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) and all the other infrastructure logic |
---|
56 | // separately. |
---|
57 | // In addition to the memory controller, the module instantiates: |
---|
58 | // 1. Reset logic based on user clocks |
---|
59 | // 2. IDELAY control block |
---|
60 | //Reference: |
---|
61 | //Revision History: |
---|
62 | // Rev 1.1 - Parameter USE_DM_PORT added. PK. 6/25/08 |
---|
63 | // Rev 1.2 - Parameter HIGH_PERFORMANCE_MODE added. PK. 7/10/08 |
---|
64 | // Rev 1.3 - Parameter IODELAY_GRP added. PK. 11/27/08 |
---|
65 | //***************************************************************************** |
---|
66 | |
---|
67 | `timescale 1ns/1ps |
---|
68 | |
---|
69 | (* X_CORE_INFO = "mig_v3_6_ddr2_v5, Coregen 12.3" , CORE_GENERATION_INFO = "ddr2_v5,mig_v3_6,{component_name=dram, 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=3, 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, CLK_PERIOD=5000, RST_ACT_LOW=1, INTERFACE_TYPE=DDR2_SDRAM, LANGUAGE=Verilog, SYNTHESIS_TOOL=ISE, NO_OF_CONTROLLERS=1}" *) |
---|
70 | module dram # |
---|
71 | ( |
---|
72 | parameter BANK_WIDTH = 2, |
---|
73 | // # of memory bank addr bits. |
---|
74 | parameter CKE_WIDTH = 1, |
---|
75 | // # of memory clock enable outputs. |
---|
76 | parameter CLK_WIDTH = 1, |
---|
77 | // # of clock outputs. |
---|
78 | parameter COL_WIDTH = 10, |
---|
79 | // # of memory column bits. |
---|
80 | parameter CS_NUM = 1, |
---|
81 | // # of separate memory chip selects. |
---|
82 | parameter CS_WIDTH = 1, |
---|
83 | // # of total memory chip selects. |
---|
84 | parameter CS_BITS = 0, |
---|
85 | // set to log2(CS_NUM) (rounded up). |
---|
86 | parameter DM_WIDTH = 8, |
---|
87 | // # of data mask bits. |
---|
88 | parameter DQ_WIDTH = 64, |
---|
89 | // # of data width. |
---|
90 | parameter DQ_PER_DQS = 8, |
---|
91 | // # of DQ data bits per strobe. |
---|
92 | parameter DQS_WIDTH = 8, |
---|
93 | // # of DQS strobes. |
---|
94 | parameter DQ_BITS = 6, |
---|
95 | // set to log2(DQS_WIDTH*DQ_PER_DQS). |
---|
96 | parameter DQS_BITS = 3, |
---|
97 | // set to log2(DQS_WIDTH). |
---|
98 | parameter ODT_WIDTH = 1, |
---|
99 | // # of memory on-die term enables. |
---|
100 | parameter ROW_WIDTH = 13, |
---|
101 | // # of memory row and # of addr bits. |
---|
102 | parameter ADDITIVE_LAT = 0, |
---|
103 | // additive write latency. |
---|
104 | parameter BURST_LEN = 4, |
---|
105 | // burst length (in double words). |
---|
106 | parameter BURST_TYPE = 0, |
---|
107 | // burst type (=0 seq; =1 interleaved). |
---|
108 | parameter CAS_LAT = 3, |
---|
109 | // CAS latency. |
---|
110 | parameter ECC_ENABLE = 0, |
---|
111 | // enable ECC (=1 enable). |
---|
112 | parameter APPDATA_WIDTH = 128, |
---|
113 | // # of usr read/write data bus bits. |
---|
114 | parameter MULTI_BANK_EN = 1, |
---|
115 | // Keeps multiple banks open. (= 1 enable). |
---|
116 | parameter TWO_T_TIME_EN = 1, |
---|
117 | // 2t timing for unbuffered dimms. |
---|
118 | parameter ODT_TYPE = 1, |
---|
119 | // ODT (=0(none),=1(75),=2(150),=3(50)). |
---|
120 | parameter REDUCE_DRV = 0, |
---|
121 | // reduced strength mem I/O (=1 yes). |
---|
122 | parameter REG_ENABLE = 0, |
---|
123 | // registered addr/ctrl (=1 yes). |
---|
124 | parameter TREFI_NS = 7800, |
---|
125 | // auto refresh interval (ns). |
---|
126 | parameter TRAS = 40000, |
---|
127 | // active->precharge delay. |
---|
128 | parameter TRCD = 15000, |
---|
129 | // active->read/write delay. |
---|
130 | parameter TRFC = 105000, |
---|
131 | // refresh->refresh, refresh->active delay. |
---|
132 | parameter TRP = 15000, |
---|
133 | // precharge->command delay. |
---|
134 | parameter TRTP = 7500, |
---|
135 | // read->precharge delay. |
---|
136 | parameter TWR = 15000, |
---|
137 | // used to determine write->precharge. |
---|
138 | parameter TWTR = 7500, |
---|
139 | // write->read delay. |
---|
140 | parameter HIGH_PERFORMANCE_MODE = "TRUE", |
---|
141 | // # = TRUE, the IODELAY performance mode is set |
---|
142 | // to high. |
---|
143 | // # = FALSE, the IODELAY performance mode is set |
---|
144 | // to low. |
---|
145 | parameter SIM_ONLY = 0, |
---|
146 | // = 1 to skip SDRAM power up delay. |
---|
147 | parameter DEBUG_EN = 0, |
---|
148 | // Enable debug signals/controls. |
---|
149 | // When this parameter is changed from 0 to 1, |
---|
150 | // make sure to uncomment the coregen commands |
---|
151 | // in ise_flow.bat or create_ise.bat files in |
---|
152 | // par folder. |
---|
153 | parameter CLK_PERIOD = 5000, |
---|
154 | // Core/Memory clock period (in ps). |
---|
155 | parameter DLL_FREQ_MODE = "HIGH", |
---|
156 | // DCM Frequency range. |
---|
157 | parameter CLK_TYPE = "SINGLE_ENDED", |
---|
158 | // # = "DIFFERENTIAL " ->; Differential input clocks , |
---|
159 | // # = "SINGLE_ENDED" -> Single ended input clocks. |
---|
160 | parameter NOCLK200 = 0, |
---|
161 | // clk200 enable and disable. |
---|
162 | parameter RST_ACT_LOW = 1 |
---|
163 | // =1 for active low reset, =0 for active high. |
---|
164 | ) |
---|
165 | ( |
---|
166 | inout [DQ_WIDTH-1:0] ddr2_dq, |
---|
167 | output [ROW_WIDTH-1:0] ddr2_a, |
---|
168 | output [BANK_WIDTH-1:0] ddr2_ba, |
---|
169 | output ddr2_ras_n, |
---|
170 | output ddr2_cas_n, |
---|
171 | output ddr2_we_n, |
---|
172 | output [CS_WIDTH-1:0] ddr2_cs_n, |
---|
173 | output [ODT_WIDTH-1:0] ddr2_odt, |
---|
174 | output [CKE_WIDTH-1:0] ddr2_cke, |
---|
175 | output [DM_WIDTH-1:0] ddr2_dm, |
---|
176 | input sys_clk, |
---|
177 | input idly_clk_200, |
---|
178 | input sys_rst_n, |
---|
179 | output phy_init_done, |
---|
180 | output rst0_tb, |
---|
181 | output clk0_tb, |
---|
182 | output app_wdf_afull, |
---|
183 | output app_af_afull, |
---|
184 | output rd_data_valid, |
---|
185 | input app_wdf_wren, |
---|
186 | input app_af_wren, |
---|
187 | input [30:0] app_af_addr, |
---|
188 | input [2:0] app_af_cmd, |
---|
189 | output [(APPDATA_WIDTH)-1:0] rd_data_fifo_out, |
---|
190 | input [(APPDATA_WIDTH)-1:0] app_wdf_data, |
---|
191 | input [(APPDATA_WIDTH/8)-1:0] app_wdf_mask_data, |
---|
192 | inout [DQS_WIDTH-1:0] ddr2_dqs, |
---|
193 | inout [DQS_WIDTH-1:0] ddr2_dqs_n, |
---|
194 | output [CLK_WIDTH-1:0] ddr2_ck, |
---|
195 | output [CLK_WIDTH-1:0] ddr2_ck_n |
---|
196 | ); |
---|
197 | |
---|
198 | //*************************************************************************** |
---|
199 | // IODELAY Group Name: Replication and placement of IDELAYCTRLs will be |
---|
200 | // handled automatically by software tools if IDELAYCTRLs have same refclk, |
---|
201 | // reset and rdy nets. Designs with a unique RESET will commonly create a |
---|
202 | // unique RDY. Constraint IODELAY_GROUP is associated to a set of IODELAYs |
---|
203 | // with an IDELAYCTRL. The parameter IODELAY_GRP value can be any string. |
---|
204 | //*************************************************************************** |
---|
205 | |
---|
206 | localparam IODELAY_GRP = "IODELAY_MIG"; |
---|
207 | |
---|
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 | .DLL_FREQ_MODE (DLL_FREQ_MODE), |
---|
295 | .CLK_TYPE (CLK_TYPE), |
---|
296 | .NOCLK200 (NOCLK200), |
---|
297 | .RST_ACT_LOW (RST_ACT_LOW) |
---|
298 | ) |
---|
299 | u_ddr2_infrastructure |
---|
300 | ( |
---|
301 | .sys_clk_p (sys_clk_p), |
---|
302 | .sys_clk_n (sys_clk_n), |
---|
303 | .sys_clk (sys_clk), |
---|
304 | .clk200_p (clk200_p), |
---|
305 | .clk200_n (clk200_n), |
---|
306 | .idly_clk_200 (idly_clk_200), |
---|
307 | .sys_rst_n (sys_rst_n), |
---|
308 | .rst0 (rst0), |
---|
309 | .rst90 (rst90), |
---|
310 | .rstdiv0 (rstdiv0), |
---|
311 | .rst200 (rst200), |
---|
312 | .clk0 (clk0), |
---|
313 | .clk90 (clk90), |
---|
314 | .clkdiv0 (clkdiv0), |
---|
315 | .clk200 (clk200), |
---|
316 | .idelay_ctrl_rdy (idelay_ctrl_rdy) |
---|
317 | ); |
---|
318 | |
---|
319 | ddr2_top # |
---|
320 | ( |
---|
321 | .BANK_WIDTH (BANK_WIDTH), |
---|
322 | .CKE_WIDTH (CKE_WIDTH), |
---|
323 | .CLK_WIDTH (CLK_WIDTH), |
---|
324 | .COL_WIDTH (COL_WIDTH), |
---|
325 | .CS_NUM (CS_NUM), |
---|
326 | .CS_WIDTH (CS_WIDTH), |
---|
327 | .CS_BITS (CS_BITS), |
---|
328 | .DM_WIDTH (DM_WIDTH), |
---|
329 | .DQ_WIDTH (DQ_WIDTH), |
---|
330 | .DQ_PER_DQS (DQ_PER_DQS), |
---|
331 | .DQS_WIDTH (DQS_WIDTH), |
---|
332 | .DQ_BITS (DQ_BITS), |
---|
333 | .DQS_BITS (DQS_BITS), |
---|
334 | .ODT_WIDTH (ODT_WIDTH), |
---|
335 | .ROW_WIDTH (ROW_WIDTH), |
---|
336 | .ADDITIVE_LAT (ADDITIVE_LAT), |
---|
337 | .BURST_LEN (BURST_LEN), |
---|
338 | .BURST_TYPE (BURST_TYPE), |
---|
339 | .CAS_LAT (CAS_LAT), |
---|
340 | .ECC_ENABLE (ECC_ENABLE), |
---|
341 | .APPDATA_WIDTH (APPDATA_WIDTH), |
---|
342 | .MULTI_BANK_EN (MULTI_BANK_EN), |
---|
343 | .TWO_T_TIME_EN (TWO_T_TIME_EN), |
---|
344 | .ODT_TYPE (ODT_TYPE), |
---|
345 | .REDUCE_DRV (REDUCE_DRV), |
---|
346 | .REG_ENABLE (REG_ENABLE), |
---|
347 | .TREFI_NS (TREFI_NS), |
---|
348 | .TRAS (TRAS), |
---|
349 | .TRCD (TRCD), |
---|
350 | .TRFC (TRFC), |
---|
351 | .TRP (TRP), |
---|
352 | .TRTP (TRTP), |
---|
353 | .TWR (TWR), |
---|
354 | .TWTR (TWTR), |
---|
355 | .HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE), |
---|
356 | .IODELAY_GRP (IODELAY_GRP), |
---|
357 | .SIM_ONLY (SIM_ONLY), |
---|
358 | .DEBUG_EN (DEBUG_EN), |
---|
359 | .FPGA_SPEED_GRADE (3), |
---|
360 | .USE_DM_PORT (1), |
---|
361 | .CLK_PERIOD (CLK_PERIOD) |
---|
362 | ) |
---|
363 | u_ddr2_top_0 |
---|
364 | ( |
---|
365 | .ddr2_dq (ddr2_dq), |
---|
366 | .ddr2_a (ddr2_a), |
---|
367 | .ddr2_ba (ddr2_ba), |
---|
368 | .ddr2_ras_n (ddr2_ras_n), |
---|
369 | .ddr2_cas_n (ddr2_cas_n), |
---|
370 | .ddr2_we_n (ddr2_we_n), |
---|
371 | .ddr2_cs_n (ddr2_cs_n), |
---|
372 | .ddr2_odt (ddr2_odt), |
---|
373 | .ddr2_cke (ddr2_cke), |
---|
374 | .ddr2_dm (ddr2_dm), |
---|
375 | .phy_init_done (phy_init_done), |
---|
376 | .rst0 (rst0), |
---|
377 | .rst90 (rst90), |
---|
378 | .rstdiv0 (rstdiv0), |
---|
379 | .clk0 (clk0), |
---|
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 | |
---|
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 | |
---|
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 |
---|