1 |
2 |
ZTEX |
//*****************************************************************************
|
2 |
|
|
// (c) Copyright 2009 Xilinx, Inc. All rights reserved.
|
3 |
|
|
//
|
4 |
|
|
// This file contains confidential and proprietary information
|
5 |
|
|
// of Xilinx, Inc. and is protected under U.S. and
|
6 |
|
|
// international copyright and other intellectual property
|
7 |
|
|
// laws.
|
8 |
|
|
//
|
9 |
|
|
// DISCLAIMER
|
10 |
|
|
// This disclaimer is not a license and does not grant any
|
11 |
|
|
// rights to the materials distributed herewith. Except as
|
12 |
|
|
// otherwise provided in a valid license issued to you by
|
13 |
|
|
// Xilinx, and to the maximum extent permitted by applicable
|
14 |
|
|
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
15 |
|
|
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
16 |
|
|
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
17 |
|
|
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
18 |
|
|
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
19 |
|
|
// (2) Xilinx shall not be liable (whether in contract or tort,
|
20 |
|
|
// including negligence, or under any other theory of
|
21 |
|
|
// liability) for any loss or damage of any kind or nature
|
22 |
|
|
// related to, arising under or in connection with these
|
23 |
|
|
// materials, including for any direct, or any indirect,
|
24 |
|
|
// special, incidental, or consequential loss or damage
|
25 |
|
|
// (including loss of data, profits, goodwill, or any type of
|
26 |
|
|
// loss or damage suffered as a result of any action brought
|
27 |
|
|
// by a third party) even if such damage or loss was
|
28 |
|
|
// reasonably foreseeable or Xilinx had been advised of the
|
29 |
|
|
// possibility of the same.
|
30 |
|
|
//
|
31 |
|
|
// CRITICAL APPLICATIONS
|
32 |
|
|
// Xilinx products are not designed or intended to be fail-
|
33 |
|
|
// safe, or for use in any application requiring fail-safe
|
34 |
|
|
// performance, such as life-support or safety devices or
|
35 |
|
|
// systems, Class III medical devices, nuclear facilities,
|
36 |
|
|
// applications related to the deployment of airbags, or any
|
37 |
|
|
// other applications that could lead to death, personal
|
38 |
|
|
// injury, or severe property or environmental damage
|
39 |
|
|
// (individually and collectively, "Critical
|
40 |
|
|
// Applications"). Customer assumes the sole risk and
|
41 |
|
|
// liability of any use of Xilinx products in Critical
|
42 |
|
|
// Applications, subject only to applicable laws and
|
43 |
|
|
// regulations governing limitations on product liability.
|
44 |
|
|
//
|
45 |
|
|
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
46 |
|
|
// PART OF THIS FILE AT ALL TIMES.
|
47 |
|
|
//
|
48 |
|
|
//*****************************************************************************
|
49 |
|
|
// ____ ____
|
50 |
|
|
// / /\/ /
|
51 |
|
|
// /___/ \ / Vendor : Xilinx
|
52 |
|
|
// \ \ \/ Version : 3.92
|
53 |
|
|
// \ \ Application : MIG
|
54 |
|
|
// / / Filename : sim_tb_top.v
|
55 |
|
|
// /___/ /\ Date Last Modified : $Date: 2011/06/02 07:17:00 $
|
56 |
|
|
// \ \ / \ Date Created : Mon Mar 2 2009
|
57 |
|
|
// \___\/\___\
|
58 |
|
|
//
|
59 |
|
|
// Device : Spartan-6
|
60 |
|
|
// Design Name : DDR/DDR2/DDR3/LPDDR
|
61 |
|
|
// Purpose : This is the simulation testbench which is used to verify the
|
62 |
|
|
// design. The basic clocks and resets to the interface are
|
63 |
|
|
// generated here. This also connects the memory interface to the
|
64 |
|
|
// memory model.
|
65 |
|
|
//*****************************************************************************
|
66 |
|
|
|
67 |
|
|
`timescale 1ps/1ps
|
68 |
|
|
module sim_tb_top;
|
69 |
|
|
|
70 |
|
|
// ========================================================================== //
|
71 |
|
|
// Parameters //
|
72 |
|
|
// ========================================================================== //
|
73 |
|
|
parameter DEBUG_EN = 0;
|
74 |
|
|
localparam DBG_WR_STS_WIDTH = 32;
|
75 |
|
|
localparam DBG_RD_STS_WIDTH = 32;
|
76 |
|
|
localparam C3_P0_PORT_MODE = "BI_MODE";
|
77 |
|
|
localparam C3_P1_PORT_MODE = "BI_MODE";
|
78 |
|
|
localparam C3_P2_PORT_MODE = "WR_MODE";
|
79 |
|
|
localparam C3_P3_PORT_MODE = "RD_MODE";
|
80 |
|
|
localparam C3_P4_PORT_MODE = "WR_MODE";
|
81 |
|
|
localparam C3_P5_PORT_MODE = "RD_MODE";
|
82 |
|
|
localparam C3_PORT_ENABLE = 6'b111111;
|
83 |
|
|
localparam C3_PORT_CONFIG = "B32_B32_W32_R32_W32_R32";
|
84 |
|
|
parameter C3_MEMCLK_PERIOD = 5000;
|
85 |
|
|
parameter C3_RST_ACT_LOW = 0;
|
86 |
|
|
parameter C3_INPUT_CLK_TYPE = "SINGLE_ENDED";
|
87 |
|
|
parameter C3_NUM_DQ_PINS = 16;
|
88 |
|
|
parameter C3_MEM_ADDR_WIDTH = 13;
|
89 |
|
|
parameter C3_MEM_BANKADDR_WIDTH = 2;
|
90 |
|
|
parameter C3_MEM_ADDR_ORDER = "ROW_BANK_COLUMN";
|
91 |
|
|
parameter C3_P0_MASK_SIZE = 4;
|
92 |
|
|
parameter C3_P0_DATA_PORT_SIZE = 32;
|
93 |
|
|
parameter C3_P1_MASK_SIZE = 4;
|
94 |
|
|
parameter C3_P1_DATA_PORT_SIZE = 32;
|
95 |
|
|
parameter C3_MEM_BURST_LEN = 4;
|
96 |
|
|
parameter C3_MEM_NUM_COL_BITS = 10;
|
97 |
|
|
parameter C3_CALIB_SOFT_IP = "TRUE";
|
98 |
|
|
parameter C3_SIMULATION = "TRUE";
|
99 |
|
|
parameter C3_HW_TESTING = "FALSE";
|
100 |
|
|
parameter C3_SMALL_DEVICE = "FALSE";
|
101 |
|
|
localparam C3_p0_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
102 |
|
|
localparam C3_p0_DATA_MODE = 4'b0010;
|
103 |
|
|
localparam C3_p0_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h02ffffff:32'h000002ff;
|
104 |
|
|
localparam C3_p0_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hfc000000:32'hfffffc00;
|
105 |
|
|
localparam C3_p0_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
106 |
|
|
localparam C3_p1_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h03000000:32'h00000300;
|
107 |
|
|
localparam C3_p1_DATA_MODE = 4'b0010;
|
108 |
|
|
localparam C3_p1_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h04ffffff:32'h000004ff;
|
109 |
|
|
localparam C3_p1_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hf8000000:32'hfffff800;
|
110 |
|
|
localparam C3_p1_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h03000000:32'h00000300;
|
111 |
|
|
localparam C3_p2_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h05000000:32'h00000500;
|
112 |
|
|
localparam C3_p2_DATA_MODE = 4'b0010;
|
113 |
|
|
localparam C3_p2_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h06ffffff:32'h000006ff;
|
114 |
|
|
localparam C3_p2_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hf8000000:32'hfffff800;
|
115 |
|
|
localparam C3_p2_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h05000000:32'h00000500;
|
116 |
|
|
localparam C3_p3_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
117 |
|
|
localparam C3_p3_DATA_MODE = 4'b0010;
|
118 |
|
|
localparam C3_p3_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h02ffffff:32'h000002ff;
|
119 |
|
|
localparam C3_p3_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hfc000000:32'hfffffc00;
|
120 |
|
|
localparam C3_p3_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
121 |
|
|
localparam C3_p4_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h07000000:32'h00000700;
|
122 |
|
|
localparam C3_p4_DATA_MODE = 4'b0010;
|
123 |
|
|
localparam C3_p4_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h08ffffff:32'h000008ff;
|
124 |
|
|
localparam C3_p4_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hf0000000:32'hfffff000;
|
125 |
|
|
localparam C3_p4_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h07000000:32'h00000800;
|
126 |
|
|
localparam C3_p5_BEGIN_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
127 |
|
|
localparam C3_p5_DATA_MODE = 4'b0010;
|
128 |
|
|
localparam C3_p5_END_ADDRESS = (C3_HW_TESTING == "TRUE") ? 32'h02ffffff:32'h000002ff;
|
129 |
|
|
localparam C3_p5_PRBS_EADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'hfc000000:32'hfffffc00;
|
130 |
|
|
localparam C3_p5_PRBS_SADDR_MASK_POS = (C3_HW_TESTING == "TRUE") ? 32'h01000000:32'h00000100;
|
131 |
|
|
|
132 |
|
|
// ========================================================================== //
|
133 |
|
|
// Signal Declarations //
|
134 |
|
|
// ========================================================================== //
|
135 |
|
|
// Clocks
|
136 |
|
|
// Clocks
|
137 |
|
|
reg c3_sys_clk;
|
138 |
|
|
wire c3_sys_clk_p;
|
139 |
|
|
wire c3_sys_clk_n;
|
140 |
|
|
// System Reset
|
141 |
|
|
reg c3_sys_rst;
|
142 |
|
|
wire c3_sys_rst_i;
|
143 |
|
|
|
144 |
|
|
// Design-Top Port Map
|
145 |
|
|
wire [31:0] c3_cmp_data;
|
146 |
|
|
wire c3_cmp_error;
|
147 |
|
|
wire [C3_MEM_ADDR_WIDTH-1:0] mcb3_dram_a;
|
148 |
|
|
wire [C3_MEM_BANKADDR_WIDTH-1:0] mcb3_dram_ba;
|
149 |
|
|
wire mcb3_dram_ck;
|
150 |
|
|
wire mcb3_dram_ck_n;
|
151 |
|
|
wire [C3_NUM_DQ_PINS-1:0] mcb3_dram_dq;
|
152 |
|
|
wire mcb3_dram_dqs;
|
153 |
|
|
wire mcb3_dram_dm;
|
154 |
|
|
wire mcb3_dram_ras_n;
|
155 |
|
|
wire mcb3_dram_cas_n;
|
156 |
|
|
wire mcb3_dram_we_n;
|
157 |
|
|
wire mcb3_dram_cke;
|
158 |
|
|
wire c3_error;
|
159 |
|
|
wire c3_calib_done;
|
160 |
|
|
|
161 |
|
|
wire [64 + (2*C3_P0_DATA_PORT_SIZE - 1):0] c3_p0_error_status;
|
162 |
|
|
wire [64 + (2*C3_P1_DATA_PORT_SIZE - 1):0] c3_p1_error_status;
|
163 |
|
|
wire [127 : 0] c3_p2_error_status;
|
164 |
|
|
wire [127 : 0] c3_p3_error_status;
|
165 |
|
|
wire [127 : 0] c3_p4_error_status;
|
166 |
|
|
wire [127 : 0] c3_p5_error_status;
|
167 |
|
|
wire mcb3_dram_udqs; // for X16 parts
|
168 |
|
|
wire mcb3_dram_udm; // for X16 parts
|
169 |
|
|
wire c3_vio_modify_enable = 1'b1;
|
170 |
|
|
wire [2:0] c3_vio_data_mode_value = 3'b010;
|
171 |
|
|
wire [2:0] c3_vio_addr_mode_value = 3'b011;
|
172 |
|
|
|
173 |
|
|
// User design Sim
|
174 |
|
|
wire c3_clk0;
|
175 |
|
|
wire c3_rst0;
|
176 |
|
|
|
177 |
|
|
reg c3_aresetn;
|
178 |
|
|
wire c3_wrap_en;
|
179 |
|
|
wire c3_cmd_err;
|
180 |
|
|
wire c3_data_msmatch_err;
|
181 |
|
|
wire c3_write_err;
|
182 |
|
|
wire c3_read_err;
|
183 |
|
|
wire c3_test_cmptd;
|
184 |
|
|
wire c3_dbg_wr_sts_vld;
|
185 |
|
|
wire c3_dbg_rd_sts_vld;
|
186 |
|
|
wire [DBG_WR_STS_WIDTH-1:0] c3_dbg_wr_sts;
|
187 |
|
|
wire [DBG_WR_STS_WIDTH-1:0] c3_dbg_rd_sts;
|
188 |
|
|
wire c3_p0_cmd_en;
|
189 |
|
|
wire [2:0] c3_p0_cmd_instr;
|
190 |
|
|
wire [5:0] c3_p0_cmd_bl;
|
191 |
|
|
wire [29:0] c3_p0_cmd_byte_addr;
|
192 |
|
|
wire c3_p0_cmd_empty;
|
193 |
|
|
wire c3_p0_cmd_full;
|
194 |
|
|
wire c3_p0_wr_en;
|
195 |
|
|
wire [C3_P0_MASK_SIZE - 1:0] c3_p0_wr_mask;
|
196 |
|
|
wire [C3_P0_DATA_PORT_SIZE - 1:0] c3_p0_wr_data;
|
197 |
|
|
wire c3_p0_wr_full;
|
198 |
|
|
wire c3_p0_wr_empty;
|
199 |
|
|
wire [6:0] c3_p0_wr_count;
|
200 |
|
|
wire c3_p0_wr_underrun;
|
201 |
|
|
wire c3_p0_wr_error;
|
202 |
|
|
wire c3_p0_rd_en;
|
203 |
|
|
wire [C3_P0_DATA_PORT_SIZE - 1:0] c3_p0_rd_data;
|
204 |
|
|
wire c3_p0_rd_full;
|
205 |
|
|
wire c3_p0_rd_empty;
|
206 |
|
|
wire [6:0] c3_p0_rd_count;
|
207 |
|
|
wire c3_p0_rd_overflow;
|
208 |
|
|
wire c3_p0_rd_error;
|
209 |
|
|
|
210 |
|
|
wire c3_p1_cmd_en;
|
211 |
|
|
wire [2:0] c3_p1_cmd_instr;
|
212 |
|
|
wire [5:0] c3_p1_cmd_bl;
|
213 |
|
|
wire [29:0] c3_p1_cmd_byte_addr;
|
214 |
|
|
wire c3_p1_cmd_empty;
|
215 |
|
|
wire c3_p1_cmd_full;
|
216 |
|
|
wire c3_p1_wr_en;
|
217 |
|
|
wire [C3_P1_MASK_SIZE - 1:0] c3_p1_wr_mask;
|
218 |
|
|
wire [C3_P1_DATA_PORT_SIZE - 1:0] c3_p1_wr_data;
|
219 |
|
|
wire c3_p1_wr_full;
|
220 |
|
|
wire c3_p1_wr_empty;
|
221 |
|
|
wire [6:0] c3_p1_wr_count;
|
222 |
|
|
wire c3_p1_wr_underrun;
|
223 |
|
|
wire c3_p1_wr_error;
|
224 |
|
|
wire c3_p1_rd_en;
|
225 |
|
|
wire [C3_P1_DATA_PORT_SIZE - 1:0] c3_p1_rd_data;
|
226 |
|
|
wire c3_p1_rd_full;
|
227 |
|
|
wire c3_p1_rd_empty;
|
228 |
|
|
wire [6:0] c3_p1_rd_count;
|
229 |
|
|
wire c3_p1_rd_overflow;
|
230 |
|
|
wire c3_p1_rd_error;
|
231 |
|
|
|
232 |
|
|
wire c3_p2_cmd_en;
|
233 |
|
|
wire [2:0] c3_p2_cmd_instr;
|
234 |
|
|
wire [5:0] c3_p2_cmd_bl;
|
235 |
|
|
wire [29:0] c3_p2_cmd_byte_addr;
|
236 |
|
|
wire c3_p2_cmd_empty;
|
237 |
|
|
wire c3_p2_cmd_full;
|
238 |
|
|
wire c3_p2_wr_en;
|
239 |
|
|
wire [3:0] c3_p2_wr_mask;
|
240 |
|
|
wire [31:0] c3_p2_wr_data;
|
241 |
|
|
wire c3_p2_wr_full;
|
242 |
|
|
wire c3_p2_wr_empty;
|
243 |
|
|
wire [6:0] c3_p2_wr_count;
|
244 |
|
|
wire c3_p2_wr_underrun;
|
245 |
|
|
wire c3_p2_wr_error;
|
246 |
|
|
|
247 |
|
|
wire c3_p3_cmd_en;
|
248 |
|
|
wire [2:0] c3_p3_cmd_instr;
|
249 |
|
|
wire [5:0] c3_p3_cmd_bl;
|
250 |
|
|
wire [29:0] c3_p3_cmd_byte_addr;
|
251 |
|
|
wire c3_p3_cmd_empty;
|
252 |
|
|
wire c3_p3_cmd_full;
|
253 |
|
|
wire c3_p3_rd_en;
|
254 |
|
|
wire [31:0] c3_p3_rd_data;
|
255 |
|
|
wire c3_p3_rd_full;
|
256 |
|
|
wire c3_p3_rd_empty;
|
257 |
|
|
wire [6:0] c3_p3_rd_count;
|
258 |
|
|
wire c3_p3_rd_overflow;
|
259 |
|
|
wire c3_p3_rd_error;
|
260 |
|
|
|
261 |
|
|
wire c3_p4_cmd_en;
|
262 |
|
|
wire [2:0] c3_p4_cmd_instr;
|
263 |
|
|
wire [5:0] c3_p4_cmd_bl;
|
264 |
|
|
wire [29:0] c3_p4_cmd_byte_addr;
|
265 |
|
|
wire c3_p4_cmd_empty;
|
266 |
|
|
wire c3_p4_cmd_full;
|
267 |
|
|
wire c3_p4_wr_en;
|
268 |
|
|
wire [3:0] c3_p4_wr_mask;
|
269 |
|
|
wire [31:0] c3_p4_wr_data;
|
270 |
|
|
wire c3_p4_wr_full;
|
271 |
|
|
wire c3_p4_wr_empty;
|
272 |
|
|
wire [6:0] c3_p4_wr_count;
|
273 |
|
|
wire c3_p4_wr_underrun;
|
274 |
|
|
wire c3_p4_wr_error;
|
275 |
|
|
|
276 |
|
|
wire c3_p5_cmd_en;
|
277 |
|
|
wire [2:0] c3_p5_cmd_instr;
|
278 |
|
|
wire [5:0] c3_p5_cmd_bl;
|
279 |
|
|
wire [29:0] c3_p5_cmd_byte_addr;
|
280 |
|
|
wire c3_p5_cmd_empty;
|
281 |
|
|
wire c3_p5_cmd_full;
|
282 |
|
|
wire c3_p5_rd_en;
|
283 |
|
|
wire [31:0] c3_p5_rd_data;
|
284 |
|
|
wire c3_p5_rd_full;
|
285 |
|
|
wire c3_p5_rd_empty;
|
286 |
|
|
wire [6:0] c3_p5_rd_count;
|
287 |
|
|
wire c3_p5_rd_overflow;
|
288 |
|
|
wire c3_p5_rd_error;
|
289 |
|
|
|
290 |
|
|
wire c3_p2_rd_clk;
|
291 |
|
|
wire c3_p2_rd_en;
|
292 |
|
|
wire[31:0] c3_p2_rd_data;
|
293 |
|
|
wire c3_p2_rd_full;
|
294 |
|
|
wire c3_p2_rd_empty;
|
295 |
|
|
wire[6:0] c3_p2_rd_count;
|
296 |
|
|
wire c3_p2_rd_overflow;
|
297 |
|
|
wire c3_p2_rd_error;
|
298 |
|
|
wire c3_p3_wr_clk;
|
299 |
|
|
wire c3_p3_wr_en;
|
300 |
|
|
wire[3:0] c3_p3_wr_mask;
|
301 |
|
|
wire[31:0] c3_p3_wr_data;
|
302 |
|
|
wire c3_p3_wr_full;
|
303 |
|
|
wire c3_p3_wr_empty;
|
304 |
|
|
wire[6:0] c3_p3_wr_count;
|
305 |
|
|
wire c3_p3_wr_underrun;
|
306 |
|
|
wire c3_p3_wr_error;
|
307 |
|
|
wire c3_p4_rd_clk;
|
308 |
|
|
wire c3_p4_rd_en;
|
309 |
|
|
wire[31:0] c3_p4_rd_data;
|
310 |
|
|
wire c3_p4_rd_full;
|
311 |
|
|
wire c3_p4_rd_empty;
|
312 |
|
|
wire[6:0] c3_p4_rd_count;
|
313 |
|
|
wire c3_p4_rd_overflow;
|
314 |
|
|
wire c3_p4_rd_error;
|
315 |
|
|
wire c3_p5_wr_clk;
|
316 |
|
|
wire c3_p5_wr_en;
|
317 |
|
|
wire[3:0] c3_p5_wr_mask;
|
318 |
|
|
wire[31:0] c3_p5_wr_data;
|
319 |
|
|
wire c3_p5_wr_full;
|
320 |
|
|
wire c3_p5_wr_empty;
|
321 |
|
|
wire[6:0] c3_p5_wr_count;
|
322 |
|
|
wire c3_p5_wr_underrun;
|
323 |
|
|
wire c3_p5_wr_error;
|
324 |
|
|
|
325 |
|
|
// Error & Calib Signals
|
326 |
|
|
wire error;
|
327 |
|
|
wire calib_done;
|
328 |
|
|
wire rzq3;
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
// ========================================================================== //
|
332 |
|
|
// Clocks Generation //
|
333 |
|
|
// ========================================================================== //
|
334 |
|
|
|
335 |
|
|
initial
|
336 |
|
|
c3_sys_clk = 1'b0;
|
337 |
|
|
always
|
338 |
|
|
#(C3_MEMCLK_PERIOD/2) c3_sys_clk = ~c3_sys_clk;
|
339 |
|
|
|
340 |
|
|
assign c3_sys_clk_p = c3_sys_clk;
|
341 |
|
|
assign c3_sys_clk_n = ~c3_sys_clk;
|
342 |
|
|
|
343 |
|
|
// ========================================================================== //
|
344 |
|
|
// Reset Generation //
|
345 |
|
|
// ========================================================================== //
|
346 |
|
|
|
347 |
|
|
initial begin
|
348 |
|
|
c3_sys_rst = 1'b0;
|
349 |
|
|
#20000;
|
350 |
|
|
c3_sys_rst = 1'b1;
|
351 |
|
|
end
|
352 |
|
|
assign c3_sys_rst_i = C3_RST_ACT_LOW ? c3_sys_rst : ~c3_sys_rst;
|
353 |
|
|
|
354 |
|
|
// ========================================================================== //
|
355 |
|
|
// Error Grouping //
|
356 |
|
|
// ========================================================================== //
|
357 |
|
|
assign error = c3_error;
|
358 |
|
|
assign calib_done = c3_calib_done;
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
PULLDOWN rzq_pulldown3 (.O(rzq3));
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
// ========================================================================== //
|
366 |
|
|
// DESIGN TOP INSTANTIATION //
|
367 |
|
|
// ========================================================================== //
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
mem0 #(
|
372 |
|
|
|
373 |
|
|
.C3_P0_MASK_SIZE (C3_P0_MASK_SIZE ),
|
374 |
|
|
.C3_P0_DATA_PORT_SIZE (C3_P0_DATA_PORT_SIZE ),
|
375 |
|
|
.C3_P1_MASK_SIZE (C3_P1_MASK_SIZE ),
|
376 |
|
|
.C3_P1_DATA_PORT_SIZE (C3_P1_DATA_PORT_SIZE ),
|
377 |
|
|
.C3_MEMCLK_PERIOD (C3_MEMCLK_PERIOD),
|
378 |
|
|
.C3_RST_ACT_LOW (C3_RST_ACT_LOW),
|
379 |
|
|
.C3_INPUT_CLK_TYPE (C3_INPUT_CLK_TYPE),
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
.DEBUG_EN (DEBUG_EN),
|
383 |
|
|
|
384 |
|
|
.C3_MEM_ADDR_ORDER (C3_MEM_ADDR_ORDER ),
|
385 |
|
|
.C3_NUM_DQ_PINS (C3_NUM_DQ_PINS ),
|
386 |
|
|
.C3_MEM_ADDR_WIDTH (C3_MEM_ADDR_WIDTH ),
|
387 |
|
|
.C3_MEM_BANKADDR_WIDTH (C3_MEM_BANKADDR_WIDTH),
|
388 |
|
|
|
389 |
|
|
.C3_SIMULATION (C3_SIMULATION),
|
390 |
|
|
.C3_CALIB_SOFT_IP (C3_CALIB_SOFT_IP )
|
391 |
|
|
)
|
392 |
|
|
design_top (
|
393 |
|
|
|
394 |
|
|
.c3_sys_clk (c3_sys_clk),
|
395 |
|
|
.c3_sys_rst_i (c3_sys_rst_i),
|
396 |
|
|
|
397 |
|
|
.mcb3_dram_dq (mcb3_dram_dq),
|
398 |
|
|
.mcb3_dram_a (mcb3_dram_a),
|
399 |
|
|
.mcb3_dram_ba (mcb3_dram_ba),
|
400 |
|
|
.mcb3_dram_ras_n (mcb3_dram_ras_n),
|
401 |
|
|
.mcb3_dram_cas_n (mcb3_dram_cas_n),
|
402 |
|
|
.mcb3_dram_we_n (mcb3_dram_we_n),
|
403 |
|
|
.mcb3_dram_cke (mcb3_dram_cke),
|
404 |
|
|
.mcb3_dram_ck (mcb3_dram_ck),
|
405 |
|
|
.mcb3_dram_ck_n (mcb3_dram_ck_n),
|
406 |
|
|
.mcb3_dram_dqs (mcb3_dram_dqs),
|
407 |
|
|
.mcb3_dram_udqs (mcb3_dram_udqs), // for X16 parts
|
408 |
|
|
.mcb3_dram_udm (mcb3_dram_udm), // for X16 parts
|
409 |
|
|
.mcb3_dram_dm (mcb3_dram_dm),
|
410 |
|
|
|
411 |
|
|
.c3_clk0 (c3_clk0),
|
412 |
|
|
.c3_rst0 (c3_rst0),
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
.c3_calib_done (c3_calib_done),
|
416 |
|
|
.mcb3_rzq (rzq3),
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
.c3_p0_cmd_clk (c3_clk0),
|
420 |
|
|
.c3_p0_cmd_en (c3_p0_cmd_en),
|
421 |
|
|
.c3_p0_cmd_instr (c3_p0_cmd_instr),
|
422 |
|
|
.c3_p0_cmd_bl (c3_p0_cmd_bl),
|
423 |
|
|
.c3_p0_cmd_byte_addr (c3_p0_cmd_byte_addr),
|
424 |
|
|
.c3_p0_cmd_empty (c3_p0_cmd_empty),
|
425 |
|
|
.c3_p0_cmd_full (c3_p0_cmd_full),
|
426 |
|
|
.c3_p0_wr_clk (c3_clk0),
|
427 |
|
|
.c3_p0_wr_en (c3_p0_wr_en),
|
428 |
|
|
.c3_p0_wr_mask (c3_p0_wr_mask),
|
429 |
|
|
.c3_p0_wr_data (c3_p0_wr_data),
|
430 |
|
|
.c3_p0_wr_full (c3_p0_wr_full),
|
431 |
|
|
.c3_p0_wr_empty (c3_p0_wr_empty),
|
432 |
|
|
.c3_p0_wr_count (c3_p0_wr_count),
|
433 |
|
|
.c3_p0_wr_underrun (c3_p0_wr_underrun),
|
434 |
|
|
.c3_p0_wr_error (c3_p0_wr_error),
|
435 |
|
|
.c3_p0_rd_clk (c3_clk0),
|
436 |
|
|
.c3_p0_rd_en (c3_p0_rd_en),
|
437 |
|
|
.c3_p0_rd_data (c3_p0_rd_data),
|
438 |
|
|
.c3_p0_rd_full (c3_p0_rd_full),
|
439 |
|
|
.c3_p0_rd_empty (c3_p0_rd_empty),
|
440 |
|
|
.c3_p0_rd_count (c3_p0_rd_count),
|
441 |
|
|
.c3_p0_rd_overflow (c3_p0_rd_overflow),
|
442 |
|
|
.c3_p0_rd_error (c3_p0_rd_error),
|
443 |
|
|
.c3_p1_cmd_clk (c3_clk0),
|
444 |
|
|
.c3_p1_cmd_en (c3_p1_cmd_en),
|
445 |
|
|
.c3_p1_cmd_instr (c3_p1_cmd_instr),
|
446 |
|
|
.c3_p1_cmd_bl (c3_p1_cmd_bl),
|
447 |
|
|
.c3_p1_cmd_byte_addr (c3_p1_cmd_byte_addr),
|
448 |
|
|
.c3_p1_cmd_empty (c3_p1_cmd_empty),
|
449 |
|
|
.c3_p1_cmd_full (c3_p1_cmd_full),
|
450 |
|
|
.c3_p1_wr_clk (c3_clk0),
|
451 |
|
|
.c3_p1_wr_en (c3_p1_wr_en),
|
452 |
|
|
.c3_p1_wr_mask (c3_p1_wr_mask),
|
453 |
|
|
.c3_p1_wr_data (c3_p1_wr_data),
|
454 |
|
|
.c3_p1_wr_full (c3_p1_wr_full),
|
455 |
|
|
.c3_p1_wr_empty (c3_p1_wr_empty),
|
456 |
|
|
.c3_p1_wr_count (c3_p1_wr_count),
|
457 |
|
|
.c3_p1_wr_underrun (c3_p1_wr_underrun),
|
458 |
|
|
.c3_p1_wr_error (c3_p1_wr_error),
|
459 |
|
|
.c3_p1_rd_clk (c3_clk0),
|
460 |
|
|
.c3_p1_rd_en (c3_p1_rd_en),
|
461 |
|
|
.c3_p1_rd_data (c3_p1_rd_data),
|
462 |
|
|
.c3_p1_rd_full (c3_p1_rd_full),
|
463 |
|
|
.c3_p1_rd_empty (c3_p1_rd_empty),
|
464 |
|
|
.c3_p1_rd_count (c3_p1_rd_count),
|
465 |
|
|
.c3_p1_rd_overflow (c3_p1_rd_overflow),
|
466 |
|
|
.c3_p1_rd_error (c3_p1_rd_error),
|
467 |
|
|
.c3_p2_cmd_clk (c3_clk0),
|
468 |
|
|
.c3_p2_cmd_en (c3_p2_cmd_en),
|
469 |
|
|
.c3_p2_cmd_instr (c3_p2_cmd_instr),
|
470 |
|
|
.c3_p2_cmd_bl (c3_p2_cmd_bl),
|
471 |
|
|
.c3_p2_cmd_byte_addr (c3_p2_cmd_byte_addr),
|
472 |
|
|
.c3_p2_cmd_empty (c3_p2_cmd_empty),
|
473 |
|
|
.c3_p2_cmd_full (c3_p2_cmd_full),
|
474 |
|
|
.c3_p2_wr_clk (c3_clk0),
|
475 |
|
|
.c3_p2_wr_en (c3_p2_wr_en),
|
476 |
|
|
.c3_p2_wr_mask (c3_p2_wr_mask),
|
477 |
|
|
.c3_p2_wr_data (c3_p2_wr_data),
|
478 |
|
|
.c3_p2_wr_full (c3_p2_wr_full),
|
479 |
|
|
.c3_p2_wr_empty (c3_p2_wr_empty),
|
480 |
|
|
.c3_p2_wr_count (c3_p2_wr_count),
|
481 |
|
|
.c3_p2_wr_underrun (c3_p2_wr_underrun),
|
482 |
|
|
.c3_p2_wr_error (c3_p2_wr_error),
|
483 |
|
|
.c3_p3_cmd_clk (c3_clk0),
|
484 |
|
|
.c3_p3_cmd_en (c3_p3_cmd_en),
|
485 |
|
|
.c3_p3_cmd_instr (c3_p3_cmd_instr),
|
486 |
|
|
.c3_p3_cmd_bl (c3_p3_cmd_bl),
|
487 |
|
|
.c3_p3_cmd_byte_addr (c3_p3_cmd_byte_addr),
|
488 |
|
|
.c3_p3_cmd_empty (c3_p3_cmd_empty),
|
489 |
|
|
.c3_p3_cmd_full (c3_p3_cmd_full),
|
490 |
|
|
.c3_p3_rd_clk (c3_clk0),
|
491 |
|
|
.c3_p3_rd_en (c3_p3_rd_en),
|
492 |
|
|
.c3_p3_rd_data (c3_p3_rd_data),
|
493 |
|
|
.c3_p3_rd_full (c3_p3_rd_full),
|
494 |
|
|
.c3_p3_rd_empty (c3_p3_rd_empty),
|
495 |
|
|
.c3_p3_rd_count (c3_p3_rd_count),
|
496 |
|
|
.c3_p3_rd_overflow (c3_p3_rd_overflow),
|
497 |
|
|
.c3_p3_rd_error (c3_p3_rd_error),
|
498 |
|
|
.c3_p4_cmd_clk (c3_clk0),
|
499 |
|
|
.c3_p4_cmd_en (c3_p4_cmd_en),
|
500 |
|
|
.c3_p4_cmd_instr (c3_p4_cmd_instr),
|
501 |
|
|
.c3_p4_cmd_bl (c3_p4_cmd_bl),
|
502 |
|
|
.c3_p4_cmd_byte_addr (c3_p4_cmd_byte_addr),
|
503 |
|
|
.c3_p4_cmd_empty (c3_p4_cmd_empty),
|
504 |
|
|
.c3_p4_cmd_full (c3_p4_cmd_full),
|
505 |
|
|
.c3_p4_wr_clk (c3_clk0),
|
506 |
|
|
.c3_p4_wr_en (c3_p4_wr_en),
|
507 |
|
|
.c3_p4_wr_mask (c3_p4_wr_mask),
|
508 |
|
|
.c3_p4_wr_data (c3_p4_wr_data),
|
509 |
|
|
.c3_p4_wr_full (c3_p4_wr_full),
|
510 |
|
|
.c3_p4_wr_empty (c3_p4_wr_empty),
|
511 |
|
|
.c3_p4_wr_count (c3_p4_wr_count),
|
512 |
|
|
.c3_p4_wr_underrun (c3_p4_wr_underrun),
|
513 |
|
|
.c3_p4_wr_error (c3_p4_wr_error),
|
514 |
|
|
.c3_p5_cmd_clk (c3_clk0),
|
515 |
|
|
.c3_p5_cmd_en (c3_p5_cmd_en),
|
516 |
|
|
.c3_p5_cmd_instr (c3_p5_cmd_instr),
|
517 |
|
|
.c3_p5_cmd_bl (c3_p5_cmd_bl),
|
518 |
|
|
.c3_p5_cmd_byte_addr (c3_p5_cmd_byte_addr),
|
519 |
|
|
.c3_p5_cmd_empty (c3_p5_cmd_empty),
|
520 |
|
|
.c3_p5_cmd_full (c3_p5_cmd_full),
|
521 |
|
|
.c3_p5_rd_clk (c3_clk0),
|
522 |
|
|
.c3_p5_rd_en (c3_p5_rd_en),
|
523 |
|
|
.c3_p5_rd_data (c3_p5_rd_data),
|
524 |
|
|
.c3_p5_rd_full (c3_p5_rd_full),
|
525 |
|
|
.c3_p5_rd_empty (c3_p5_rd_empty),
|
526 |
|
|
.c3_p5_rd_count (c3_p5_rd_count),
|
527 |
|
|
.c3_p5_rd_overflow (c3_p5_rd_overflow),
|
528 |
|
|
.c3_p5_rd_error (c3_p5_rd_error)
|
529 |
|
|
);
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
// Test bench top for the controller-3
|
537 |
|
|
memc_tb_top #
|
538 |
|
|
(
|
539 |
|
|
.C_SIMULATION (C3_SIMULATION),
|
540 |
|
|
.C_NUM_DQ_PINS (C3_NUM_DQ_PINS),
|
541 |
|
|
.C_MEM_BURST_LEN (C3_MEM_BURST_LEN),
|
542 |
|
|
.C_MEM_NUM_COL_BITS (C3_MEM_NUM_COL_BITS),
|
543 |
|
|
.C_SMALL_DEVICE (C3_SMALL_DEVICE),
|
544 |
|
|
|
545 |
|
|
// The following parameters from C_PORT_ENABLE to C_P5_PORT_MODE are introduced
|
546 |
|
|
// to handle the static instances of all the six traffic generators inside the
|
547 |
|
|
// memc_tb_top module.
|
548 |
|
|
.C_PORT_ENABLE (C3_PORT_ENABLE),
|
549 |
|
|
.C_P0_MASK_SIZE (C3_P0_MASK_SIZE),
|
550 |
|
|
.C_P0_DATA_PORT_SIZE (C3_P0_DATA_PORT_SIZE),
|
551 |
|
|
.C_P1_MASK_SIZE (C3_P1_MASK_SIZE),
|
552 |
|
|
.C_P1_DATA_PORT_SIZE (C3_P1_DATA_PORT_SIZE),
|
553 |
|
|
.C_P0_PORT_MODE (C3_P0_PORT_MODE),
|
554 |
|
|
.C_P1_PORT_MODE (C3_P1_PORT_MODE),
|
555 |
|
|
.C_P2_PORT_MODE (C3_P2_PORT_MODE),
|
556 |
|
|
.C_P3_PORT_MODE (C3_P3_PORT_MODE),
|
557 |
|
|
.C_P4_PORT_MODE (C3_P4_PORT_MODE),
|
558 |
|
|
.C_P5_PORT_MODE (C3_P5_PORT_MODE),
|
559 |
|
|
|
560 |
|
|
.C_p0_BEGIN_ADDRESS (C3_p0_BEGIN_ADDRESS),
|
561 |
|
|
.C_p0_DATA_MODE (C3_p0_DATA_MODE),
|
562 |
|
|
.C_p0_END_ADDRESS (C3_p0_END_ADDRESS),
|
563 |
|
|
.C_p0_PRBS_EADDR_MASK_POS (C3_p0_PRBS_EADDR_MASK_POS),
|
564 |
|
|
.C_p0_PRBS_SADDR_MASK_POS (C3_p0_PRBS_SADDR_MASK_POS),
|
565 |
|
|
.C_p1_BEGIN_ADDRESS (C3_p1_BEGIN_ADDRESS),
|
566 |
|
|
.C_p1_DATA_MODE (C3_p1_DATA_MODE),
|
567 |
|
|
.C_p1_END_ADDRESS (C3_p1_END_ADDRESS),
|
568 |
|
|
.C_p1_PRBS_EADDR_MASK_POS (C3_p1_PRBS_EADDR_MASK_POS),
|
569 |
|
|
.C_p1_PRBS_SADDR_MASK_POS (C3_p1_PRBS_SADDR_MASK_POS),
|
570 |
|
|
.C_p2_BEGIN_ADDRESS (C3_p2_BEGIN_ADDRESS),
|
571 |
|
|
.C_p2_DATA_MODE (C3_p2_DATA_MODE),
|
572 |
|
|
.C_p2_END_ADDRESS (C3_p2_END_ADDRESS),
|
573 |
|
|
.C_p2_PRBS_EADDR_MASK_POS (C3_p2_PRBS_EADDR_MASK_POS),
|
574 |
|
|
.C_p2_PRBS_SADDR_MASK_POS (C3_p2_PRBS_SADDR_MASK_POS),
|
575 |
|
|
.C_p3_BEGIN_ADDRESS (C3_p3_BEGIN_ADDRESS),
|
576 |
|
|
.C_p3_DATA_MODE (C3_p3_DATA_MODE),
|
577 |
|
|
.C_p3_END_ADDRESS (C3_p3_END_ADDRESS),
|
578 |
|
|
.C_p3_PRBS_EADDR_MASK_POS (C3_p3_PRBS_EADDR_MASK_POS),
|
579 |
|
|
.C_p3_PRBS_SADDR_MASK_POS (C3_p3_PRBS_SADDR_MASK_POS),
|
580 |
|
|
.C_p4_BEGIN_ADDRESS (C3_p4_BEGIN_ADDRESS),
|
581 |
|
|
.C_p4_DATA_MODE (C3_p4_DATA_MODE),
|
582 |
|
|
.C_p4_END_ADDRESS (C3_p4_END_ADDRESS),
|
583 |
|
|
.C_p4_PRBS_EADDR_MASK_POS (C3_p4_PRBS_EADDR_MASK_POS),
|
584 |
|
|
.C_p4_PRBS_SADDR_MASK_POS (C3_p4_PRBS_SADDR_MASK_POS),
|
585 |
|
|
.C_p5_BEGIN_ADDRESS (C3_p5_BEGIN_ADDRESS),
|
586 |
|
|
.C_p5_DATA_MODE (C3_p5_DATA_MODE),
|
587 |
|
|
.C_p5_END_ADDRESS (C3_p5_END_ADDRESS),
|
588 |
|
|
.C_p5_PRBS_EADDR_MASK_POS (C3_p5_PRBS_EADDR_MASK_POS),
|
589 |
|
|
.C_p5_PRBS_SADDR_MASK_POS (C3_p5_PRBS_SADDR_MASK_POS)
|
590 |
|
|
)
|
591 |
|
|
memc3_tb_top_inst
|
592 |
|
|
(
|
593 |
|
|
.error (c3_error),
|
594 |
|
|
.calib_done (c3_calib_done),
|
595 |
|
|
.clk0 (c3_clk0),
|
596 |
|
|
.rst0 (c3_rst0),
|
597 |
|
|
.cmp_error (c3_cmp_error),
|
598 |
|
|
.cmp_data_valid (c3_cmp_data_valid),
|
599 |
|
|
.cmp_data (c3_cmp_data),
|
600 |
|
|
.vio_modify_enable (c3_vio_modify_enable),
|
601 |
|
|
.vio_data_mode_value (c3_vio_data_mode_value),
|
602 |
|
|
.vio_addr_mode_value (c3_vio_addr_mode_value),
|
603 |
|
|
.p0_error_status (c3_p0_error_status),
|
604 |
|
|
.p1_error_status (c3_p1_error_status),
|
605 |
|
|
.p2_error_status (c3_p2_error_status),
|
606 |
|
|
.p3_error_status (c3_p3_error_status),
|
607 |
|
|
.p4_error_status (c3_p4_error_status),
|
608 |
|
|
.p5_error_status (c3_p5_error_status),
|
609 |
|
|
|
610 |
|
|
// The following port map shows that all the memory controller ports are connected
|
611 |
|
|
// to the test bench top. However, a traffic generator can be connected to the
|
612 |
|
|
// corresponding port only if the port is enabled, whose information can be obtained
|
613 |
|
|
// from the parameters C_PORT_ENABLE.
|
614 |
|
|
|
615 |
|
|
// User Port-0 command interface will be active only when the port is enabled in
|
616 |
|
|
// the port configurations Config-1, Config-2, Config-3, Config-4 and Config-5
|
617 |
|
|
.p0_mcb_cmd_en (c3_p0_cmd_en),
|
618 |
|
|
.p0_mcb_cmd_instr (c3_p0_cmd_instr),
|
619 |
|
|
.p0_mcb_cmd_bl (c3_p0_cmd_bl),
|
620 |
|
|
.p0_mcb_cmd_addr (c3_p0_cmd_byte_addr),
|
621 |
|
|
.p0_mcb_cmd_full (c3_p0_cmd_full),
|
622 |
|
|
// User Port-0 data write interface will be active only when the port is enabled in
|
623 |
|
|
// the port configurations Config-1, Config-2, Config-3, Config-4 and Config-5
|
624 |
|
|
.p0_mcb_wr_en (c3_p0_wr_en),
|
625 |
|
|
.p0_mcb_wr_mask (c3_p0_wr_mask),
|
626 |
|
|
.p0_mcb_wr_data (c3_p0_wr_data),
|
627 |
|
|
.p0_mcb_wr_full (c3_p0_wr_full),
|
628 |
|
|
.p0_mcb_wr_fifo_counts (c3_p0_wr_count),
|
629 |
|
|
// User Port-0 data read interface will be active only when the port is enabled in
|
630 |
|
|
// the port configurations Config-1, Config-2, Config-3, Config-4 and Config-5
|
631 |
|
|
.p0_mcb_rd_en (c3_p0_rd_en),
|
632 |
|
|
.p0_mcb_rd_data (c3_p0_rd_data),
|
633 |
|
|
.p0_mcb_rd_empty (c3_p0_rd_empty),
|
634 |
|
|
.p0_mcb_rd_fifo_counts (c3_p0_rd_count),
|
635 |
|
|
|
636 |
|
|
// User Port-1 command interface will be active only when the port is enabled in
|
637 |
|
|
// the port configurations Config-1, Config-2, Config-3 and Config-4
|
638 |
|
|
.p1_mcb_cmd_en (c3_p1_cmd_en),
|
639 |
|
|
.p1_mcb_cmd_instr (c3_p1_cmd_instr),
|
640 |
|
|
.p1_mcb_cmd_bl (c3_p1_cmd_bl),
|
641 |
|
|
.p1_mcb_cmd_addr (c3_p1_cmd_byte_addr),
|
642 |
|
|
.p1_mcb_cmd_full (c3_p1_cmd_full),
|
643 |
|
|
// User Port-1 data write interface will be active only when the port is enabled in
|
644 |
|
|
// the port configurations Config-1, Config-2, Config-3 and Config-4
|
645 |
|
|
.p1_mcb_wr_en (c3_p1_wr_en),
|
646 |
|
|
.p1_mcb_wr_mask (c3_p1_wr_mask),
|
647 |
|
|
.p1_mcb_wr_data (c3_p1_wr_data),
|
648 |
|
|
.p1_mcb_wr_full (c3_p1_wr_full),
|
649 |
|
|
.p1_mcb_wr_fifo_counts (c3_p1_wr_count),
|
650 |
|
|
// User Port-1 data read interface will be active only when the port is enabled in
|
651 |
|
|
// the port configurations Config-1, Config-2, Config-3 and Config-4
|
652 |
|
|
.p1_mcb_rd_en (c3_p1_rd_en),
|
653 |
|
|
.p1_mcb_rd_data (c3_p1_rd_data),
|
654 |
|
|
.p1_mcb_rd_empty (c3_p1_rd_empty),
|
655 |
|
|
.p1_mcb_rd_fifo_counts (c3_p1_rd_count),
|
656 |
|
|
|
657 |
|
|
// User Port-2 command interface will be active only when the port is enabled in
|
658 |
|
|
// the port configurations Config-1, Config-2 and Config-3
|
659 |
|
|
.p2_mcb_cmd_en (c3_p2_cmd_en),
|
660 |
|
|
.p2_mcb_cmd_instr (c3_p2_cmd_instr),
|
661 |
|
|
.p2_mcb_cmd_bl (c3_p2_cmd_bl),
|
662 |
|
|
.p2_mcb_cmd_addr (c3_p2_cmd_byte_addr),
|
663 |
|
|
.p2_mcb_cmd_full (c3_p2_cmd_full),
|
664 |
|
|
// User Port-2 data write interface will be active only when the port is enabled in
|
665 |
|
|
// the port configurations Config-1 write direction, Config-2 and Config-3
|
666 |
|
|
.p2_mcb_wr_en (c3_p2_wr_en),
|
667 |
|
|
.p2_mcb_wr_mask (c3_p2_wr_mask),
|
668 |
|
|
.p2_mcb_wr_data (c3_p2_wr_data),
|
669 |
|
|
.p2_mcb_wr_full (c3_p2_wr_full),
|
670 |
|
|
.p2_mcb_wr_fifo_counts (c3_p2_wr_count),
|
671 |
|
|
// User Port-2 data read interface will be active only when the port is enabled in
|
672 |
|
|
// the port configurations Config-1 read direction, Config-2 and Config-3
|
673 |
|
|
.p2_mcb_rd_en (c3_p2_rd_en),
|
674 |
|
|
.p2_mcb_rd_data (c3_p2_rd_data),
|
675 |
|
|
.p2_mcb_rd_empty (c3_p2_rd_empty),
|
676 |
|
|
.p2_mcb_rd_fifo_counts (c3_p2_rd_count),
|
677 |
|
|
|
678 |
|
|
// User Port-3 command interface will be active only when the port is enabled in
|
679 |
|
|
// the port configurations Config-1 and Config-2
|
680 |
|
|
.p3_mcb_cmd_en (c3_p3_cmd_en),
|
681 |
|
|
.p3_mcb_cmd_instr (c3_p3_cmd_instr),
|
682 |
|
|
.p3_mcb_cmd_bl (c3_p3_cmd_bl),
|
683 |
|
|
.p3_mcb_cmd_addr (c3_p3_cmd_byte_addr),
|
684 |
|
|
.p3_mcb_cmd_full (c3_p3_cmd_full),
|
685 |
|
|
// User Port-3 data write interface will be active only when the port is enabled in
|
686 |
|
|
// the port configurations Config-1 write direction and Config-2
|
687 |
|
|
.p3_mcb_wr_en (c3_p3_wr_en),
|
688 |
|
|
.p3_mcb_wr_mask (c3_p3_wr_mask),
|
689 |
|
|
.p3_mcb_wr_data (c3_p3_wr_data),
|
690 |
|
|
.p3_mcb_wr_full (c3_p3_wr_full),
|
691 |
|
|
.p3_mcb_wr_fifo_counts (c3_p3_wr_count),
|
692 |
|
|
// User Port-3 data read interface will be active only when the port is enabled in
|
693 |
|
|
// the port configurations Config-1 read direction and Config-2
|
694 |
|
|
.p3_mcb_rd_en (c3_p3_rd_en),
|
695 |
|
|
.p3_mcb_rd_data (c3_p3_rd_data),
|
696 |
|
|
.p3_mcb_rd_empty (c3_p3_rd_empty),
|
697 |
|
|
.p3_mcb_rd_fifo_counts (c3_p3_rd_count),
|
698 |
|
|
|
699 |
|
|
// User Port-4 command interface will be active only when the port is enabled in
|
700 |
|
|
// the port configuration Config-1
|
701 |
|
|
.p4_mcb_cmd_en (c3_p4_cmd_en),
|
702 |
|
|
.p4_mcb_cmd_instr (c3_p4_cmd_instr),
|
703 |
|
|
.p4_mcb_cmd_bl (c3_p4_cmd_bl),
|
704 |
|
|
.p4_mcb_cmd_addr (c3_p4_cmd_byte_addr),
|
705 |
|
|
.p4_mcb_cmd_full (c3_p4_cmd_full),
|
706 |
|
|
// User Port-4 data write interface will be active only when the port is enabled in
|
707 |
|
|
// the port configuration Config-1 write direction
|
708 |
|
|
.p4_mcb_wr_en (c3_p4_wr_en),
|
709 |
|
|
.p4_mcb_wr_mask (c3_p4_wr_mask),
|
710 |
|
|
.p4_mcb_wr_data (c3_p4_wr_data),
|
711 |
|
|
.p4_mcb_wr_full (c3_p4_wr_full),
|
712 |
|
|
.p4_mcb_wr_fifo_counts (c3_p4_wr_count),
|
713 |
|
|
// User Port-4 data read interface will be active only when the port is enabled in
|
714 |
|
|
// the port configuration Config-1 read direction
|
715 |
|
|
.p4_mcb_rd_en (c3_p4_rd_en),
|
716 |
|
|
.p4_mcb_rd_data (c3_p4_rd_data),
|
717 |
|
|
.p4_mcb_rd_empty (c3_p4_rd_empty),
|
718 |
|
|
.p4_mcb_rd_fifo_counts (c3_p4_rd_count),
|
719 |
|
|
|
720 |
|
|
// User Port-5 command interface will be active only when the port is enabled in
|
721 |
|
|
// the port configuration Config-1
|
722 |
|
|
.p5_mcb_cmd_en (c3_p5_cmd_en),
|
723 |
|
|
.p5_mcb_cmd_instr (c3_p5_cmd_instr),
|
724 |
|
|
.p5_mcb_cmd_bl (c3_p5_cmd_bl),
|
725 |
|
|
.p5_mcb_cmd_addr (c3_p5_cmd_byte_addr),
|
726 |
|
|
.p5_mcb_cmd_full (c3_p5_cmd_full),
|
727 |
|
|
// User Port-5 data write interface will be active only when the port is enabled in
|
728 |
|
|
// the port configuration Config-1 write direction
|
729 |
|
|
.p5_mcb_wr_en (c3_p5_wr_en),
|
730 |
|
|
.p5_mcb_wr_mask (c3_p5_wr_mask),
|
731 |
|
|
.p5_mcb_wr_data (c3_p5_wr_data),
|
732 |
|
|
.p5_mcb_wr_full (c3_p5_wr_full),
|
733 |
|
|
.p5_mcb_wr_fifo_counts (c3_p5_wr_count),
|
734 |
|
|
// User Port-5 data read interface will be active only when the port is enabled in
|
735 |
|
|
// the port configuration Config-1 read direction
|
736 |
|
|
.p5_mcb_rd_en (c3_p5_rd_en),
|
737 |
|
|
.p5_mcb_rd_data (c3_p5_rd_data),
|
738 |
|
|
.p5_mcb_rd_empty (c3_p5_rd_empty),
|
739 |
|
|
.p5_mcb_rd_fifo_counts (c3_p5_rd_count)
|
740 |
|
|
);
|
741 |
|
|
|
742 |
|
|
|
743 |
|
|
|
744 |
|
|
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
// ========================================================================== //
|
748 |
|
|
// Memory model instances //
|
749 |
|
|
// ========================================================================== //
|
750 |
|
|
|
751 |
|
|
generate
|
752 |
|
|
if(C3_NUM_DQ_PINS == 16) begin : MEM_INST3
|
753 |
|
|
ddr_model_c3 u_mem3(
|
754 |
|
|
.Dq (mcb3_dram_dq),
|
755 |
|
|
.Dqs ({mcb3_dram_udqs,mcb3_dram_dqs}),
|
756 |
|
|
.Addr (mcb3_dram_a),
|
757 |
|
|
.Ba (mcb3_dram_ba),
|
758 |
|
|
.Clk (mcb3_dram_ck),
|
759 |
|
|
.Clk_n (mcb3_dram_ck_n),
|
760 |
|
|
.Cke (mcb3_dram_cke),
|
761 |
|
|
.Cs_n (1'b0),
|
762 |
|
|
.Ras_n (mcb3_dram_ras_n),
|
763 |
|
|
.Cas_n (mcb3_dram_cas_n),
|
764 |
|
|
.We_n (mcb3_dram_we_n),
|
765 |
|
|
.Dm ({mcb3_dram_udm,mcb3_dram_dm})
|
766 |
|
|
);
|
767 |
|
|
end else begin
|
768 |
|
|
ddr_model_c3 u_mem3(
|
769 |
|
|
.Dq (mcb3_dram_dq),
|
770 |
|
|
.Dqs (mcb3_dram_dqs),
|
771 |
|
|
.Addr (mcb3_dram_a),
|
772 |
|
|
.Ba (mcb3_dram_ba),
|
773 |
|
|
.Clk (mcb3_dram_ck),
|
774 |
|
|
.Clk_n (mcb3_dram_ck_n),
|
775 |
|
|
.Cke (mcb3_dram_cke),
|
776 |
|
|
.Cs_n (1'b0),
|
777 |
|
|
.Ras_n (mcb3_dram_ras_n),
|
778 |
|
|
.Cas_n (mcb3_dram_cas_n),
|
779 |
|
|
.We_n (mcb3_dram_we_n),
|
780 |
|
|
.Dm (mcb3_dram_dm)
|
781 |
|
|
);
|
782 |
|
|
end
|
783 |
|
|
endgenerate
|
784 |
|
|
|
785 |
|
|
// ========================================================================== //
|
786 |
|
|
// Reporting the test case status
|
787 |
|
|
// ========================================================================== //
|
788 |
|
|
initial
|
789 |
|
|
begin : Logging
|
790 |
|
|
fork
|
791 |
|
|
begin : calibration_done
|
792 |
|
|
wait (calib_done);
|
793 |
|
|
$display("Calibration Done");
|
794 |
|
|
#50000000;
|
795 |
|
|
if (!error) begin
|
796 |
|
|
$display("TEST PASSED");
|
797 |
|
|
end
|
798 |
|
|
else begin
|
799 |
|
|
$display("TEST FAILED: DATA ERROR");
|
800 |
|
|
end
|
801 |
|
|
disable calib_not_done;
|
802 |
|
|
$finish;
|
803 |
|
|
end
|
804 |
|
|
|
805 |
|
|
begin : calib_not_done
|
806 |
|
|
#200000000;
|
807 |
|
|
if (!calib_done) begin
|
808 |
|
|
$display("TEST FAILED: INITIALIZATION DID NOT COMPLETE");
|
809 |
|
|
end
|
810 |
|
|
disable calibration_done;
|
811 |
|
|
$finish;
|
812 |
|
|
end
|
813 |
|
|
join
|
814 |
|
|
end
|
815 |
|
|
|
816 |
|
|
endmodule
|