diff options
| author | Jack Koenig | 2018-12-04 13:53:36 -0800 |
|---|---|---|
| committer | GitHub | 2018-12-04 13:53:36 -0800 |
| commit | 83f2a65a3ab1d21258883c0b113406ef9900a57f (patch) | |
| tree | c21edf9bc9c5f2f42ec5716a829145024bb82862 /src/main/scala/chisel3/util | |
| parent | ab951049c2c60402e2318ba863520d4a16c8288d (diff) | |
| parent | 3db21bd8e5a32c29efa55494d180dac4d22589e5 (diff) | |
Merge pull request #950 from freechipsproject/as-bools
asBools, asBool, and chained apply on asBools
Diffstat (limited to 'src/main/scala/chisel3/util')
| -rw-r--r-- | src/main/scala/chisel3/util/Bitwise.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/ImplicitConversions.scala | 2 | ||||
| -rw-r--r-- | src/main/scala/chisel3/util/OneHot.scala | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala index 387fd109..956b8262 100644 --- a/src/main/scala/chisel3/util/Bitwise.scala +++ b/src/main/scala/chisel3/util/Bitwise.scala @@ -24,7 +24,7 @@ object FillInterleaved { * * Output data-equivalent to in(size(in)-1) (n times) ## ... ## in(1) (n times) ## in(0) (n times) */ - def apply(n: Int, in: UInt): UInt = apply(n, in.toBools) + def apply(n: Int, in: UInt): UInt = apply(n, in.asBools) /** Creates n repetitions of each bit of x in order. * @@ -69,7 +69,7 @@ object Fill { case 0 => UInt(0.W) case 1 => x case _ if x.isWidthKnown && x.getWidth == 1 => - Mux(x.toBool, ((BigInt(1) << n) - 1).asUInt(n.W), 0.U(n.W)) + Mux(x.asBool, ((BigInt(1) << n) - 1).asUInt(n.W), 0.U(n.W)) case _ => val nBits = log2Ceil(n + 1) val p2 = Array.ofDim[UInt](nBits) diff --git a/src/main/scala/chisel3/util/ImplicitConversions.scala b/src/main/scala/chisel3/util/ImplicitConversions.scala index 994ac735..24ea0470 100644 --- a/src/main/scala/chisel3/util/ImplicitConversions.scala +++ b/src/main/scala/chisel3/util/ImplicitConversions.scala @@ -13,5 +13,5 @@ object ImplicitConversions { // The explicit fromIntToLiteral resolves an ambiguous conversion between fromIntToLiteral and // UInt.asUInt. implicit def intToUInt(x: Int): UInt = chisel3.core.fromIntToLiteral(x).asUInt - implicit def booleanToBool(x: Boolean): Bool = x.asBool + implicit def booleanToBool(x: Boolean): Bool = x.B } diff --git a/src/main/scala/chisel3/util/OneHot.scala b/src/main/scala/chisel3/util/OneHot.scala index a6af0d99..3ffbdfe2 100644 --- a/src/main/scala/chisel3/util/OneHot.scala +++ b/src/main/scala/chisel3/util/OneHot.scala @@ -36,7 +36,7 @@ object OHToUInt { */ object PriorityEncoder { def apply(in: Seq[Bool]): UInt = PriorityMux(in, (0 until in.size).map(_.asUInt)) - def apply(in: Bits): UInt = apply(in.toBools) + def apply(in: Bits): UInt = apply(in.asBools) } /** Returns the one hot encoding of the input UInt. |
