diff options
| author | ducky | 2018-05-11 15:49:03 -0700 |
|---|---|---|
| committer | Richard Lin | 2018-07-04 18:39:28 -0500 |
| commit | 0d157633104cdd96b881726802c7691783aeb7e6 (patch) | |
| tree | c23419f3999010a97b83757adcf9d375f3bce0eb /chiselFrontend/src/main/scala/chisel3/core | |
| parent | 6ff91db33279c9f3ccbafe993cf4abee0542298a (diff) | |
broken
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. |
