chisel2-deprecated
chisel2-deprecated copied to clipboard
Statically typed enums
It would be nice to have a type (like UInt, Bool) for enum wires which also does static type checking (for example, to make sure I don't accidentally assign Animal.Duck to my ALU function port - though integer to enum conversions may be allowed as long as they're explicit).
The current method just generates literals of some given type (UFix in the manual), and (presumably?) doesn't do any checking that assignments are the correct type of enum. Additionally, the example doesn't show recommended ways to define enums on IOs (you'd think this would be more common), where the values are supposed to be shared across class boundaries.