Skip to content

[FIRRTL] Use hw.hierpath in CreateSiFiveMetadata#9829

Merged
seldridge merged 2 commits intomainfrom
dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath
Mar 5, 2026
Merged

[FIRRTL] Use hw.hierpath in CreateSiFiveMetadata#9829
seldridge merged 2 commits intomainfrom
dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath

Conversation

@seldridge
Copy link
Member

Change the CreateSiFiveMetadata pass to use hw.hierpath operations to
encode memory paths making this robust to hierarchical transformations
like ModuleInliner.

Previously, these used paths encoded in verbatims, like so:

{{0}}.{{1}}. ... .{{n-1}}

This changes this to encode the interior part of the path with an
hw.hierpath operation, like so:

{{<root-module>}}.{{<hw.hierpath>}}.{{<leaf-mem>}}

This is not perfect as it still has the root module and leaf memory
encoded using this strategy. However, it fixes an observed failure when
trying to use the --inline-input-only-modules option.

@seldridge seldridge requested a review from darthscsi as a code owner March 4, 2026 23:16
@seldridge seldridge requested review from dtzSiFive and prithayan March 4, 2026 23:52
@seldridge seldridge force-pushed the dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath branch from ace8bd5 to e39a473 Compare March 5, 2026 04:27
Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

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

LGTM

@seldridge seldridge force-pushed the dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath branch 2 times, most recently from a25d593 to 95f2c78 Compare March 5, 2026 06:20
Add a utility function isInstanceUnderLayer to check if an instance
should be excluded from metadata emission and other analyses. An instance
is considered "under a layer" if it:
  - is under a LayerBlockOp,
  - is under an sv::IfDefOp,
  - has getLowerToBind() set,
  - or Has getDoNotPrint() set.

AI-assisted-by: Augment (Claude Sonnet 4.5)
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
…archy

Replace explicit {{0}}.{{1}}.{{2}}... paths with hierpath-based triplet
format {{<root>}}.{{<path>}}.{{<leaf>}} where:
- <root> is the DUT module symbol
- <path> is an optional hw.hierpath from root to the final instance
- <leaf> is the final instance name

This makes the hierarchy paths resilient to hierarchy manipulations
applied after this pass, as hierpaths are resolved during lowering.

AI-assisted-by: Augment (Claude Sonnet 4.5)
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
@seldridge seldridge force-pushed the dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath branch from 95f2c78 to cd30463 Compare March 5, 2026 06:21
@seldridge seldridge merged commit 740ec66 into main Mar 5, 2026
6 checks passed
@seldridge seldridge deleted the dev/seldridge/firrtl-create-sifive-metadata-use-hw.hierpath branch March 5, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants