summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main
diff options
context:
space:
mode:
authorJack Koenig2019-04-12 13:00:00 -0700
committerGitHub2019-04-12 13:00:00 -0700
commit6169f2b1c2e7d4e2aee098a8d4dbff6c9bcda663 (patch)
tree372c8265a0178891fcbfd89e638a8b206307b33e /chiselFrontend/src/main
parent9f77bf54543724594711f0455ef91f51edfbd22e (diff)
Implement connectFromBits in ChiselEnum (#1052)
This is necessary to use ChiselEnum in aggregates where things are casted using .asTypeOf
Diffstat (limited to 'chiselFrontend/src/main')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/core/StrongEnum.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/StrongEnum.scala b/chiselFrontend/src/main/scala/chisel3/core/StrongEnum.scala
index c359a119..1689e6ad 100644
--- a/chiselFrontend/src/main/scala/chisel3/core/StrongEnum.scala
+++ b/chiselFrontend/src/main/scala/chisel3/core/StrongEnum.scala
@@ -102,10 +102,10 @@ abstract class EnumType(private val factory: EnumFactory, selfAnnotating: Boolea
this.factory == that.asInstanceOf[EnumType].factory
}
- // This isn't actually used anywhere (and it would throw an exception anyway). But it has to be defined since we
- // inherit it from Data.
private[core] override def connectFromBits(that: Bits)(implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions): Unit = ???
+ compileOptions: CompileOptions): Unit = {
+ this := factory.apply(that.asUInt)
+ }
final def === (that: EnumType): Bool = macro SourceInfoTransform.thatArg
final def =/= (that: EnumType): Bool = macro SourceInfoTransform.thatArg