rems-project / sail

Sail architecture definition language
Other
617 stars 112 forks source link

sail -fmt rewrites bitfield accesses #240

Open arichardson opened 1 year ago

arichardson commented 1 year ago

From sail-cheri-riscv:

-
-function haveXcheri () -> bool =
-  /* This is a necessary but not sufficient condition, but should do for now. */
-  misa.X() == 0b1
-
+function haveXcheri () -> bool = /* This is a necessary but not sufficient condition, but should do for now. */
+_mod_X(misa) == 0b1
 }

Not quite sure why the misa.X() was changed to _mod_X(misa).

Alasdair commented 1 year ago

Yes, the bitfield desugaring happens very early. It's one of the things I need to change in order to fix this.

I'm not sure whether to update to misa.X == 0b1. We have allowed treating bitfield members like normal fields for a while now.

jrtc27 commented 1 year ago

Yes, the bitfield desugaring happens very early. It's one of the things I need to change in order to fix this.

I'm not sure whether to update to misa.X == 0b1. We have allowed treating bitfield members like normal fields for a while now.

I'd be in favour of that, even if it does mean a bit of churn