-
Notifications
You must be signed in to change notification settings - Fork 298
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][CheckCombLoops] Support property types #5383
Conversation
57551da
to
faeb5de
Compare
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.
@@ -248,12 +248,12 @@ class DiscoverLoops { | |||
void preprocess(SmallVector<Value> &worklist) { | |||
// All the input ports are added to the worklist. | |||
for (BlockArgument arg : module.getArguments()) { | |||
auto argType = arg.getType(); | |||
auto argType = cast<FIRRTLType>(arg.getType()); |
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 BlockArguments / module ports can be non-FIRRTLType's, ports and wires can be foreign I believe.
Curious how/why this is safe, but see that it previously already made this assumption so maybe nevermind 👍 .
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.
Yeah, it does not look like this code works with foreign types.
@@ -248,12 +248,12 @@ class DiscoverLoops { | |||
void preprocess(SmallVector<Value> &worklist) { | |||
// All the input ports are added to the worklist. | |||
for (BlockArgument arg : module.getArguments()) { | |||
auto argType = arg.getType(); | |||
auto argType = cast<FIRRTLType>(arg.getType()); | |||
if (argType.isa<RefType>()) | |||
continue; |
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.
Note to self: follow-up to get this working through references (cc #4691), thanks for getting this working for non-base types!
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.
Looks good
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.
Nice, I was hoping this wouldn't be a big change.
lib/Dialect/FIRRTL/FIRRTLTypes.cpp
Outdated
@@ -493,7 +493,7 @@ bool FIRRTLType::isGround() { | |||
.Case<BundleType, FVectorType, FEnumType, OpenBundleType, OpenVectorType>( | |||
[](Type) { return false; }) | |||
// Not ground per spec, but leaf of aggregate. | |||
.Case<RefType>([](Type) { return false; }) | |||
.Case<StringType, RefType>([](Type) { return false; }) |
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 just be PropertyType?
This change adds support for property types. Right now property types show up as regular ports on instances and modules, and are assigned the through the PropAssignOp, which implements the ConnectLike interface. Module ports, instance ports, and connect like operations had to be updated to support FIRRTLTypes instead of just FIRRTLBaseTypes.
faeb5de
to
dcbd410
Compare
This change adds support for property types to CheckCombLoops. Right now property types show up as regular ports on instances and modules, and are assigned the through the PropAssignOp, which implements the ConnectLike interface. Module ports, instance ports, and connect like operations had to be updated to support FIRRTLTypes instead of just FIRRTLBaseTypes.