Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rwy7
Copy link
Contributor

@rwy7 rwy7 commented Jul 2, 2025

Enable the ability for "bind" layers to appear under "inline" layers.

  • Disable the verifier which prevents bind layers from appearing under inline layers.
  • In the bindfile for the child layer, try to statically assert that the parent inline layer is already enabled. We cannot enable the parent layer from within the bindfile of the child, because it could happen too late. Inline layers should be enabled via defines passed on the command line.
  • Add some tests.

@rwy7 rwy7 added the FIRRTL Involving the `firrtl` dialect label Jul 2, 2025
@rwy7 rwy7 force-pushed the bind-under-inline branch 3 times, most recently from 6d28628 to 6b86340 Compare August 6, 2025 16:07
@rwy7 rwy7 marked this pull request as ready for review August 6, 2025 18:16
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

Very cool to see this work by just turning off the verifier.

I'd like to see one end-to-end test. Otherwise, LGTM.

Follow-on:

if (newInstance.getInnerSymAttr())
if (auto forceName = circuitState.instanceForceNames.lookup(
{cast<hw::HWModuleOp>(newInstance->getParentOp()).getNameAttr(),
{newInstance->getParentOfType<hw::HWModuleOp>().getNameAttr(),
Copy link
Member

Choose a reason for hiding this comment

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

Nice cleanup. Always feel free to land this kind of change directly (especially since it is nicely factored into a separate commit!).

Comment on lines -387 to +392
OpBuilder builder(layerBlock);
auto macroName = macroNames[layer];
auto ifDef = sv::IfDefOp::create(builder, layerBlock.getLoc(), macroName);
ifDef.getBodyRegion().takeBody(layerBlock.getBodyRegion());
if (!layerBlock.getBody()->empty()) {
OpBuilder builder(layerBlock);
auto macroName = macroNames[layer];
auto ifDef = builder.create<sv::IfDefOp>(layerBlock.getLoc(), macroName);
ifDef.getBodyRegion().takeBody(layerBlock.getBodyRegion());
}
Copy link
Member

Choose a reason for hiding this comment

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

Not creating the empty ifdefs unnecessarily seems good.

Out of curiosity, do we canonicalize these away in SV if they are empty today?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep there is a canonicalizer.

@rwy7 rwy7 force-pushed the bind-under-inline branch from 6b86340 to 4f45330 Compare August 12, 2025 18:07
@rwy7 rwy7 merged commit a128e8b into llvm:main Aug 12, 2025
7 checks passed
@rwy7 rwy7 deleted the bind-under-inline branch August 12, 2025 18:36
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.

2 participants