Fix $display with %d following %g.
This commit is contained in:
parent
8cf12416c0
commit
5df3bbe188
2
Changes
2
Changes
|
|
@ -18,6 +18,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||
|
||||
**** Fix reporting not found modules if generate-off, bug403. [Jeremy Bennett]
|
||||
|
||||
**** Fix $display with %d following %g. [Holger Wächtler]
|
||||
|
||||
|
||||
* Verilator 3.824 2011/10/25
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,9 @@ void _vl_vsformat(string& output, const char* formatp, va_list ap) {
|
|||
case 'e':
|
||||
case 'f':
|
||||
case 'g': {
|
||||
const int lbits = va_arg(ap, int);
|
||||
double d = va_arg(ap, double);
|
||||
if (lbits) {} // UNUSED - always 64
|
||||
strncpy(tmpf, pctp, pos-pctp+1);
|
||||
tmpf[pos-pctp+1] = '\0';
|
||||
sprintf(tmp, tmpf, d);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ execute (
|
|||
[0] e=2.579000e+15 e1=2.579000e+15 e30=3e+15 e32=2.58e+15
|
||||
[0] f=2579000000000000.000000 f1=2.579000e+15 f30=3e+15 f32=2.58e+15
|
||||
[0] g=2.579e+15 g1=2.579000e+15 g30=3e+15 g32=2.58e+15
|
||||
|
||||
r8= 3 n1=1 n2=0.1
|
||||
n1=1 n2=0.1 r8= 3
|
||||
'),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module t;
|
|||
real n2; initial n2 = 0.1;
|
||||
real n3; initial n3 = 1.2345e-15;
|
||||
real n4; initial n4 = 2.579e+15;
|
||||
reg [7:0] r8; initial r8 = 3;
|
||||
|
||||
initial begin
|
||||
// Display formatting
|
||||
|
|
@ -31,6 +32,9 @@ module t;
|
|||
$display("[%0t] e=%e e1=%1e e30=%3.0e e32=%3.2e", $time, n4,n4,n4,n4);
|
||||
$display("[%0t] f=%f f1=%1e f30=%3.0e f32=%3.2e", $time, n4,n4,n4,n4);
|
||||
$display("[%0t] g=%g g1=%1e g30=%3.0e g32=%3.2e", $time, n4,n4,n4,n4);
|
||||
$display;
|
||||
$display("r8=%d n1=%g n2=%g", r8, n1, n2);
|
||||
$display("n1=%g n2=%g r8=%d", n1, n2, r8);
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ execute (
|
|||
[0] e=2.579000e+15 e1=2.579000e+15 e30=3e+15 e32=2.58e+15
|
||||
[0] f=2579000000000000.000000 f1=2.579000e+15 f30=3e+15 f32=2.58e+15
|
||||
[0] g=2.579e+15 g1=2.579000e+15 g30=3e+15 g32=2.58e+15
|
||||
|
||||
r8= 3 n1=1 n2=0.1
|
||||
n1=1 n2=0.1 r8= 3
|
||||
'),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue