Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icarus does undef propagation of const multiplies incorrectly #18

Closed
cliffordwolf opened this issue Feb 27, 2014 · 2 comments
Closed

Icarus does undef propagation of const multiplies incorrectly #18

cliffordwolf opened this issue Feb 27, 2014 · 2 comments

Comments

@cliffordwolf
Copy link
Contributor

@cliffordwolf cliffordwolf commented Feb 27, 2014

The following module should set the output to constant 4'bxxxx:

module test(y);
  output [3:0] y;
  assign y = 4'b0 * 4'bx;
endmodule

But Icarus Verilog (git a3450bf) is too smart and outputs 4'b0000 instead.

I guess this is related to issue #15.

@martinwhitaker
Copy link
Collaborator

@martinwhitaker martinwhitaker commented Feb 27, 2014

It's not exactly related, as it is one of the general optimisations the compiler does, so would happen even if the second operand was a variable. I've fixed this in other places by adding a check that the second operand is not a four-state signal, but I missed this one.

martinwhitaker added a commit that referenced this issue Feb 27, 2014
…ncorrect.

When an expression is elaborated, the compiler converts multiplies with
one constamt zero operand into a constant zero value. This is only valid
if the other operand is not a 4-state variable.
@martinwhitaker
Copy link
Collaborator

@martinwhitaker martinwhitaker commented Feb 27, 2014

I've pushed a fix for this to the git master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants