Skip to content

Commit

Permalink
Zero mstatus.UPIE/UIE bits in legalize_mstatus
Browse files Browse the repository at this point in the history
This was missed when we removed the N extension.

I'm not really a fan of this code style - in other places we explicitly copy the bits that *are* implemented using their field names, which is also not ideal but definitely better and less error prone. We should change this code to do that at some point. I added a TODO.
  • Loading branch information
Timmmm authored Nov 6, 2024
1 parent ded340f commit 0b9c639
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion model/riscv_sys_regs.sail
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ function legalize_mstatus(o : Mstatus, v : xlenbits) -> Mstatus = {
* that does not have a matching bitfield entry. All bits above 32 are handled
* explicitly later.
*/
let m : Mstatus = Mk_Mstatus(zero_extend(v[22 .. 7] @ 0b0 @ v[5 .. 3] @ 0b0 @ v[1 .. 0]));
// TODO: This method is error prone. We should instead explicitly copy the
// fields that are implemented. See legalize_mie() for an example.
let m : Mstatus = Mk_Mstatus(zero_extend(v[22 .. 7] @ 0b0 @ v[5 .. 5] @ 0b0 @ v[3 .. 3] @ 0b0 @ v[1 .. 1] @ 0b0));

/* FS is WARL, and making FS writable can support the M-mode emulation of an FPU
* to support code running in S/U-modes. Spike does this, and for now, we match it,
Expand Down

0 comments on commit 0b9c639

Please sign in to comment.