Skip to content

Commit abe1ab0

Browse files
committed
[dv] Don't set rvfi_trap when executing ebreak into debug
This aids the implementation of the double fault detector checker (as an ebreak into debug doesn't sync the seen_sync_exec flag).
1 parent 8e852d2 commit abe1ab0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

dv/cosim/spike_cosim.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,10 @@ bool SpikeCosim::check_debug_ebreak(uint32_t write_reg, uint32_t pc,
954954
return false;
955955
}
956956

957-
if (!sync_trap) {
957+
if (sync_trap) {
958958
std::stringstream err_str;
959-
err_str << "DUT executed ebreak at " << std::hex << pc
960-
<< " but didn't indicate a synchronous trap, which was unexpected";
959+
err_str << "DUT executed ebreak into debug at " << std::hex << pc
960+
<< " but indicated a synchronous trap, which was unexpected";
961961
errors.emplace_back(err_str.str());
962962

963963
return false;

rtl/ibex_core.sv

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,9 @@ module ibex_core import ibex_pkg::*; #(
13451345
end
13461346
end
13471347

1348-
assign rvfi_trap_id = id_stage_i.controller_i.id_exception_o;
1348+
assign rvfi_trap_id = id_stage_i.controller_i.id_exception_o &
1349+
~(id_stage_i.ebrk_insn & id_stage_i.controller_i.ebreak_into_debug);
1350+
13491351
assign rvfi_trap_wb = id_stage_i.controller_i.exc_req_lsu;
13501352
// WB is instantly done in the tracking pipeline when a trap is progress through the pipeline
13511353
assign rvfi_wb_done = rvfi_stage_valid[0] & (instr_done_wb | rvfi_stage_trap[0]);
@@ -1356,7 +1358,9 @@ module ibex_core import ibex_pkg::*; #(
13561358
// Without writeback stage signal new instr_new_wb when instruction enters ID/EX to correctly
13571359
// setup register write signals
13581360
assign rvfi_instr_new_wb = instr_new_id;
1359-
assign rvfi_trap_id = id_stage_i.controller_i.exc_req_d | id_stage_i.controller_i.exc_req_lsu;
1361+
assign rvfi_trap_id =
1362+
(id_stage_i.controller_i.exc_req_d | id_stage_i.controller_i.exc_req_lsu) &
1363+
~(id_stage_i.ebrk_insn & id_stage_i.controller_i.ebreak_into_debug);
13601364
assign rvfi_trap_wb = 1'b0;
13611365
assign rvfi_wb_done = instr_done_wb;
13621366
end

0 commit comments

Comments
 (0)