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

Optimize generation of SV for bus subset to eliminate extraneous assign statements #408

Closed mkorbel1 closed 11 months ago

mkorbel1 commented 1 year ago

Motivation

SystemVerilog has some weird rules about when you can take a bus subset/slice (e.g. you cannot take a slice on an expression). The current implementation in ROHD marks "original_..." as not unpreferred so to avoid the signal being eliminated so that a slice is not taken on an expression. If there's a bus-subset with no expression, however, then we add an extra assign statement in the generated SystemVerilog for no reason.

Desired solution

Detect when it's required to have a separate assign statement and only keep it there in those cases. This will make the generated SV a little prettier and reduce clutter of unnecessary intermediate signals.

Alternatives considered

No response

Additional details

This is probably tricky to figure out for all cases and to implement properly. This is not a functional issue, only style.