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

[firtool] use FIRRTL layer syntax for specialization CL options #7418

Closed
youngar opened this issue Jul 31, 2024 · 1 comment · Fixed by #7520
Closed

[firtool] use FIRRTL layer syntax for specialization CL options #7418

youngar opened this issue Jul 31, 2024 · 1 comment · Fixed by #7520
Labels
FIRRTL Involving the `firrtl` dialect

Comments

@youngar
Copy link
Member

youngar commented Jul 31, 2024

The syntax for nested layers doesn't match the FIRRTL spec and instead matches the MLIR representation. It would seem to make more sense to use the FIRRTL syntax.
Namely, firtool -enable-layers=Verification.Assert instead of firtool -enable-layers=Verification::Assert.

@youngar youngar added the FIRRTL Involving the `firrtl` dialect label Jul 31, 2024
@youngar
Copy link
Member Author

youngar commented Jul 31, 2024

Fix would be to this code:

// Helper to transform a layer name specification of the form `A::B::C` into
// a SymbolRefAttr.
auto parseLayerName = [&](StringRef name) {
// Parse the layer name into a SymbolRefAttr.
auto [head, rest] = name.split("::");
SmallVector<FlatSymbolRefAttr> nestedRefs;
while (!rest.empty()) {
StringRef next;
std::tie(next, rest) = rest.split("::");
nestedRefs.push_back(FlatSymbolRefAttr::get(getContext(), next));
}
return SymbolRefAttr::get(getContext(), head, nestedRefs);
};

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 a pull request may close this issue.

2 participants
@youngar and others