-
Notifications
You must be signed in to change notification settings - Fork 124
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 new features to slang-tidy #776
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With this commit the checks and configurations of the slang-tidy tool can be specified using a config file.
This new check will report an error if it finds an always_latch on the design.
Also minor fixes in the code
Instead of creating a new diagnostic engine and client, use the one provided by the driver.
This new check, checks for use of old verilog syntax of always_comb and always_ff.
Also minor refactors here and there
Also minor refactors here and there
* pyslang.h: correct file reference in leading comment * Python bindings: expose a visitor pattern Expose visit methods on pyslang Expressions, Statements, and Symbols. This method is modelled after MLIR's visitor pattern wherein callbacks can signal certain actions on the walk, such as interrupting (i.e., stopping entirely), skipping child nodes, or to advance. This commit includes no tests, as pyslang tests are not included in the slang repo, but in the pyslang repo. Once this commit is visible to pyslang, tests will be added there. Here is an example test case that could be added, modelled off slang/tests/unittests/VisitorTests.cpp: ``` from pyslang import * tree = SyntaxTree.fromText( """ module m; int j; initial begin : asdf j = j + 3; if (1) begin : baz static int i; i = i + 2; if (1) begin : boz i = i + 4 end end end endmodule """) class Visitor: def __init__(self): self.stmt_ct = 0 def visit(self, node): if isinstance(node, Statement): self.stmt_ct += 1 c = Compilation() c.addSyntaxTree(tree) v = Visitor() c.getRoot().visit(v.visit) assert v.stmt_ct == 11 ```
This check will trigger a warning if a non-blocking assignment is used inside an always_comb block
Check that there is no use of blocking assignments inside an always_ff, for variables that represent a register. Only allowed blocking assignments are those used in local variables.
With this commit the checks and configurations of the slang-tidy tool can be specified using a config file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds new features to slang-tidy:
This PR also adds a new tool:
include/slang/util/CppTypePrinter.h