Fix bugs where SSA could potentially generate inferred latches #391
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.
Description & Motivation
Sometimes an intermediate SSA signal in a
Combinational
that generates phi signals could be undriven in other clauses (If
andCase
). This is functionally fine since those intermediate signals are unused in the other clauses, however synthesis tools may infer a latch on them. This also means SV linting tools will flag errors, since the synthesis tool may infer a latch.This PR sets these unimportant intermediate signals to 0 in unused cases. It would be better if synthesis tools could be told to treat something as a dont-care instead of 0, but this is the best solution for now without that.
Also, this fixes a bug in
Case
where SSA could be missing a default item, which breaks the phi logic.Also, this fixes a bug in
If
where an extra empty "else" clause is generated sometimes in SSA.Related Issue(s)
N/A
Testing
Added new tests to check for inferred latches (indicated by X's in certain situations in the ROHD simulations since signals are undriven).
Backwards-compatibility
No, only if someone was depending on the bugs.
Documentation
No