intel / rohd-hcl

A hardware component library developed with ROHD.
https://pub.dev/packages/rohd_hcl
BSD 3-Clause "New" or "Revised" License
81 stars 23 forks source link

Optimize `Sum` and `Counter` to avoid underflow/overflow logic when possible #90

Open mkorbel1 opened 2 months ago

mkorbel1 commented 2 months ago

Motivation

As a follow-on to #89

It should be possible to avoid creating logic which considers whether an overflow/underflow has occurred by determining whether it is ever possible.

For example:

Desired solution

Conditionally generate the portions of the If.block for overflow/underflow based on analysis of the provided interfaces.

Alternatives considered

No response

Additional details

No response

mkorbel1 commented 2 months ago

Note that as part of this, we probably need to pass maxValue and minValue directly into Sum from Counter rather than the processed Logic versions of them, so that Sum can properly infer the true maximum/minimum values.