From 2643130c4148def1e0cacb055f9ca521987b311b Mon Sep 17 00:00:00 2001 From: bbracker Date: Sun, 20 Jun 2021 10:11:39 -0400 Subject: [PATCH] read from MSTATUS workaround because QEMU has incorrect MSTATUS --- wally-pipelined/regression/regression-wally.py | 2 +- wally-pipelined/testbench/testbench-linux.sv | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wally-pipelined/regression/regression-wally.py b/wally-pipelined/regression/regression-wally.py index d3afe6ed..eac221cd 100755 --- a/wally-pipelined/regression/regression-wally.py +++ b/wally-pipelined/regression/regression-wally.py @@ -31,7 +31,7 @@ configs = [ TestCase( name="buildroot", cmd="vsim -do wally-buildroot-batch.do -c > {}", - grepstr="# loaded 600000 instructions" + grepstr="# loaded 2000000 instructions" ), TestCase( name="rv32ic", diff --git a/wally-pipelined/testbench/testbench-linux.sv b/wally-pipelined/testbench/testbench-linux.sv index a5f273e4..2f223f73 100644 --- a/wally-pipelined/testbench/testbench-linux.sv +++ b/wally-pipelined/testbench/testbench-linux.sv @@ -49,7 +49,7 @@ module testbench(); logic ignoreRFwrite; - parameter waveOnICount = 690000; // # of instructions at which to turn on waves in graphical sim + parameter waveOnICount = 2060000; // # of instructions at which to turn on waves in graphical sim assign GPIOPinsIn = 0; assign UARTSin = 1; @@ -498,6 +498,9 @@ module testbench(); scan_file_rf = $fscanf(data_file_rf, "%d\n", regNumExpected); scan_file_rf = $fscanf(data_file_rf, "%x\n", regExpected); force dut.hart.ieu.dp.regf.wd3 = regExpected; + // Hack to compensate for QEMU's incorrect MSTATUS + end else if (PCtextW.substr(0,3) == "csrr" && PCtextW.substr(10,16) == "mstatus") begin + force dut.hart.ieu.dp.regf.wd3 = dut.hart.ieu.dp.WriteDataW & ~64'ha00000000; end else release dut.hart.ieu.dp.regf.wd3; end @@ -590,7 +593,7 @@ module testbench(); scan_file_PC = $fscanf(data_file_PC, "%x\n", pcExpected); if (instrs <= 10 || (instrs <= 100 && instrs % 10 == 0) || (instrs <= 1000 && instrs % 100 == 0) || (instrs <= 10000 && instrs % 1000 == 0) || - (instrs <= 100000 && instrs % 10000 == 0) || (instrs <= 1000000 && instrs % 100000 == 0)) begin + (instrs <= 100000 && instrs % 10000 == 0) || (instrs % 100000 == 0)) begin $display("loaded %0d instructions", instrs); end if (instrs == waveOnICount) begin