dbSta: keep top-level supply ports visible in pin iterator (#10414) - #10723
dbSta: keep top-level supply ports visible in pin iterator (#10414)#10723saurav-fermions wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies DbInstancePinIterator::hasNext() in dbNetwork.cc to retain power and ground supply boundary terms (BTerms) for the top-level block. This ensures top-level ports remain visible to consumers like write_verilog, which requires them to emit the correct assign statements connecting ports to internal supply nets with different names, fixing issue #10414. Additionally, a new test case write_verilog10 has been added to verify this fix. There are no review comments, so I have no feedback to provide.
|
Needs fixed |
Move the write_verilog10 file-deps entry after write_verilog1 to satisfy buildifier's unsorted-dict-items check (BUILD:290). Addresses @maliberty review on The-OpenROAD-Project#10723. Signed-off-by: Saurav Singh <saurav.singh@fermions.co>
|
Fixed — moved the |
dsengupta0628
left a comment
There was a problem hiding this comment.
This is partial revert of the change by @gadfort #8957
Bug Peter's PR fixed: power/ground nets connected to leaf instances whose LEF does not mark pins as POWER/GROUND (real case: COVER BUMP cells with INOUT pins). OpenSTA then builds a timing graph over those supply nets --> memory blows. Fix: added isPGSupply() and filtered supply terms out of 4 iterators:
- DbInstancePinIterator - top branch (BTerms)
- DbInstancePinIterator - leaf branch (ITerms)
- DbNetPinIterator
- DbNetTermIterator
What PR #10723 reverts
Only 1 from above--> the top-level BTerm branch. Other 3 filters stay.
The memory blowup likely came from leaf instance ITerms (COVER BUMP cells) : that path (2, 3) stays filtered. This PR only re-exposes top-level primary I/O ports, a different code path.
Now exposing top supply BTerms could let OpenSTA add graph vertices/edges at the top boundary for supply nets. But the heavy blowup in Peter's case was leaf-instance traversal, not top ports so maybe unlikely to reproduce #8957's symptom. I would still prefer this to be verified.
Another concern. After this PR,
- DbInstancePinIterator (top branch) --> supply BTerm visible
- DbNetTermIterator::next() + DbNetPinIterator --> supply BTerm/ITerm still filtered
Same supply BTerm now appears when you walk the top instance's pins but is hidden when you walk its net's terminals. Any consumer that cross-references pins to net-terms assumes symmetry --> could mismatch.
write_verilog likely fine (it walks instance pins to emit assigns), but please confirm no other consumer of DbInstancePinIterator (e.g. graph builder, sta sdc, parasitics) chokes on supply ports reappearing.
|
@dsengupta0628 thanks for the careful analysis — you've characterized it exactly right. On #8957 not regressing: agreed. Peter's blow-up came from leaf-instance ITerm traversal (the COVER-BUMP cells with unmarked INOUT pins). This PR only re-exposes the top-level primary-I/O BTerm branch of On the asymmetry (top instance-pin walk shows a supply BTerm; the net-terminal walk still hides it): that's a real and deliberate observation. The motivation is #10414 — On the other consumers you flagged (graph builder / SDC / parasitics): the dbSta regression suite and the |
|
Hi @saurav-fermions can you please merge with latest master and resolve the CI failures? |
|
Please fix the CI failure - I think the BUILD entry is wrong. I have no other comments blocking the merge otherwise |
…OAD-Project#10414) DbInstancePinIterator filtered power/ground BTerms out of the top-level branch. The top block's ports are the design's primary I/O (including supply pins) and must stay visible to consumers that walk the top instance's pins: write_verilog relies on this iterator to emit the "assign <port> = <net>;" aliases that connect a power/ground port to an internal supply net whose name differs from the port name. Filtering them dropped those connections and broke LVS. Only the top-level BTerm branch is unfiltered; leaf instance ITerms and the net-terminal iterators keep the existing supply filtering, so the memory blow-up addressed by The-OpenROAD-Project#8957 (supply nets on leaf instances whose LEF does not mark pins as POWER/GROUND) is unaffected. Adds the write_verilog10 regression covering a PG port aliased to a differently-named internal supply net.
26624fc to
6209fc9
Compare
|
@dsengupta0628 rebased onto current master and pushed (also squashed into one commit). On the BUILD entry: I sorted the On that Clang-Tidy failure: I ran clang-tidy locally against the project's Both are at the include block (lines 81/83), nowhere near my change (~line 522), and they reproduce identically on unmodified Verification: rebuilt on current master — Your earlier asymmetry point still stands as noted — the offer to add a pin↔net-term cross-check test, or to make the exposure symmetric for the top block only, is still open if you'd prefer either before merge. |
Thank you. Can you please add a test that cross-checks top-port pins vs net-terms? To fix this, in src/dbSta/test/BUILD, please delete these 3 lines: I don't follow why the CI is failing consistently- it maybe because Bazel build is not working. Can you please try the above and recheck? |
dsengupta0628
left a comment
There was a problem hiding this comment.
One more request. As @gadfort rightly pointed out, we need a test to ensure the timing graph doesn't pick up the bumps like it did before.
src/sta/graph/Graph.cc: makeVerticesAndEdges() calls makePinVertices(network_->topInstance()), which walks network_->pinIterator(inst) → DbInstancePinIterator with top_=true. That is exactly the branch this PR changes. So the PR puts top-level power/ground BTerms back into the timing graph as vertices — bidirect, so two each, driver and load.
Origin of the filter is #8957. Cause there: COVER BUMP cells whose LEF marks the pins INOUT instead of POWER/GROUND, so STA built the graph on the supply nets and memory ballooned.
Note #8957 touched two spots in DbInstancePinIterator::hasNext() — one for instance terminals, one for the top block's terminals. As outlined in my first comment, this PR only changes the second, so the bump cells themselves are still filtered. It is the top-level ports that come back.
I have not measured this, it is from reading the code, so worth confirming: on a design with a large number of power and ground ports, compare the graph vertex count before and after.
If the count does grow, one option is to read the port connections for write_verilog off the block terminals directly, leaving the graph path untouched.
Either way, please add a test - #8957 went in without one. src/dbSta/test is the right place, next to write_verilog10. Something like: a small LEF with a bump-like cell whose pins are INOUT, a DEF tying it and several top-level power/ground ports to one supply net, then print the graph vertices with sta::vertex_iterator and dump the verilog with make_result_file + report_file. The .ok then covers both sides at once — the supply pins stay out of the vertex list, and the assign lines stay in the verilog. Register it in CMakeLists.txt and in ALL_TESTS in BUILD.
If the vertex order out of that iterator is not stable, sort before printing.
Addresses review feedback on The-OpenROAD-Project#10414: - New supply_port_graph test guards both sides at once, as requested: the timing-graph vertex list must not contain the top-level power/ground terminals (the growth The-OpenROAD-Project#8957 fixed), while the top instance pin walk must still expose them and write_verilog -include_pwr_gnd must still emit the assign aliases. It also cross-checks the supply BTerms odb reports on each supply net against the pin walk, so the two views cannot silently diverge. Vertex and pin names are sorted before printing for a stable golden. Verified discriminating: reverting the dbNetwork.cc change makes the test fail (supply pins drop out of the pin walk and the assign lines disappear). - Remove the write_verilog10 entry from the per-test resources dict in src/dbSta/test/BUILD. glob([test_name + ".*"]) already picks up write_verilog10.def, so the explicit entry duplicated the label and broke the Bazel build (Clang-Tidy-Bazel).
|
I think we should avoid iterator asymmetry. |
|
It would require some changes in opensta, but it seems like we need a way for the verilog writer and the timing graph to use different iterators. |
Summary
write_verilog -include_pwr_gndstopped emittingassign <port> = <net>;for top-level supply ports wired to an internal supply net of a different name (e.g.vccd1/vccd2->vdpwr), breaking LVS. This keeps top-level supply ports visible in the pin iterator so the assigns are restored.Type of Change
Impact
Power/ground port connections reappear in written Verilog; fixes the LVS breakage.
Verification
ctest -R '^dbSta\.'71/71.Related Issues
Fixes #10414
Developed with SAIGE, Fermions' autonomous RTL/EDA debugging agent; root-caused, tested, and signed off by the submitter (@saurav-fermions).