Skip to content
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

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

youngar
Copy link
Member

@youngar youngar commented Jun 13, 2023

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.

@youngar youngar added the FIRRTL Involving the `firrtl` dialect label Jun 13, 2023
Copy link
Contributor

@dtzSiFive dtzSiFive left a 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());
Copy link
Contributor

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 👍 .

Copy link
Member Author

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;
Copy link
Contributor

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!

Copy link
Contributor

@prithayan prithayan left a comment

Choose a reason for hiding this comment

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

Looks good

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.

Nice, I was hoping this wouldn't be a big change.

@@ -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; })
Copy link
Contributor

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.
@youngar youngar merged commit 00565a2 into llvm:main Jun 13, 2023
@youngar youngar deleted the firrtl-prop-combloop branch June 13, 2023 18:39
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.

4 participants