Skip to content

Commit ce9552f

Browse files
committed
[dv] Fix the riscv_dret_test
The test checked for the exception handler to launch and then waited for the core to flush its pipeline. However, the flush happened immediately after the exception, which led the test to miss the first exception handler and the `check_priv_mode` to fail, since the check only executed after the flush leaving the exception handlers. This also means that on later executions, we were not checking the exception handlers as we go, but instead, the exception handler from the exception before. Accordingly, this test only failed if Ibex initially started in USER mode. Otherwise, it was anyways always in MACHINE mode
1 parent 0a13971 commit ce9552f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dv/uvm/core_ibex/tests/core_ibex_test_lib.sv

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,14 +1118,16 @@ class core_ibex_directed_test extends core_ibex_debug_intr_basic_test;
11181118

11191119
// Illegal instruction checker
11201120
virtual task check_illegal_insn(string exception_msg);
1121-
check_next_core_status(HANDLING_EXCEPTION, "Core did not jump to vectored exception handler", 10000);
1122-
check_next_core_status(ILLEGAL_INSTR_EXCEPTION, exception_msg, 10000);
1123-
check_mcause(1'b0, ExcCauseIllegalInsn);
1124-
// Ibex will wait to change the privilege mode until it is allowed to FLUSH. This happens because
1125-
// we are blocking the current instruction until the instruction from WB stage is ready.
1121+
// Ibex will wait to change the privilege mode until it is allowed to FLUSH. This happens
1122+
// because it is blocking the current instruction until the instruction from WB stage is ready.
11261123
wait (dut_vif.dut_cb.ctrl_fsm_cs == FLUSH);
11271124
clk_vif.wait_clks(2);
11281125
check_priv_mode(PRIV_LVL_M);
1126+
check_next_core_status(HANDLING_EXCEPTION,
1127+
"Core did not jump to vectored exception handler",
1128+
10000);
1129+
check_next_core_status(ILLEGAL_INSTR_EXCEPTION, exception_msg, 10000);
1130+
check_mcause(1'b0, ExcCauseIllegalInsn);
11291131
wait_ret("mret", 15000);
11301132
endtask
11311133

0 commit comments

Comments
 (0)