odb: avoid moved port names on buffered driver nets by jinchuntan · Pull Request #11815 · The-OpenROAD-Project/OpenROAD · GitHub
Skip to content

odb: avoid moved port names on buffered driver nets - #11815

Open
jinchuntan wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
jinchuntan:fix/buffered-port-net-names
Open

jinchuntan wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
jinchuntan:fix/buffered-port-net-names

Conversation

@jinchuntan

Copy link
Copy Markdown

Summary

Check every moved port when renaming the original flat net and its modnets during buffer insertion. The first port still supplies the new net's name.

Type of Change

  • Bug fix

Impact

When two output ports share a net, moving both behind a buffer no longer leaves the driver's net named after the second port. Writing and reading the Verilog preserves separate buffer input and output nets.

Verification

Eight cases cover both original port names, flat and hierarchical linking, and moving one or both ports. Each case exports Verilog and reads it back to check connectivity. Two cases reproduce the short on unchanged code and pass with the fix.

All 54 tests across these targets pass:

bazelisk test --test_output=errors \
  //src/odb/test/cpp:TestInsertBuffer \
  //src/odb/test/cpp:OdbGTests \
  //src/odb/test/cpp:TestModule

Local validation used the pinned LLVM dependency with archive ownership restoration disabled for this container. Remote caching and build telemetry were disabled. The full OpenROAD application and ORFS flow were not built.

  • The focused build and relevant tests pass.
  • Changed C++ files are formatted with clang-format 23.1.2.
  • Regression tests are included and registered in Bazel.
  • The commit includes a DCO sign-off.

Related Issues

Fixes #11789

Check every moved BTerm when renaming flat nets and modnets during
buffer insertion. Keep the first BTerm as the new net name.

Cover both original port names and partial port moves in flat and
hierarchical designs, including Verilog export and re-import.

Fixes The-OpenROAD-Project#11789

Signed-off-by: Nigel Tan <nigeltanjc@gmail.com>
@jinchuntan
jinchuntan requested a review from a team as a code owner October 17, 2026 23:31
@jinchuntan
jinchuntan requested a review from maliberty October 17, 2026 23:31

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

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.

Code Review

This pull request updates dbInsertBuffer::createNewFlatNet to iterate over all connected terms and rename colliding flat nets or modnets for any port moving to the new net, rather than just checking a single port. It also adds a comprehensive unit test suite (TestInsertBuffer) to verify this behavior. The review feedback points out a potential null pointer dereference in the new loop over connected_terms if any element is nullptr, and suggests adding a null check to prevent a crash.

Comment on lines +481 to 484

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.

high

If connected_terms contains a nullptr (which is possible since load_pins can contain null pointers as handled in validateLoadPinsAndFindLCA), calling obj->getObjectType() will result in a null pointer dereference and crash the application.

Adding a null check prevents this potential crash.

    for (dbObject* obj : connected_terms) {
      if (obj == nullptr) {
        continue;
      }
      if (obj->getObjectType() != dbBTermObj) {
        continue;
      }

@maliberty
maliberty requested a review from jhkim-pii October 18, 2026 15:44
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.

odb: insert_buffer on two ports that share a net leaves the driver net named after one port; write_verilog then shorts the buffer

1 participant