diff options
| author | ducky | 2018-07-01 12:40:25 -0700 |
|---|---|---|
| committer | Richard Lin | 2018-07-04 18:39:28 -0500 |
| commit | 94bde13444b956b2ef3c3cf7e94870b1d890f65d (patch) | |
| tree | 95d478dc89be94c2a419cd997c4e809952aa73c8 /chiselFrontend/src/main/scala/chisel3/core/Bits.scala | |
| parent | a931abe0cf57481b47093b5950d3bffd9575f803 (diff) | |
Prefer litValue, eliminate litToBigInt
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/Bits.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Bits.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala index a8ebab1b..b54b5e11 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Bits.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Bits.scala @@ -86,7 +86,7 @@ sealed abstract class Bits(width: Width) case _ => None } - override def litToBigIntOption: Option[BigInt] = litArgOption.map(_.num) + override def litOption: Option[BigInt] = litArgOption.map(_.num) private[core] def litIsForcedWidth: Option[Boolean] = litArgOption.map(_.forcedWidth) // provide bits-specific literal handling functionality here @@ -764,7 +764,7 @@ sealed class Bool() extends UInt(1.W) with Reset { new Bool().asInstanceOf[this.type] } - def litToBooleanOption: Option[Boolean] = litToBigIntOption.map { + def litToBooleanOption: Option[Boolean] = litOption.map { case intVal if intVal == 1 => true case intVal if intVal == 0 => false case intVal => throwException(s"Boolean with unexpected literal value $intVal") @@ -851,7 +851,7 @@ sealed class FixedPoint private (width: Width, val binaryPoint: BinaryPoint) case _ => this badConnect that } - def litToDoubleOption: Option[Double] = litToBigIntOption.map { intVal => + def litToDoubleOption: Option[Double] = litOption.map { intVal => val multiplier = math.pow(2, binaryPoint.get) intVal.toDouble / multiplier } @@ -1125,6 +1125,8 @@ final class Analog private (width: Width) extends Element(width) { private[core] override def typeEquivalent(that: Data): Boolean = that.isInstanceOf[Analog] && this.width == that.width + override def litOption = None + def cloneType: this.type = new Analog(width).asInstanceOf[this.type] // Used to enforce single bulk connect of Analog types, multi-attach is still okay @@ -1153,8 +1155,6 @@ final class Analog private (width: Width) extends Element(width) { binding = target } - override def litToBigIntOption = None - override def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = throwException("Analog does not support asUInt") |
