forked from github/verilator
* Fix empty string arguments to display (#3484).
This commit is contained in:
parent
a4fddb3fbe
commit
5f3316d3dc
1
Changes
1
Changes
@ -14,6 +14,7 @@ Verilator 4.225 devel
|
||||
**Minor:**
|
||||
|
||||
* Fix incorrect bit op tree optimization (#3470). [algrobman]
|
||||
* Fix empty string arguments to display (#3484). [Grulfen]
|
||||
* Fix table misoptimizing away display (#3488). [Stefan Post]
|
||||
|
||||
|
||||
|
@ -352,43 +352,45 @@ private:
|
||||
while (argp) {
|
||||
if (skipCount) {
|
||||
argp = argp->nextp();
|
||||
skipCount--;
|
||||
--skipCount;
|
||||
continue;
|
||||
}
|
||||
const AstConst* const constp = VN_CAST(argp, Const);
|
||||
const bool isFromString = (constp) ? constp->num().isFromString() : false;
|
||||
if (isFromString) {
|
||||
const int numchars = argp->dtypep()->width() / 8;
|
||||
string str(numchars, ' ');
|
||||
// now scan for % operators
|
||||
bool inpercent = false;
|
||||
for (int i = 0; i < numchars; i++) {
|
||||
const int ii = numchars - i - 1;
|
||||
const char c = constp->num().dataByte(ii);
|
||||
str[i] = c;
|
||||
if (!inpercent && c == '%') {
|
||||
inpercent = true;
|
||||
} else if (inpercent) {
|
||||
inpercent = false;
|
||||
switch (c) {
|
||||
case '0': // FALLTHRU
|
||||
case '1': // FALLTHRU
|
||||
case '2': // FALLTHRU
|
||||
case '3': // FALLTHRU
|
||||
case '4': // FALLTHRU
|
||||
case '5': // FALLTHRU
|
||||
case '6': // FALLTHRU
|
||||
case '7': // FALLTHRU
|
||||
case '8': // FALLTHRU
|
||||
case '9': // FALLTHRU
|
||||
case '.': inpercent = true; break;
|
||||
case '%': break;
|
||||
default:
|
||||
if (V3Number::displayedFmtLegal(c, isScan)) ++skipCount;
|
||||
if (!constp->num().toString().empty()) {
|
||||
string str(numchars, ' ');
|
||||
// now scan for % operators
|
||||
bool inpercent = false;
|
||||
for (int i = 0; i < numchars; i++) {
|
||||
const int ii = numchars - i - 1;
|
||||
const char c = constp->num().dataByte(ii);
|
||||
str[i] = c;
|
||||
if (!inpercent && c == '%') {
|
||||
inpercent = true;
|
||||
} else if (inpercent) {
|
||||
inpercent = false;
|
||||
switch (c) {
|
||||
case '0': // FALLTHRU
|
||||
case '1': // FALLTHRU
|
||||
case '2': // FALLTHRU
|
||||
case '3': // FALLTHRU
|
||||
case '4': // FALLTHRU
|
||||
case '5': // FALLTHRU
|
||||
case '6': // FALLTHRU
|
||||
case '7': // FALLTHRU
|
||||
case '8': // FALLTHRU
|
||||
case '9': // FALLTHRU
|
||||
case '.': inpercent = true; break;
|
||||
case '%': break;
|
||||
default:
|
||||
if (V3Number::displayedFmtLegal(c, isScan)) ++skipCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
newFormat.append(str);
|
||||
}
|
||||
newFormat.append(str);
|
||||
AstNode* const nextp = argp->nextp();
|
||||
argp->unlinkFrBack();
|
||||
VL_DO_DANGLING(pushDeletep(argp), argp);
|
||||
|
@ -1,5 +1,7 @@
|
||||
Merge:
|
||||
This should merge
|
||||
Merge:
|
||||
This should also merge
|
||||
f
|
||||
1=1 a=top.t 1=1 1=1 b=top.t 1=1
|
||||
pre
|
||||
|
@ -20,7 +20,7 @@ execute(
|
||||
);
|
||||
|
||||
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}__stats.txt",
|
||||
qr/Node count, DISPLAY \s+ 41 \s+ 27 \s+ 27 \s+ 6/);
|
||||
qr/Node count, DISPLAY \s+ 44 \s+ 27 \s+ 27 \s+ 6/);
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
@ -19,6 +19,10 @@ module t (/*AUTOARG*/);
|
||||
$write("should ");
|
||||
$display("merge");
|
||||
|
||||
$display("Merge:");
|
||||
$write("This ", "", "should ", "", "also ");
|
||||
$display("merge");
|
||||
|
||||
$display("f");
|
||||
$write(" 1=%0d a=%m 1=%0d", one, one);
|
||||
$display(" 1=%0d b=%m 1=%0d", one, one);
|
||||
|
Loading…
Reference in New Issue
Block a user