Skip to content

Conversation

@fabianschuiki
Copy link
Contributor

The updateObjectInClass function replaces all firrtl.object ops with om.object ops before any dialect conversion is done. Doing so replaces a !firrtl.class<...> with a !om.class.type<...>, which leads to invalid IR and the WireOp lowering later crashing because it asks a firrtl.propassign for its source operand, which is expected to be a FIRRTL type, which then crashes in an assertion failure.

To avoid this, add an unrealized_conversion_cast op to map the !om.class.type<...> back to !firrtl.class<...>, and then eliminate the cast during the dialect conversion.

The `updateObjectInClass` function replaces all `firrtl.object` ops with
`om.object` ops before any dialect conversion is done. Doing so replaces
a `!firrtl.class<...>` with a `!om.class.type<...>`, which leads to
invalid IR and the `WireOp` lowering later crashing because it asks a
`firrtl.propassign` for its source operand, which is expected to be a
FIRRTL type, which then crashes in an assertion failure.

To avoid this, add an `unrealized_conversion_cast` op to map the
`!om.class.type<...>` back to `!firrtl.class<...>`, and then eliminate
the cast during the dialect conversion.
@fabianschuiki fabianschuiki added the FIRRTL Involving the `firrtl` dialect label Sep 23, 2025
Copy link
Contributor

@mikeurbach mikeurbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, thanks for bringing in the casts.

@fabianschuiki fabianschuiki merged commit db3e113 into main Sep 23, 2025
7 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/fix-classes-in-wires branch September 23, 2025 21:30
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.

3 participants