Skip to content

Commit 83ac7a9

Browse files
Don't check MCAUSE[31] in debug_mode to identify sync/async trap
Interrupts are disabled in Debug Mode (Sdext 4.1.2), and simultaneously registers, including MCAUSE, are not updated by exceptions (Sdext 4.1.3), so reading MCAUSE[31] after an exception (eg. invalid instruction) in debug_mode may still report the previous cause (which could be an interrupt).
1 parent 8beddf5 commit 83ac7a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dv/cosim/spike_cosim.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ bool SpikeCosim::step(uint32_t write_reg, uint32_t write_reg_data,
196196
// is presented on the RVFI but was not retired.)
197197

198198
if (processor->get_state()->last_inst_pc == PC_INVALID) {
199-
if (!(processor->get_state()->mcause->read() & 0x80000000)) {
199+
if (!(processor->get_state()->mcause->read() & 0x80000000) ||
200+
processor->get_state()->debug_mode) { // (Async-Traps are disabled in debug mode)
200201
// Spike encountered a synchronous trap
201202
pending_sync_exception = true;
202203

0 commit comments

Comments
 (0)