odb: Avoid Verilog namespace collisions - #11038
Open
jhkim-pii wants to merge 8 commits into
Open
Conversation
Share bracket sanitization between hierarchical connection and buffer insertion so generated scalar names remain valid Verilog identifiers. Make generated net and instance names mutually unique against ports, nets, and instances within their module scope. Add dbSta, ODB, and resizer regressions for bracketed names and namespace collisions. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Check concrete top-level BTerms when generating instance names so a scalar instance cannot reuse an existing port name. Add a focused regression where the BTerm name differs from its backing net, preserving the existing scoped uniqueness behavior for hierarchical modules. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Preserve local identifiers containing the hierarchy delimiter when checking generated net and instance names. Derive the local-name offset from the exact parent hierarchy prefix instead of splitting at the final delimiter, and add regressions for escaped instance and ModNet collisions. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Use the exact parent module-instance prefix to recover local names after generated-name validation. This preserves escaped hierarchy delimiters and makes scoped instance collision checks cover both leaf and module instances. Extend the ODB, dbSta, and resizer regressions to lock the escaped-name behavior and emitted Verilog. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Make basename extraction distinguish hierarchy separators from escaped local delimiters and retain exact block-level leaf-instance checks. Handle top-port collisions according to strict or associated-net naming, preserve BTerm-derived net names, and make bracket sanitization backslash-parity aware. Add regressions for full-path hierarchy connections, parsed instances, escaped delimiters, top ports, and backslash pairs. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Require a corresponding flat net to either own the top BTerm or already carry its candidate name before reusing that port identifier. This preserves port-net migration while rejecting unrelated lenient naming calls, with a regression for the unrelated-net case. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Distinguish the corresponding flat net used for ModNet creation from the exact BTerm reused during port migration. Name-based association could accept an unrelated net with the same local basename and weaken flat-net collision checks. Pass the moving BTerm explicitly, keep flat-net creation strict, and use escape-aware basename lookup for ModBTerms. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Bring secure-replace-bracket up to the current private master before further development. Preserve the existing namespace-collision fixes while incorporating upstream changes through a non-rewriting merge. Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances hierarchical net and instance naming in ODB to prevent name collisions in Verilog module scopes and correctly handle escaped brackets and delimiters. Key changes include moving and improving the bracket-to-underscore sanitization utility, updating dbBlock::getBaseName to respect escaped delimiters, and adding robust collision checks in makeNewNetName and makeNewInstName. Comprehensive unit tests have also been added to verify these behaviors. The reviewer feedback suggests adding a defensive null check for full_name in dbBlock::getBaseName to prevent potential null pointer dereferences, which is a valid improvement.
Collaborator
|
🥳 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
replaceBracketsWithUnderscoresto the shared ODB utility API and reuse it from dbSta and buffer insertion.Related