| 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_top.v
|
| 46 |
|
|
// /___/ /\ Date Last Modified: $Date: 2009/01/15 14:22:14 $
|
| 47 |
|
|
// \ \ / \ Date Created: Wed Aug 16 2006
|
| 48 |
|
|
// \___\/\___\
|
| 49 |
|
|
//
|
| 50 |
|
|
//Device: Virtex-5
|
| 51 |
|
|
//Design Name: DDR2
|
| 52 |
|
|
//Purpose:
|
| 53 |
|
|
// System level module. This level contains just the memory controller.
|
| 54 |
|
|
// This level will be intiantated when the user wants to remove the
|
| 55 |
|
|
// synthesizable test bench, IDELAY control block and the clock
|
| 56 |
|
|
// generation modules.
|
| 57 |
|
|
//Reference:
|
| 58 |
|
|
//Revision History:
|
| 59 |
|
|
// Rev 1.1 - Parameter USE_DM_PORT added. PK. 6/25/08
|
| 60 |
|
|
// Rev 1.2 - Parameter HIGH_PERFORMANCE_MODE added. PK. 7/10/08
|
| 61 |
|
|
// Rev 1.3 - Parameter IODELAY_GRP added. PK. 11/27/08
|
| 62 |
|
|
//*****************************************************************************
|
| 63 |
|
|
|
| 64 |
|
|
`timescale 1ns/1ps
|
| 65 |
|
|
|
| 66 |
|
|
module ddr2_top #
|
| 67 |
|
|
(
|
| 68 |
|
|
// Following parameters are for 72-bit RDIMM design (for ML561 Reference
|
| 69 |
|
|
// board design). Actual values may be different. Actual parameters values
|
| 70 |
|
|
// are passed from design top module ddr2_mig module. Please refer to
|
| 71 |
|
|
// the ddr2_mig module for actual values.
|
| 72 |
|
|
parameter BANK_WIDTH = 2, // # of memory bank addr bits
|
| 73 |
|
|
parameter CKE_WIDTH = 1, // # of memory clock enable outputs
|
| 74 |
|
|
parameter CLK_WIDTH = 1, // # of clock outputs
|
| 75 |
|
|
parameter COL_WIDTH = 10, // # of memory column bits
|
| 76 |
|
|
parameter CS_NUM = 1, // # of separate memory chip selects
|
| 77 |
|
|
parameter CS_BITS = 0, // set to log2(CS_NUM) (rounded up)
|
| 78 |
|
|
parameter CS_WIDTH = 1, // # of total memory chip selects
|
| 79 |
|
|
parameter USE_DM_PORT = 1, // enable Data Mask (=1 enable)
|
| 80 |
|
|
parameter DM_WIDTH = 9, // # of data mask bits
|
| 81 |
|
|
parameter DQ_WIDTH = 72, // # of data width
|
| 82 |
|
|
parameter DQ_BITS = 7, // set to log2(DQS_WIDTH*DQ_PER_DQS)
|
| 83 |
|
|
parameter DQ_PER_DQS = 8, // # of DQ data bits per strobe
|
| 84 |
|
|
parameter DQS_WIDTH = 9, // # of DQS strobes
|
| 85 |
|
|
parameter DQS_BITS = 4, // set to log2(DQS_WIDTH)
|
| 86 |
|
|
parameter HIGH_PERFORMANCE_MODE = "TRUE", // IODELAY Performance Mode
|
| 87 |
|
|
parameter IODELAY_GRP = "IODELAY_MIG", // IODELAY Group Name
|
| 88 |
|
|
parameter ODT_WIDTH = 1, // # of memory on-die term enables
|
| 89 |
|
|
parameter ROW_WIDTH = 14, // # of memory row & # of addr bits
|
| 90 |
|
|
parameter APPDATA_WIDTH = 144, // # of usr read/write data bus bits
|
| 91 |
|
|
parameter ADDITIVE_LAT = 0, // additive write latency
|
| 92 |
|
|
parameter BURST_LEN = 4, // burst length (in double words)
|
| 93 |
|
|
parameter BURST_TYPE = 0, // burst type (=0 seq; =1 interlved)
|
| 94 |
|
|
parameter CAS_LAT = 5, // CAS latency
|
| 95 |
|
|
parameter ECC_ENABLE = 0, // enable ECC (=1 enable)
|
| 96 |
|
|
parameter ODT_TYPE = 1, // ODT (=0(none),=1(75),=2(150),=3(50))
|
| 97 |
|
|
parameter MULTI_BANK_EN = 1, // enable bank management
|
| 98 |
|
|
parameter TWO_T_TIME_EN = 0, // 2t timing for unbuffered dimms
|
| 99 |
|
|
parameter REDUCE_DRV = 0, // reduced strength mem I/O (=1 yes)
|
| 100 |
|
|
parameter REG_ENABLE = 1, // registered addr/ctrl (=1 yes)
|
| 101 |
|
|
parameter TREFI_NS = 7800, // auto refresh interval (ns)
|
| 102 |
|
|
parameter TRAS = 40000, // active->precharge delay
|
| 103 |
|
|
parameter TRCD = 15000, // active->read/write delay
|
| 104 |
|
|
parameter TRFC = 105000, // ref->ref, ref->active delay
|
| 105 |
|
|
parameter TRP = 15000, // precharge->command delay
|
| 106 |
|
|
parameter TRTP = 7500, // read->precharge delay
|
| 107 |
|
|
parameter TWR = 15000, // used to determine wr->prech
|
| 108 |
|
|
parameter TWTR = 10000, // write->read delay
|
| 109 |
|
|
parameter CLK_PERIOD = 3000, // Core/Mem clk period (in ps)
|
| 110 |
|
|
parameter SIM_ONLY = 0, // = 1 to skip power up delay
|
| 111 |
|
|
parameter DEBUG_EN = 0, // Enable debug signals/controls
|
| 112 |
|
|
parameter FPGA_SPEED_GRADE = 2 // FPGA Speed Grade
|
| 113 |
|
|
)
|
| 114 |
|
|
(
|
| 115 |
|
|
input clk0,
|
| 116 |
|
|
input usr_clk, // jb
|
| 117 |
|
|
input clk90,
|
| 118 |
|
|
input clkdiv0,
|
| 119 |
|
|
input rst0,
|
| 120 |
|
|
input rst90,
|
| 121 |
|
|
input rstdiv0,
|
| 122 |
|
|
input [2:0] app_af_cmd,
|
| 123 |
|
|
input [30:0] app_af_addr,
|
| 124 |
|
|
input app_af_wren,
|
| 125 |
|
|
input app_wdf_wren,
|
| 126 |
|
|
input [APPDATA_WIDTH-1:0] app_wdf_data,
|
| 127 |
|
|
input [(APPDATA_WIDTH/8)-1:0] app_wdf_mask_data,
|
| 128 |
|
|
output app_af_afull,
|
| 129 |
|
|
output app_wdf_afull,
|
| 130 |
|
|
output rd_data_valid,
|
| 131 |
|
|
output [APPDATA_WIDTH-1:0] rd_data_fifo_out,
|
| 132 |
|
|
output [1:0] rd_ecc_error,
|
| 133 |
|
|
output phy_init_done,
|
| 134 |
|
|
output [CLK_WIDTH-1:0] ddr2_ck,
|
| 135 |
|
|
output [CLK_WIDTH-1:0] ddr2_ck_n,
|
| 136 |
|
|
output [ROW_WIDTH-1:0] ddr2_a,
|
| 137 |
|
|
output [BANK_WIDTH-1:0] ddr2_ba,
|
| 138 |
|
|
output ddr2_ras_n,
|
| 139 |
|
|
output ddr2_cas_n,
|
| 140 |
|
|
output ddr2_we_n,
|
| 141 |
|
|
output [CS_WIDTH-1:0] ddr2_cs_n,
|
| 142 |
|
|
output [CKE_WIDTH-1:0] ddr2_cke,
|
| 143 |
|
|
output [ODT_WIDTH-1:0] ddr2_odt,
|
| 144 |
|
|
output [DM_WIDTH-1:0] ddr2_dm,
|
| 145 |
|
|
inout [DQS_WIDTH-1:0] ddr2_dqs,
|
| 146 |
|
|
inout [DQS_WIDTH-1:0] ddr2_dqs_n,
|
| 147 |
|
|
inout [DQ_WIDTH-1:0] ddr2_dq,
|
| 148 |
|
|
// Debug signals (optional use)
|
| 149 |
|
|
input dbg_idel_up_all,
|
| 150 |
|
|
input dbg_idel_down_all,
|
| 151 |
|
|
input dbg_idel_up_dq,
|
| 152 |
|
|
input dbg_idel_down_dq,
|
| 153 |
|
|
input dbg_idel_up_dqs,
|
| 154 |
|
|
input dbg_idel_down_dqs,
|
| 155 |
|
|
input dbg_idel_up_gate,
|
| 156 |
|
|
input dbg_idel_down_gate,
|
| 157 |
|
|
input [DQ_BITS-1:0] dbg_sel_idel_dq,
|
| 158 |
|
|
input dbg_sel_all_idel_dq,
|
| 159 |
|
|
input [DQS_BITS:0] dbg_sel_idel_dqs,
|
| 160 |
|
|
input dbg_sel_all_idel_dqs,
|
| 161 |
|
|
input [DQS_BITS:0] dbg_sel_idel_gate,
|
| 162 |
|
|
input dbg_sel_all_idel_gate,
|
| 163 |
|
|
output [3:0] dbg_calib_done,
|
| 164 |
|
|
output [3:0] dbg_calib_err,
|
| 165 |
|
|
output [(6*DQ_WIDTH)-1:0] dbg_calib_dq_tap_cnt,
|
| 166 |
|
|
output [(6*DQS_WIDTH)-1:0] dbg_calib_dqs_tap_cnt,
|
| 167 |
|
|
output [(6*DQS_WIDTH)-1:0] dbg_calib_gate_tap_cnt,
|
| 168 |
|
|
output [DQS_WIDTH-1:0] dbg_calib_rd_data_sel,
|
| 169 |
|
|
output [(5*DQS_WIDTH)-1:0] dbg_calib_rden_dly,
|
| 170 |
|
|
output [(5*DQS_WIDTH)-1:0] dbg_calib_gate_dly
|
| 171 |
|
|
);
|
| 172 |
|
|
|
| 173 |
|
|
// memory initialization/control logic
|
| 174 |
|
|
ddr2_mem_if_top #
|
| 175 |
|
|
(
|
| 176 |
|
|
.BANK_WIDTH (BANK_WIDTH),
|
| 177 |
|
|
.CKE_WIDTH (CKE_WIDTH),
|
| 178 |
|
|
.CLK_WIDTH (CLK_WIDTH),
|
| 179 |
|
|
.COL_WIDTH (COL_WIDTH),
|
| 180 |
|
|
.CS_BITS (CS_BITS),
|
| 181 |
|
|
.CS_NUM (CS_NUM),
|
| 182 |
|
|
.CS_WIDTH (CS_WIDTH),
|
| 183 |
|
|
.USE_DM_PORT (USE_DM_PORT),
|
| 184 |
|
|
.DM_WIDTH (DM_WIDTH),
|
| 185 |
|
|
.DQ_WIDTH (DQ_WIDTH),
|
| 186 |
|
|
.DQ_BITS (DQ_BITS),
|
| 187 |
|
|
.DQ_PER_DQS (DQ_PER_DQS),
|
| 188 |
|
|
.DQS_BITS (DQS_BITS),
|
| 189 |
|
|
.DQS_WIDTH (DQS_WIDTH),
|
| 190 |
|
|
.HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE),
|
| 191 |
|
|
.IODELAY_GRP (IODELAY_GRP),
|
| 192 |
|
|
.ODT_WIDTH (ODT_WIDTH),
|
| 193 |
|
|
.ROW_WIDTH (ROW_WIDTH),
|
| 194 |
|
|
.APPDATA_WIDTH (APPDATA_WIDTH),
|
| 195 |
|
|
.ADDITIVE_LAT (ADDITIVE_LAT),
|
| 196 |
|
|
.BURST_LEN (BURST_LEN),
|
| 197 |
|
|
.BURST_TYPE (BURST_TYPE),
|
| 198 |
|
|
.CAS_LAT (CAS_LAT),
|
| 199 |
|
|
.ECC_ENABLE (ECC_ENABLE),
|
| 200 |
|
|
.MULTI_BANK_EN (MULTI_BANK_EN),
|
| 201 |
|
|
.TWO_T_TIME_EN (TWO_T_TIME_EN),
|
| 202 |
|
|
.ODT_TYPE (ODT_TYPE),
|
| 203 |
|
|
.DDR_TYPE (1),
|
| 204 |
|
|
.REDUCE_DRV (REDUCE_DRV),
|
| 205 |
|
|
.REG_ENABLE (REG_ENABLE),
|
| 206 |
|
|
.TREFI_NS (TREFI_NS),
|
| 207 |
|
|
.TRAS (TRAS),
|
| 208 |
|
|
.TRCD (TRCD),
|
| 209 |
|
|
.TRFC (TRFC),
|
| 210 |
|
|
.TRP (TRP),
|
| 211 |
|
|
.TRTP (TRTP),
|
| 212 |
|
|
.TWR (TWR),
|
| 213 |
|
|
.TWTR (TWTR),
|
| 214 |
|
|
.CLK_PERIOD (CLK_PERIOD),
|
| 215 |
|
|
.SIM_ONLY (SIM_ONLY),
|
| 216 |
|
|
.DEBUG_EN (DEBUG_EN),
|
| 217 |
|
|
.FPGA_SPEED_GRADE (FPGA_SPEED_GRADE)
|
| 218 |
|
|
)
|
| 219 |
|
|
u_mem_if_top
|
| 220 |
|
|
(
|
| 221 |
|
|
.clk0 (clk0),
|
| 222 |
|
|
.usr_clk (usr_clk), // jb
|
| 223 |
|
|
.clk90 (clk90),
|
| 224 |
|
|
.clkdiv0 (clkdiv0),
|
| 225 |
|
|
.rst0 (rst0),
|
| 226 |
|
|
.rst90 (rst90),
|
| 227 |
|
|
.rstdiv0 (rstdiv0),
|
| 228 |
|
|
.app_af_cmd (app_af_cmd),
|
| 229 |
|
|
.app_af_addr (app_af_addr),
|
| 230 |
|
|
.app_af_wren (app_af_wren),
|
| 231 |
|
|
.app_wdf_wren (app_wdf_wren),
|
| 232 |
|
|
.app_wdf_data (app_wdf_data),
|
| 233 |
|
|
.app_wdf_mask_data (app_wdf_mask_data),
|
| 234 |
|
|
.app_af_afull (app_af_afull),
|
| 235 |
|
|
.app_wdf_afull (app_wdf_afull),
|
| 236 |
|
|
.rd_data_valid (rd_data_valid),
|
| 237 |
|
|
.rd_data_fifo_out (rd_data_fifo_out),
|
| 238 |
|
|
.rd_ecc_error (rd_ecc_error),
|
| 239 |
|
|
.phy_init_done (phy_init_done),
|
| 240 |
|
|
.ddr_ck (ddr2_ck),
|
| 241 |
|
|
.ddr_ck_n (ddr2_ck_n),
|
| 242 |
|
|
.ddr_addr (ddr2_a),
|
| 243 |
|
|
.ddr_ba (ddr2_ba),
|
| 244 |
|
|
.ddr_ras_n (ddr2_ras_n),
|
| 245 |
|
|
.ddr_cas_n (ddr2_cas_n),
|
| 246 |
|
|
.ddr_we_n (ddr2_we_n),
|
| 247 |
|
|
.ddr_cs_n (ddr2_cs_n),
|
| 248 |
|
|
.ddr_cke (ddr2_cke),
|
| 249 |
|
|
.ddr_odt (ddr2_odt),
|
| 250 |
|
|
.ddr_dm (ddr2_dm),
|
| 251 |
|
|
.ddr_dqs (ddr2_dqs),
|
| 252 |
|
|
.ddr_dqs_n (ddr2_dqs_n),
|
| 253 |
|
|
.ddr_dq (ddr2_dq),
|
| 254 |
|
|
.dbg_idel_up_all (dbg_idel_up_all),
|
| 255 |
|
|
.dbg_idel_down_all (dbg_idel_down_all),
|
| 256 |
|
|
.dbg_idel_up_dq (dbg_idel_up_dq),
|
| 257 |
|
|
.dbg_idel_down_dq (dbg_idel_down_dq),
|
| 258 |
|
|
.dbg_idel_up_dqs (dbg_idel_up_dqs),
|
| 259 |
|
|
.dbg_idel_down_dqs (dbg_idel_down_dqs),
|
| 260 |
|
|
.dbg_idel_up_gate (dbg_idel_up_gate),
|
| 261 |
|
|
.dbg_idel_down_gate (dbg_idel_down_gate),
|
| 262 |
|
|
.dbg_sel_idel_dq (dbg_sel_idel_dq),
|
| 263 |
|
|
.dbg_sel_all_idel_dq (dbg_sel_all_idel_dq),
|
| 264 |
|
|
.dbg_sel_idel_dqs (dbg_sel_idel_dqs),
|
| 265 |
|
|
.dbg_sel_all_idel_dqs (dbg_sel_all_idel_dqs),
|
| 266 |
|
|
.dbg_sel_idel_gate (dbg_sel_idel_gate),
|
| 267 |
|
|
.dbg_sel_all_idel_gate (dbg_sel_all_idel_gate),
|
| 268 |
|
|
.dbg_calib_done (dbg_calib_done),
|
| 269 |
|
|
.dbg_calib_err (dbg_calib_err),
|
| 270 |
|
|
.dbg_calib_dq_tap_cnt (dbg_calib_dq_tap_cnt),
|
| 271 |
|
|
.dbg_calib_dqs_tap_cnt (dbg_calib_dqs_tap_cnt),
|
| 272 |
|
|
.dbg_calib_gate_tap_cnt (dbg_calib_gate_tap_cnt),
|
| 273 |
|
|
.dbg_calib_rd_data_sel (dbg_calib_rd_data_sel),
|
| 274 |
|
|
.dbg_calib_rden_dly (dbg_calib_rden_dly),
|
| 275 |
|
|
.dbg_calib_gate_dly (dbg_calib_gate_dly)
|
| 276 |
|
|
);
|
| 277 |
|
|
|
| 278 |
|
|
endmodule
|