New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to mret/xinhv handling. #331
Updates to mret/xinhv handling. #331
Conversation
…nhv assumes for mpp==PRIV_LVL_U. Unique case violation in cs_registers due to clearing of minhv fixed, assertions added to make sure there is no conflicting writes to mcause. Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com> Added comments and assertions to explain why the clearing of mcause.minhv is allowed to happen at the same time as an mret updates CSRs from the WB stage. Other updates to comments to clarify minhv handling. Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
@@ -753,6 +761,9 @@ module cv32e40s_controller_fsm import cv32e40s_pkg::*; | |||
ctrl_fsm_o.csr_save_cause = !debug_mode_q; // Do not update CSRs if in debug mode | |||
ctrl_fsm_o.csr_cause.exception_code = exception_cause_wb; | |||
|
|||
// Keep mcause.minhv when taking exceptions and interrupts, only cleared on successful pointer fetches or CSR writes. | |||
ctrl_fsm_o.csr_cause.minhv = mcause_i.minhv; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have an assertion checking that various CLIC related signals are inactive when SMCLIC=0?
E.g.FSM is never in POINTER_FETCH state, ctrl_fsm_o.csr_cause.minhv is 1'b0, mcause_i.minhv = 1'b0, *.instr_meta.clic_ptr = 1'b0, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added assertion.
rtl/cv32e40s_cs_registers.sv
Outdated
// The fields mstatus.mpp and mstatus.mpie er aliased between mcause and mstatus. The mcause write | ||
// due to csr_celar_minhv will however only write to mcause.minhv, and no updates to mstatus.mpp/mpie. | ||
if (ctrl_fsm_i.csr_clear_minhv) begin | ||
if (SMCLIC) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can if (SMCLI) be made the 'outer if' instead (for code coverage reasons)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order of if's fixed.
…CLIC=0. Refactored order of if statement for coverage purposes. Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
Updates to mret/xinhv handling. Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
Updated handling of mret related to mcause.mpp and mcause.minhv. No inhv assumes for mpp==PRIV_LVL_U. Unique case violation in cs_registers due to clearing of minhv fixed, assertions added to make sure there is no conflicting writes to mcause.
When merged, this PR will be cherry picked to the E40X to apply the changes there. Should fix issue #498 on CV32E40X when done.