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 handling $signed in unsigned with -Wno-WIDTH #729
Comments
Original Redmine Comment I'll look at this and the other one shortly, hopefully easy to fix. Would you mind posting the tests as something self-checking? (e.g. use an initial with $stop if fails, or better see "writing tests" in the documentation). Thanks. |
Original Redmine Comment Wilson Snyder wrote:
here you go: http://svn.clifford.at/handicraft/2014/verilatortest/ |
Original Redmine Comment Thanks for the test. It correctly was making the $signed 2 bits, but the later extending due to turning off WIDTH warnings was wrong. Please note ignoring warnings makes it a lot more likely you'll hit bugs, be it in Verilator or other tools. |
Original Redmine Comment Forgot to add pushed to git towards 3.857. |
Original Redmine Comment The fix for this should have only addressed those logical compares which zero pad (<,>,<=,>=,==,===,! =, ! ==), but hit some additional cases as detected by #�. New fix is pending after some additional testing. |
Original Redmine Comment New fix in git with #� working, towards 3.857. Added a bunch of new tests, but wouldn't be surprised if there are other sign extension problems when WIDTH warnings are suppressed. |
Original Redmine Comment Wilson Snyder wrote:
Don't worry: I'm going to find and report them all. ;) |
Original Redmine Comment In 3.860. |
Author Name: Clifford Wolf (@cliffordwolf)
Original Redmine Issue: 729 from https://www.veripool.org
Original Date: 2014-04-03
Original Assignee: Wilson Snyder (@wsnyder)
The following module should output 0 for a = 2'b11 and b = 3'b111. But Verilator 3.856 outputs 1 instead.
Analysis: The argument of $signed is self determined. So even though the comparison is a 3 bit operator, $signed(a) returns the two bit value 2'bs11. This is then extended to 3 bits, but because b is unsigned this is not a sign extension but a zero padding. Thus the expression is 3'b011 == 3'b111, which is false.
Crosscheck: Vivado 2013.4, XST 14.7, Isim 14.7 and Modelsim 10.1d implement this correctly.
The text was updated successfully, but these errors were encountered: