Merge pull request #552 from ucb-bar/fix-abs-func
Fix up Absolute value.
This commit is contained in:
commit
fbefbb5549
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user