cv32e40x icon indicating copy to clipboard operation
cv32e40x copied to clipboard

Take MRET debug exception from WB

Open Silabs-ArjanB opened this issue 3 years ago • 2 comments

In https://github.com/openhwgroup/cv32e40x/pull/456 an RVFI fix was done that likely could better have been done in the RTL instead.

Fix that should be undone in RVFI:

assign pc_mux_exception = (ctrl_fsm_i.pc_mux == PC_TRAP_EXC) || (ctrl_fsm_i.pc_mux == PC_TRAP_DBE);

vs.

assign pc_mux_exception = (ctrl_fsm_i.pc_mux == PC_TRAP_EXC) || pc_mux_debug_exception ; assign pc_mux_debug_exception = (ctrl_fsm_i.pc_mux == PC_TRAP_DBE) && !dret_in_ex_i; // Ignore exceptions from instructons that will never be executed

In the RTL we should consider taking the MRET related debug exception from WB instead (as we do for other exceptions). Check potential impact on PC hardening logic as well.

Silabs-ArjanB avatar Feb 25 '22 09:02 Silabs-ArjanB

The following code should be updated as well:

assign ctrl_fsm_o.jump_in_id_raw = (alu_jmp_id_i && alu_en_id_i) || (sys_mret_id_i && sys_en_id_i && !debug_mode_q);

Silabs-ArjanB avatar Feb 25 '22 13:02 Silabs-ArjanB

Some further updates are needed here

Silabs-ArjanB avatar Jun 03 '22 11:06 Silabs-ArjanB

I believe this should be fixed now with the merge of PR #442 on cv32e40s.

silabs-oysteink avatar Apr 26 '23 09:04 silabs-oysteink