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

-Wsign-compare and annoying SV limitations of genvar types #1026

Closed
MikePopoloski opened this issue Jun 11, 2024 Discussed in #1018 · 1 comment
Closed

-Wsign-compare and annoying SV limitations of genvar types #1026

MikePopoloski opened this issue Jun 11, 2024 Discussed in #1018 · 1 comment

Comments

@MikePopoloski
Copy link
Owner

Discussed in #1018

Originally posted by jrudess June 1, 2024
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

parameter int unsigned NUM_PORTS = 3;

for (genvar i = 0; i < NUM_PORTS; i++) begin
end

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?

@MikePopoloski
Copy link
Owner Author

Done in 4dcf49d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant