3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 17:15:33 +00:00

fmt: format %t consistently at initial

This commit is contained in:
Charlotte 2023-06-28 11:51:22 +10:00 committed by Marcelina Kościelnicka
parent c391ee7a0d
commit 9f9561379b
3 changed files with 23 additions and 10 deletions

View file

@ -606,6 +606,7 @@ std::string Fmt::render() const
break;
case FmtPart::INTEGER:
case FmtPart::TIME:
case FmtPart::CHARACTER: {
std::string buf;
if (part.type == FmtPart::INTEGER) {
@ -689,6 +690,9 @@ std::string Fmt::render() const
} else log_abort();
} else if (part.type == FmtPart::CHARACTER) {
buf = part.sig.as_const().decode_string();
} else if (part.type == FmtPart::TIME) {
// We only render() during initial, so time is always zero.
buf = "0";
}
log_assert(part.width == 0 || part.padding != '\0');
@ -705,12 +709,6 @@ std::string Fmt::render() const
str += std::string(part.width - buf.size(), part.padding);
break;
}
case FmtPart::TIME: {
// We only render() during initial, so time is always zero.
str += "0";
break;
}
}
}