Skip to content

When replacing a register with its reset value, attempt width coercion #8379

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rwy7
Copy link
Contributor

@rwy7 rwy7 commented Apr 1, 2025

We have a canonicalization which can replace a register with its reset
value, if the reset signal is constantly high. However, the reset-value
of a register does not have to exactly match the type of the register,
it only has to be equivalent. Previously, this canonicalization would
fail if the reset value's type doesn't exactly match the register's
type. This commit makes the canonicalization attempt to coerce the
reset value to the type of the register.

The coercion code will perform sign extension or truncation for
integers, and will recursively attempt to coerce the elements of a
bundle or vector.

@rwy7 rwy7 requested review from darthscsi and seldridge as code owners April 1, 2025 17:53
@rwy7 rwy7 added the FIRRTL Involving the `firrtl` dialect label Apr 1, 2025
@rwy7 rwy7 force-pushed the fix-reg-canonicalizer branch 2 times, most recently from abf9729 to f111f9c Compare April 1, 2025 18:18
We have a canonicalization which can replace a register with its reset
value, if the reset signal is constantly high. However, the reset-value
of a register does not have to exactly match the type of the register,
it only has to be equivalent. Previously, this canonicalization would
fail if the reset value's type doesn't exactly match the register's
type.  This commit makes the canonicalization attempt to coerce the
reset value to the type of the register.

The coercion code will perform sign extension or truncation for
integers, and will recursively attempt to coerce the elements of a
bundle or vector.
@rwy7 rwy7 force-pushed the fix-reg-canonicalizer branch from f111f9c to de395bf Compare April 2, 2025 18:32
@rwy7 rwy7 changed the title When replacing register with reset value, attemp coercion When replacing a register with its reset value, attempt width coercion Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant