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

Ranges starting with zero result in unsigned/constant warning #1581

Closed
veripoolbot opened this issue Nov 2, 2019 · 3 comments
Closed

Ranges starting with zero result in unsigned/constant warning #1581

veripoolbot opened this issue Nov 2, 2019 · 3 comments
Assignees

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Nov 2, 2019


Author Name: Mitch Hayenga
Original Redmine Issue: 1581 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


Trying to use the inside operator with a range, had multiple functions fail on warnings and realized it was all that had ranges starting with zero. Below is a minimal test case. This was done with the Fedora 31 default verilator (distro released this week).

1 package test_pkg;
  2 
  3 function automatic logic testRangeWorks(input [7:0] byte_in);
  4   return byte_in inside { 8'h00, [8'h01 : 8'h04] };
  5 endfunction
  6 
  7 function automatic logic testRangeFails(input [7:0] byte_in);
  8   return byte_in inside { [8'h00 : 8'h04] };
  9 endfunction
 10 
 11 endpackage

*$ verilator --version*
Verilator 4.016 2019-06-16 rev UNKNOWN_REV

*$ verilator --lint-only -sv test_pkg.sv* 
%Warning-UNSIGNED: test_pkg.sv:8: Comparison is constant due to unsigned arithmetic
                    ... Use "/* verilator lint_off UNSIGNED */" and lint_on around source to disable this message.
%Error: Exiting due to 1 warning(s)
%Error: Command Failed /usr/bin/verilator_bin --lint-only -sv test_pkg.sv

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 2, 2019


Original Redmine Comment
Author Name: Mitch Hayenga
Original Date: 2019-11-02T18:49:10Z


Note: It also seems to have a range issue issue if the range extends to the end of the range (8'hff). Works if I split it and make it { [8'h40 : 8'hfe], 8'hff }

  7 function automatic logic testRangeAlsoFails(input [7:0] byte_in);
  8   return byte_in inside { [8'h40 : 8'hff] };
  9 endfunction

%Warning-CMPCONST: test_pkg.sv:8: Comparison is constant due to limited range
                    ... Use "/* verilator lint_off CMPCONST */" and lint_on around source to disable this message.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 2, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-02T20:56:50Z


Thanks for the good report. Verilator internally converts the inside to <= or >=, which normally give those warnings, but obviously pointless to the user.

Fixed in git towards next release 4.022.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 10, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-10T19:29:34Z


In 4.022.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.