1
0

Merge pull request #552 from ucb-bar/fix-abs-func

Fix up Absolute value.
This commit is contained in:
Henry Cook 2017-02-09 10:09:16 -08:00 committed by GitHub
commit fbefbb5549

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 {