mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
cxxrtl: Handle case of Bits < 4
in formatting of values
This commit is contained in:
parent
c848d98d91
commit
6206a3af30
|
@ -796,7 +796,10 @@ std::ostream &operator<<(std::ostream &os, const value_formatted<Bits> &vf)
|
||||||
buf += '0';
|
buf += '0';
|
||||||
while (!val.is_zero()) {
|
while (!val.is_zero()) {
|
||||||
value<Bits> quotient, remainder;
|
value<Bits> quotient, remainder;
|
||||||
std::tie(quotient, remainder) = val.udivmod(value<Bits>{10u});
|
if (Bits >= 4)
|
||||||
|
std::tie(quotient, remainder) = val.udivmod(value<Bits>{10u});
|
||||||
|
else
|
||||||
|
std::tie(quotient, remainder) = std::make_pair(value<Bits>{0u}, val);
|
||||||
buf += '0' + remainder.template trunc<(Bits > 4 ? 4 : Bits)>().val().template get<uint8_t>();
|
buf += '0' + remainder.template trunc<(Bits > 4 ? 4 : Bits)>().val().template get<uint8_t>();
|
||||||
val = quotient;
|
val = quotient;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue