From 001aab20b38861067f413bd6b828d7d4c40050ad Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 30 Mar 2016 21:58:54 -0700 Subject: Return Seq, not Vec, from PriorityEncoderOH It doesn't really make sense to create a one-hot result then follow it with a decoder. It's more performant to use a PriorityEncoder followed by a comparator. Discourage the former by returning Seq, not Vec. In Chisel2, it seems the return type was originally Seq, but was at some point inadvertently changed to Vec. --- src/main/scala/Chisel/util/OneHot.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/scala/Chisel/util/OneHot.scala b/src/main/scala/Chisel/util/OneHot.scala index 38b96511..73f27403 100644 --- a/src/main/scala/Chisel/util/OneHot.scala +++ b/src/main/scala/Chisel/util/OneHot.scala @@ -51,12 +51,12 @@ object UIntToOH object PriorityEncoderOH { private def encode(in: Seq[Bool]): UInt = { - val outs = Vec.tabulate(in.size)(i => UInt(BigInt(1) << i, in.size)) + val outs = Seq.tabulate(in.size)(i => UInt(BigInt(1) << i, in.size)) PriorityMux(in :+ Bool(true), outs :+ UInt(0, in.size)) } - def apply(in: Seq[Bool]): Vec[Bool] = { + def apply(in: Seq[Bool]): Seq[Bool] = { val enc = encode(in) - Vec.tabulate(in.size)(enc(_)) + Seq.tabulate(in.size)(enc(_)) } def apply(in: Bits): UInt = encode((0 until in.getWidth).map(i => in(i))) } -- cgit v1.2.3