mirror of
https://github.com/verilator/verilator.git
synced 2025-01-09 08:07:46 +00:00
Fix $sformat with non-constant string first argument
This commit is contained in:
parent
6de78d58fa
commit
3c8953fec2
@ -3570,10 +3570,11 @@ public:
|
|||||||
addNOp1p(exprsp);
|
addNOp1p(exprsp);
|
||||||
addNOp2p(NULL);
|
addNOp2p(NULL);
|
||||||
}
|
}
|
||||||
AstSFormatF(FileLine* fl, NoFormat, AstNode* exprsp, char missingArgChar = 'd')
|
AstSFormatF(FileLine* fl, NoFormat, AstNode* exprsp, char missingArgChar = 'd',
|
||||||
|
bool hidden = true)
|
||||||
: ASTGEN_SUPER(fl)
|
: ASTGEN_SUPER(fl)
|
||||||
, m_text("")
|
, m_text("")
|
||||||
, m_hidden(true)
|
, m_hidden(hidden)
|
||||||
, m_hasFormat(false)
|
, m_hasFormat(false)
|
||||||
, m_missingArgChar(missingArgChar) {
|
, m_missingArgChar(missingArgChar) {
|
||||||
dtypeSetString();
|
dtypeSetString();
|
||||||
|
@ -3642,7 +3642,7 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
|
|||||||
| yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,$5); }
|
| yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,$5); }
|
||||||
| yD_RTOI '(' expr ')' { $$ = new AstRToIS($1,$3); }
|
| yD_RTOI '(' expr ')' { $$ = new AstRToIS($1,$3); }
|
||||||
| yD_SAMPLED '(' expr ')' { $$ = new AstSampled($1, $3); }
|
| yD_SAMPLED '(' expr ')' { $$ = new AstSampled($1, $3); }
|
||||||
| yD_SFORMATF '(' str commaEListE ')' { $$ = new AstSFormatF($1,*$3,false,$4); }
|
| yD_SFORMATF '(' exprDispList ')' { $$ = new AstSFormatF($1, AstSFormatF::NoFormat(), $3, 'd', false); }
|
||||||
| yD_SHORTREALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); UNSUPREAL($1); }
|
| yD_SHORTREALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); UNSUPREAL($1); }
|
||||||
| yD_SIGNED '(' expr ')' { $$ = new AstSigned($1,$3); }
|
| yD_SIGNED '(' expr ')' { $$ = new AstSigned($1,$3); }
|
||||||
| yD_SIN '(' expr ')' { $$ = new AstSinD($1,$3); }
|
| yD_SIN '(' expr ')' { $$ = new AstSinD($1,$3); }
|
||||||
@ -4313,11 +4313,6 @@ exprDispList<nodep>: // exprList for within $display
|
|||||||
{ $$ = $1; $1->addNext(new AstConst($<fl>2, AstConst::VerilogStringLiteral(), " ")); }
|
{ $$ = $1; $1->addNext(new AstConst($<fl>2, AstConst::VerilogStringLiteral(), " ")); }
|
||||||
;
|
;
|
||||||
|
|
||||||
commaEListE<nodep>:
|
|
||||||
/* empty */ { $$ = NULL; }
|
|
||||||
| ',' exprList { $$ = $2; }
|
|
||||||
;
|
|
||||||
|
|
||||||
vrdList<nodep>:
|
vrdList<nodep>:
|
||||||
idClassSel { $$ = $1; }
|
idClassSel { $$ = $1; }
|
||||||
| vrdList ',' idClassSel { $$ = $1;$1->addNext($3); }
|
| vrdList ',' idClassSel { $$ = $1;$1->addNext($3); }
|
||||||
|
@ -62,11 +62,11 @@ module t;
|
|||||||
if (str2 !== "lib=t") $stop;
|
if (str2 !== "lib=t") $stop;
|
||||||
|
|
||||||
str3 = $sformatf("u=%u", {"a","b","c","d"}); // Value selected so is printable
|
str3 = $sformatf("u=%u", {"a","b","c","d"}); // Value selected so is printable
|
||||||
`ifdef TEST_VERBOSE $display("chku %s %s",str3,str3); `endif
|
`ifdef TEST_VERBOSE $display("chku %s", str3); `endif
|
||||||
if (str3 !== "u=dcba") $stop;
|
if (str3 !== "u=dcba") $stop;
|
||||||
|
|
||||||
str3 = $sformatf("v=%v", {"a","b","c","d"}); // Value selected so is printable
|
str3 = $sformatf("v=%v", {"a","b","c","d"}); // Value selected so is printable
|
||||||
`ifdef TEST_VERBOSE $display("chkv %s %s",str3,str3); `endif
|
`ifdef TEST_VERBOSE $display("chkv %s", str3); `endif
|
||||||
|
|
||||||
$sformat(ochar,"%s","c");
|
$sformat(ochar,"%s","c");
|
||||||
if (ochar != "c") $stop;
|
if (ochar != "c") $stop;
|
||||||
|
Loading…
Reference in New Issue
Block a user