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

Add more lint warnings #533

Open
MikePopoloski opened this issue Apr 17, 2022 · 2 comments
Open

Add more lint warnings #533

MikePopoloski opened this issue Apr 17, 2022 · 2 comments
Labels

Comments

@MikePopoloski
Copy link
Owner

MikePopoloski commented Apr 17, 2022

Ideas for things that should be checked:

  • Implicit conversions in constexprs that change value
  • empty loop/if body
  • header guard mismatch
  • misleading if else indentation
  • implicit conversions
  • self-assign
  • shadowing names
  • signedness issues
  • switch coverage of enum
  • uninitialized vars in constexprs
  • unreachable code
  • unused variables
  • unused typedef
  • unused parameters
  • posedge of multi-bit value
  • latches, blocking assignments in ffs
  • dangling else
  • missing return
  • comparisons that always eval to same result
  • enums in set membership ops
@Sustrak
Copy link
Contributor

Sustrak commented Jul 8, 2022

Hi,
I would like to add the following lint rule: Register only assigned on reset.
The reason is that most synthesis tools will complain about this.

The following code snipped would trigger this warning:

logic my_register;
always_ff @(posedge clk or negedge rst) begin
    if (~rst) begin
        my_register <= '0;
    end else begin
        ...
        { other signals but no, my_register }
        ...
    end
end

Where it would be the best place to put the code to detect this scenario?

@MikePopoloski
Copy link
Owner Author

I think it would be easiest as a post-processing task once the AST is constructed. You can walk the tree, find all variables and then loop through their drivers by calling getFirstDriver() / getNextDriver() and look at the places it's assigned.

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

No branches or pull requests

2 participants