summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman2016-07-07 00:11:15 -0700
committerAndrew Waterman2016-07-07 00:34:03 -0700
commitfb39f7dc372b5836f02d8d7964f5fcc6a38f8747 (patch)
treeca446855b34936b45692657dd8255d2a616c34ac
parent378edecbf797f19cf26f5a4d6a3ed3df701ba66d (diff)
Avoid needlessly creating Vecs
-rw-r--r--src/main/scala/chisel3/util/Bitwise.scala2
-rw-r--r--src/main/scala/chisel3/util/OneHot.scala2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala
index ab1ff550..7f295200 100644
--- a/src/main/scala/chisel3/util/Bitwise.scala
+++ b/src/main/scala/chisel3/util/Bitwise.scala
@@ -11,7 +11,7 @@ import chisel3.core.SeqUtils
object FillInterleaved
{
def apply(n: Int, in: UInt): UInt = apply(n, in.toBools)
- def apply(n: Int, in: Seq[Bool]): UInt = Vec(in.map(Fill(n, _))).toBits
+ def apply(n: Int, in: Seq[Bool]): UInt = Cat(in.map(Fill(n, _)).reverse)
}
/** Returns the number of bits set (i.e value is 1) in the input signal.
diff --git a/src/main/scala/chisel3/util/OneHot.scala b/src/main/scala/chisel3/util/OneHot.scala
index 820c72d6..abede61e 100644
--- a/src/main/scala/chisel3/util/OneHot.scala
+++ b/src/main/scala/chisel3/util/OneHot.scala
@@ -10,7 +10,7 @@ import chisel3._
/** Converts from One Hot Encoding to a UInt indicating which bit is active
* This is the inverse of [[Chisel.UIntToOH UIntToOH]]*/
object OHToUInt {
- def apply(in: Seq[Bool]): UInt = apply(Vec(in))
+ def apply(in: Seq[Bool]): UInt = apply(Cat(in.reverse), in.size)
def apply(in: Vec[Bool]): UInt = apply(in.toBits, in.size)
def apply(in: Bits): UInt = apply(in, in.getWidth)