-
Notifications
You must be signed in to change notification settings - Fork 868
Feat/3dblox parser path assertions #9812
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
Merged
osamahammad21
merged 7 commits into
The-OpenROAD-Project:master
from
The-OpenROAD-Project-staging:feat/3dblox-parser-pathAssertions
Apr 4, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6acfeb1
odb: impl 3dblox parser path assertions
d193d4b
odb: fix 3dblox parser path assertions PR comments
96bd9c2
odb: fix 3dblox pasert path assertions PR comments
4f94638
odb: fix 3dblox parser path assertions PR comments
dec8a3c
odb: fix 3dblox parser path assertions PR comments
90a2ef2
odb: fix 3dblox parser path assertions PR comments
2be6b45
odb: fix 3dblox parser path assertions PR comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,6 +188,15 @@ void ThreeDBlox::readDbx(const std::string& dbx_file) | |
| createConnection(connection); | ||
| } | ||
| calculateSize(chip); | ||
| for (const auto& [_, assertion] : data.path_assertions) { | ||
| dbChipPath* chip_path = dbChipPath::create(chip, assertion.name.c_str()); | ||
| for (const auto& entry : assertion.entries) { | ||
| // Resolve the dotted path string to a live DB object | ||
| std::vector<dbChipInst*> path_insts; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be used as per my previous comment. |
||
| dbChipRegionInst* region_inst = resolvePath(entry.region, path_insts); | ||
| chip_path->addEntry(path_insts, region_inst, entry.negated); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void ThreeDBlox::check() | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,9 @@ void DbxParser::parseYamlContent(DbxData& data, const std::string& content) | |
| if (root["Connection"]) { | ||
| parseConnections(data.connections, root["Connection"]); | ||
| } | ||
| if (root["Path"]) { | ||
| parsePaths(data.path_assertions, root["Path"]); | ||
| } | ||
|
|
||
| } catch (const YAML::Exception& e) { | ||
| logError("DBX YAML parsing error: " + std::string(e.what())); | ||
|
|
@@ -233,4 +236,65 @@ void DbxParser::parseConnection(Connection& connection, | |
| } | ||
| } | ||
|
|
||
| void DbxParser::parsePaths(std::map<std::string, PathAssertion>& paths, | ||
| const YAML::Node& paths_node) | ||
| { | ||
| paths.clear(); | ||
| const std::string prefix = "Path"; | ||
| for (const auto& path_pair : paths_node) { | ||
| PathAssertion path; | ||
| extractValue(path_pair.first, path.name); | ||
|
|
||
| // Validate name format: must be "PathN" where N is a positive integer. | ||
| if (path.name.size() <= prefix.size() || !path.name.starts_with(prefix) | ||
| || path.name.find_first_not_of("0123456789", prefix.size()) | ||
| != std::string::npos | ||
| || path.name[prefix.size()] == '0') { | ||
|
Comment on lines
+249
to
+252
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| logError("DBX Path assertion name '" + path.name | ||
| + "' must follow the format 'PathN' (e.g. Path1, Path2)"); | ||
| continue; | ||
| } | ||
|
|
||
| const YAML::Node& path_node = path_pair.second; | ||
| parsePath(path, path_node); | ||
| paths[path.name] = path; | ||
| } | ||
| } | ||
|
|
||
| void DbxParser::parsePath(PathAssertion& path, const YAML::Node& path_node) | ||
| { | ||
| if (!path_node.IsSequence()) { | ||
| logError("DBX Path assertion '" + path.name + "' must be a YAML sequence"); | ||
| } | ||
|
|
||
| const std::string prefix = "NOT "; | ||
| for (const auto& entry_node : path_node) { | ||
| std::string raw; | ||
| extractValue(entry_node, raw); | ||
|
|
||
| raw = trim(raw); | ||
| if (raw.empty()) { | ||
| continue; | ||
| } | ||
|
|
||
| PathAssertionEntry entry; | ||
| if (raw.substr(0, prefix.size()) == prefix) { | ||
| entry.negated = true; | ||
| raw = trim(raw.substr(prefix.size())); | ||
| } | ||
|
|
||
| if (raw.find(".regions.") == std::string::npos) { | ||
| logError("DBX Path assertion entry '" + raw + "' in '" + path.name | ||
| + "' must contain '.regions.' (e.g. HBM_1.regions.r1)"); | ||
| } | ||
|
|
||
| entry.region = raw; | ||
| path.entries.push_back(entry); | ||
| } | ||
|
|
||
| if (path.entries.empty()) { | ||
| logError("DBX Path assertion '" + path.name + "' has no valid entries"); | ||
| } | ||
| } | ||
|
|
||
| } // namespace odb | ||
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "dbChipPath", | ||
| "type": "dbObject", | ||
| "fields": [ | ||
| { | ||
| "name": "name_", | ||
| "type": "char *", | ||
| "default": "nullptr", | ||
| "flags": [ | ||
| "no-set" | ||
| ] | ||
| }, | ||
| { | ||
| "name": "entries_", | ||
| "type": "std::vector<std::tuple<std::vector<dbId<_dbChipInst>>, dbId<_dbChipRegionInst>, bool>>", | ||
| "flags": [ | ||
| "private", | ||
| "no-cmp" | ||
|
maliberty marked this conversation as resolved.
|
||
| ] | ||
| } | ||
| ], | ||
| "h_includes": [ | ||
| "odb/dbId.h" | ||
| ], | ||
| "cpp_includes": [ | ||
| "dbChip.h", | ||
| "dbChipRegionInst.h", | ||
| "dbChipInst.h" | ||
| ] | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be used in the dbChipConn as well. It should be defined outside the dbChipPath scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will it be used? I think keeping this private is better?