Skip to content

Commit 32e6154

Browse files
committed
feat: modify addr range and format
1 parent 764dfa6 commit 32e6154

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

gowin/tester/bare_tester.v

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module bare_tester (
22
input clk,
3-
input clk_x1,
3+
input clk_ref,
44
output reg rstn,
55
input init_calib_complete,
66
output reg [ 5:0] app_burst_number,
@@ -19,11 +19,7 @@ module bare_tester (
1919
output txp
2020
);
2121

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;
2723
always @(posedge clk) begin
2824
rst_cnt <= rst_cnt + 1;
2925
if (rst_cnt > 32'd2_700_000_000 - 32'd1) begin
@@ -89,7 +85,8 @@ module bare_tester (
8985
//counted in 2 Bytes
9086
//So in every Single-Busrt, the addr should increse by 8
9187
//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;
9390

9491
reg [127:0] rng;
9592
reg [127:0] rng_inv;
@@ -109,7 +106,7 @@ module bare_tester (
109106
end
110107
end
111108

112-
always @(posedge clk_x1) begin
109+
always @(posedge clk_ref) begin
113110
rng <= rng_i;
114111
rng_inv <= ~rng_i;
115112
mask <= mask_i;
@@ -123,8 +120,8 @@ module bare_tester (
123120

124121
if (rng_rst) begin
125122
rng_i <= rng_init_pattern;
126-
mask_i <= 'hFFFE;
127123
// mask_i <= 'hF8FC;
124+
mask_i <= 'h0;
128125
rng_cnt <= 7'd0;
129126
end
130127
end
@@ -137,7 +134,7 @@ module bare_tester (
137134
reg [ 5:0] wt_cnt;
138135
reg error_bit;
139136

140-
always @(posedge clk_x1 or negedge rstn) begin
137+
always @(posedge clk_ref or negedge rstn) begin
141138
if (rstn == 1'b0) begin
142139
init_cnt <= 'd0;
143140
wt_cnt <= 'd0;
@@ -170,7 +167,7 @@ module bare_tester (
170167

171168
case (detect_state)
172169
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
174171
app_cmd_en <= 1'b1;
175172
app_cmd <= WR_CMD;
176173
int_app_addr <= 27'h000_0000;
@@ -185,7 +182,7 @@ module bare_tester (
185182
if (app_cmd_rdy && app_wdata_rdy && (init_cnt == 8'd0)) begin
186183
app_cmd_en <= 1'b1;
187184
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;
189186

190187
app_wdata_en <= 1'b1;
191188
app_wdata <= DET_SIZE_WR_VAL2;
@@ -228,7 +225,8 @@ module bare_tester (
228225
FILL_RST: begin
229226
rng_rst <= 1'b1;
230227
//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;
232230
fill_state <= FILL_RNG;
233231
end
234232
FILL_RNG: begin
@@ -258,7 +256,7 @@ module bare_tester (
258256

259257
fill_state <= FILL_RNG;
260258
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
262260
work_state <= WORK_CHECK;
263261
fill_state <= FILL_RST;
264262
end
@@ -285,7 +283,7 @@ module bare_tester (
285283
CHECK_RST: begin
286284
rng_rst <= 1'b1;
287285
//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;
289287
check_state <= CHECK_CMD;
290288
end
291289

@@ -327,8 +325,8 @@ module bare_tester (
327325
check_state <= CHECK_CMD;
328326

329327
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;
332330
check_state <= CHECK_RST;
333331
end
334332
end else begin
@@ -359,7 +357,7 @@ module bare_tester (
359357
FILL_RST: begin
360358
rng_rst <= 1'b1;
361359
//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;
363361
fill_state <= FILL_RNG;
364362
end
365363
FILL_RNG: begin
@@ -389,7 +387,7 @@ module bare_tester (
389387

390388
fill_state <= FILL_RNG;
391389
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
393391
work_state <= WORK_INV_CHECK;
394392
fill_state <= FILL_RST;
395393
end
@@ -417,7 +415,7 @@ module bare_tester (
417415
CHECK_RST: begin
418416
rng_rst <= 1'b1;
419417
//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;
421419
check_state <= CHECK_CMD;
422420
end
423421

@@ -456,7 +454,7 @@ module bare_tester (
456454
check_state <= CHECK_CMD;
457455

458456
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
460458
work_state <= WORK_CC_FILL;
461459
check_state <= CHECK_RST;
462460
end

0 commit comments

Comments
 (0)