diff options
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 2 | ||||
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Data.scala | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index 03125488..0550a72c 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -75,6 +75,8 @@ sealed abstract class Bits(width: Width) def cloneType: this.type = cloneTypeWidth(width) + override def elementLitArg: Option[LitArg] = litArgOption + protected def litArgOption: Option[LitArg] = topBindingOpt match { case Some(ElementLitBinding(litArg)) => Some(litArg) case Some(BundleLitBinding(litMap)) => litMap.get(this) diff --git a/chiselFrontend/src/main/scala/chisel3/core/Data.scala b/chiselFrontend/src/main/scala/chisel3/core/Data.scala index e2d8775d..ab277d9f 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Data.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Data.scala @@ -405,6 +405,10 @@ abstract class Data extends HasId with NamedComponent { @deprecated("isLit is deprecated, use litToBigIntOption or litTo*Option", "chisel3.2") def isLit(): Boolean = litArg.isDefined + // If this is an element literal, returns the LitArg bound to it. + // INTERNAL API, but this isn't protected to allow bundle literal constructors. + def elementLitArg: Option[LitArg] = None + /** * If this is a literal that is representable as bits, returns the value as a BigInt. * If not a literal, or not representable as bits (for example, is or contains Analog), returns None. |
