Menu

#999 expression involving parameter/localparam yields wrong value

devel
closed-fixed
None
6
2016-01-07
2016-01-07
No

When comparing the value of a parameter/localparam to a register/variable directly in a control instruction, e.g:

localparam integer XX = 1;
integer cmp = 0;
initial
if ( XX == cmp )
$display("Should not be printed");

Then v10_0 does print the above statement (but v0_9_7 does not, i.e., behaves correctly). I built and executed on ubuntu 14.04 (linux-x86_64).

If I assign the comparison result to an intermediate variable then there is no problem

reg result;

initial begin
result = (XX==cmp);
if ( result )
$display("Should not be printed");
end

remains silent (under both versions).
Test case as well as the output it produces for v10_0 and v0_9_7, respectively is attached.

3 Attachments

Related

Bugs: #1021

Discussion

  • Martin Whitaker

    Martin Whitaker - 2016-01-07
    • assigned_to: Martin Whitaker
     
  • Martin Whitaker

    Martin Whitaker - 2016-01-07

    This is a bug in the new vvp target code generator. It will also be present in the v10 release.

     
  • Martin Whitaker

    Martin Whitaker - 2016-01-07

    Fixed in both master and v10 branches. Thanks for reporting this.

     
  • Martin Whitaker

    Martin Whitaker - 2016-01-07
    • status: open --> closed-fixed
     

Log in to post a comment.

Auth0 Logo