You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mstatush is not really handled correctly at the moment. The Mstatus type is:
bitfield Mstatus : xlenbits = {
SD : xlen - 1,
// The MBE and SBE fields are in mstatus in RV64 and absent in RV32.
// On RV32, they are in mstatush, which doesn't exist in RV64. For now,
// they are handled in an ad-hoc way.
// MBE : 37
// SBE : 36
// The SXL and UXL fields don't exist on RV32, so they are modelled
// via explicit getters and setters; see below.
// SXL : 35 .. 34,
// UXL : 33 .. 32,
TSR : 22,
...
SIE : 1,
}
register mstatus : Mstatus
But it is never modified and we ignore writes to mstatush (because the model doesn't support big endian.
This is quite awkward. For other 64-bit registers, e.g. menvcfg the h version is just a view into the top 32 bits of the 64-bit value (search for Upper 32 bits of in the priv spec and you see a load of these). That is easy to handle because we just have a single bitfield Menvcfg : bits(64) and then read/write the relevant parts in the CSR access functions.
However mstatus is very annoyingly not quite like that because the SD bit is always at xlen - 1. It is in a different position on RV32 and RV64.
The best solution I can think of is this:
bitfield Mstatus : bits(64) = {
SD_64 : 63, // SD bit for RV64.
MBE : 37
SBE : 36
SXL : 35 .. 34,
UXL : 33 .. 32,
SD_32 : 31, // SD bit for RV32.
TSR : 22,
...
SIE : 1,
}
And then you have to do something like:
let sd = mstatus[if xlen == 32 then SD_32 else SD_64];
We can put that in a function.
I think that is better than the current situation, and it would remove the need to have getters/setters for MBE/SBE/SXL/UXL.
The text was updated successfully, but these errors were encountered:
mstatush
is not really handled correctly at the moment. TheMstatus
type is:There is an
mstatush
register:But it is never modified and we ignore writes to
mstatush
(because the model doesn't support big endian.This is quite awkward. For other 64-bit registers, e.g.
menvcfg
theh
version is just a view into the top 32 bits of the 64-bit value (search forUpper 32 bits of
in the priv spec and you see a load of these). That is easy to handle because we just have a singlebitfield Menvcfg : bits(64)
and then read/write the relevant parts in the CSR access functions.However
mstatus
is very annoyingly not quite like that because theSD
bit is always atxlen - 1
. It is in a different position on RV32 and RV64.The best solution I can think of is this:
And then you have to do something like:
We can put that in a function.
I think that is better than the current situation, and it would remove the need to have getters/setters for MBE/SBE/SXL/UXL.
The text was updated successfully, but these errors were encountered: