chisel2-deprecated icon indicating copy to clipboard operation
chisel2-deprecated copied to clipboard

Statically typed enums

Open doughnit opened this issue 10 years ago • 0 comments

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.

doughnit avatar Sep 15 '15 17:09 doughnit