-
Notifications
You must be signed in to change notification settings - Fork 614
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
Support BoringUtils.bore on OpaqueType wrapping a Property. #4337
Conversation
@@ -239,6 +239,10 @@ abstract class RawModule extends BaseModule { | |||
case (false, false) => | |||
// For non-probe, directly create Nodes for lhs, skipping visibility check to support BoringUtils.drive. | |||
(left, right) match { | |||
case (lhsOpaque: OpaqueType, rhsOpaque: OpaqueType) | |||
if DataMirror | |||
.isProperty(lhsOpaque.allElements.head) && DataMirror.isProperty(rhsOpaque.allElements.head) => |
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 not sure if there is a better way to query the underlying Data than allElements.head
... if this is about the best we can do, maybe I can add an internal-only helper method to access this?
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.
See my comment on all 4 lines with suggestion.
case (lhsOpaque: OpaqueType, rhsOpaque: OpaqueType) | ||
if DataMirror | ||
.isProperty(lhsOpaque.allElements.head) && DataMirror.isProperty(rhsOpaque.allElements.head) => | ||
PropAssign(si, Node(lhsOpaque.allElements.head), Node(rhsOpaque.allElements.head)) |
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.
case (lhsOpaque: OpaqueType, rhsOpaque: OpaqueType) | |
if DataMirror | |
.isProperty(lhsOpaque.allElements.head) && DataMirror.isProperty(rhsOpaque.allElements.head) => | |
PropAssign(si, Node(lhsOpaque.allElements.head), Node(rhsOpaque.allElements.head)) | |
case (lhsOpaque: Record, rhsOpaque: Record) | |
if lhsOpaque._isOpaqueType && rhsOpaque._isOpaqueType && DataMirror.isProperty=> | |
secretConnection(lhsOpaque.getElements.head, rhsOpaque.getElements.head) |
OpaqueType
the trait isn't enough to check (and note the trait is self-typed by Record
), instead we match on Record
and check _isOpaqueType
. Also this needs to be recursive in some way because you can have OpaqueTypes
of OpaqueTypes
. It's turtles all the way down!
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.
Ah good point. What if DataMirror.isProperty handles _isOpaqueType and recursively checking? Then we could have one case here that just uses the if DataMirror.isProperty
condition?
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.
Ugh I guess it's not that easy, this needs to recursively pick off the allElements.head till it gets to the bottom.
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 think fa90b8f should handle it, this is now using _isOpaqueType and recursively unwrapping OpaqueTypes.
…handle nested OpaqueTypes.
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.
LGTM, see suggestions though to fix the compile issue.
Oh, thanks for fixing the |
Co-authored-by: Jack Koenig <[email protected]> (cherry picked from commit 5dd085c) # Conflicts: # core/src/main/scala/chisel3/RawModule.scala # src/test/scala/chiselTests/BoringUtilsSpec.scala
Co-authored-by: Jack Koenig <[email protected]> (cherry picked from commit 5dd085c)
…4338) Co-authored-by: Jack Koenig <[email protected]> (cherry picked from commit 5dd085c) Co-authored-by: Mike Urbach <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
This ensures boring from an OpaqueType that wraps a Property uses the correct connection operator in the IR.
Reviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.