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
There are a few places I've noticed where the existence of bitfields depends on xlen. For example in Mstatus:
bitfield Mstatus : xlenbits = {
// 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 riscv_sys_regs.sail.
// SXL : 35 .. 34,
// UXL : 33 .. 32,
For these the current code basically gives up on bitfields and accesses mstatus.bits[33..32] directly, which is a bit of a shame. I wonder if it would make sense to support conditional bitfields, like this:
bitfield Mstatus : xlenbits = {
MBE : 37 if xlen == 64,
SBE : 36 if xlen == 64,
SXL : 35 .. 34, if xlen == 64,
UXL : 33 .. 32 if xlen == 64,
That would allow you to move them as well. The condition would have to be inferable to true or false at compile time (or initialisation time or whatever we're calling it I guess).
To be honest it's probably not worth it just for the handful of times this would be useful. Just thought I'd share the idea... :-)
The text was updated successfully, but these errors were encountered:
There are a few places I've noticed where the existence of bitfields depends on
xlen
. For example inMstatus
:For these the current code basically gives up on bitfields and accesses
mstatus.bits[33..32]
directly, which is a bit of a shame. I wonder if it would make sense to support conditional bitfields, like this:That would allow you to move them as well. The condition would have to be inferable to
true
orfalse
at compile time (or initialisation time or whatever we're calling it I guess).To be honest it's probably not worth it just for the handful of times this would be useful. Just thought I'd share the idea... :-)
The text was updated successfully, but these errors were encountered: