[10] | 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_top.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 | // 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 dram module. Please refer to |
---|
| 71 | // the dram 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 clk90, |
---|
| 117 | input clkdiv0, |
---|
| 118 | input rst0, |
---|
| 119 | input rst90, |
---|
| 120 | input rstdiv0, |
---|
| 121 | input [2:0] app_af_cmd, |
---|
| 122 | input [30:0] app_af_addr, |
---|
| 123 | input app_af_wren, |
---|
| 124 | input app_wdf_wren, |
---|
| 125 | input [APPDATA_WIDTH-1:0] app_wdf_data, |
---|
| 126 | input [(APPDATA_WIDTH/8)-1:0] app_wdf_mask_data, |
---|
| 127 | output app_af_afull, |
---|
| 128 | output app_wdf_afull, |
---|
| 129 | output rd_data_valid, |
---|
| 130 | output [APPDATA_WIDTH-1:0] rd_data_fifo_out, |
---|
| 131 | output [1:0] rd_ecc_error, |
---|
| 132 | output phy_init_done, |
---|
| 133 | output [CLK_WIDTH-1:0] ddr2_ck, |
---|
| 134 | output [CLK_WIDTH-1:0] ddr2_ck_n, |
---|
| 135 | output [ROW_WIDTH-1:0] ddr2_a, |
---|
| 136 | output [BANK_WIDTH-1:0] ddr2_ba, |
---|
| 137 | output ddr2_ras_n, |
---|
| 138 | output ddr2_cas_n, |
---|
| 139 | output ddr2_we_n, |
---|
| 140 | output [CS_WIDTH-1:0] ddr2_cs_n, |
---|
| 141 | output [CKE_WIDTH-1:0] ddr2_cke, |
---|
| 142 | output [ODT_WIDTH-1:0] ddr2_odt, |
---|
| 143 | output [DM_WIDTH-1:0] ddr2_dm, |
---|
| 144 | inout [DQS_WIDTH-1:0] ddr2_dqs, |
---|
| 145 | inout [DQS_WIDTH-1:0] ddr2_dqs_n, |
---|
| 146 | inout [DQ_WIDTH-1:0] ddr2_dq, |
---|
| 147 | // Debug signals (optional use) |
---|
| 148 | input dbg_idel_up_all, |
---|
| 149 | input dbg_idel_down_all, |
---|
| 150 | input dbg_idel_up_dq, |
---|
| 151 | input dbg_idel_down_dq, |
---|
| 152 | input dbg_idel_up_dqs, |
---|
| 153 | input dbg_idel_down_dqs, |
---|
| 154 | input dbg_idel_up_gate, |
---|
| 155 | input dbg_idel_down_gate, |
---|
| 156 | input [DQ_BITS-1:0] dbg_sel_idel_dq, |
---|
| 157 | input dbg_sel_all_idel_dq, |
---|
| 158 | input [DQS_BITS:0] dbg_sel_idel_dqs, |
---|
| 159 | input dbg_sel_all_idel_dqs, |
---|
| 160 | input [DQS_BITS:0] dbg_sel_idel_gate, |
---|
| 161 | input dbg_sel_all_idel_gate, |
---|
| 162 | output [3:0] dbg_calib_done, |
---|
| 163 | output [3:0] dbg_calib_err, |
---|
| 164 | output [(6*DQ_WIDTH)-1:0] dbg_calib_dq_tap_cnt, |
---|
| 165 | output [(6*DQS_WIDTH)-1:0] dbg_calib_dqs_tap_cnt, |
---|
| 166 | output [(6*DQS_WIDTH)-1:0] dbg_calib_gate_tap_cnt, |
---|
| 167 | output [DQS_WIDTH-1:0] dbg_calib_rd_data_sel, |
---|
| 168 | output [(5*DQS_WIDTH)-1:0] dbg_calib_rden_dly, |
---|
| 169 | output [(5*DQS_WIDTH)-1:0] dbg_calib_gate_dly |
---|
| 170 | ); |
---|
| 171 | |
---|
| 172 | // memory initialization/control logic |
---|
| 173 | ddr2_mem_if_top # |
---|
| 174 | ( |
---|
| 175 | .BANK_WIDTH (BANK_WIDTH), |
---|
| 176 | .CKE_WIDTH (CKE_WIDTH), |
---|
| 177 | .CLK_WIDTH (CLK_WIDTH), |
---|
| 178 | .COL_WIDTH (COL_WIDTH), |
---|
| 179 | .CS_BITS (CS_BITS), |
---|
| 180 | .CS_NUM (CS_NUM), |
---|
| 181 | .CS_WIDTH (CS_WIDTH), |
---|
| 182 | .USE_DM_PORT (USE_DM_PORT), |
---|
| 183 | .DM_WIDTH (DM_WIDTH), |
---|
| 184 | .DQ_WIDTH (DQ_WIDTH), |
---|
| 185 | .DQ_BITS (DQ_BITS), |
---|
| 186 | .DQ_PER_DQS (DQ_PER_DQS), |
---|
| 187 | .DQS_BITS (DQS_BITS), |
---|
| 188 | .DQS_WIDTH (DQS_WIDTH), |
---|
| 189 | .HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE), |
---|
| 190 | .IODELAY_GRP (IODELAY_GRP), |
---|
| 191 | .ODT_WIDTH (ODT_WIDTH), |
---|
| 192 | .ROW_WIDTH (ROW_WIDTH), |
---|
| 193 | .APPDATA_WIDTH (APPDATA_WIDTH), |
---|
| 194 | .ADDITIVE_LAT (ADDITIVE_LAT), |
---|
| 195 | .BURST_LEN (BURST_LEN), |
---|
| 196 | .BURST_TYPE (BURST_TYPE), |
---|
| 197 | .CAS_LAT (CAS_LAT), |
---|
| 198 | .ECC_ENABLE (ECC_ENABLE), |
---|
| 199 | .MULTI_BANK_EN (MULTI_BANK_EN), |
---|
| 200 | .TWO_T_TIME_EN (TWO_T_TIME_EN), |
---|
| 201 | .ODT_TYPE (ODT_TYPE), |
---|
| 202 | .DDR_TYPE (1), |
---|
| 203 | .REDUCE_DRV (REDUCE_DRV), |
---|
| 204 | .REG_ENABLE (REG_ENABLE), |
---|
| 205 | .TREFI_NS (TREFI_NS), |
---|
| 206 | .TRAS (TRAS), |
---|
| 207 | .TRCD (TRCD), |
---|
| 208 | .TRFC (TRFC), |
---|
| 209 | .TRP (TRP), |
---|
| 210 | .TRTP (TRTP), |
---|
| 211 | .TWR (TWR), |
---|
| 212 | .TWTR (TWTR), |
---|
| 213 | .CLK_PERIOD (CLK_PERIOD), |
---|
| 214 | .SIM_ONLY (SIM_ONLY), |
---|
| 215 | .DEBUG_EN (DEBUG_EN), |
---|
| 216 | .FPGA_SPEED_GRADE (FPGA_SPEED_GRADE) |
---|
| 217 | ) |
---|
| 218 | u_mem_if_top |
---|
| 219 | ( |
---|
| 220 | .clk0 (clk0), |
---|
| 221 | .clk90 (clk90), |
---|
| 222 | .clkdiv0 (clkdiv0), |
---|
| 223 | .rst0 (rst0), |
---|
| 224 | .rst90 (rst90), |
---|
| 225 | .rstdiv0 (rstdiv0), |
---|
| 226 | .app_af_cmd (app_af_cmd), |
---|
| 227 | .app_af_addr (app_af_addr), |
---|
| 228 | .app_af_wren (app_af_wren), |
---|
| 229 | .app_wdf_wren (app_wdf_wren), |
---|
| 230 | .app_wdf_data (app_wdf_data), |
---|
| 231 | .app_wdf_mask_data (app_wdf_mask_data), |
---|
| 232 | .app_af_afull (app_af_afull), |
---|
| 233 | .app_wdf_afull (app_wdf_afull), |
---|
| 234 | .rd_data_valid (rd_data_valid), |
---|
| 235 | .rd_data_fifo_out (rd_data_fifo_out), |
---|
| 236 | .rd_ecc_error (rd_ecc_error), |
---|
| 237 | .phy_init_done (phy_init_done), |
---|
| 238 | .ddr_ck (ddr2_ck), |
---|
| 239 | .ddr_ck_n (ddr2_ck_n), |
---|
| 240 | .ddr_addr (ddr2_a), |
---|
| 241 | .ddr_ba (ddr2_ba), |
---|
| 242 | .ddr_ras_n (ddr2_ras_n), |
---|
| 243 | .ddr_cas_n (ddr2_cas_n), |
---|
| 244 | .ddr_we_n (ddr2_we_n), |
---|
| 245 | .ddr_cs_n (ddr2_cs_n), |
---|
| 246 | .ddr_cke (ddr2_cke), |
---|
| 247 | .ddr_odt (ddr2_odt), |
---|
| 248 | .ddr_dm (ddr2_dm), |
---|
| 249 | .ddr_dqs (ddr2_dqs), |
---|
| 250 | .ddr_dqs_n (ddr2_dqs_n), |
---|
| 251 | .ddr_dq (ddr2_dq), |
---|
| 252 | .dbg_idel_up_all (dbg_idel_up_all), |
---|
| 253 | .dbg_idel_down_all (dbg_idel_down_all), |
---|
| 254 | .dbg_idel_up_dq (dbg_idel_up_dq), |
---|
| 255 | .dbg_idel_down_dq (dbg_idel_down_dq), |
---|
| 256 | .dbg_idel_up_dqs (dbg_idel_up_dqs), |
---|
| 257 | .dbg_idel_down_dqs (dbg_idel_down_dqs), |
---|
| 258 | .dbg_idel_up_gate (dbg_idel_up_gate), |
---|
| 259 | .dbg_idel_down_gate (dbg_idel_down_gate), |
---|
| 260 | .dbg_sel_idel_dq (dbg_sel_idel_dq), |
---|
| 261 | .dbg_sel_all_idel_dq (dbg_sel_all_idel_dq), |
---|
| 262 | .dbg_sel_idel_dqs (dbg_sel_idel_dqs), |
---|
| 263 | .dbg_sel_all_idel_dqs (dbg_sel_all_idel_dqs), |
---|
| 264 | .dbg_sel_idel_gate (dbg_sel_idel_gate), |
---|
| 265 | .dbg_sel_all_idel_gate (dbg_sel_all_idel_gate), |
---|
| 266 | .dbg_calib_done (dbg_calib_done), |
---|
| 267 | .dbg_calib_err (dbg_calib_err), |
---|
| 268 | .dbg_calib_dq_tap_cnt (dbg_calib_dq_tap_cnt), |
---|
| 269 | .dbg_calib_dqs_tap_cnt (dbg_calib_dqs_tap_cnt), |
---|
| 270 | .dbg_calib_gate_tap_cnt (dbg_calib_gate_tap_cnt), |
---|
| 271 | .dbg_calib_rd_data_sel (dbg_calib_rd_data_sel), |
---|
| 272 | .dbg_calib_rden_dly (dbg_calib_rden_dly), |
---|
| 273 | .dbg_calib_gate_dly (dbg_calib_gate_dly) |
---|
| 274 | ); |
---|
| 275 | |
---|
| 276 | endmodule |
---|