[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_mem_if_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: DDR/DDR2 |
---|
| 52 | //Purpose: |
---|
| 53 | // Top-level for parameterizable (DDR or DDR2) memory interface |
---|
| 54 | //Reference: |
---|
| 55 | //Revision History: |
---|
| 56 | // Rev 1.1 - Parameter USE_DM_PORT added. PK. 6/25/08 |
---|
| 57 | // Rev 1.2 - Parameter HIGH_PERFORMANCE_MODE added. PK. 7/10/08 |
---|
| 58 | // Rev 1.3 - Parameter CS_BITS added. PK. 10/8/08 |
---|
| 59 | // Rev 1.4 - Parameter IODELAY_GRP added. PK. 11/27/08 |
---|
| 60 | //***************************************************************************** |
---|
| 61 | |
---|
| 62 | `timescale 1ns/1ps |
---|
| 63 | |
---|
| 64 | module ddr2_mem_if_top # |
---|
| 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 CLK_WIDTH = 1, |
---|
| 73 | parameter COL_WIDTH = 10, |
---|
| 74 | parameter CS_BITS = 0, |
---|
| 75 | parameter CS_NUM = 1, |
---|
| 76 | parameter CS_WIDTH = 1, |
---|
| 77 | parameter USE_DM_PORT = 1, |
---|
| 78 | parameter DM_WIDTH = 9, |
---|
| 79 | parameter DQ_WIDTH = 72, |
---|
| 80 | parameter DQ_BITS = 7, |
---|
| 81 | parameter DQ_PER_DQS = 8, |
---|
| 82 | parameter DQS_BITS = 4, |
---|
| 83 | parameter DQS_WIDTH = 9, |
---|
| 84 | parameter HIGH_PERFORMANCE_MODE = "TRUE", |
---|
| 85 | parameter IODELAY_GRP = "IODELAY_MIG", |
---|
| 86 | parameter ODT_WIDTH = 1, |
---|
| 87 | parameter ROW_WIDTH = 14, |
---|
| 88 | parameter APPDATA_WIDTH = 144, |
---|
| 89 | parameter ADDITIVE_LAT = 0, |
---|
| 90 | parameter BURST_LEN = 4, |
---|
| 91 | parameter BURST_TYPE = 0, |
---|
| 92 | parameter CAS_LAT = 5, |
---|
| 93 | parameter ECC_ENABLE = 0, |
---|
| 94 | parameter MULTI_BANK_EN = 1, |
---|
| 95 | parameter TWO_T_TIME_EN = 0, |
---|
| 96 | parameter ODT_TYPE = 1, |
---|
| 97 | parameter DDR_TYPE = 1, |
---|
| 98 | parameter REDUCE_DRV = 0, |
---|
| 99 | parameter REG_ENABLE = 1, |
---|
| 100 | parameter TREFI_NS = 7800, |
---|
| 101 | parameter TRAS = 40000, |
---|
| 102 | parameter TRCD = 15000, |
---|
| 103 | parameter TRFC = 105000, |
---|
| 104 | parameter TRP = 15000, |
---|
| 105 | parameter TRTP = 7500, |
---|
| 106 | parameter TWR = 15000, |
---|
| 107 | parameter TWTR = 10000, |
---|
| 108 | parameter CLK_PERIOD = 3000, |
---|
| 109 | parameter SIM_ONLY = 0, |
---|
| 110 | parameter DEBUG_EN = 0, |
---|
| 111 | parameter FPGA_SPEED_GRADE = 2 |
---|
| 112 | ) |
---|
| 113 | ( |
---|
| 114 | input clk0, |
---|
| 115 | input clk90, |
---|
| 116 | input clkdiv0, |
---|
| 117 | input rst0, |
---|
| 118 | input rst90, |
---|
| 119 | input rstdiv0, |
---|
| 120 | input [2:0] app_af_cmd, |
---|
| 121 | input [30:0] app_af_addr, |
---|
| 122 | input app_af_wren, |
---|
| 123 | input app_wdf_wren, |
---|
| 124 | input [APPDATA_WIDTH-1:0] app_wdf_data, |
---|
| 125 | input [(APPDATA_WIDTH/8)-1:0] app_wdf_mask_data, |
---|
| 126 | output [1:0] rd_ecc_error, |
---|
| 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 phy_init_done, |
---|
| 132 | output [CLK_WIDTH-1:0] ddr_ck, |
---|
| 133 | output [CLK_WIDTH-1:0] ddr_ck_n, |
---|
| 134 | output [ROW_WIDTH-1:0] ddr_addr, |
---|
| 135 | output [BANK_WIDTH-1:0] ddr_ba, |
---|
| 136 | output ddr_ras_n, |
---|
| 137 | output ddr_cas_n, |
---|
| 138 | output ddr_we_n, |
---|
| 139 | output [CS_WIDTH-1:0] ddr_cs_n, |
---|
| 140 | output [CKE_WIDTH-1:0] ddr_cke, |
---|
| 141 | output [ODT_WIDTH-1:0] ddr_odt, |
---|
| 142 | output [DM_WIDTH-1:0] ddr_dm, |
---|
| 143 | inout [DQS_WIDTH-1:0] ddr_dqs, |
---|
| 144 | inout [DQS_WIDTH-1:0] ddr_dqs_n, |
---|
| 145 | inout [DQ_WIDTH-1:0] ddr_dq, |
---|
| 146 | // Debug signals (optional use) |
---|
| 147 | input dbg_idel_up_all, |
---|
| 148 | input dbg_idel_down_all, |
---|
| 149 | input dbg_idel_up_dq, |
---|
| 150 | input dbg_idel_down_dq, |
---|
| 151 | input dbg_idel_up_dqs, |
---|
| 152 | input dbg_idel_down_dqs, |
---|
| 153 | input dbg_idel_up_gate, |
---|
| 154 | input dbg_idel_down_gate, |
---|
| 155 | input [DQ_BITS-1:0] dbg_sel_idel_dq, |
---|
| 156 | input dbg_sel_all_idel_dq, |
---|
| 157 | input [DQS_BITS:0] dbg_sel_idel_dqs, |
---|
| 158 | input dbg_sel_all_idel_dqs, |
---|
| 159 | input [DQS_BITS:0] dbg_sel_idel_gate, |
---|
| 160 | input dbg_sel_all_idel_gate, |
---|
| 161 | output [3:0] dbg_calib_done, |
---|
| 162 | output [3:0] dbg_calib_err, |
---|
| 163 | output [(6*DQ_WIDTH)-1:0] dbg_calib_dq_tap_cnt, |
---|
| 164 | output [(6*DQS_WIDTH)-1:0] dbg_calib_dqs_tap_cnt, |
---|
| 165 | output [(6*DQS_WIDTH)-1:0] dbg_calib_gate_tap_cnt, |
---|
| 166 | output [DQS_WIDTH-1:0] dbg_calib_rd_data_sel, |
---|
| 167 | output [(5*DQS_WIDTH)-1:0] dbg_calib_rden_dly, |
---|
| 168 | output [(5*DQS_WIDTH)-1:0] dbg_calib_gate_dly |
---|
| 169 | ); |
---|
| 170 | |
---|
| 171 | wire [30:0] af_addr; |
---|
| 172 | wire [2:0] af_cmd; |
---|
| 173 | wire af_empty; |
---|
| 174 | wire [ROW_WIDTH-1:0] ctrl_addr; |
---|
| 175 | wire ctrl_af_rden; |
---|
| 176 | wire [BANK_WIDTH-1:0] ctrl_ba; |
---|
| 177 | wire ctrl_cas_n; |
---|
| 178 | wire [CS_NUM-1:0] ctrl_cs_n; |
---|
| 179 | wire ctrl_ras_n; |
---|
| 180 | wire ctrl_rden; |
---|
| 181 | wire ctrl_ref_flag; |
---|
| 182 | wire ctrl_we_n; |
---|
| 183 | wire ctrl_wren; |
---|
| 184 | wire [DQS_WIDTH-1:0] phy_calib_rden; |
---|
| 185 | wire [DQS_WIDTH-1:0] phy_calib_rden_sel; |
---|
| 186 | wire [DQ_WIDTH-1:0] rd_data_fall; |
---|
| 187 | wire [DQ_WIDTH-1:0] rd_data_rise; |
---|
| 188 | wire [(2*DQ_WIDTH)-1:0] wdf_data; |
---|
| 189 | wire [((2*DQ_WIDTH)/8)-1:0] wdf_mask_data; |
---|
| 190 | wire wdf_rden; |
---|
| 191 | |
---|
| 192 | //*************************************************************************** |
---|
| 193 | |
---|
| 194 | ddr2_phy_top # |
---|
| 195 | ( |
---|
| 196 | .BANK_WIDTH (BANK_WIDTH), |
---|
| 197 | .CKE_WIDTH (CKE_WIDTH), |
---|
| 198 | .CLK_WIDTH (CLK_WIDTH), |
---|
| 199 | .COL_WIDTH (COL_WIDTH), |
---|
| 200 | .CS_BITS (CS_BITS), |
---|
| 201 | .CS_NUM (CS_NUM), |
---|
| 202 | .CS_WIDTH (CS_WIDTH), |
---|
| 203 | .USE_DM_PORT (USE_DM_PORT), |
---|
| 204 | .DM_WIDTH (DM_WIDTH), |
---|
| 205 | .DQ_WIDTH (DQ_WIDTH), |
---|
| 206 | .DQ_BITS (DQ_BITS), |
---|
| 207 | .DQ_PER_DQS (DQ_PER_DQS), |
---|
| 208 | .DQS_BITS (DQS_BITS), |
---|
| 209 | .DQS_WIDTH (DQS_WIDTH), |
---|
| 210 | .HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE), |
---|
| 211 | .IODELAY_GRP (IODELAY_GRP), |
---|
| 212 | .ODT_WIDTH (ODT_WIDTH), |
---|
| 213 | .ROW_WIDTH (ROW_WIDTH), |
---|
| 214 | .TWO_T_TIME_EN (TWO_T_TIME_EN), |
---|
| 215 | .ADDITIVE_LAT (ADDITIVE_LAT), |
---|
| 216 | .BURST_LEN (BURST_LEN), |
---|
| 217 | .BURST_TYPE (BURST_TYPE), |
---|
| 218 | .CAS_LAT (CAS_LAT), |
---|
| 219 | .ECC_ENABLE (ECC_ENABLE), |
---|
| 220 | .ODT_TYPE (ODT_TYPE), |
---|
| 221 | .DDR_TYPE (DDR_TYPE), |
---|
| 222 | .REDUCE_DRV (REDUCE_DRV), |
---|
| 223 | .REG_ENABLE (REG_ENABLE), |
---|
| 224 | .TWR (TWR), |
---|
| 225 | .CLK_PERIOD (CLK_PERIOD), |
---|
| 226 | .SIM_ONLY (SIM_ONLY), |
---|
| 227 | .DEBUG_EN (DEBUG_EN), |
---|
| 228 | .FPGA_SPEED_GRADE (FPGA_SPEED_GRADE) |
---|
| 229 | ) |
---|
| 230 | u_phy_top |
---|
| 231 | ( |
---|
| 232 | .clk0 (clk0), |
---|
| 233 | .clk90 (clk90), |
---|
| 234 | .clkdiv0 (clkdiv0), |
---|
| 235 | .rst0 (rst0), |
---|
| 236 | .rst90 (rst90), |
---|
| 237 | .rstdiv0 (rstdiv0), |
---|
| 238 | .ctrl_wren (ctrl_wren), |
---|
| 239 | .ctrl_addr (ctrl_addr), |
---|
| 240 | .ctrl_ba (ctrl_ba), |
---|
| 241 | .ctrl_ras_n (ctrl_ras_n), |
---|
| 242 | .ctrl_cas_n (ctrl_cas_n), |
---|
| 243 | .ctrl_we_n (ctrl_we_n), |
---|
| 244 | .ctrl_cs_n (ctrl_cs_n), |
---|
| 245 | .ctrl_rden (ctrl_rden), |
---|
| 246 | .ctrl_ref_flag (ctrl_ref_flag), |
---|
| 247 | .wdf_data (wdf_data), |
---|
| 248 | .wdf_mask_data (wdf_mask_data), |
---|
| 249 | .wdf_rden (wdf_rden), |
---|
| 250 | .phy_init_done (phy_init_done), |
---|
| 251 | .phy_calib_rden (phy_calib_rden), |
---|
| 252 | .phy_calib_rden_sel (phy_calib_rden_sel), |
---|
| 253 | .rd_data_rise (rd_data_rise), |
---|
| 254 | .rd_data_fall (rd_data_fall), |
---|
| 255 | .ddr_ck (ddr_ck), |
---|
| 256 | .ddr_ck_n (ddr_ck_n), |
---|
| 257 | .ddr_addr (ddr_addr), |
---|
| 258 | .ddr_ba (ddr_ba), |
---|
| 259 | .ddr_ras_n (ddr_ras_n), |
---|
| 260 | .ddr_cas_n (ddr_cas_n), |
---|
| 261 | .ddr_we_n (ddr_we_n), |
---|
| 262 | .ddr_cs_n (ddr_cs_n), |
---|
| 263 | .ddr_cke (ddr_cke), |
---|
| 264 | .ddr_odt (ddr_odt), |
---|
| 265 | .ddr_dm (ddr_dm), |
---|
| 266 | .ddr_dqs (ddr_dqs), |
---|
| 267 | .ddr_dqs_n (ddr_dqs_n), |
---|
| 268 | .ddr_dq (ddr_dq), |
---|
| 269 | .dbg_idel_up_all (dbg_idel_up_all), |
---|
| 270 | .dbg_idel_down_all (dbg_idel_down_all), |
---|
| 271 | .dbg_idel_up_dq (dbg_idel_up_dq), |
---|
| 272 | .dbg_idel_down_dq (dbg_idel_down_dq), |
---|
| 273 | .dbg_idel_up_dqs (dbg_idel_up_dqs), |
---|
| 274 | .dbg_idel_down_dqs (dbg_idel_down_dqs), |
---|
| 275 | .dbg_idel_up_gate (dbg_idel_up_gate), |
---|
| 276 | .dbg_idel_down_gate (dbg_idel_down_gate), |
---|
| 277 | .dbg_sel_idel_dq (dbg_sel_idel_dq), |
---|
| 278 | .dbg_sel_all_idel_dq (dbg_sel_all_idel_dq), |
---|
| 279 | .dbg_sel_idel_dqs (dbg_sel_idel_dqs), |
---|
| 280 | .dbg_sel_all_idel_dqs (dbg_sel_all_idel_dqs), |
---|
| 281 | .dbg_sel_idel_gate (dbg_sel_idel_gate), |
---|
| 282 | .dbg_sel_all_idel_gate (dbg_sel_all_idel_gate), |
---|
| 283 | .dbg_calib_done (dbg_calib_done), |
---|
| 284 | .dbg_calib_err (dbg_calib_err), |
---|
| 285 | .dbg_calib_dq_tap_cnt (dbg_calib_dq_tap_cnt), |
---|
| 286 | .dbg_calib_dqs_tap_cnt (dbg_calib_dqs_tap_cnt), |
---|
| 287 | .dbg_calib_gate_tap_cnt (dbg_calib_gate_tap_cnt), |
---|
| 288 | .dbg_calib_rd_data_sel (dbg_calib_rd_data_sel), |
---|
| 289 | .dbg_calib_rden_dly (dbg_calib_rden_dly), |
---|
| 290 | .dbg_calib_gate_dly (dbg_calib_gate_dly) |
---|
| 291 | ); |
---|
| 292 | |
---|
| 293 | ddr2_usr_top # |
---|
| 294 | ( |
---|
| 295 | .BANK_WIDTH (BANK_WIDTH), |
---|
| 296 | .COL_WIDTH (COL_WIDTH), |
---|
| 297 | .CS_BITS (CS_BITS), |
---|
| 298 | .DQ_WIDTH (DQ_WIDTH), |
---|
| 299 | .DQ_PER_DQS (DQ_PER_DQS), |
---|
| 300 | .DQS_WIDTH (DQS_WIDTH), |
---|
| 301 | .APPDATA_WIDTH (APPDATA_WIDTH), |
---|
| 302 | .ECC_ENABLE (ECC_ENABLE), |
---|
| 303 | .ROW_WIDTH (ROW_WIDTH) |
---|
| 304 | ) |
---|
| 305 | u_usr_top |
---|
| 306 | ( |
---|
| 307 | .clk0 (clk0), |
---|
| 308 | .clk90 (clk90), |
---|
| 309 | .rst0 (rst0), |
---|
| 310 | .rd_data_in_rise (rd_data_rise), |
---|
| 311 | .rd_data_in_fall (rd_data_fall), |
---|
| 312 | .phy_calib_rden (phy_calib_rden), |
---|
| 313 | .phy_calib_rden_sel(phy_calib_rden_sel), |
---|
| 314 | .rd_data_valid (rd_data_valid), |
---|
| 315 | .rd_ecc_error (rd_ecc_error), |
---|
| 316 | .rd_data_fifo_out (rd_data_fifo_out), |
---|
| 317 | .app_af_cmd (app_af_cmd), |
---|
| 318 | .app_af_addr (app_af_addr), |
---|
| 319 | .app_af_wren (app_af_wren), |
---|
| 320 | .ctrl_af_rden (ctrl_af_rden), |
---|
| 321 | .af_cmd (af_cmd), |
---|
| 322 | .af_addr (af_addr), |
---|
| 323 | .af_empty (af_empty), |
---|
| 324 | .app_af_afull (app_af_afull), |
---|
| 325 | .app_wdf_wren (app_wdf_wren), |
---|
| 326 | .app_wdf_data (app_wdf_data), |
---|
| 327 | .app_wdf_mask_data (app_wdf_mask_data), |
---|
| 328 | .wdf_rden (wdf_rden), |
---|
| 329 | .app_wdf_afull (app_wdf_afull), |
---|
| 330 | .wdf_data (wdf_data), |
---|
| 331 | .wdf_mask_data (wdf_mask_data) |
---|
| 332 | ); |
---|
| 333 | |
---|
| 334 | |
---|
| 335 | ddr2_ctrl # |
---|
| 336 | ( |
---|
| 337 | .BANK_WIDTH (BANK_WIDTH), |
---|
| 338 | .COL_WIDTH (COL_WIDTH), |
---|
| 339 | .CS_BITS (CS_BITS), |
---|
| 340 | .CS_NUM (CS_NUM), |
---|
| 341 | .ROW_WIDTH (ROW_WIDTH), |
---|
| 342 | .ADDITIVE_LAT (ADDITIVE_LAT), |
---|
| 343 | .BURST_LEN (BURST_LEN), |
---|
| 344 | .CAS_LAT (CAS_LAT), |
---|
| 345 | .ECC_ENABLE (ECC_ENABLE), |
---|
| 346 | .REG_ENABLE (REG_ENABLE), |
---|
| 347 | .MULTI_BANK_EN (MULTI_BANK_EN), |
---|
| 348 | .TWO_T_TIME_EN (TWO_T_TIME_EN), |
---|
| 349 | .TREFI_NS (TREFI_NS), |
---|
| 350 | .TRAS (TRAS), |
---|
| 351 | .TRCD (TRCD), |
---|
| 352 | .TRFC (TRFC), |
---|
| 353 | .TRP (TRP), |
---|
| 354 | .TRTP (TRTP), |
---|
| 355 | .TWR (TWR), |
---|
| 356 | .TWTR (TWTR), |
---|
| 357 | .CLK_PERIOD (CLK_PERIOD), |
---|
| 358 | .DDR_TYPE (DDR_TYPE) |
---|
| 359 | ) |
---|
| 360 | u_ctrl |
---|
| 361 | ( |
---|
| 362 | .clk (clk0), |
---|
| 363 | .rst (rst0), |
---|
| 364 | .af_cmd (af_cmd), |
---|
| 365 | .af_addr (af_addr), |
---|
| 366 | .af_empty (af_empty), |
---|
| 367 | .phy_init_done (phy_init_done), |
---|
| 368 | .ctrl_ref_flag (ctrl_ref_flag), |
---|
| 369 | .ctrl_af_rden (ctrl_af_rden), |
---|
| 370 | .ctrl_wren (ctrl_wren), |
---|
| 371 | .ctrl_rden (ctrl_rden), |
---|
| 372 | .ctrl_addr (ctrl_addr), |
---|
| 373 | .ctrl_ba (ctrl_ba), |
---|
| 374 | .ctrl_ras_n (ctrl_ras_n), |
---|
| 375 | .ctrl_cas_n (ctrl_cas_n), |
---|
| 376 | .ctrl_we_n (ctrl_we_n), |
---|
| 377 | .ctrl_cs_n (ctrl_cs_n) |
---|
| 378 | ); |
---|
| 379 | |
---|
| 380 | endmodule |
---|