Fix %0 format on $value$plusargs.

This commit is contained in:
Wilson Snyder 2021-11-17 17:54:07 -05:00
parent d2a8fa7440
commit 0abc856be9
3 changed files with 9 additions and 2 deletions

View File

@ -23,6 +23,7 @@ Verilator 4.215 devel
* Fix split_var assign merging (#3177) (#3179). [Yutetsu TAKATSUKASA]
* Fix nested generate if genblk naming (#3189). [yanx21]
* Fix display of empty string constant (#3207). [Julie Schwartz]
* Fix %0 format on $value$plusargs.
Verilator 4.214 2021-10-17

View File

@ -1600,6 +1600,7 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_M
inPct = true;
} else if (!inPct) { // Normal text
prefix += *posp;
} else if (inPct && posp[0] == '0') { // %0
} else { // Format character
switch (std::tolower(*posp)) {
case '%':

View File

@ -23,11 +23,16 @@ module t;
if ($test$plusargs("NOTTHERE")!==0) $stop;
p_i = 10;
if ($value$plusargs("NOTTHERE%d", p_i)!==0) $stop;
if ($value$plusargs("NOTTHERE%d", p_i) !== 0) $stop;
if ($value$plusargs("NOTTHERE%0d", p_i) !== 0) $stop;
if (p_i !== 10) $stop;
p_i = 0;
if ($value$plusargs("INT=%d", p_i)!==1) $stop;
if ($value$plusargs("INT=%d", p_i) !== 1) $stop;
if (p_i !== 32'd1234) $stop;
p_i = 0;
if ($value$plusargs("INT=%0d", p_i) !== 1) $stop;
if (p_i !== 32'd1234) $stop;
p_i = 0;