Skip to content

Commit 17a0f47

Browse files
authored
[TB] Fix block-size emulation for DMA test across warm resets (#856)
* Persist the block-size emulation value when firmware re-sets emu mode after reset inj * MICROSOFT AUTOMATED PIPELINE: Stamp 'cwhitehead-msft-axi-fifo-tb-blksize-fix' with updated timestamp and hash after successful run * Print newlines for reset message * Longer randomization bounds for rand reset so it happens during interesting work * Randomization update for Verilator compat * MICROSOFT AUTOMATED PIPELINE: Stamp 'cwhitehead-msft-axi-fifo-tb-blksize-fix' with updated timestamp and hash after successful run
1 parent f55e076 commit 17a0f47

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

.github/workflow_metadata/pr_hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bb770fbea4cc05fabff8bcdc96130bf6c60a372ae0b3b0add6f0be911be0d5d0592541c7f599f6a5644145eb981fedbc
1+
72bbc24d2efd78d87f5fc0e13b3230457a3f2611b3f5a6cb748d42beca67e9a6e9a6f5e5f4e67b87cb2b636344db0a14
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1744656671
1+
1744826985

src/integration/tb/caliptra_top_tb_axi_fifo.sv

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,15 @@ module caliptra_top_tb_axi_fifo #(
249249
// and we should grab the next value...
250250
@(negedge en_recovery_emulation);
251251
end
252-
block_size_idx++;
253-
if (block_size_idx >= 100) begin
254-
$display("TB Reached end of block_size array, exiting watch loop");
255-
break;
252+
// If a reset caused en_recovery_emulation to deassert, test will continue with the same
253+
// test scenario and block_size value after the reset.
254+
// Otherwise, advance to the next testcase and emulate the next block_size value
255+
if (rst_n) begin
256+
block_size_idx++;
257+
if (block_size_idx >= 100) begin
258+
$display("TB Reached end of block_size array, exiting watch loop");
259+
break;
260+
end
256261
end
257262
end
258263
end

src/integration/tb/caliptra_top_tb_services.sv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,11 @@ endgenerate //IV_NO
14371437
timed_warm_rst <= 'b1;
14381438
end
14391439
else if((WriteData[7:0] == 8'hee) && mailbox_write) begin
1440-
wait_time_to_rst = $urandom_range(5,100);
1440+
`ifndef VERILATOR
1441+
std::randomize(wait_time_to_rst) with {wait_time_to_rst dist {[5:24] :/ 3, [25:99] :/ 5, [100:255] :/ 8, [256:511] :/ 5, [512:1023] :/ 1};};
1442+
`else
1443+
wait_time_to_rst = $urandom_range(5,150);
1444+
`endif
14411445
prandom_warm_rst <= 'b1;
14421446
rst_cyclecnt <= cycleCnt;
14431447
end

src/integration/test_suites/rand_test_dma/rand_test_dma.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,14 @@ void main(void) {
283283
VPRINTF(MEDIUM, "Sending payload via AHB i/f\n");
284284

285285
if (inject_rst && (rst_done == 0)) {
286-
VPRINTF(LOW, "Request random reset");
286+
VPRINTF(LOW, "Request random reset\n");
287287
SEND_STDOUT_CTRL(RAND_RST);
288288
}
289289

290290
soc_ifc_axi_dma_send_ahb_payload(dst_addr, use_wr_fixed, (uint32_t*)payload_start_addr, transfer_size*4, 0);
291291
} else {
292292
if (inject_rst && (rst_done == 0)) {
293-
VPRINTF(LOW, "Request random reset");
293+
VPRINTF(LOW, "Request random reset\n");
294294
SEND_STDOUT_CTRL(RAND_RST);
295295
}
296296
if (!dst_is_fifo) {
@@ -398,7 +398,7 @@ void main(void) {
398398
VPRINTF(HIGH, "Sending payload from Mailbox\n");
399399

400400
if (inject_rst && (rst_done==0)) {
401-
VPRINTF(LOW, "Request random reset");
401+
VPRINTF(LOW, "Request random reset\n");
402402
SEND_STDOUT_CTRL(RAND_RST);
403403
}
404404

@@ -407,7 +407,7 @@ void main(void) {
407407
VPRINTF(HIGH, "Sending large payload from Mailbox\n");
408408

409409
if (inject_rst && (rst_done==0)) {
410-
VPRINTF(LOW, "Request random reset");
410+
VPRINTF(LOW, "Request random reset\n");
411411
SEND_STDOUT_CTRL(RAND_RST);
412412
}
413413
if (!dst_is_fifo) {
@@ -501,7 +501,7 @@ void main(void) {
501501
VPRINTF(HIGH, "Moving payload at SRAM via axi-to-axi xfer\n");
502502

503503
if (inject_rst && (rst_done==0)) {
504-
VPRINTF(LOW, "Request random reset");
504+
VPRINTF(LOW, "Request random reset\n");
505505
SEND_STDOUT_CTRL(RAND_RST);
506506
}
507507

@@ -514,7 +514,7 @@ void main(void) {
514514
VPRINTF(HIGH, "Moving large from FIFO via axi-to-axi xfer\n");
515515

516516
if (inject_rst && (rst_done==0)) {
517-
VPRINTF(LOW, "Request random reset");
517+
VPRINTF(LOW, "Request random reset\n");
518518
SEND_STDOUT_CTRL(RAND_RST);
519519
}
520520

@@ -607,7 +607,7 @@ void main(void) {
607607
VPRINTF(HIGH, "Reading payload to Mailbox\n");
608608

609609
if (inject_rst && (rst_done==0)) {
610-
VPRINTF(LOW, "Request random reset");
610+
VPRINTF(LOW, "Request random reset\n");
611611
SEND_STDOUT_CTRL(RAND_RST);
612612
}
613613
soc_ifc_axi_dma_read_mbox_payload_no_wait(src_addr, dst_offset, use_rd_fixed, transfer_size*4, block_size);
@@ -619,7 +619,7 @@ void main(void) {
619619
VPRINTF(HIGH, "Reading rand payload to Mailbox\n");
620620

621621
if (inject_rst && (rst_done==0)) {
622-
VPRINTF(LOW, "Request random reset");
622+
VPRINTF(LOW, "Request random reset\n");
623623
SEND_STDOUT_CTRL(RAND_RST);
624624
}
625625

@@ -703,7 +703,7 @@ void main(void) {
703703
VPRINTF(HIGH, "Reading payload via AHB i/f\n");
704704

705705
if (inject_rst && (rst_done==0)) {
706-
VPRINTF(LOW, "Request random reset");
706+
VPRINTF(LOW, "Request random reset\n");
707707
SEND_STDOUT_CTRL(RAND_RST);
708708
}
709709

@@ -717,7 +717,7 @@ void main(void) {
717717
VPRINTF(HIGH, "Reading payload via AHB i/f\n");
718718

719719
if (inject_rst && (rst_done==0)) {
720-
VPRINTF(LOW, "Request random reset");
720+
VPRINTF(LOW, "Request random reset\n");
721721
SEND_STDOUT_CTRL(RAND_RST);
722722
}
723723
// Arm AXI2HB transfer

0 commit comments

Comments
 (0)