Fix display %x formatting of real.

This commit is contained in:
Wilson Snyder 2023-08-30 17:21:33 -04:00
parent 5e6519c1b0
commit 373265752f
6 changed files with 29 additions and 0 deletions

View File

@ -30,6 +30,7 @@ Verilator 5.015 devel
* Fix false MULTITOP on bound interfaces (#4438). [Alex Solomatnikov]
* Fix internal error on real conversion (#4447). [vdhotre-ventana]
* Fix lifetime unknown error on enum.name (#4448). [jwoutersymatra]
* Fix display %x formatting of real.
Verilator 5.014 2023-08-06

View File

@ -4815,6 +4815,16 @@ private:
}
break;
}
case 'b': // FALLTHRU
case 'o': // FALLTHRU
case 'x': {
if (argp) {
AstNodeExpr* const nextp = VN_AS(argp->nextp(), NodeExpr);
if (argp->isDouble()) spliceCvtS(argp, true, 64);
argp = nextp;
}
break;
}
case 'p': { // Pattern
const AstNodeDType* const dtypep = argp ? argp->dtypep()->skipRefp() : nullptr;
const AstBasicDType* const basicp = dtypep ? dtypep->basicp() : nullptr;

View File

@ -3,6 +3,7 @@
[0] In top.t.sub.write_m.subblock (sub)
[0] In top.t.sub2.write_m (sub2)
[0] In top.t.sub2.write_m.subblock2 (sub2)
a: -0.4=> 0.4 0 0 0
[0] Back \ Quote "
[0] %b=000001100 %0b=1100 %b=00000101010111011101110111100110011001100 %0b=101010111011101110111100110011001100 %b=000001010101111000001001000110100010101100111100000010010001101000101011001111000 %0b=1010101111000001001000110100010101100111100000010010001101000101011001111000
[0] %B=000001100 %0B=1100 %B=00000101010111011101110111100110011001100 %0B=101010111011101110111100110011001100 %B=000001010101111000001001000110100010101100111100000010010001101000101011001111000 %0B=1010101111000001001000110100010101100111100000010010001101000101011001111000

View File

@ -21,11 +21,13 @@ module t;
sub sub ();
sub2 sub2 ();
sub3 sub3 ();
initial begin
$write("[%0t] In %m: Hi\n", $time);
sub.write_m;
sub2.write_m;
sub3.write_m;
// Escapes
$display("[%0t] Back \\ Quote \"", $time); // Old bug when \" last on the line.
@ -229,3 +231,18 @@ module sub2;
end
endtask
endmodule
module sub3;
function real copyr(input real r);
copyr = r;
endfunction
real a, d;
task write_m;
a = 0.4;
// verilator lint_off REALCVT
$display("a: -0.4=> %.1f %0d %0x %0b", copyr(a), copyr(a), copyr(a), copyr(a));
// verilator lint_on REALCVT
endtask
endmodule