1 |
2 |
ZTEX |
//*****************************************************************************
|
2 |
|
|
// (c) Copyright 2008-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: %version
|
53 |
|
|
// \ \ Application: MIG
|
54 |
|
|
// / / Filename: init_mem_pattern_ctr.v
|
55 |
|
|
// /___/ /\ Date Last Modified: $Date: 2011/06/02 07:16:33 $
|
56 |
|
|
// \ \ / \ Date Created: Fri Sep 01 2006
|
57 |
|
|
// \___\/\___\
|
58 |
|
|
//
|
59 |
|
|
//Device: Spartan6
|
60 |
|
|
//Design Name: DDR/DDR2/DDR3/LPDDR
|
61 |
|
|
//Purpose: This moduel has a small FSM to control the operation of
|
62 |
|
|
// mcb_traffic_gen module.It first fill up the memory with a selected
|
63 |
|
|
// DATA pattern and then starts the memory testing state.
|
64 |
|
|
//Reference:
|
65 |
|
|
//Revision History: 1.1 Modify to allow data_mode_o to be controlled by parameter DATA_MODE
|
66 |
|
|
// and the fixed_bl_o is fixed at 64 if data_mode_o == PRBA and FAMILY == "SPARTAN6"
|
67 |
|
|
// The fixed_bl_o in Virtex6 is determined by the MEM_BURST_LENGTH.
|
68 |
|
|
// 1.2 10-1-2009 Added parameter TST_MEM_INSTR_MODE to select instruction pattern during
|
69 |
|
|
// memory testing phase.
|
70 |
|
|
// 1.3 05/19/2010 If MEM_BURST_LEN value is passed with value of zero, it is treated as
|
71 |
|
|
// "OTF" Burst Mode and TG will only generate BL 8 traffic.
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
//*****************************************************************************
|
75 |
|
|
|
76 |
|
|
`timescale 1ps/1ps
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
module init_mem_pattern_ctr #
|
83 |
|
|
(
|
84 |
|
|
parameter TCQ = 100,
|
85 |
|
|
parameter FAMILY = "SPARTAN6", // VIRTEX6, SPARTAN6
|
86 |
|
|
parameter TST_MEM_INSTR_MODE = "R_W_INSTR_MODE", // Spartan6 Available commands:
|
87 |
|
|
// "FIXED_INSTR_R_MODE", "FIXED_INSTR_W_MODE"
|
88 |
|
|
// "R_W_INSTR_MODE", "RP_WP_INSTR_MODE
|
89 |
|
|
// "R_RP_W_WP_INSTR_MODE", "R_RP_W_WP_REF_INSTR_MODE"
|
90 |
|
|
// Virtex 6 Available commands:
|
91 |
|
|
// "FIXED_INSTR_R_MODE" - Only Read commands will be generated.
|
92 |
|
|
// "FIXED_INSTR_W_MODE" -- Only Write commands will be generated.
|
93 |
|
|
// "R_W_INSTR_MODE" - Random Read/Write commands will be generated.
|
94 |
|
|
parameter MEM_BURST_LEN = 8, // VIRTEX 6 Option.
|
95 |
|
|
parameter CMD_PATTERN = "CGEN_ALL", // "CGEN_ALL" option generates all available
|
96 |
|
|
// commands pattern.
|
97 |
|
|
parameter BEGIN_ADDRESS = 32'h00000000,
|
98 |
|
|
parameter END_ADDRESS = 32'h00000fff,
|
99 |
|
|
parameter ADDR_WIDTH = 30,
|
100 |
|
|
parameter DWIDTH = 32,
|
101 |
|
|
parameter CMD_SEED_VALUE = 32'h12345678,
|
102 |
|
|
parameter DATA_SEED_VALUE = 32'hca345675,
|
103 |
|
|
parameter DATA_MODE = 4'b0010,
|
104 |
|
|
parameter PORT_MODE = "BI_MODE", // V6 Option: "BI_MODE"; SP6 Option: "WR_MODE", "RD_MODE", "BI_MODE"
|
105 |
|
|
parameter EYE_TEST = "FALSE" // set EYE_TEST = "TRUE" to probe memory signals.
|
106 |
|
|
// Traffic Generator will only write to one single location and no
|
107 |
|
|
// read transactions will be generated.
|
108 |
|
|
|
109 |
|
|
)
|
110 |
|
|
(
|
111 |
|
|
input clk_i,
|
112 |
|
|
input rst_i,
|
113 |
|
|
|
114 |
|
|
input [ADDR_WIDTH-1:0] mcb_cmd_addr_i,
|
115 |
|
|
input [5:0] mcb_cmd_bl_i,
|
116 |
|
|
input mcb_cmd_en_i,
|
117 |
|
|
input [2:0] mcb_cmd_instr_i,
|
118 |
|
|
input mcb_wr_en_i,
|
119 |
|
|
input vio_modify_enable, // 0: default to ADDR as DATA PATTERN. No runtime change in data mode.
|
120 |
|
|
// 1: enable exteral VIO to control the data_mode pattern
|
121 |
|
|
// and address mode pattern during runtime.
|
122 |
|
|
input [2:0] vio_data_mode_value,
|
123 |
|
|
input [2:0] vio_addr_mode_value,
|
124 |
|
|
input [1:0] vio_bl_mode_value,
|
125 |
|
|
input [5:0] vio_fixed_bl_value, // valid range is: from 1 to 64.
|
126 |
|
|
|
127 |
|
|
input mcb_init_done_i,
|
128 |
|
|
input cmp_error,
|
129 |
|
|
output reg run_traffic_o,
|
130 |
|
|
// runtime parameter
|
131 |
|
|
output [31:0] start_addr_o, // define the start of address
|
132 |
|
|
output [31:0] end_addr_o,
|
133 |
|
|
output [31:0] cmd_seed_o, // same seed apply to all addr_prbs_gen, bl_prbs_gen, instr_prbs_gen
|
134 |
|
|
output [31:0] data_seed_o,
|
135 |
|
|
output reg load_seed_o, //
|
136 |
|
|
// upper layer inputs to determine the command bus and data pattern
|
137 |
|
|
// internal traffic generator initialize the memory with
|
138 |
|
|
output reg [2:0] addr_mode_o, // "00" = bram; takes the address from bram output
|
139 |
|
|
// "001" = fixed address from the fixed_addr input
|
140 |
|
|
// "010" = psuedo ramdom pattern; generated from internal 64 bit LFSR
|
141 |
|
|
// "011" = sequential
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
// for each instr_mode, traffic gen fill up with a predetermined pattern before starting the instr_pattern that defined
|
145 |
|
|
// in the instr_mode input. The runtime mode will be automatically loaded inside when it is in
|
146 |
|
|
output reg [3:0] instr_mode_o, // "0000" = Fixed
|
147 |
|
|
// "0001" = bram; takes instruction from bram output
|
148 |
|
|
// "0010" = R/W
|
149 |
|
|
// "0011" = RP/WP
|
150 |
|
|
// "0100" = R/RP/W/WP
|
151 |
|
|
// "0101" = R/RP/W/WP/REF
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
output reg [1:0] bl_mode_o, // "00" = bram; takes the burst length from bram output
|
155 |
|
|
// "01" = fixed , takes the burst length from the fixed_bl input
|
156 |
|
|
// "10" = psuedo ramdom pattern; generated from internal 16 bit LFSR
|
157 |
|
|
|
158 |
|
|
output reg [3:0] data_mode_o, // "00" = bram;
|
159 |
|
|
// "01" = fixed data from the fixed_data input
|
160 |
|
|
// "10" = psuedo ramdom pattern; generated from internal 32 bit LFSR
|
161 |
|
|
// "11" = sequential using the addrs as the starting data pattern
|
162 |
|
|
output reg mode_load_o,
|
163 |
|
|
|
164 |
|
|
// fixed pattern inputs interface
|
165 |
|
|
output reg [5:0] fixed_bl_o, // range from 1 to 64
|
166 |
|
|
output reg [2:0] fixed_instr_o, //RD 3'b001
|
167 |
|
|
//RDP 3'b011
|
168 |
|
|
//WR 3'b000
|
169 |
|
|
//WRP 3'b010
|
170 |
|
|
//REFRESH 3'b100
|
171 |
|
|
output [31:0] fixed_addr_o // only upper 30 bits will be used
|
172 |
|
|
|
173 |
|
|
);
|
174 |
|
|
|
175 |
|
|
//FSM State Defination
|
176 |
|
|
parameter IDLE = 5'b00001,
|
177 |
|
|
INIT_MEM_WRITE = 5'b00010,
|
178 |
|
|
INIT_MEM_READ = 5'b00100,
|
179 |
|
|
TEST_MEM = 5'b01000,
|
180 |
|
|
CMP_ERROR = 5'b10000;
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
localparam BRAM_ADDR = 2'b00;
|
184 |
|
|
localparam FIXED_ADDR = 2'b01;
|
185 |
|
|
localparam PRBS_ADDR = 2'b10;
|
186 |
|
|
localparam SEQUENTIAL_ADDR = 2'b11;
|
187 |
|
|
|
188 |
|
|
localparam BRAM_INSTR_MODE = 4'b0000;
|
189 |
|
|
localparam FIXED_INSTR_MODE = 4'b0001;
|
190 |
|
|
localparam R_W_INSTR_MODE = 4'b0010;
|
191 |
|
|
localparam RP_WP_INSTR_MODE = 4'b0011;
|
192 |
|
|
localparam R_RP_W_WP_INSTR_MODE = 4'b0100;
|
193 |
|
|
localparam R_RP_W_WP_REF_INSTR_MODE = 4'b0101;
|
194 |
|
|
|
195 |
|
|
localparam BRAM_BL_MODE = 2'b00;
|
196 |
|
|
localparam FIXED_BL_MODE = 2'b01;
|
197 |
|
|
localparam PRBS_BL_MODE = 2'b10;
|
198 |
|
|
|
199 |
|
|
localparam BRAM_DATAL_MODE = 4'b0000;
|
200 |
|
|
localparam FIXED_DATA_MODE = 4'b0001;
|
201 |
|
|
localparam ADDR_DATA_MODE = 4'b0010;
|
202 |
|
|
localparam HAMMER_DATA_MODE = 4'b0011;
|
203 |
|
|
localparam NEIGHBOR_DATA_MODE = 4'b0100;
|
204 |
|
|
localparam WALKING1_DATA_MODE = 4'b0101;
|
205 |
|
|
localparam WALKING0_DATA_MODE = 4'b0110;
|
206 |
|
|
localparam PRBS_DATA_MODE = 4'b0111;
|
207 |
|
|
|
208 |
|
|
// type fixed instruction
|
209 |
|
|
localparam RD_INSTR = 3'b001;
|
210 |
|
|
localparam RDP_INSTR = 3'b011;
|
211 |
|
|
localparam WR_INSTR = 3'b000;
|
212 |
|
|
|
213 |
|
|
localparam WRP_INSTR = 3'b010;
|
214 |
|
|
localparam REFRESH_INSTR = 3'b100;
|
215 |
|
|
localparam NOP_WR_INSTR = 3'b101;
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
reg [4:0] current_state;
|
219 |
|
|
reg [4:0] next_state;
|
220 |
|
|
reg mcb_init_done_reg;
|
221 |
|
|
reg mcb_init_done_reg1;
|
222 |
|
|
reg AC2_G_E2,AC1_G_E1,AC3_G_E3;
|
223 |
|
|
reg upper_end_matched;
|
224 |
|
|
reg [31:0] end_boundary_addr;
|
225 |
|
|
reg [31:0] mcb_cmd_addr_r;
|
226 |
|
|
|
227 |
|
|
reg mcb_cmd_en_r;
|
228 |
|
|
//reg [ADDR_WIDTH-1:0] mcb_cmd_addr_r;
|
229 |
|
|
reg [5:0] mcb_cmd_bl_r;
|
230 |
|
|
reg lower_end_matched;
|
231 |
|
|
reg end_addr_reached;
|
232 |
|
|
reg run_traffic;
|
233 |
|
|
reg bram_mode_enable;
|
234 |
|
|
wire tst_matched;
|
235 |
|
|
reg [31:0] current_address;
|
236 |
|
|
reg [5:0] fix_bl_value;
|
237 |
|
|
reg [3:0] data_mode_sel;
|
238 |
|
|
reg [2:0] addr_mode_sel;
|
239 |
|
|
reg [1:0] bl_mode_sel;
|
240 |
|
|
reg [2:0] addr_mode;
|
241 |
|
|
reg [10:0] INC_COUNTS;
|
242 |
|
|
wire [5:0] FIXEDBL;
|
243 |
|
|
wire [3:0] test_mem_instr_mode;
|
244 |
|
|
|
245 |
|
|
assign test_mem_instr_mode = (TST_MEM_INSTR_MODE == "BRAM_INSTR_MODE") ? 4'b0000:
|
246 |
|
|
(TST_MEM_INSTR_MODE == "FIXED_INSTR_R_MODE" ||
|
247 |
|
|
TST_MEM_INSTR_MODE == "FIXED_INSTR_W_MODE") ? 4'b0001:
|
248 |
|
|
(TST_MEM_INSTR_MODE == "R_W_INSTR_MODE") ? 4'b0010:
|
249 |
|
|
(TST_MEM_INSTR_MODE == "RP_WP_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0011:
|
250 |
|
|
(TST_MEM_INSTR_MODE == "R_RP_W_WP_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0100:
|
251 |
|
|
(TST_MEM_INSTR_MODE == "R_RP_W_WP_REF_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0101:
|
252 |
|
|
4'b0010;
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
assign FIXEDBL = 64; // This is fixed for current Spartan 6 Example Design
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
generate
|
273 |
|
|
if (FAMILY == "SPARTAN6" ) begin : INC_COUNTS_S
|
274 |
|
|
|
275 |
|
|
always @ (posedge clk_i)
|
276 |
|
|
INC_COUNTS <= (DWIDTH/8);
|
277 |
|
|
|
278 |
|
|
end
|
279 |
|
|
endgenerate
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
generate
|
287 |
|
|
if (FAMILY == "VIRTEX6" ) begin : INC_COUNTS_V
|
288 |
|
|
always @ (posedge clk_i)
|
289 |
|
|
begin
|
290 |
|
|
if ( (DWIDTH >= 256 && DWIDTH <= 576)) // 64 144
|
291 |
|
|
INC_COUNTS <= 32 ;
|
292 |
|
|
else if ((DWIDTH >= 128) && (DWIDTH <= 224)) // 32 dq pins or 566 dq pins
|
293 |
|
|
INC_COUNTS <= 16 ;
|
294 |
|
|
else if ((DWIDTH == 64) || (DWIDTH == 96)) // 16 dq pins or 24 dqpins
|
295 |
|
|
INC_COUNTS <= 8 ;
|
296 |
|
|
else if ((DWIDTH == 32) ) // 8 dq pins
|
297 |
|
|
INC_COUNTS <= 4 ;
|
298 |
|
|
end
|
299 |
|
|
end
|
300 |
|
|
endgenerate
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
always @ (posedge clk_i)
|
304 |
|
|
begin
|
305 |
|
|
if (rst_i)
|
306 |
|
|
current_address <= BEGIN_ADDRESS;
|
307 |
|
|
else if (mcb_wr_en_i && (current_state == INIT_MEM_WRITE && (PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE"))
|
308 |
|
|
|| (mcb_wr_en_i && (current_state == IDLE && PORT_MODE == "RD_MODE")) )
|
309 |
|
|
current_address <= current_address + INC_COUNTS;
|
310 |
|
|
else
|
311 |
|
|
current_address <= current_address;
|
312 |
|
|
|
313 |
|
|
end
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
always @ (posedge clk_i)
|
317 |
|
|
begin
|
318 |
|
|
if (current_address[29:24] >= end_boundary_addr[29:24])
|
319 |
|
|
AC3_G_E3 <= 1'b1;
|
320 |
|
|
else
|
321 |
|
|
AC3_G_E3 <= 1'b0;
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
if (current_address[23:16] >= end_boundary_addr[23:16])
|
325 |
|
|
AC2_G_E2 <= 1'b1;
|
326 |
|
|
else
|
327 |
|
|
AC2_G_E2 <= 1'b0;
|
328 |
|
|
|
329 |
|
|
if (current_address[15:8] >= end_boundary_addr[15:8])
|
330 |
|
|
AC1_G_E1 <= 1'b1;
|
331 |
|
|
else
|
332 |
|
|
AC1_G_E1 <= 1'b0;
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
end
|
336 |
|
|
always @(posedge clk_i)
|
337 |
|
|
begin
|
338 |
|
|
if (rst_i)
|
339 |
|
|
upper_end_matched <= 1'b0;
|
340 |
|
|
|
341 |
|
|
else if (mcb_cmd_en_i)
|
342 |
|
|
upper_end_matched <= AC3_G_E3 & AC2_G_E2 & AC1_G_E1;
|
343 |
|
|
end
|
344 |
|
|
|
345 |
|
|
wire [6:0] FIXED_BL_VALUE;
|
346 |
|
|
assign FIXED_BL_VALUE = (FAMILY == "VIRTEX6" && (MEM_BURST_LEN == 8 || MEM_BURST_LEN == 0)) ? 2 :
|
347 |
|
|
(FAMILY == "VIRTEX6" && MEM_BURST_LEN == 4) ? 1 :
|
348 |
|
|
FIXEDBL;
|
349 |
|
|
|
350 |
|
|
always @(posedge clk_i)
|
351 |
|
|
begin
|
352 |
|
|
// end_boundary_addr <= (END_ADDRESS[31:0] - (DWIDTH/8)*FIXEDBL +1) ;
|
353 |
|
|
end_boundary_addr <= (END_ADDRESS[31:0] - (DWIDTH/8) +1) ;
|
354 |
|
|
|
355 |
|
|
end
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
always @(posedge clk_i)
|
360 |
|
|
begin
|
361 |
|
|
if (current_address[7:0] >= end_boundary_addr[7:0])
|
362 |
|
|
|
363 |
|
|
lower_end_matched <= 1'b1;
|
364 |
|
|
else
|
365 |
|
|
lower_end_matched <= 1'b0;
|
366 |
|
|
|
367 |
|
|
end
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
always @(posedge clk_i)
|
371 |
|
|
begin
|
372 |
|
|
if (mcb_cmd_en_i )
|
373 |
|
|
mcb_cmd_addr_r <= mcb_cmd_addr_i;
|
374 |
|
|
end
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
always @(posedge clk_i)
|
378 |
|
|
begin
|
379 |
|
|
if (mcb_cmd_en_i)
|
380 |
|
|
mcb_cmd_bl_r <= mcb_cmd_bl_i;
|
381 |
|
|
end
|
382 |
|
|
|
383 |
|
|
always @(posedge clk_i)
|
384 |
|
|
begin
|
385 |
|
|
if ((upper_end_matched && lower_end_matched && FAMILY == "SPARTAN6" && DWIDTH == 32) ||
|
386 |
|
|
(upper_end_matched && lower_end_matched && FAMILY == "SPARTAN6" && DWIDTH == 64) ||
|
387 |
|
|
(upper_end_matched && DWIDTH == 128 && FAMILY == "SPARTAN6") ||
|
388 |
|
|
(upper_end_matched && lower_end_matched && FAMILY == "VIRTEX6"))
|
389 |
|
|
end_addr_reached <= 1'b1;
|
390 |
|
|
else
|
391 |
|
|
end_addr_reached <= 1'b0;
|
392 |
|
|
|
393 |
|
|
end
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
assign tst_matched = upper_end_matched & lower_end_matched;
|
397 |
|
|
|
398 |
|
|
assign fixed_addr_o = 32'h00001234;
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
always @ (posedge clk_i)
|
403 |
|
|
begin
|
404 |
|
|
mcb_init_done_reg1 <= mcb_init_done_i;
|
405 |
|
|
mcb_init_done_reg <= mcb_init_done_reg1;
|
406 |
|
|
end
|
407 |
|
|
|
408 |
|
|
always @ (posedge clk_i)
|
409 |
|
|
run_traffic_o <= run_traffic;
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
always @ (posedge clk_i)
|
414 |
|
|
begin
|
415 |
|
|
if (rst_i)
|
416 |
|
|
current_state <= 5'b00001;
|
417 |
|
|
else
|
418 |
|
|
current_state <= next_state;
|
419 |
|
|
end
|
420 |
|
|
|
421 |
|
|
assign start_addr_o = BEGIN_ADDRESS;//BEGIN_ADDRESS;
|
422 |
|
|
assign end_addr_o = END_ADDRESS;
|
423 |
|
|
assign cmd_seed_o = CMD_SEED_VALUE;
|
424 |
|
|
assign data_seed_o = DATA_SEED_VALUE;
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
reg [2:0] syn1_vio_data_mode_value;
|
428 |
|
|
reg [2:0] syn1_vio_addr_mode_value;
|
429 |
|
|
|
430 |
|
|
|
431 |
|
|
always @ (posedge clk_i)
|
432 |
|
|
begin
|
433 |
|
|
if (rst_i) begin
|
434 |
|
|
syn1_vio_data_mode_value <= 3'b011;
|
435 |
|
|
syn1_vio_addr_mode_value <= 2'b11;
|
436 |
|
|
end
|
437 |
|
|
else if (vio_modify_enable == 1'b1) begin
|
438 |
|
|
syn1_vio_data_mode_value <= vio_data_mode_value;
|
439 |
|
|
syn1_vio_addr_mode_value <= vio_addr_mode_value;
|
440 |
|
|
end
|
441 |
|
|
end
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
always @ (posedge clk_i)
|
445 |
|
|
begin
|
446 |
|
|
if (rst_i) begin
|
447 |
|
|
data_mode_sel <= DATA_MODE;//ADDR_DATA_MODE;
|
448 |
|
|
addr_mode_sel <= 2'b11;
|
449 |
|
|
end
|
450 |
|
|
else if (vio_modify_enable == 1'b1) begin
|
451 |
|
|
data_mode_sel <= syn1_vio_data_mode_value[2:0];
|
452 |
|
|
addr_mode_sel <= vio_addr_mode_value;
|
453 |
|
|
end
|
454 |
|
|
end
|
455 |
|
|
|
456 |
|
|
always @ (posedge clk_i)
|
457 |
|
|
begin
|
458 |
|
|
if (rst_i || FAMILY == "VIRTEX6")
|
459 |
|
|
fix_bl_value <= FIXED_BL_VALUE;//ADDR_DATA_MODE;
|
460 |
|
|
|
461 |
|
|
else if (vio_modify_enable == 1'b1) begin
|
462 |
|
|
fix_bl_value <= vio_fixed_bl_value;
|
463 |
|
|
end
|
464 |
|
|
end
|
465 |
|
|
|
466 |
|
|
always @ (posedge clk_i)
|
467 |
|
|
begin
|
468 |
|
|
if (rst_i || (FAMILY == "VIRTEX6"))
|
469 |
|
|
if (FAMILY == "VIRTEX6")
|
470 |
|
|
bl_mode_sel <= FIXED_BL_MODE;
|
471 |
|
|
else
|
472 |
|
|
bl_mode_sel <= PRBS_BL_MODE;
|
473 |
|
|
else if (vio_modify_enable == 1'b1) begin
|
474 |
|
|
bl_mode_sel <= vio_bl_mode_value;
|
475 |
|
|
end
|
476 |
|
|
end
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
always @ (posedge clk_i)
|
483 |
|
|
begin
|
484 |
|
|
data_mode_o <= data_mode_sel;
|
485 |
|
|
addr_mode_o <= addr_mode;
|
486 |
|
|
|
487 |
|
|
// assuming if vio_modify_enable is enabled and vio_addr_mode_value is set to zero
|
488 |
|
|
// user wants to have bram interface.
|
489 |
|
|
if (syn1_vio_addr_mode_value == 0 && vio_modify_enable == 1'b1)
|
490 |
|
|
bram_mode_enable <= 1'b1;
|
491 |
|
|
else
|
492 |
|
|
bram_mode_enable <= 1'b0;
|
493 |
|
|
|
494 |
|
|
end
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
always @ (*)
|
498 |
|
|
begin
|
499 |
|
|
load_seed_o = 1'b0;
|
500 |
|
|
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
501 |
|
|
addr_mode = 'b0;
|
502 |
|
|
else
|
503 |
|
|
addr_mode = SEQUENTIAL_ADDR;
|
504 |
|
|
|
505 |
|
|
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
506 |
|
|
instr_mode_o = 'b0;
|
507 |
|
|
else
|
508 |
|
|
instr_mode_o = FIXED_INSTR_MODE;
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
512 |
|
|
bl_mode_o = 'b0;
|
513 |
|
|
else
|
514 |
|
|
bl_mode_o = FIXED_BL_MODE;
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
if (FAMILY == "VIRTEX6")
|
519 |
|
|
fixed_bl_o = FIXED_BL_VALUE;
|
520 |
|
|
// PRBS mode
|
521 |
|
|
else if (data_mode_o[2:0] == 3'b111 && FAMILY == "SPARTAN6")
|
522 |
|
|
fixed_bl_o = 64; // Our current PRBS algorithm wants to maximize the range bl from 1 to 64.
|
523 |
|
|
else
|
524 |
|
|
fixed_bl_o = fix_bl_value;
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
mode_load_o = 1'b0;
|
529 |
|
|
run_traffic = 1'b0;
|
530 |
|
|
next_state = IDLE;
|
531 |
|
|
|
532 |
|
|
if (PORT_MODE == "RD_MODE") begin
|
533 |
|
|
fixed_instr_o = RD_INSTR;
|
534 |
|
|
end
|
535 |
|
|
else if( PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE") begin
|
536 |
|
|
fixed_instr_o = WR_INSTR;
|
537 |
|
|
end
|
538 |
|
|
|
539 |
|
|
case(current_state)
|
540 |
|
|
IDLE:
|
541 |
|
|
begin
|
542 |
|
|
if(mcb_init_done_reg ) //rdp_rdy_i comes from read_data path
|
543 |
|
|
begin
|
544 |
|
|
if (PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE") begin
|
545 |
|
|
next_state = INIT_MEM_WRITE;
|
546 |
|
|
mode_load_o = 1'b1;
|
547 |
|
|
run_traffic = 1'b0;
|
548 |
|
|
load_seed_o = 1'b1;
|
549 |
|
|
end
|
550 |
|
|
else if (PORT_MODE == "RD_MODE" && end_addr_reached) begin
|
551 |
|
|
next_state = TEST_MEM;
|
552 |
|
|
mode_load_o = 1'b1;
|
553 |
|
|
run_traffic = 1'b1;
|
554 |
|
|
load_seed_o = 1'b1;
|
555 |
|
|
|
556 |
|
|
end
|
557 |
|
|
end
|
558 |
|
|
else
|
559 |
|
|
begin
|
560 |
|
|
next_state = IDLE;
|
561 |
|
|
run_traffic = 1'b0;
|
562 |
|
|
load_seed_o = 1'b0;
|
563 |
|
|
|
564 |
|
|
end
|
565 |
|
|
|
566 |
|
|
end
|
567 |
|
|
INIT_MEM_WRITE: begin
|
568 |
|
|
|
569 |
|
|
if (end_addr_reached && EYE_TEST == "FALSE" )
|
570 |
|
|
begin
|
571 |
|
|
next_state = TEST_MEM;
|
572 |
|
|
mode_load_o = 1'b1;
|
573 |
|
|
load_seed_o = 1'b1;
|
574 |
|
|
run_traffic = 1'b1;
|
575 |
|
|
|
576 |
|
|
end
|
577 |
|
|
else
|
578 |
|
|
begin
|
579 |
|
|
next_state = INIT_MEM_WRITE;
|
580 |
|
|
run_traffic = 1'b1;
|
581 |
|
|
mode_load_o = 1'b0;
|
582 |
|
|
load_seed_o = 1'b0;
|
583 |
|
|
if (EYE_TEST == "TRUE")
|
584 |
|
|
addr_mode = FIXED_ADDR;
|
585 |
|
|
else if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
586 |
|
|
addr_mode = 'b0;
|
587 |
|
|
else
|
588 |
|
|
addr_mode = SEQUENTIAL_ADDR;
|
589 |
|
|
|
590 |
|
|
end
|
591 |
|
|
|
592 |
|
|
end
|
593 |
|
|
|
594 |
|
|
INIT_MEM_READ: begin
|
595 |
|
|
|
596 |
|
|
if (end_addr_reached )
|
597 |
|
|
begin
|
598 |
|
|
next_state = TEST_MEM;
|
599 |
|
|
mode_load_o = 1'b1;
|
600 |
|
|
load_seed_o = 1'b1;
|
601 |
|
|
|
602 |
|
|
end
|
603 |
|
|
else
|
604 |
|
|
begin
|
605 |
|
|
next_state = INIT_MEM_READ;
|
606 |
|
|
run_traffic = 1'b0;
|
607 |
|
|
mode_load_o = 1'b0;
|
608 |
|
|
load_seed_o = 1'b0;
|
609 |
|
|
|
610 |
|
|
end
|
611 |
|
|
|
612 |
|
|
end
|
613 |
|
|
TEST_MEM: begin
|
614 |
|
|
if (cmp_error)
|
615 |
|
|
next_state = CMP_ERROR;
|
616 |
|
|
|
617 |
|
|
else
|
618 |
|
|
next_state = TEST_MEM;
|
619 |
|
|
run_traffic = 1'b1;
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
if (PORT_MODE == "BI_MODE" && TST_MEM_INSTR_MODE == "FIXED_INSTR_W_MODE")
|
623 |
|
|
fixed_instr_o = WR_INSTR;
|
624 |
|
|
else if (PORT_MODE == "BI_MODE" && TST_MEM_INSTR_MODE == "FIXED_INSTR_R_MODE")
|
625 |
|
|
fixed_instr_o = RD_INSTR;
|
626 |
|
|
else if (PORT_MODE == "RD_MODE")
|
627 |
|
|
fixed_instr_o = RD_INSTR;
|
628 |
|
|
|
629 |
|
|
else if( PORT_MODE == "WR_MODE")
|
630 |
|
|
fixed_instr_o = WR_INSTR;
|
631 |
|
|
|
632 |
|
|
|
633 |
|
|
if (FAMILY == "VIRTEX6")
|
634 |
|
|
fixed_bl_o = fix_bl_value;
|
635 |
|
|
else if ((data_mode_o == 3'b111) && (FAMILY == "SPARTAN6"))
|
636 |
|
|
fixed_bl_o = 64; // Our current PRBS algorithm wants to maximize the range bl from 1 to 64.
|
637 |
|
|
else
|
638 |
|
|
fixed_bl_o = fix_bl_value;
|
639 |
|
|
|
640 |
|
|
bl_mode_o = bl_mode_sel;//FIXED_BL_MODE;//PRBS_BL_MODE;//PRBS_BL_MODE; //FIXED_BL_MODE;
|
641 |
|
|
|
642 |
|
|
if (bl_mode_o == PRBS_BL_MODE)
|
643 |
|
|
addr_mode = PRBS_ADDR;
|
644 |
|
|
else
|
645 |
|
|
addr_mode = addr_mode_sel;
|
646 |
|
|
|
647 |
|
|
|
648 |
|
|
|
649 |
|
|
if(PORT_MODE == "BI_MODE") begin
|
650 |
|
|
if(CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
651 |
|
|
instr_mode_o = BRAM_INSTR_MODE;
|
652 |
|
|
else
|
653 |
|
|
instr_mode_o = test_mem_instr_mode;//R_RP_W_WP_REF_INSTR_MODE;//FIXED_INSTR_MODE;//R_W_INSTR_MODE;//R_RP_W_WP_INSTR_MODE;//R_W_INSTR_MODE;//R_W_INSTR_MODE; //FIXED_INSTR_MODE;//
|
654 |
|
|
end
|
655 |
|
|
else if (PORT_MODE == "RD_MODE" || PORT_MODE == "WR_MODE") begin
|
656 |
|
|
instr_mode_o = FIXED_INSTR_MODE;
|
657 |
|
|
end
|
658 |
|
|
|
659 |
|
|
end
|
660 |
|
|
|
661 |
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
CMP_ERROR:
|
666 |
|
|
begin
|
667 |
|
|
next_state = CMP_ERROR;
|
668 |
|
|
bl_mode_o = bl_mode_sel;//PRBS_BL_MODE;//PRBS_BL_MODE; //FIXED_BL_MODE;
|
669 |
|
|
fixed_instr_o = RD_INSTR;
|
670 |
|
|
addr_mode = SEQUENTIAL_ADDR;//PRBS_ADDR;//PRBS_ADDR;//PRBS_ADDR;//SEQUENTIAL_ADDR;
|
671 |
|
|
if(CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
672 |
|
|
instr_mode_o = BRAM_INSTR_MODE;//
|
673 |
|
|
else
|
674 |
|
|
instr_mode_o = test_mem_instr_mode;//FIXED_INSTR_MODE;//R_W_INSTR_MODE;//R_RP_W_WP_INSTR_MODE;//R_W_INSTR_MODE;//R_W_INSTR_MODE; //FIXED_INSTR_MODE;//
|
675 |
|
|
|
676 |
|
|
run_traffic = 1'b1; // ?? keep it running or stop if error happened
|
677 |
|
|
|
678 |
|
|
end
|
679 |
|
|
default:
|
680 |
|
|
begin
|
681 |
|
|
next_state = IDLE;
|
682 |
|
|
//run_traffic = 1'b0;
|
683 |
|
|
|
684 |
|
|
end
|
685 |
|
|
|
686 |
|
|
endcase
|
687 |
|
|
end
|
688 |
|
|
|
689 |
|
|
|
690 |
|
|
|
691 |
|
|
|
692 |
|
|
endmodule
|