#486 implicitly sized parameter is displayed with wrong spacing


This is possibly similar to bug 2043384, in that it deals with behavior being different between explicit and implicit sizing of a parameter value.

If I define a submodule with a parameter -- with no range specified in the parameter declaration, so we expect the size of the parameter to be determined by the location which gives it a value -- and inside the submodule we display the value:

$display ( "%m xxx is: ", xxx );

Then I see different behavior when I instantiate the parameter with "5" vs "32'd5", even though my understanding is that "5" is implicitly assumed to be size 32.

With a size, I see this output:

test.m1d xxx is: 5

Without a size, I see this output:

test.m1 xxx is: 5

I believe that the first spacing is correct and we should see this amount of spacing in the second example.


  • kvarko

    kvarko - 2008-08-08

    Modules (test and sub) which exhibit the bug

  • kvarko

    kvarko - 2008-08-08

    Logged In: YES
    Originator: YES

    I guess that this might not be related entirely to parameters, but be an issue of how IVerilog displays unsized constants. Because I see unexpected output in this example too:

    module test3 ();
    initial begin
    $display ( "1 is: ", 5 );
    $display ( "2 is: ", 32'd5 );
    $display ( "3 is: ", 32'sd5 );

    Here, I expect the first and third lines to look the same, since the Verilog 2001 standard says that unsized constants are treated as signed integers and a footnote adds that the number of bits shall be at least 32. And the second line should have one less space, because it is an unsigned integer. The second and third line look OK, but the first line does not:

    1 is: 5
    2 is: 5
    3 is: 5

    Incidentally: In the presence of parameters in the original example, I would guess that the sign is dropped between the constant and the $display, so there should not be a difference between the three constant expressions?

  • Cary R.

    Cary R. - 2008-08-08

    Logged In: YES
    Originator: NO

    Icarus does not implicitly size constants to be 32 bits. It makes them as big as need to provide full precision. In this case 5 can be correctly represented with less than 32 bits. This can cause problems in some expressions and there is one report for the development branch that demonstrates this. We have not decided what to do about this yet and whatever we do it will likely not make it into V0.8. We suggest that people use the development branch if possible since it has many improvements compared to V0.8. I'm closing this report since it is already captured in other places.

  • Cary R.

    Cary R. - 2008-08-08
    • status: open --> closed-duplicate

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks