1
0

Fix up Absolute value.

As of ucb-bar/chisel#491 and 32885ac, abs now returns the same type as its argument. Add a cast to UInt.
This commit is contained in:
Jim Lawson 2017-02-08 15:00:43 -08:00
parent 69f4c1a144
commit 307e0ca9c0

View File

@ -89,7 +89,7 @@ object Str
def apply(x: SInt): UInt = apply(x, 10) def apply(x: SInt): UInt = apply(x, 10)
def apply(x: SInt, radix: Int): UInt = { def apply(x: SInt, radix: Int): UInt = {
val neg = x < SInt(0) val neg = x < SInt(0)
val abs = x.abs val abs = x.abs.asUInt
if (radix != 10) { if (radix != 10) {
Cat(Mux(neg, Str('-'), Str(' ')), Str(abs, radix)) Cat(Mux(neg, Str('-'), Str(' ')), Str(abs, radix))
} else { } else {