mirror of
https://github.com/verilator/verilator.git
synced 2025-05-02 05:26:53 +00:00
Support $swrite with arbitrary arguments
This commit is contained in:
parent
ae701e014d
commit
933e796cc2
@ -3708,6 +3708,11 @@ public:
|
|||||||
setOp1p(new AstSFormatF(fl, text, true, exprsp, missingArgChar));
|
setOp1p(new AstSFormatF(fl, text, true, exprsp, missingArgChar));
|
||||||
setOp3p(lhsp);
|
setOp3p(lhsp);
|
||||||
}
|
}
|
||||||
|
AstSFormat(FileLine* fl, AstNode* lhsp, AstNode* exprsp, char missingArgChar = 'd')
|
||||||
|
: ASTGEN_SUPER(fl) {
|
||||||
|
setOp1p(new AstSFormatF(fl, AstSFormatF::NoFormat(), exprsp, missingArgChar));
|
||||||
|
setOp3p(lhsp);
|
||||||
|
}
|
||||||
ASTNODE_NODE_FUNCS(SFormat)
|
ASTNODE_NODE_FUNCS(SFormat)
|
||||||
virtual const char* broken() const {
|
virtual const char* broken() const {
|
||||||
BROKEN_RTN(!fmtp());
|
BROKEN_RTN(!fmtp());
|
||||||
|
@ -3450,11 +3450,11 @@ system_t_call<nodep>: // IEEE: system_tf_call (as task)
|
|||||||
| yD_STOP parenE { $$ = new AstStop($1, false); }
|
| yD_STOP parenE { $$ = new AstStop($1, false); }
|
||||||
| yD_STOP '(' expr ')' { $$ = new AstStop($1, false); DEL($3); }
|
| yD_STOP '(' expr ')' { $$ = new AstStop($1, false); DEL($3); }
|
||||||
//
|
//
|
||||||
| yD_SFORMAT '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1, $3, *$5, $6); }
|
| yD_SFORMAT '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5); }
|
||||||
| yD_SWRITE '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1, $3, *$5, $6); }
|
| yD_SWRITE '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5); }
|
||||||
| yD_SWRITEB '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1, $3, *$5, $6, 'b'); }
|
| yD_SWRITEB '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'b'); }
|
||||||
| yD_SWRITEH '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1, $3, *$5, $6, 'h'); }
|
| yD_SWRITEH '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'h'); }
|
||||||
| yD_SWRITEO '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1, $3, *$5, $6, 'o'); }
|
| yD_SWRITEO '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'o'); }
|
||||||
//
|
//
|
||||||
| yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL); }
|
| yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, NULL); }
|
||||||
| yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3); }
|
| yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, NULL, $3); }
|
||||||
|
@ -43,6 +43,11 @@ module t;
|
|||||||
$swrite(str2, "e=%f", r);
|
$swrite(str2, "e=%f", r);
|
||||||
$swrite(str2, "e=%g", r);
|
$swrite(str2, "e=%g", r);
|
||||||
|
|
||||||
|
str3 = "hello";
|
||||||
|
$swrite(str2, {str3, str3});
|
||||||
|
`ifdef TEST_VERBOSE $display("str2=%0s",str2); `endif
|
||||||
|
if (str2 !== "hellohello") $stop;
|
||||||
|
|
||||||
r = 0.01;
|
r = 0.01;
|
||||||
$swrite(str2, "e=%e f=%f g=%g", r, r, r);
|
$swrite(str2, "e=%e f=%f g=%g", r, r, r);
|
||||||
`ifdef TEST_VERBOSE $display("str2=%0s",str2); `endif
|
`ifdef TEST_VERBOSE $display("str2=%0s",str2); `endif
|
||||||
|
Loading…
Reference in New Issue
Block a user