diff options
author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2020-11-30 17:04:19 +0000 |
---|---|---|
committer | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2020-11-30 17:05:02 +0000 |
commit | 3e0b01b83d37b6f4af9f6e48781829d3bcc5d939 (patch) | |
tree | b277cdcd2664508b9f0528c5fbd2d0967dba70d9 /model | |
parent | bc66137c799bbc3b5a010d6a0843a60b5a9d068c (diff) | |
download | sail-riscv-3e0b01b83d37b6f4af9f6e48781829d3bcc5d939.zip sail-riscv-3e0b01b83d37b6f4af9f6e48781829d3bcc5d939.tar.gz sail-riscv-3e0b01b83d37b6f4af9f6e48781829d3bcc5d939.tar.bz2 |
Ignore undefined bits in mstatus on write
Diffstat (limited to 'model')
-rw-r--r-- | model/riscv_sys_regs.sail | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/model/riscv_sys_regs.sail b/model/riscv_sys_regs.sail index a23cfab..b1d6fd7 100644 --- a/model/riscv_sys_regs.sail +++ b/model/riscv_sys_regs.sail @@ -189,7 +189,12 @@ function set_mstatus_UXL(m : Mstatus, a : arch_xlen) -> Mstatus = { } function legalize_mstatus(o : Mstatus, v : xlenbits) -> Mstatus = { - let m : Mstatus = Mk_Mstatus(v); + /* + * Populate all defined fields using the bits of v, stripping anything + * that does not have a matching bitfield entry. All bits above 32 are handled + * explicitly later. + */ + let m : Mstatus = Mk_Mstatus(EXTZ(v[22 .. 11] @ 0b00 @ v[8 .. 7] @ 0b0 @ v[5 .. 3] @ 0b0 @ v[1 .. 0])); /* We don't have any extension context yet. */ let m = update_XS(m, extStatus_to_bits(Off)); |