Skip to content

Feat/3dblox parser path assertions#9812

Open
openroad-ci wants to merge 4 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-parser-pathAssertions
Open

Feat/3dblox parser path assertions#9812
openroad-ci wants to merge 4 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-parser-pathAssertions

Conversation

@openroad-ci
Copy link
Collaborator

Related to: #9300

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the dbChipPath object to the OpenROAD database, enabling the storage and retrieval of chip paths. It includes modifications to several files to integrate this new object into the database schema and parser, as well as new tests to verify the functionality. The code changes appear well-structured and follow existing patterns in the codebase. Additionally, specific feedback has been provided regarding naming conventions, operator implementation, and defensive null checks.

Comment on lines +249 to +252
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') {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The validation logic for the path assertion name allows names like Path01, which might be confusing. It would be better to disallow leading zeros to ensure a cleaner naming convention.

        || path.name[prefix.size()] == '0') {

Comment on lines +38 to +40
bool _dbChipPath::operator<(const _dbChipPath& rhs) const
{
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The < operator always returns true. This might not be the intended behavior. Consider implementing a meaningful comparison based on the object's attributes, or remove the operator if it's not needed.

bool _dbChipPath::operator<(const _dbChipPath& rhs)
{
  return false; // Implement a meaningful comparison or remove this operator
}

Comment on lines +128 to +136
// Reject duplicate path names within the same chip
if (_chip->chip_path_hash_.hasMember(name)) {
_dbDatabase* db = (_dbDatabase*) _chip->getOwner();
db->getLogger()->error(utl::ODB,
533,
"ChipPath {} already exists in chip {}",
name,
chip->getName());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The error message uses chip->getName() without checking if chip is valid. Although unlikely, it's good practice to ensure chip is not null before dereferencing it to prevent potential crashes.

    if (_chip->chip_path_hash_.hasMember(name)) {
      _dbDatabase* db = (_dbDatabase*) _chip->getOwner();
      db->getLogger()->error(utl::ODB,
                             533,
                             "ChipPath {} already exists in chip {}",
                             name,
                             chip ? chip->getName() : "<null>");

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

#pragma once

#include <cstdint>
#include <utility>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: included header cstdint is not used directly [misc-include-cleaner]

Suggested change
#include <utility>
#include <utility>

},
{
"name": "entries_",
"type": "std::vector<std::pair<dbId<_dbChipRegionInst>, bool>>",
Copy link
Member

Choose a reason for hiding this comment

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

How does that work? Each entry should have the full path:

  • std::vector<dbId<_dbChipInst>> (chip path)
  • dbId<_dbChipRegionInst> (the region)

Choose a reason for hiding this comment

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

This is a single path. where each region in the path can be negated. Then in the schema we have:

    {
      "parent":"dbChip",
      "child":"dbChipPath",
      "type":"1_n",
      "tbl_name":"chip_path_tbl_",
      "schema":"kSchemaChipPath",
      "hash": true,
      "flags": ["no-serial"]
    }

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;
Copy link
Member

Choose a reason for hiding this comment

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

this should be used as per my previous comment.

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)");
continue;
Copy link
Member

Choose a reason for hiding this comment

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

logError stops execution. Remove the continue

Choose a reason for hiding this comment

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

OK

Comment on lines +7454 to +7458
struct Entry
{
dbChipRegionInst* region;
bool negated;
};
Copy link
Member

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.

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?

@ahmed532 ahmed532 requested a review from maliberty March 23, 2026 20:36
struct Entry
{
dbChipRegionInst* region;
bool negated;
Copy link
Member

Choose a reason for hiding this comment

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

document the meaning of negated

Ahmed R. Mohamed added 4 commits March 24, 2026 01:46
Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
Store db objects in paths instead of strings.
Use idiomatic ODB db object size calculation.
Use hashtable.
Use named constants.

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
operator< does not have
`// NOLINTBEGIN(readability-simplify-boolean-expr)`

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
document dbChipPath negated field

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
@openroad-ci openroad-ci force-pushed the feat/3dblox-parser-pathAssertions branch from fd46e54 to 6408817 Compare March 24, 2026 01:55
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.

4 participants