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