diff --git a/backends/cxxrtl/cxxrtl.h b/backends/cxxrtl/cxxrtl.h index 6d955fe9b..c7a632105 100644 --- a/backends/cxxrtl/cxxrtl.h +++ b/backends/cxxrtl/cxxrtl.h @@ -904,10 +904,12 @@ std::ostream &operator<<(std::ostream &os, const value_formatted &vf) val = val.neg(); if (val.is_zero()) buf += '0'; - // TODO: rigorously check our signed behaviour here while (!val.is_zero()) { value quotient; - val.signedDivideWithRemainder(value{10u}, quotient); + if (negative) + val.signedDivideWithRemainder(value{10u}, quotient); + else + val.divideWithRemainder(value{10u}, quotient); buf += '0' + val.template slice<3, 0>().val().template get(); val = quotient; }