workaround for ignoring MTIME

This commit is contained in:
bbracker 2021-06-20 02:26:39 -04:00
parent 086f031b84
commit 069a79fafd

View File

@ -47,7 +47,9 @@ module testbench();
logic HREADYEXT, HRESPEXT; logic HREADYEXT, HRESPEXT;
logic UARTSout; logic UARTSout;
parameter waveOnICount = 650000; // # of instructions at which to turn on waves in graphical sim logic ignoreRFwrite;
parameter waveOnICount = 690000; // # of instructions at which to turn on waves in graphical sim
assign GPIOPinsIn = 0; assign GPIOPinsIn = 0;
assign UARTSin = 1; assign UARTSin = 1;
@ -129,6 +131,7 @@ module testbench();
// initialize test // initialize test
initial initial
begin begin
ignoreRFwrite <= 0;
reset <= 1; # 22; reset <= 0; reset <= 1; # 22; reset <= 0;
end end
@ -252,8 +255,12 @@ module testbench();
`ERROR `ERROR
end end
end else begin end else begin
if (ignoreRFwrite)
ignoreRFwrite <= 0;
else begin
scan_file_rf = $fscanf(data_file_rf, "%d\n", regNumExpected); scan_file_rf = $fscanf(data_file_rf, "%d\n", regNumExpected);
scan_file_rf = $fscanf(data_file_rf, "%x\n", regExpected); scan_file_rf = $fscanf(data_file_rf, "%x\n", regExpected);
end
if (i != regNumExpected) begin if (i != regNumExpected) begin
$display("%0t ps, instr %0d: wrong register changed: %0d, %0d expected to switch to %x from %x", $time, instrs, i, regNumExpected, regExpected, dut.hart.ieu.dp.regf.rf[regNumExpected]); $display("%0t ps, instr %0d: wrong register changed: %0d, %0d expected to switch to %x from %x", $time, instrs, i, regNumExpected, regExpected, dut.hart.ieu.dp.regf.rf[regNumExpected]);
`ERROR `ERROR
@ -472,6 +479,15 @@ module testbench();
//if(it.InstrW != InstrWExpected) begin //if(it.InstrW != InstrWExpected) begin
// $display("%0t ps, instr %0d: InstrW does not equal InstrW expected: %x, %x", $time, instrs, it.InstrW, InstrWExpected); // $display("%0t ps, instr %0d: InstrW does not equal InstrW expected: %x, %x", $time, instrs, it.InstrW, InstrWExpected);
//end //end
//
// Hack to compensate for how Wally's MTIME may diverge from QEMU's MTIME (and that is okay)
if (PCtextW.substr(0,5) == "rdtime") begin
ignoreRFwrite <= 1;
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;
end else
release dut.hart.ieu.dp.regf.wd3;
end end
end end