Skip to content
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 for CLIC spec (august 23) #928

Conversation

silabs-oysteink
Copy link
Contributor

mcause.minhv only set when taking an exception for a CLIC pointer or mret pointer restart. When jumping due to an mret, mcause.minhv is checked regardless of mcause.mpp.

mcause.minhv only set when taking an exception for a CLIC pointer or mret pointer restart.
When jumping due to an mret, mcause.minhv is checked regardless of mcause.mpp.

Signed-off-by: Oystein Knauserud <[email protected]>
@silabs-oysteink silabs-oysteink added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label Aug 31, 2023
…its fan-in. The signal clic_ptr_in_wb is used by RVFI but not by the controller.

Signed-off-by: Oystein Knauserud <[email protected]>
// 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;
// Set mcause.minhv if exception is for a CLIC or mret pointer. Otherwise clear it
ctrl_fsm_o.csr_cause.minhv = (ex_wb_pipe_i.instr_meta.clic_ptr || ex_wb_pipe_i.instr_meta.mret_ptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using the unqualified signals here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'exception_in_wb' on line 846 is already qualified with ex_wb_pipe_i.instr_valid. It shouldn't be needed to also factor it into line 865.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not strictly needed indeed, but it would be more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated code

@@ -1465,6 +1456,9 @@ module cv32e40x_controller_fsm import cv32e40x_pkg::*;
assign ctrl_fsm_o.debug_running = debug_fsm_cs[RUNNING_INDEX];
assign ctrl_fsm_o.debug_halted = debug_fsm_cs[HALTED_INDEX];

// Tie off unused signals
assign unused_signals = clic_ptr_in_wb;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this signal should actually be used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it could be used for detecting 'clic_ptr_in_pipeline'. I will refactor code to use this signal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the 'unused_signal'

mepc_we // mepc is written
|->
(mcause_we && // mcause is written
mcause_n.minhv == ((ex_wb_pipe_i.instr_meta.clic_ptr || ex_wb_pipe_i.instr_meta.mret_ptr) && // pointer in WB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use qualified signals

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@@ -163,6 +163,25 @@ module cv32e40x_cs_registers_sva
a_mcause_mstatus_alias: assert property(p_mcause_mstatus_alias)
else `uvm_error("cs_registers", "mcause.mpp and mcause.mpie not aliased correctly")

// Whenever mepc is written by HW, mcause.minhv must also be written with the correct value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prove other way around as well (if minhv is written mepc should be written)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added assert to prove that whenever mcause.minhv changes mepc must also be written.

Added assert for checking that mepc is always written when mcause.minhv is changed.
Refactored some code in controller_fsm.

SEC clean.

Signed-off-by: Oystein Knauserud <[email protected]>
@Silabs-ArjanB Silabs-ArjanB merged commit 71d2f82 into openhwgroup:master Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants