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][CreateSifiveMetadata] Use symbols for memory metadata #5482

Merged
merged 5 commits into from
Jun 27, 2023

Conversation

prithayan
Copy link
Contributor

@prithayan prithayan commented Jun 26, 2023

Use symbols to emit memory metadata, this ensures that the instance names respect any renaming due to ForceNameAnnotation. Since memory instance cannot be renamed, use it as verbatim, this ensures that the pre-extract paths for seq mems are used.
Fixes #5469
For reference, the previous change related to ExtractSeqMems, #3123

// CHECK: sv.verbatim "[\0A {\0A \22module_name\22: \22
// CHECK-SAME: {{0}}
// CHECK-SAME: \22,\0A \22depth\22: 16,\0A \22width\22: 8,\0A \22masked\22: false,\0A \22read\22: 1,\0A \22write\22: 0,\0A \22readwrite\22: 1,\0A \22extra_ports\22: [],\0A \22
// CHECK-SAME: hierarchy\22: [\0A \22{{[{][{]3[}][}]}}.{{[{][{]4[}][}]}}.memory_ext
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Can this be simplified/more readable with CHECK-SAME{LITERAL}: instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks for reminding. Updated with it.

@prithayan prithayan marked this pull request as ready for review June 27, 2023 00:48
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.

LGTM

Can you give this a spin on an internal design and check the metadata before/after to make sure things look good?

Comment on lines 372 to 374
auto dutVerbatimOp = builder.create<sv::VerbatimOp>(
builder.getUnknownLoc(), dutJsonBuffer, ValueRange(),
builder.getArrayAttr(jsonSymbols));
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the PR could save on the two builder.getUnknownLoc() by using an ImplicitLocOpBuilder instead of an OpBuilder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this. Fixed.

@prithayan prithayan force-pushed the dev/pbarua/metadata_forcename branch from 0faf261 to c933dd9 Compare June 27, 2023 20:03
@prithayan
Copy link
Contributor Author

Thanks for review. I tested on few internal designs, looks good. Also verified that this fixes the issue with ForceNameAnnotation on the internal design.

@prithayan prithayan merged commit 13bdb37 into main Jun 27, 2023
@prithayan prithayan deleted the dev/pbarua/metadata_forcename branch June 27, 2023 21:02
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.

[FIRRTL] Metadata wrong when using ForceNameAnnotation
3 participants