From 0719146300e6100a6e403541402391642bf90753 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 4 Aug 2015 04:40:04 -0700 Subject: Fix inferred width of Reverse --- src/main/scala/Chisel/utils.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/scala/Chisel/utils.scala b/src/main/scala/Chisel/utils.scala index 830687b8..fe8329a7 100644 --- a/src/main/scala/Chisel/utils.scala +++ b/src/main/scala/Chisel/utils.scala @@ -218,13 +218,13 @@ object Reverse if (length == 1) { in } else if (isPow2(length) && length >= 8 && length <= 64) { - // Do it in logarithmic time to speed up C++. Neutral for real HW. + // This esoterica improves simulation performance var res = in var shift = length >> 1 var mask = UInt((BigInt(1) << length) - 1, length) do { - mask = mask ^ (mask(length-shift-1,0) << UInt(shift)) - res = ((res >> UInt(shift)) & mask) | (res(length-shift-1,0) << UInt(shift) & ~mask) + mask = mask ^ (mask(length-shift-1,0) << shift) + res = ((res >> shift) & mask) | ((res(length-shift-1,0) << shift) & ~mask) shift = shift >> 1 } while (shift > 0) res -- cgit v1.2.3