Skip to content

Add per field mutable_misa config options - #1524

Open
Jordan Carlin (jordancarlin) wants to merge 1 commit into
riscv:masterfrom
jordancarlin:mutable_misa
Open

Add per field mutable_misa config options#1524
Jordan Carlin (jordancarlin) wants to merge 1 commit into
riscv:masterfrom
jordancarlin:mutable_misa

Conversation

@jordancarlin

Copy link
Copy Markdown
Collaborator

This is one approach to fix #1517 by adding a parameter per extension that has a field in misa indicating whether the bit is writable. I think this is easier to use than a bitmask for the whole misa CSR, but that is another approach that we should consider.

@allenjbaum

Allen Baum (allenjbaum) commented Feb 4, 2026 via email

Copy link
Copy Markdown
Collaborator

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown

Test Results

2 117 tests  ±0   2 117 ✅ ±0   23m 40s ⏱️ -15s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit b13c131. ± Comparison against base commit 0f291de.

@Timmmm Tim Hutt (Timmmm) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah I'm still on the fence. I kind of think that although at first glance CSRs seem nice and uniform and a generic mechanism would work, if you look closer there are all sorts of horrible special snowflakes like seed, sstatus, senvcfg, etc.

Can we see what the alternative would look like for this PR though?

I think something like this?

private function legalize_misa(m : Misa, v : xlenbits) -> Misa = {
  let misa_writable_mask : xlenbits = config ...;
  let v = Mk_Misa(v & misa_writable_mask | m.bits & ~(misa_writable_mask));
  ...

Comment thread model/core/sys_regs.sail
// Suppress updates to MISA if MISA is not writable or if by disabling C next PC would become misaligned or an extension vetoes
if not(sys_enable_writable_misa) | (v[C] == 0b0 & (nextPC[1] == 0b1 | ext_veto_disable_C()))
// Suppress updates to MISA if by disabling C next PC would become misaligned or an extension vetoes
if (v[C] == 0b0 & (nextPC[1] == 0b1 | ext_veto_disable_C()))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If C is immutable and hard-coded to 1, and you write 0, should this still ignore the entire write?

@allenjbaum

Allen Baum (allenjbaum) commented Feb 4, 2026 via email

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional configurability needed for misa writability

3 participants