From e72c8b8e09f35f42edf16e1364077e32fa4ce625 Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 2 Jul 2024 14:22:51 -0700 Subject: [PATCH] Watchdog timeout on buildroot boot is a halting criteria --- testbench/common/watchdog.sv | 14 ++++++++++---- testbench/testbench.sv | 5 ++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/testbench/common/watchdog.sv b/testbench/common/watchdog.sv index 296900b20..69b185c40 100644 --- a/testbench/common/watchdog.sv +++ b/testbench/common/watchdog.sv @@ -26,7 +26,8 @@ module watchdog #(parameter XLEN, WatchDogTimerThreshold) (input clk, - input reset + input reset, + string TEST ); // check for hang up. @@ -46,9 +47,14 @@ module watchdog #(parameter XLEN, WatchDogTimerThreshold) always_comb begin WatchDogTimeOut = WatchDogTimerCount >= WatchDogTimerThreshold; if(WatchDogTimeOut) begin - $display("FAILURE: Watch Dog Time Out triggered. PCW stuck at %x for more than %d cycles", PCW, WatchDogTimerCount); - $stop; - end + if (TEST == "buildroot") $display("Watch Dog Time Out triggered. This is a normal termination for a full buildroot boot. Check sim//logs/buildroot_uart.log to check if the boot printed the login prompt."); + else $display("FAILURE: Watch Dog Time Out triggered. PCW stuck at %x for more than %d cycles", PCW, WatchDogTimerCount); + `ifdef QUESTA + $stop; // if this is changed to $finish for Questa, wally-batch.do does not go to the next step to run coverage, and wally.do terminates without allowing GUI debug + `else + $finish; + `endif + end end endmodule diff --git a/testbench/testbench.sv b/testbench/testbench.sv index be0422550..f6087da1b 100644 --- a/testbench/testbench.sv +++ b/testbench/testbench.sv @@ -118,10 +118,9 @@ module testbench; TEST = "none"; if (!$value$plusargs("ElfFile=%s", ElfFile)) ElfFile = "none"; - else begin - end if (!$value$plusargs("INSTR_LIMIT=%d", INSTR_LIMIT)) INSTR_LIMIT = 0; + //$display("TEST = %s ElfFile = %s", TEST, ElfFile); // pick tests based on modes supported //tests = '{}; @@ -613,7 +612,7 @@ module testbench; InstrFName, InstrDName, InstrEName, InstrMName, InstrWName); // watch for problems such as lockup, reading unitialized memory, bad configs - watchdog #(P.XLEN, 1000000) watchdog(.clk, .reset); // check if PCW is stuck + watchdog #(P.XLEN, 1000000) watchdog(.clk, .reset, .TEST); // check if PCW is stuck ramxdetector #(P.XLEN, P.LLEN) ramxdetector(clk, dut.core.lsu.MemRWM[1], dut.core.lsu.LSULoadAccessFaultM, dut.core.lsu.ReadDataM, dut.core.ifu.PCM, InstrM, dut.core.lsu.IEUAdrM, InstrMName); riscvassertions #(P) riscvassertions(); // check assertions for a legal configuration