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][ResolvePaths] Fix detection of agg target if alias. #7257

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Dialect/FIRRTL/Transforms/ResolvePaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ struct PathResolver {
// we are targeting a module, the type will be null.
if (Type targetType = path->ref.getType()) {
auto fieldId = path->fieldIdx;
auto baseType = dyn_cast<FIRRTLBaseType>(targetType);
auto baseType = type_dyn_cast<FIRRTLBaseType>(targetType);
if (!baseType)
return emitError(loc, "unable to target non-hardware type ")
<< targetType;
targetType = hw::FieldIdImpl::getFinalTypeByFieldID(baseType, fieldId);
if (isa<BundleType, FVectorType>(targetType))
if (type_isa<BundleType, FVectorType>(targetType))
return emitError(loc, "unable to target aggregate type ") << targetType;
}

Expand Down
9 changes: 9 additions & 0 deletions test/Dialect/FIRRTL/resolve-paths-errors.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ firrtl.module @BundleTarget(in %a : !firrtl.bundle<>) {

// -----

firrtl.circuit "AliasBundleTarget" {
firrtl.module @AliasBundleTarget(in %a : !firrtl.alias<t, bundle<>>) {
// expected-error @below {{unable to target aggregate type '!firrtl.alias<t, bundle<>>'}}
%0 = firrtl.unresolved_path "OMReferenceTarget:~AliasBundleTarget|AliasBundleTarget>a"
}
}

// -----

firrtl.circuit "VectorTarget" {
firrtl.module @VectorTarget(in %a : !firrtl.vector<uint<1>, 1>) {
// expected-error @below {{unable to target aggregate type '!firrtl.vector<uint<1>, 1>'}}
Expand Down
Loading