-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
New Rule: Implicit case default #281
New Rule: Implicit case default #281
Conversation
New Rule: implicit_case_default -- basic implementation
…d to implement default case support
New Rule: implicit case default -- updated implementation
Minor changes to implicit_case_default
Thanks @ShreChinno and @ronitnallagatla Since it's trivial to construct cases where this rule will pass where it shouldn't, I think there should be some very clear warnings in the explanation. My concern is that users might use this instead of the stricter versions, and not realise that it doesn't provide the same strength of guarantees. This will pass, but shouldn't: always_comb begin
if (foo) begin // Initialisation is conditional.
a = 1;
end
case (bar)
5: a = 5;
6: a = 6;
// no default
endcase
end The |
This rule is a more lenient version of `case_default`. It adapts to a specific | ||
coding style of setting default values to signals at the top of a procedural | ||
block to ensure that signals have a default value regardless of the logic in the | ||
procedural block. As such, this rule will only consider values set | ||
**unconditionally** at the top of the procedural block as a default and will | ||
disregard assignments made in conditional blocks like `if`/`else`, etc. If this | ||
coding style is not preferred, it is strongly suggested to use the rules | ||
mentioned below as they offer stricter guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaveMcEwan, thanks for your feedback. I have updated the explanation to indicate that this rule is not as strict as the alternatives. Is there anything else you might want to add or perhaps rephrase?
The additional exlanation seems to be good. |
This pull request is a simple case implementation for implicit case default. It keeps track of implicitly defined variables in a vector and references it when it encounters it under the case statement. Passes if there is a default case defined.
Relevant Issues