-
Notifications
You must be signed in to change notification settings - Fork 642
Open
Labels
FeatureNew feature, will be included in release notesNew feature, will be included in release notesbugfeature requestusability
Milestone
Description
Type of issue: bug report / feature request
Impact: API addition (no impact on existing code)
Development Phase: request
Other information:
When using ChiselEnum
, one should be able to take enum literals and use asUInt
followed by litValue
. This pattern is notably useful when trying to turn enum literals into BitPat
s.
object ExampleEnum extends ChiselEnum {
val Foo, Bar = Value
}
// Does not work since BitPat() internally calls .litValue which crashes with None.get
val simple = BitPat(ExampleEnum.Foo.asUInt)
// Instead we have to use a clumsy workaround
val complicated = BitPat(ExampleEnum.Foo.litValue.U(ExampleEnum.getWidth.W))
Metadata
Metadata
Assignees
Labels
FeatureNew feature, will be included in release notesNew feature, will be included in release notesbugfeature requestusability