mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-24 01:25:33 +00:00
fmt,cxxrtl: add support for uppercase hex format.
This is necessary for translating Python format strings in Amaranth.
This commit is contained in:
parent
a5441bc00c
commit
8388846e3a
3 changed files with 11 additions and 4 deletions
|
@ -1034,6 +1034,7 @@ struct fmt_part {
|
|||
unsigned base; // = 10;
|
||||
bool signed_; // = false;
|
||||
bool plus; // = false;
|
||||
bool hex_upper; // = false;
|
||||
|
||||
// VLOG_TIME type
|
||||
bool realtime; // = false;
|
||||
|
@ -1085,7 +1086,7 @@ struct fmt_part {
|
|||
uint8_t value = val.bit(index) | (val.bit(index + 1) << 1) | (val.bit(index + 2) << 2);
|
||||
if (step == 4)
|
||||
value |= val.bit(index + 3) << 3;
|
||||
buf += "0123456789abcdef"[value];
|
||||
buf += (hex_upper ? "0123456789ABCDEF" : "0123456789abcdef")[value];
|
||||
}
|
||||
std::reverse(buf.begin(), buf.end());
|
||||
} else if (base == 10) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue