Skip to content

sta: ensure correct connectivity in modnets#10322

Open
gadfort wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
gadfort:sta-dbread
Open

sta: ensure correct connectivity in modnets#10322
gadfort wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
gadfort:sta-dbread

Conversation

@gadfort
Copy link
Copy Markdown
Collaborator

@gadfort gadfort commented May 3, 2026

Summary

ensure correct connectivity in verilog read in with hier turned on. I noticed an issue where multiple clocks that could not have any paths between them where getting connected in openroad, this was the fix Claude suggested with the associated testcases.
I checked this on a much larger circuit and it appears to work correctly, but this should be verified.

Type of Change

  • Bug fix

Impact

Avoids creating incorrect connections.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

[Link issues here]

Signed-off-by: Peter Gadfort <gadfort@zeroasic.com>
@gadfort gadfort requested a review from maliberty May 3, 2026 15:13
@github-actions github-actions Bot added the size/M label May 3, 2026
Copy link
Copy Markdown
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

Comment thread src/dbSta/src/dbNetwork.cc
Comment thread src/dbSta/test/cpp/TestReadVerilog.cpp
Signed-off-by: Peter Gadfort <gadfort@zeroasic.com>
Copy link
Copy Markdown
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 fixes a bug in dbReadVerilog where deep-descendant pins were incorrectly attached to ancestor module ports by name and includes regression tests. It also introduces a sanity check, checkSanityModNetPortAliasing, to detect structural integrity violations where a module boundary aliases distinct external nets. Feedback suggests optimizing performance by moving container declarations outside of loops in the sanity check and refining the warning message to only include ports that contribute to the aliasing issue.

Comment on lines +4544 to +4545
// collect the distinct ids encountered. >= 2 distinct ids
// means the boundary aliases two unrelated external nets.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Declaring std::set and std::vector inside the nested loops results in frequent allocations and deallocations. For designs with a large number of hierarchical nets, this can impact performance. Consider moving these declarations outside the loops and using .clear() at the start of each iteration. Additionally, ensure the containers are cleared at the end of the function's scope to maintain consistency with repository practices.

References
  1. When checking for container clearing before population, verify if the container is cleared at the end of the function's scope, not just at the beginning.

Comment on lines +4547 to +4559
std::vector<std::string> port_names;
for (odb::dbModBTerm* mbt : mbts) {
port_names.emplace_back(mbt->getName());
odb::dbModITerm* pmi = mbt->getParentModITerm();
if (pmi == nullptr) {
continue;
}
odb::dbModNet* pmn = pmi->getModNet();
if (pmn == nullptr) {
continue;
}
odb::dbNet* pflat = pmn->findRelatedNet();
if (pflat != nullptr) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Currently, all port names are added to port_names, but the warning message specifically highlights ports that resolve to distinct flat nets. If a port is unconnected (i.e., pflat is null), including it in the warning list might be confusing to the user. It is better to only include ports that actually contribute to the aliasing issue.

        odb::dbNet* pflat = pmn->findRelatedNet();
        if (pflat != nullptr) {
          parent_flat_ids.insert(pflat->getId());
          port_names.emplace_back(mbt->getName());
        }

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

clang-tidy review says "All clean, LGTM! 👍"

@maliberty maliberty requested a review from jhkim-pii May 4, 2026 17:26
@maliberty
Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants