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: ddr2_phy_dqs_iob.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 | // This module places the data strobes in the IOBs. |
---|
54 | //Reference: |
---|
55 | //Revision History: |
---|
56 | // Rev 1.1 - Parameter HIGH_PERFORMANCE_MODE added. PK. 7/10/08 |
---|
57 | // Rev 1.2 - Parameter IODELAY_GRP added and constraint IODELAY_GROUP added |
---|
58 | // on IODELAY primitives. PK. 11/27/08 |
---|
59 | // Rev 1.3 - IDDR primitve (u_iddr_dq_ce) is replaced with a negative-edge |
---|
60 | // triggered flip-flop. PK. 03/20/09 |
---|
61 | // Rev 1.4 - To fix CR 540201, S and syn_preserve attributes are added |
---|
62 | // for dqs_oe_n_r. PK. 01/08/10 |
---|
63 | //***************************************************************************** |
---|
64 | |
---|
65 | `timescale 1ns/1ps |
---|
66 | |
---|
67 | module ddr2_phy_dqs_iob # |
---|
68 | ( |
---|
69 | // Following parameters are for 72-bit RDIMM design (for ML561 Reference |
---|
70 | // board design). Actual values may be different. Actual parameters values |
---|
71 | // are passed from design top module dram module. Please refer to |
---|
72 | // the dram module for actual values. |
---|
73 | parameter DDR_TYPE = 1, |
---|
74 | parameter HIGH_PERFORMANCE_MODE = "TRUE", |
---|
75 | parameter IODELAY_GRP = "IODELAY_MIG" |
---|
76 | ) |
---|
77 | ( |
---|
78 | input clk0, |
---|
79 | input clkdiv0, |
---|
80 | input rst0, |
---|
81 | input dlyinc_dqs, |
---|
82 | input dlyce_dqs, |
---|
83 | input dlyrst_dqs, |
---|
84 | input dlyinc_gate, |
---|
85 | input dlyce_gate, |
---|
86 | input dlyrst_gate, |
---|
87 | input dqs_oe_n, |
---|
88 | input dqs_rst_n, |
---|
89 | input en_dqs, |
---|
90 | inout ddr_dqs, |
---|
91 | inout ddr_dqs_n, |
---|
92 | output dq_ce, |
---|
93 | output delayed_dqs |
---|
94 | ); |
---|
95 | |
---|
96 | wire clk180; |
---|
97 | wire dqs_bufio; |
---|
98 | |
---|
99 | wire dqs_ibuf; |
---|
100 | wire dqs_idelay; |
---|
101 | wire dqs_oe_n_delay; |
---|
102 | (* S = "TRUE" *) wire dqs_oe_n_r /* synthesis syn_preserve = 1*/; |
---|
103 | wire dqs_rst_n_delay; |
---|
104 | reg dqs_rst_n_r /* synthesis syn_preserve = 1*/; |
---|
105 | wire dqs_out; |
---|
106 | wire en_dqs_sync /* synthesis syn_keep = 1 */; |
---|
107 | |
---|
108 | // for simulation only. Synthesis should ignore this delay |
---|
109 | localparam DQS_NET_DELAY = 0.8; |
---|
110 | |
---|
111 | assign clk180 = ~clk0; |
---|
112 | |
---|
113 | // add delta delay to inputs clocked by clk180 to avoid delta-delay |
---|
114 | // simulation issues |
---|
115 | assign dqs_rst_n_delay = dqs_rst_n; |
---|
116 | assign dqs_oe_n_delay = dqs_oe_n; |
---|
117 | |
---|
118 | //*************************************************************************** |
---|
119 | // DQS input-side resources: |
---|
120 | // - IODELAY (pad -> IDELAY) |
---|
121 | // - BUFIO (IDELAY -> BUFIO) |
---|
122 | //*************************************************************************** |
---|
123 | |
---|
124 | // Route DQS from PAD to IDELAY |
---|
125 | (* IODELAY_GROUP = IODELAY_GRP *) IODELAY # |
---|
126 | ( |
---|
127 | .DELAY_SRC("I"), |
---|
128 | .IDELAY_TYPE("VARIABLE"), |
---|
129 | .HIGH_PERFORMANCE_MODE(HIGH_PERFORMANCE_MODE), |
---|
130 | .IDELAY_VALUE(0), |
---|
131 | .ODELAY_VALUE(0) |
---|
132 | ) |
---|
133 | u_idelay_dqs |
---|
134 | ( |
---|
135 | .DATAOUT (dqs_idelay), |
---|
136 | .C (clkdiv0), |
---|
137 | .CE (dlyce_dqs), |
---|
138 | .DATAIN (), |
---|
139 | .IDATAIN (dqs_ibuf), |
---|
140 | .INC (dlyinc_dqs), |
---|
141 | .ODATAIN (), |
---|
142 | .RST (dlyrst_dqs), |
---|
143 | .T () |
---|
144 | ); |
---|
145 | |
---|
146 | // From IDELAY to BUFIO |
---|
147 | BUFIO u_bufio_dqs |
---|
148 | ( |
---|
149 | .I (dqs_idelay), |
---|
150 | .O (dqs_bufio) |
---|
151 | ); |
---|
152 | |
---|
153 | // To model additional delay of DQS BUFIO + gating network |
---|
154 | // for behavioral simulation. Make sure to select a delay number smaller |
---|
155 | // than half clock cycle (otherwise output will not track input changes |
---|
156 | // because of inertial delay). Duplicate to avoid delta delay issues. |
---|
157 | assign #(DQS_NET_DELAY) i_delayed_dqs = dqs_bufio; |
---|
158 | assign #(DQS_NET_DELAY) delayed_dqs = dqs_bufio; |
---|
159 | |
---|
160 | //*************************************************************************** |
---|
161 | // DQS gate circuit (not supported for all controllers) |
---|
162 | //*************************************************************************** |
---|
163 | |
---|
164 | // Gate routing: |
---|
165 | // en_dqs -> IDELAY -> en_dqs_sync -> IDDR.S -> dq_ce -> |
---|
166 | // capture IDDR.CE |
---|
167 | |
---|
168 | // Delay CE control so that it's in phase with delayed DQS |
---|
169 | (* IODELAY_GROUP = IODELAY_GRP *) IODELAY # |
---|
170 | ( |
---|
171 | .DELAY_SRC ("DATAIN"), |
---|
172 | .IDELAY_TYPE ("VARIABLE"), |
---|
173 | .HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE), |
---|
174 | .IDELAY_VALUE (0), |
---|
175 | .ODELAY_VALUE (0) |
---|
176 | ) |
---|
177 | u_iodelay_dq_ce |
---|
178 | ( |
---|
179 | .DATAOUT (en_dqs_sync), |
---|
180 | .C (clkdiv0), |
---|
181 | .CE (dlyce_gate), |
---|
182 | .DATAIN (en_dqs), |
---|
183 | .IDATAIN (), |
---|
184 | .INC (dlyinc_gate), |
---|
185 | .ODATAIN (), |
---|
186 | .RST (dlyrst_gate), |
---|
187 | .T () |
---|
188 | ); |
---|
189 | |
---|
190 | // Generate sync'ed CE to DQ IDDR's using a negative-edge triggered flip-flop |
---|
191 | // clocked by DQS. This flop should be locked to the IOB flip-flop at the same |
---|
192 | // site as IODELAY u_idelay_dqs in order to use the dedicated route from |
---|
193 | // the IODELAY to flip-flop (to keep this route as short as possible) |
---|
194 | (* IOB = "FORCE" *) FDCPE_1 # |
---|
195 | ( |
---|
196 | .INIT(1'b0) |
---|
197 | ) |
---|
198 | u_iddr_dq_ce |
---|
199 | ( |
---|
200 | .Q (dq_ce), |
---|
201 | .C (i_delayed_dqs), |
---|
202 | .CE (1'b1), |
---|
203 | .CLR (1'b0), |
---|
204 | .D (en_dqs_sync), |
---|
205 | .PRE (en_dqs_sync) |
---|
206 | ) /* synthesis syn_useioff = 1 */ |
---|
207 | /* synthesis syn_replicate = 0 */; |
---|
208 | |
---|
209 | //*************************************************************************** |
---|
210 | // DQS output-side resources |
---|
211 | //*************************************************************************** |
---|
212 | |
---|
213 | // synthesis attribute keep of dqs_rst_n_r is "true" |
---|
214 | always @(posedge clk180) |
---|
215 | dqs_rst_n_r <= dqs_rst_n_delay; |
---|
216 | |
---|
217 | ODDR # |
---|
218 | ( |
---|
219 | .SRTYPE("SYNC"), |
---|
220 | .DDR_CLK_EDGE("OPPOSITE_EDGE") |
---|
221 | ) |
---|
222 | u_oddr_dqs |
---|
223 | ( |
---|
224 | .Q (dqs_out), |
---|
225 | .C (clk180), |
---|
226 | .CE (1'b1), |
---|
227 | .D1 (dqs_rst_n_r), // keep output deasserted for write preamble |
---|
228 | .D2 (1'b0), |
---|
229 | .R (1'b0), |
---|
230 | .S (1'b0) |
---|
231 | ); |
---|
232 | |
---|
233 | (* IOB = "FORCE" *) FDP u_tri_state_dqs |
---|
234 | ( |
---|
235 | .D (dqs_oe_n_delay), |
---|
236 | .Q (dqs_oe_n_r), |
---|
237 | .C (clk180), |
---|
238 | .PRE (rst0) |
---|
239 | ) /* synthesis syn_useioff = 1 */; |
---|
240 | |
---|
241 | //*************************************************************************** |
---|
242 | |
---|
243 | // use either single-ended (for DDR1) or differential (for DDR2) DQS input |
---|
244 | |
---|
245 | generate |
---|
246 | if (DDR_TYPE > 0) begin: gen_dqs_iob_ddr2 |
---|
247 | IOBUFDS u_iobuf_dqs |
---|
248 | ( |
---|
249 | .O (dqs_ibuf), |
---|
250 | .IO (ddr_dqs), |
---|
251 | .IOB (ddr_dqs_n), |
---|
252 | .I (dqs_out), |
---|
253 | .T (dqs_oe_n_r) |
---|
254 | ); |
---|
255 | end else begin: gen_dqs_iob_ddr1 |
---|
256 | IOBUF u_iobuf_dqs |
---|
257 | ( |
---|
258 | .O (dqs_ibuf), |
---|
259 | .IO (ddr_dqs), |
---|
260 | .I (dqs_out), |
---|
261 | .T (dqs_oe_n_r) |
---|
262 | ); |
---|
263 | end |
---|
264 | endgenerate |
---|
265 | |
---|
266 | endmodule |
---|