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

Verilator bug in signed/unsigned expression eval #737

Closed
veripoolbot opened this issue Apr 9, 2014 · 3 comments
Closed

Verilator bug in signed/unsigned expression eval #737

veripoolbot opened this issue Apr 9, 2014 · 3 comments
Assignees
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Clifford Wolf (@cliffordwolf)
Original Redmine Issue: 737 from https://www.veripool.org
Original Date: 2014-04-09
Original Assignee: Wilson Snyder (@wsnyder)


The term "(p1 + p2)" below is part of an unsigned expression and thus should
be zero-extended. Verilator fb4928b however performs signed bit extension
and thus returns an incorrect result.

module issue_035(a, y);
  input [3:0] a;
  output [5:0] y;

  localparam signed [3:0] p1 = 4'b1000;
  localparam signed [3:0] p2 = 0;
  assign y = a + (p1 + p2);
endmodule

Crosscheck: Vivado 2013.4, XST 14.7, Quartus 13.1, Xsim 2013.4 and Modelsim
10.1d implement this correctly.

Self-contained test case:

http://svn.clifford.at/handicraft/2014/verilatortest/test006.v

http://svn.clifford.at/handicraft/2014/verilatortest/test006.cc

http://svn.clifford.at/handicraft/2014/verilatortest/test006.sh

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-04-15T23:38:34Z


Stay tuned. I'm using this bug and the others as motivation to audit and cleanup all of the WIDTH related fixup code.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-04-30T02:03:26Z


Fixed in git towards 3.857.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-05-11T21:09:23Z


In 3.860.

@veripoolbot veripoolbot added area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants