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_ctl_io.v |
---|
46 | // /___/ /\ Date Last Modified: $Date: 2010/06/29 12:03:43 $ |
---|
47 | // \ \ / \ Date Created: Thu Aug 24 2006 |
---|
48 | // \___\/\___\ |
---|
49 | // |
---|
50 | //Device: Virtex-5 |
---|
51 | //Design Name: DDR2 |
---|
52 | //Purpose: |
---|
53 | // This module puts the memory control signals like address, bank address, |
---|
54 | // row address strobe, column address strobe, write enable and clock enable |
---|
55 | // in the IOBs. |
---|
56 | //Reference: |
---|
57 | //Revision History: |
---|
58 | // Rev 1.1 - To fix CR 540201, S attribute is added for CS, CKE and ODT |
---|
59 | // module (FDCPE) instances. PK. 01/08/10 |
---|
60 | //***************************************************************************** |
---|
61 | |
---|
62 | `timescale 1ns/1ps |
---|
63 | |
---|
64 | module ddr2_phy_ctl_io # |
---|
65 | ( |
---|
66 | // Following parameters are for 72-bit RDIMM design (for ML561 Reference |
---|
67 | // board design). Actual values may be different. Actual parameters values |
---|
68 | // are passed from design top module dram module. Please refer to |
---|
69 | // the dram module for actual values. |
---|
70 | parameter BANK_WIDTH = 2, |
---|
71 | parameter CKE_WIDTH = 1, |
---|
72 | parameter COL_WIDTH = 10, |
---|
73 | parameter CS_NUM = 1, |
---|
74 | parameter TWO_T_TIME_EN = 0, |
---|
75 | parameter CS_WIDTH = 1, |
---|
76 | parameter ODT_WIDTH = 1, |
---|
77 | parameter ROW_WIDTH = 14, |
---|
78 | parameter DDR_TYPE = 1 |
---|
79 | ) |
---|
80 | ( |
---|
81 | input clk0, |
---|
82 | input clk90, |
---|
83 | input rst0, |
---|
84 | input rst90, |
---|
85 | input [ROW_WIDTH-1:0] ctrl_addr, |
---|
86 | input [BANK_WIDTH-1:0] ctrl_ba, |
---|
87 | input ctrl_ras_n, |
---|
88 | input ctrl_cas_n, |
---|
89 | input ctrl_we_n, |
---|
90 | input [CS_NUM-1:0] ctrl_cs_n, |
---|
91 | input [ROW_WIDTH-1:0] phy_init_addr, |
---|
92 | input [BANK_WIDTH-1:0] phy_init_ba, |
---|
93 | input phy_init_ras_n, |
---|
94 | input phy_init_cas_n, |
---|
95 | input phy_init_we_n, |
---|
96 | input [CS_NUM-1:0] phy_init_cs_n, |
---|
97 | input [CKE_WIDTH-1:0] phy_init_cke, |
---|
98 | input phy_init_data_sel, |
---|
99 | input [CS_NUM-1:0] odt, |
---|
100 | output [ROW_WIDTH-1:0] ddr_addr, |
---|
101 | output [BANK_WIDTH-1:0] ddr_ba, |
---|
102 | output ddr_ras_n, |
---|
103 | output ddr_cas_n, |
---|
104 | output ddr_we_n, |
---|
105 | output [CKE_WIDTH-1:0] ddr_cke, |
---|
106 | output [CS_WIDTH-1:0] ddr_cs_n, |
---|
107 | output [ODT_WIDTH-1:0] ddr_odt |
---|
108 | ); |
---|
109 | |
---|
110 | reg [ROW_WIDTH-1:0] addr_mux; |
---|
111 | reg [BANK_WIDTH-1:0] ba_mux; |
---|
112 | reg cas_n_mux; |
---|
113 | reg [CS_NUM-1:0] cs_n_mux; |
---|
114 | reg ras_n_mux; |
---|
115 | reg we_n_mux; |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | //*************************************************************************** |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | // MUX to choose from either PHY or controller for SDRAM control |
---|
125 | |
---|
126 | generate // in 2t timing mode the extra register stage cannot be used. |
---|
127 | if(TWO_T_TIME_EN) begin // the control signals are asserted for two cycles |
---|
128 | always @(*)begin |
---|
129 | if (phy_init_data_sel) begin |
---|
130 | addr_mux = ctrl_addr; |
---|
131 | ba_mux = ctrl_ba; |
---|
132 | cas_n_mux = ctrl_cas_n; |
---|
133 | cs_n_mux = ctrl_cs_n; |
---|
134 | ras_n_mux = ctrl_ras_n; |
---|
135 | we_n_mux = ctrl_we_n; |
---|
136 | end else begin |
---|
137 | addr_mux = phy_init_addr; |
---|
138 | ba_mux = phy_init_ba; |
---|
139 | cas_n_mux = phy_init_cas_n; |
---|
140 | cs_n_mux = phy_init_cs_n; |
---|
141 | ras_n_mux = phy_init_ras_n; |
---|
142 | we_n_mux = phy_init_we_n; |
---|
143 | end |
---|
144 | end |
---|
145 | end else begin |
---|
146 | always @(posedge clk0)begin // register the signals in non 2t mode |
---|
147 | if (phy_init_data_sel) begin |
---|
148 | addr_mux <= ctrl_addr; |
---|
149 | ba_mux <= ctrl_ba; |
---|
150 | cas_n_mux <= ctrl_cas_n; |
---|
151 | cs_n_mux <= ctrl_cs_n; |
---|
152 | ras_n_mux <= ctrl_ras_n; |
---|
153 | we_n_mux <= ctrl_we_n; |
---|
154 | end else begin |
---|
155 | addr_mux <= phy_init_addr; |
---|
156 | ba_mux <= phy_init_ba; |
---|
157 | cas_n_mux <= phy_init_cas_n; |
---|
158 | cs_n_mux <= phy_init_cs_n; |
---|
159 | ras_n_mux <= phy_init_ras_n; |
---|
160 | we_n_mux <= phy_init_we_n; |
---|
161 | end |
---|
162 | end |
---|
163 | end |
---|
164 | endgenerate |
---|
165 | |
---|
166 | //*************************************************************************** |
---|
167 | // Output flop instantiation |
---|
168 | // NOTE: Make sure all control/address flops are placed in IOBs |
---|
169 | //*************************************************************************** |
---|
170 | |
---|
171 | // RAS: = 1 at reset |
---|
172 | (* IOB = "FORCE" *) FDCPE u_ff_ras_n |
---|
173 | ( |
---|
174 | .Q (ddr_ras_n), |
---|
175 | .C (clk0), |
---|
176 | .CE (1'b1), |
---|
177 | .CLR (1'b0), |
---|
178 | .D (ras_n_mux), |
---|
179 | .PRE (rst0) |
---|
180 | ) /* synthesis syn_useioff = 1 */; |
---|
181 | |
---|
182 | // CAS: = 1 at reset |
---|
183 | (* IOB = "FORCE" *) FDCPE u_ff_cas_n |
---|
184 | ( |
---|
185 | .Q (ddr_cas_n), |
---|
186 | .C (clk0), |
---|
187 | .CE (1'b1), |
---|
188 | .CLR (1'b0), |
---|
189 | .D (cas_n_mux), |
---|
190 | .PRE (rst0) |
---|
191 | ) /* synthesis syn_useioff = 1 */; |
---|
192 | |
---|
193 | // WE: = 1 at reset |
---|
194 | (* IOB = "FORCE" *) FDCPE u_ff_we_n |
---|
195 | ( |
---|
196 | .Q (ddr_we_n), |
---|
197 | .C (clk0), |
---|
198 | .CE (1'b1), |
---|
199 | .CLR (1'b0), |
---|
200 | .D (we_n_mux), |
---|
201 | .PRE (rst0) |
---|
202 | ) /* synthesis syn_useioff = 1 */; |
---|
203 | |
---|
204 | // CKE: = 0 at reset |
---|
205 | genvar cke_i; |
---|
206 | generate |
---|
207 | for (cke_i = 0; cke_i < CKE_WIDTH; cke_i = cke_i + 1) begin: gen_cke |
---|
208 | (* IOB = "FORCE" *) (* S = "TRUE" *) FDCPE u_ff_cke |
---|
209 | ( |
---|
210 | .Q (ddr_cke[cke_i]), |
---|
211 | .C (clk0), |
---|
212 | .CE (1'b1), |
---|
213 | .CLR (rst0), |
---|
214 | .D (phy_init_cke[cke_i]), |
---|
215 | .PRE (1'b0) |
---|
216 | ) /* synthesis syn_useioff = 1 */; |
---|
217 | end |
---|
218 | endgenerate |
---|
219 | |
---|
220 | // chip select: = 1 at reset |
---|
221 | // For unbuffered dimms the loading will be high. The chip select |
---|
222 | // can be asserted early if the loading is very high. The |
---|
223 | // code as is uses clock 0. If needed clock 270 can be used to |
---|
224 | // toggle chip select 1/4 clock cycle early. The code has |
---|
225 | // the clock 90 input for the early assertion of chip select. |
---|
226 | |
---|
227 | genvar cs_i; |
---|
228 | generate |
---|
229 | for(cs_i = 0; cs_i < CS_WIDTH; cs_i = cs_i + 1) begin: gen_cs_n |
---|
230 | if(TWO_T_TIME_EN) begin |
---|
231 | (* IOB = "FORCE" *) (* S = "TRUE" *) FDCPE u_ff_cs_n |
---|
232 | ( |
---|
233 | .Q (ddr_cs_n[cs_i]), |
---|
234 | .C (clk0), |
---|
235 | .CE (1'b1), |
---|
236 | .CLR (1'b0), |
---|
237 | .D (cs_n_mux[(cs_i*CS_NUM)/CS_WIDTH]), |
---|
238 | .PRE (rst0) |
---|
239 | ) /* synthesis syn_useioff = 1 */; |
---|
240 | end else begin // if (TWO_T_TIME_EN) |
---|
241 | (* IOB = "FORCE" *) (* S = "TRUE" *) FDCPE u_ff_cs_n |
---|
242 | ( |
---|
243 | .Q (ddr_cs_n[cs_i]), |
---|
244 | .C (clk0), |
---|
245 | .CE (1'b1), |
---|
246 | .CLR (1'b0), |
---|
247 | .D (cs_n_mux[(cs_i*CS_NUM)/CS_WIDTH]), |
---|
248 | .PRE (rst0) |
---|
249 | ) /* synthesis syn_useioff = 1 */; |
---|
250 | end // else: !if(TWO_T_TIME_EN) |
---|
251 | end |
---|
252 | endgenerate |
---|
253 | |
---|
254 | // address: = X at reset |
---|
255 | genvar addr_i; |
---|
256 | generate |
---|
257 | for (addr_i = 0; addr_i < ROW_WIDTH; addr_i = addr_i + 1) begin: gen_addr |
---|
258 | (* IOB = "FORCE" *) FDCPE u_ff_addr |
---|
259 | ( |
---|
260 | .Q (ddr_addr[addr_i]), |
---|
261 | .C (clk0), |
---|
262 | .CE (1'b1), |
---|
263 | .CLR (1'b0), |
---|
264 | .D (addr_mux[addr_i]), |
---|
265 | .PRE (1'b0) |
---|
266 | ) /* synthesis syn_useioff = 1 */; |
---|
267 | end |
---|
268 | endgenerate |
---|
269 | |
---|
270 | // bank address = X at reset |
---|
271 | genvar ba_i; |
---|
272 | generate |
---|
273 | for (ba_i = 0; ba_i < BANK_WIDTH; ba_i = ba_i + 1) begin: gen_ba |
---|
274 | (* IOB = "FORCE" *) FDCPE u_ff_ba |
---|
275 | ( |
---|
276 | .Q (ddr_ba[ba_i]), |
---|
277 | .C (clk0), |
---|
278 | .CE (1'b1), |
---|
279 | .CLR (1'b0), |
---|
280 | .D (ba_mux[ba_i]), |
---|
281 | .PRE (1'b0) |
---|
282 | ) /* synthesis syn_useioff = 1 */; |
---|
283 | end |
---|
284 | endgenerate |
---|
285 | |
---|
286 | // ODT control = 0 at reset |
---|
287 | genvar odt_i; |
---|
288 | generate |
---|
289 | if (DDR_TYPE > 0) begin: gen_odt_ddr2 |
---|
290 | for (odt_i = 0; odt_i < ODT_WIDTH; odt_i = odt_i + 1) begin: gen_odt |
---|
291 | (* IOB = "FORCE" *) (* S = "TRUE" *) FDCPE u_ff_odt |
---|
292 | ( |
---|
293 | .Q (ddr_odt[odt_i]), |
---|
294 | .C (clk0), |
---|
295 | .CE (1'b1), |
---|
296 | .CLR (rst0), |
---|
297 | .D (odt[(odt_i*CS_NUM)/ODT_WIDTH]), |
---|
298 | .PRE (1'b0) |
---|
299 | ) /* synthesis syn_useioff = 1 */; |
---|
300 | end |
---|
301 | end |
---|
302 | endgenerate |
---|
303 | |
---|
304 | endmodule |
---|