diff --git a/Changes b/Changes index 77040d98b..f40cebad4 100644 --- a/Changes +++ b/Changes @@ -16,6 +16,7 @@ Verilator 5.017 devel * Add trace() API even when Verilated without --trace (#4462). [phelter] * Add warning on interface instantiation without parens (#4094). [Gökçe Aydos] * Fix constification of $realtobits, $bitstoreal (#4522). [Andrew Nolte] +* Fix conversion of integers in $display '%e' (#4528). [muzafferkal] * Support randc (#4349). * Support resizing function call inout arguments (#4467). diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 3cc703257..0c73d9116 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -4893,6 +4893,7 @@ private: } break; } + case 'e': // FALLTHRU case 'f': // FALLTHRU case 'g': { if (argp) { diff --git a/test_regress/t/t_display_real.out b/test_regress/t/t_display_real.out index bf94bb29a..eb6fb770f 100644 --- a/test_regress/t/t_display_real.out +++ b/test_regress/t/t_display_real.out @@ -20,4 +20,6 @@ r8= 3 n1=1 n2=0.1 n1=1 n2=0.1 r8= 3 + +iconst=0.000000e+00 0.000000 0 *-* All Finished *-* diff --git a/test_regress/t/t_display_real.v b/test_regress/t/t_display_real.v index 1e5de3684..33e15d81c 100644 --- a/test_regress/t/t_display_real.v +++ b/test_regress/t/t_display_real.v @@ -11,6 +11,7 @@ module t; real n3; initial n3 = 1.2345e-15; real n4; initial n4 = 2.579e+15; reg [7:0] r8; initial r8 = 3; + integer iconst = 0; initial begin // Display formatting @@ -36,6 +37,8 @@ module t; $display; $display("r8=%d n1=%g n2=%g", r8, n1, n2); $display("n1=%g n2=%g r8=%d", n1, n2, r8); + $display; + $display("iconst=%e %f %g", iconst, iconst, iconst); $write("*-* All Finished *-*\n"); $finish; end