Skip to content

Commit

Permalink
ssp CSR alinment check
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Nov 22, 2023
1 parent f905a53 commit 9dad607
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions model/riscv_zicfiss_control.sail
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
/* Architectural state for the Zicfiss extension. */
function clause ext_is_CSR_defined(0x011, _) = haveZicfiss() // ssp
function clause ext_read_CSR(0x011) = Some(ssp)
function clause ext_write_CSR(0x011, value) = {ssp = value; Some(ssp)}

function clause ext_write_CSR(0x011, value) = {
/* if UXL/SXL can be set to 32 in RV64, the bit 2 is not read-only zero;
* Sail model does not support dynamic switching of UXL/SXL so that is
* not considered in the following algorithm yet.
*/
match architecture(misa.MXL()) {
Some(RV32) => ssp[31 .. 2] = value[31 .. 2],
Some(RV64) => ssp[63 .. 3] = value[63 .. 3],
_ => internal_error(__FILE__, __LINE__, "Unexpected architecture")
};
Some(ssp);
}

0 comments on commit 9dad607

Please sign in to comment.