I want to use SpinalEnum as RegIf field. Here is an example code, which doesn't seem to work:
object SourceEnum extends SpinalEnum {
val src1, src2, src3 = newElement()
}
...
val busif = BusInterface(...)
// Control Register
val ctrl = busif.newReg("Control register")
val source = ctrl.field(SourceEnum.C, RW, doc = "Data source")
It shows a following error during compilation: value C is not a member of object regiftest.SourceEnum. I was using the .C type "extraction" before, and it worked, but clearly it doesn't work in this case. What am I doing wrong?
Currently, as a workaround I'm using B(SourceEnum().getBitsWidth) with dest.assignFromBits(source), but it's not as elegant.
no, you can't put SpinalEnum in. the RegIf
REG.file()only accept HardType likeor old way
For details, please refer to https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Libraries/regIf.html#