1
1
module bare_tester (
2
2
input clk,
3
- input clk_x1 ,
3
+ input clk_ref ,
4
4
output reg rstn,
5
5
input init_calib_complete,
6
6
output reg [ 5 :0 ] app_burst_number,
@@ -19,11 +19,7 @@ module bare_tester (
19
19
output txp
20
20
);
21
21
22
- // always @(posedge clk_x1) begin
23
- // app_wdata_mask <= 'd0;
24
- // end
25
-
26
- reg [31 :0 ] rst_cnt;
22
+ reg [63 :0 ] rst_cnt;
27
23
always @(posedge clk) begin
28
24
rst_cnt <= rst_cnt + 1 ;
29
25
if (rst_cnt > 32'd2_700_000_000 - 32'd1 ) begin
@@ -89,7 +85,8 @@ module bare_tester (
89
85
// counted in 2 Bytes
90
86
// So in every Single-Busrt, the addr should increse by 8
91
87
// In a 64-Burst, the addr should increse by 512
92
- assign app_addr = {int_app_addr[12 :10 ], int_app_addr[26 :13 ], int_app_addr[9 :0 ]};
88
+ // assign app_addr = {int_app_addr[12:10], int_app_addr[26:13], int_app_addr[9:0]};
89
+ assign app_addr = int_app_addr;
93
90
94
91
reg [127 :0 ] rng;
95
92
reg [127 :0 ] rng_inv;
@@ -109,7 +106,7 @@ module bare_tester (
109
106
end
110
107
end
111
108
112
- always @(posedge clk_x1 ) begin
109
+ always @(posedge clk_ref ) begin
113
110
rng <= rng_i;
114
111
rng_inv <= ~ rng_i;
115
112
mask <= mask_i;
@@ -123,8 +120,8 @@ module bare_tester (
123
120
124
121
if (rng_rst) begin
125
122
rng_i <= rng_init_pattern;
126
- mask_i <= 'hFFFE;
127
123
// mask_i <= 'hF8FC;
124
+ mask_i <= 'h0;
128
125
rng_cnt <= 7'd0 ;
129
126
end
130
127
end
@@ -137,7 +134,7 @@ module bare_tester (
137
134
reg [ 5 :0 ] wt_cnt;
138
135
reg error_bit;
139
136
140
- always @(posedge clk_x1 or negedge rstn) begin
137
+ always @(posedge clk_ref or negedge rstn) begin
141
138
if (rstn == 1'b0 ) begin
142
139
init_cnt <= 'd0;
143
140
wt_cnt <= 'd0;
@@ -170,7 +167,7 @@ module bare_tester (
170
167
171
168
case (detect_state)
172
169
DETECT_SIZE_WR0:
173
- if (app_cmd_rdy && app_wdata_rdy && (init_cnt == 8'd0 )) begin
170
+ if (app_cmd_rdy && app_wdata_rdy && (init_cnt == 8'd0 )) begin // init_cnt == 0: wait 255 cycle
174
171
app_cmd_en <= 1'b1 ;
175
172
app_cmd <= WR_CMD;
176
173
int_app_addr <= 27'h000_0000 ;
@@ -185,7 +182,7 @@ module bare_tester (
185
182
if (app_cmd_rdy && app_wdata_rdy && (init_cnt == 8'd0 )) begin
186
183
app_cmd_en <= 1'b1 ;
187
184
app_cmd <= WR_CMD;
188
- int_app_addr <= 27'h400_0000 ; // Set highest adr line to 1 to detect ddr size
185
+ int_app_addr <= 27'h80_0000 ;
189
186
190
187
app_wdata_en <= 1'b1 ;
191
188
app_wdata <= DET_SIZE_WR_VAL2;
@@ -228,7 +225,8 @@ module bare_tester (
228
225
FILL_RST: begin
229
226
rng_rst <= 1'b1 ;
230
227
// set adr to the prev pos, so after add 64, it will be 0
231
- int_app_addr <= 28'h800_0000 - 28'd64 ;
228
+ // int_app_addr <= 28'h800_0000 - 28'd64;
229
+ int_app_addr <= 27'h000_0000 - 27'd64 ;
232
230
fill_state <= FILL_RNG;
233
231
end
234
232
FILL_RNG: begin
@@ -258,7 +256,7 @@ module bare_tester (
258
256
259
257
fill_state <= FILL_RNG;
260
258
if (ddr_size == DDR_SIZE_1G) begin
261
- if ({ 1'b0 , int_app_addr} == 28'h400_0000 - 28 'd128 ) begin
259
+ if (int_app_addr == 27'h100_0000 - 27 'd128 ) begin
262
260
work_state <= WORK_CHECK;
263
261
fill_state <= FILL_RST;
264
262
end
@@ -285,7 +283,7 @@ module bare_tester (
285
283
CHECK_RST: begin
286
284
rng_rst <= 1'b1 ;
287
285
// set adr to the prev pos, so after add 64, it will be 0
288
- int_app_addr <= 28'h800_0000 - 28 'd64 ;
286
+ int_app_addr <= 27'h000_0000 - 27 'd64 ;
289
287
check_state <= CHECK_CMD;
290
288
end
291
289
@@ -327,8 +325,8 @@ module bare_tester (
327
325
check_state <= CHECK_CMD;
328
326
329
327
if (ddr_size == DDR_SIZE_1G) begin
330
- if ({ 1'b0 , int_app_addr} == 28'h400_0000 - 28'd64 ) begin
331
- work_state <= WORK_INV_FILL ;
328
+ if (int_app_addr == 27'h100_0000 - 28'd64 ) begin
329
+ work_state <= WORK_FINAL ;
332
330
check_state <= CHECK_RST;
333
331
end
334
332
end else begin
@@ -359,7 +357,7 @@ module bare_tester (
359
357
FILL_RST: begin
360
358
rng_rst <= 1'b1 ;
361
359
// set adr to the prev pos, so after add 64, it will be 0
362
- int_app_addr <= 28'h800_0000 - 28'd64 ;
360
+ int_app_addr <= 28'h000_0000 - 28'd64 ;
363
361
fill_state <= FILL_RNG;
364
362
end
365
363
FILL_RNG: begin
@@ -389,7 +387,7 @@ module bare_tester (
389
387
390
388
fill_state <= FILL_RNG;
391
389
if (ddr_size == DDR_SIZE_1G) begin
392
- if ({1'b0 , int_app_addr} == 28'h400_0000 - 28'd128 ) begin
390
+ if ({1'b0 , int_app_addr} == 28'h600_0000 - 28'd128 ) begin
393
391
work_state <= WORK_INV_CHECK;
394
392
fill_state <= FILL_RST;
395
393
end
@@ -417,7 +415,7 @@ module bare_tester (
417
415
CHECK_RST: begin
418
416
rng_rst <= 1'b1 ;
419
417
// set adr to the prev pos, so after add 64, it will be 0
420
- int_app_addr <= 28'h800_0000 - 28'd64 ;
418
+ int_app_addr <= 28'h000_0000 - 28'd64 ;
421
419
check_state <= CHECK_CMD;
422
420
end
423
421
@@ -456,7 +454,7 @@ module bare_tester (
456
454
check_state <= CHECK_CMD;
457
455
458
456
if (ddr_size == DDR_SIZE_1G) begin
459
- if ({1'b0 , int_app_addr} == 28'h400_0000 - 28'd64 ) begin
457
+ if ({1'b0 , int_app_addr} == 28'h600_0000 - 28'd64 ) begin
460
458
work_state <= WORK_CC_FILL;
461
459
check_state <= CHECK_RST;
462
460
end
0 commit comments