Verilator bug with signedness and arithmetic shift #756
Comments
|
Original Redmine Comment Based on another simulator, I believe your case is equivalent to:
Everyone agrees, if comparing to signed:
This implies other simulators are propagating the sign of the == down to the RHS of the Further experiments:
Does eq '= =' normally propagate a sign between LHS and RHS? IEEE does not say, but implies not as it talks about separation of signs on each side
I cannot justify why == would propagate signed to a >>> subexpression Please run the attached and check results on your other simulators. |
|
Original Redmine Comment Wilson Snyder wrote:
In my tests the signdness is also propagated for a division subexpressions. (see 'e' and 'f' outputs in the test below)
Sec. 5.5.1 of IEEE Std 1364-2005 does. But it is subtle because you need to know that "expression" means "the whole expression". (Which is kind-of clear after the discussion of expression bit lenghts in the previous chapter and from the fact that a different interpretation of "expression" would not yield a consistent set of rules.) Only the cases where the wording "regardless of the operands" is used are cases where "the expression" stops and the subexpression may have a different signdness. Note that comparison results are such a case. So the result of a comparison is always unsigned. But this does not decouple the operands of the comparison operator from each other, it only decouples the result of the comparison from the comparison itself.
I've created a testcase based on your example code: http://svn.clifford.at/handicraft/2014/verilatortest/test009.v and run it on various simulators:
So the differences are:
|
|
Original Redmine Comment I understand how 5.5.1 applies to expressions (BTW you're better looking at 2012), but no where does it say exactly what operators are subject to this rule; some rules of thumb apply like it applies to those that are not self-determined but this sort of assumption is what half of these bugs are about. Thanks for the data; what mostly matters to me is the big three which get heavy testing: Modelsim and NC-Verilog which agree, VCS disagrees (1101111 and the source of confusion above). I'll file a bug on VCS and go with the Modelsim answer which matches yours. |
|
Original Redmine Comment Ok, with the expected values now clear it was a simple change to shift. Fixed in git towards 3.857. |
|
Original Redmine Comment Resolved earlier |
|
Original Redmine Comment In 3.860. |
Author Name: Clifford Wolf (@cliffordwolf)
Original Redmine Issue: 756 from https://www.veripool.org
Original Date: 2014-05-01
Original Assignee: Wilson Snyder (@wsnyder)
Verilator b631b59 returns 1 instead of 0 for a=-1 and b=7:
Self-contained test case:
http://svn.clifford.at/handicraft/2014/verilatortest/test008.v
http://svn.clifford.at/handicraft/2014/verilatortest/test008.cc
http://svn.clifford.at/handicraft/2014/verilatortest/test008.sh
Verilog testbench for comparison:
http://svn.clifford.at/handicraft/2014/verilatortest/test008_tb.v
The text was updated successfully, but these errors were encountered: