intel / rohd

The Rapid Open Hardware Development (ROHD) framework is a framework for describing and verifying hardware in the Dart programming language.
https://intel.github.io/rohd-website
BSD 3-Clause "New" or "Revised" License
374 stars 67 forks source link

Fix bugs where SSA could potentially generate inferred latches #391

Closed mkorbel1 closed 1 year ago

mkorbel1 commented 1 year ago

Description & Motivation

Sometimes an intermediate SSA signal in a Combinational that generates phi signals could be undriven in other clauses (If and Case). 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

Is this a breaking change that will not be backwards-compatible? If yes, how so?

No, only if someone was depending on the bugs.

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

No