Replies: 2 comments
-
Forgot to mention, that the warning can also be suppressed with an unsigned-cast in the generate statements. I don't personally mind doing that in my own code since I value being able to turn -Wsign-compare on. But I think this would be a tough sell to other code owners.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I think it's fine to suppress the warning for expressions involving genvars. I agree that it does not seem particularly helpful. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been finding -Wsign-compare to be pretty useful, except when it relates to generate-for loops.
Now this isn't really Slang's problem because it's a silly SV limitation going back to verilog-95 that genvar's can't have their types defined and are always integer type.
e.g. this code gets a -Wsign-compare warning
If I try to convert my parameters to 'int' to avoid sign-compare warnings with the generate-loops, then I just get them with comparisons against real 'logic' variables which are also unsigned. My general preference is to fix sign-compare for the logic vars and not fix the warnings for genvar cases.
What do you think about a new option to suppress the sign-compare warning only when genvar types are involved? Or maybe to split out genvars so they are not part of -Wsign-compare but maybe -Wgenvar-sign-compare?
Beta Was this translation helpful? Give feedback.
All reactions