-
Notifications
You must be signed in to change notification settings - Fork 319
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
[FIRRTL] Isolate reset inference to a cast rather than connect #4804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM!
Added some comments. Should this support aggregates / references (which are kinda like aggregates in a type sense)?
Can't speak for this direction as brain is a bit full of references, but this makes sense to me re:approach, and breaking out RTP probably needs to happen, thanks!
Should this be added to FIRRTLVisitor ?
Cast between reset types. This is used to enable strictconnects early in | ||
the pipeline by isolating all uninferred reset connections to a single op. | ||
}]; | ||
let arguments = (ins AnyResetType:$input); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this instead cast between aggregate types that contain resets? That would help to use this in front of connects before LowerTypes, and similarly with references / ref-define.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards splitting connect up instead.
@@ -88,6 +89,12 @@ void circt::firrtl::emitConnect(ImplicitLocOpBuilder &builder, Value dst, | |||
return; | |||
} | |||
|
|||
if ((dstType.hasUninferredReset() || srcType.hasUninferredReset()) && | |||
dstType != srcType) { | |||
src = builder.create<UninferredResetCastOp>(dstType, src); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(if UninferredResetCastOp supports aggregates, this could be hoisted above the checks for connecting bundles/vectors)
; CHECK: %3 = firrtl.subfield %b[b] : !firrtl.bundle<a: reset, b: reset> | ||
; CHECK: %4 = firrtl.subfield %a[b] : !firrtl.bundle<a: uint<1>, b: asyncreset> | ||
; CHECK: %[[r4:.*]] = firrtl.resetCast %4 | ||
; CHECK: firrtl.strictconnect %3, %[[r4]] : !firrtl.reset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any dedicated tests / errors to check for this new operation?
(micro-nit: commit/PR title: s/Issolate/Isolate/) |
Add a resetCast operation. This lets more connects be strictconnects as more typeconversion can be expressed explicitly.