3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-24 13:18:56 +00:00

fmt: %t/$time support

This commit is contained in:
Charlotte 2023-06-28 11:51:20 +10:00 committed by Marcelina Kościelnicka
parent 52dc397a50
commit c382d7d3ac
7 changed files with 133 additions and 26 deletions

View file

@ -30,6 +30,7 @@ struct VerilogFmtArg {
enum {
STRING = 0,
INTEGER = 1,
TIME = 2,
} type;
// All types
@ -42,6 +43,9 @@ struct VerilogFmtArg {
// INTEGER type
RTLIL::SigSpec sig;
bool signed_ = false;
// TIME type
bool realtime = false;
};
// RTLIL format part, such as the substitutions in:
@ -51,24 +55,31 @@ struct FmtPart {
STRING = 0,
INTEGER = 1,
CHARACTER = 2,
TIME = 3,
} type;
// STRING type
std::string str;
// INTEGER/CHARACTER type
// INTEGER/CHARACTER types
RTLIL::SigSpec sig;
// INTEGER/CHARACTER/TIME types
enum {
RIGHT = 0,
LEFT = 1,
} justify = RIGHT;
char padding = '\0';
size_t width = 0;
// INTEGER type
unsigned base = 10;
bool signed_ = false;
bool lzero = false;
bool plus = false;
// TIME type
bool realtime = false;
};
struct Fmt {