Skip to content

Commit

Permalink
Caught a bug in lb_cdc.v
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Penney committed Jan 14, 2025
1 parent 9a30334 commit 4fc60dc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion axi/lb_cdc.v
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fifo_2c #(
.empty(b2a_empty) // output
);

wire lbb_rstb_w, lbb_wstb_w, lbb_ren_w, lbb_wen_r;
wire lbb_rstb_w, lbb_wstb_w, lbb_ren_w, lbb_wen_w;
assign {lbb_rstb_w, lbb_wstb_w, lbb_ren_w, lbb_wen_w, lbb_addr_w, lbb_wdata_w} = a2b_dout;
assign lbb_wen = lbb_wen_w & a2b_re;
assign lbb_ren = lbb_ren_w & ren;
Expand Down
26 changes: 22 additions & 4 deletions axi/lb_test_host_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,34 @@ initial begin
// Wait for fifo_2c to clear out its uninitialized registers
#(10*STEP) $display("Reading %d registers", MAX_XACTS[7:0]);
interpacket_reset = 1'b0;
for (N=0; N<MAX_XACTS; N=N+1) begin
for (N=0; (N<MAX_XACTS) && ~break; N=N+1) begin
#STEP wnr = 1'b0;
addr = N[AW-1:0];
start_stb = 1'b1;
#STEP start_stb = 1'b0;
#(6*STEP);
end
if (break) begin
$display("FAIL");
$stop(0);
end
`wait_timeout(~busy);
if (to) $display("Timed out waiting for read transactions to complete");
interpacket_reset = 1'b1;
$display("Done reading");
#(2*STEP) $display("Writing %d registers", MAX_XACTS[7:0]);
interpacket_reset = 1'b0;
for (N=0; N<MAX_XACTS; N=N+1) begin
for (N=0; (N<MAX_XACTS) && ~break; N=N+1) begin
#STEP wnr = 1'b1;
addr = N[AW-1:0];
wdata = M;
start_stb = 1'b1;
#STEP start_stb = 1'b0;
#(6*STEP);
end
if (break) begin
$display("FAIL");
$stop(0);
end
`wait_timeout(~busy);
if (to) $display("Timed out waiting for write transactions to complete");
Expand All @@ -154,17 +162,27 @@ initial begin
#(2*STEP) $display("Reading %d registers again", MAX_XACTS[7:0]);
readback = 1'b1;
interpacket_reset = 1'b0;
for (N=0; N<MAX_XACTS; N=N+1) begin
for (N=0; (N<MAX_XACTS) && ~break; N=N+1) begin
#STEP wnr = 1'b0;
addr = N[AW-1:0];
start_stb = 1'b1;
#STEP start_stb = 1'b0;
#(6*STEP);
end
if (break) begin
$display("FAIL");
$stop(0);
end
`wait_timeout(~busy);
if (to) $display("Timed out waiting for read transactions to complete");
#(4*STEP) interpacket_reset = 1'b1;
$finish();
if (errors == 0) begin
$display("PASS");
$finish(0);
end else begin
$display("FAIL");
$stop(0);
end
end

endmodule

0 comments on commit 4fc60dc

Please sign in to comment.