-hier: parasitics wrong for nets on a top-level port that connect into a submodule (read_spef drops net, *D_NET too low)
メンテナーはふだん 1 日以内に返信
@dsengupta0628 がすでに取り組んでいます。
2026年9月29日 から。
評価
この issue はまだ評価されていません。
説明
Describe the bug
Describe the bug
With link_design -hier, parasitics are handled wrongly for a net on a top-level port that also connects into a submodule. I see two symptoms.
read_spefsilently drops the whole net. After reading a SPEF into a-hierdesign, the net has wire capacitance 0 and its driver is reported as unannotated.read_spefprints no warning. The same file read into the flat-linked design annotates correctly.- The pin node for the top-level port is wrongly flagged external. This makes the
*D_NETtotal written byestimate_parasitics -spef_filetoo low. The node's capacitance is still written in*CAP, so the two disagree. The external flag is also read by the Arnoldi and Prima delay calculators.
Hierarchy should not change capacitance, and in flat mode both symptoms go away. The in-memory RC network from estimate_parasitics is identical in the two modes; only the external flag on the port node differs.
Both symptoms are present before and after https://github.com/The-OpenROAD-Project/OpenROAD/pull/11552. That PR only changed which pin-node *CAP entries get written.
Test case: est_rc2 from src/grt/test, with r1 and u2 moved into a submodule h1. Net in1 goes from top port in1 through module port h1/in1 to h1/r1/D:
top
┌──────────────────────────────────────────────┐
│ h1 : sub │
│ ┌───────────────────────┐ │
in1 ●───────────┼──●────────────► r1/D │ │ net in1: broken in -hier
(top port) │ h1/in1 │ │
│ │ (module port) │ │
│ └───────────────────────┘ │
│ │
in2 ●────────────────────────────► r2/D │ net in2: fine (top level only)
└──────────────────────────────────────────────┘
Symptom 1: read_spef. The same flat.spef is read into each link mode, followed by report_net in1:
link_design top |
link_design -hier top |
|
|---|---|---|
| Wire capacitance | 0.776778 | 0.000000 |
| Total capacitance | 1.839120–1.917068 | 1.062342–1.140290 (the h1/r1/D Liberty pin cap only) |
report_parasitic_annotation -report_unannotated |
in1 annotated |
in1 unannotated |
Warnings from read_spef |
none | none |
Every other net annotates correctly in -hier. For example, in2 (top-level only) reads back 1.770961. The other unannotated drivers (h1/r1/QN, r2/QN, r3/QN) are unconnected outputs and show up in both modes.
Symptom 2: the *D_NET total. This is estimate_parasitics -global_routing -spef_file, net in1:
flat: -hier:
*D_NET in1 0.776778 *D_NET in1 0.719166 <- 0.0576124 low
*CAP *CAP
1 in1 0.0576124 1 in1 0.0576124 <- port pin node
2 h1/r1:D 0.0289813 2 h1/r1:D 0.0289813
3 in1:1 0.132077 3 in1:1 0.132077
4 in1:2 0.074465 4 in1:2 0.074465
5 in1:3 0.22733 5 in1:3 0.22733
6 in1:4 0.256312 6 in1:4 0.256312
(sum 0.776778 != 0.719166)
The *CAP sections are identical. The -hier total is lower by exactly the capacitance on the in1 port pin node.
Root cause (symptom 2)
The external flag on a pin node is set in ConcreteParasiticNetwork::ensureParasiticNode(const Pin*) in src/sta/parasitics/ConcreteParasitics.cc:
Net *net = network->net(pin);
if (net == nullptr && network->isTopLevelPort(pin)) {
Term *term = network->term(pin);
if (term)
net = network->net(term); // (A) top-level port: not normalized
}
else if (net)
net = network->highestNetAbove(net); // (B) other pins: normalized
node = new ConcreteParasiticNode(pin, net != net_); // is_external
flowchart TD
S["ensureParasiticNode(port in1)"] --> Q{"top-level port?"}
Q -- yes --> A["(A) net = net(term)"]
Q -- no --> B["(B) net = highestNetAbove(net(pin))<br/>modnet → flat net"]
A --> M{"link mode"}
M -- flat --> F["dbNet in1 == net_<br/>internal ✅"]
M -- "-hier" --> H["dbModNet (bterm->getModNet())<br/>!= net_ → external ❌"]
style H fill:#f8d7da,stroke:#b02a37,color:#000
- In
-hier,dbNetwork::net(const Term*)(src/dbSta/src/dbNetwork.cc) returnsbterm->getModNet()when one exists. A TODO there says it should always return the flat net. net_is the flat net, so branch (A) marks the port node external.- Branch (B) doesn't have this problem, because
dbNetwork::highestNetAbove()maps a modnet to its related flat net. That was the fix for the earlier PRIMA crash (the "isExternal issue fix to resolve crash in PRIMA delay calc" commit).
External nodes are skipped by:
| reader | effect |
|---|---|
ConcreteParasiticNetwork::capacitance() |
left out of the total, which is the *D_NET value |
ArnoldiReduce.cc |
left out of the reduction |
PrimaDelayCalc.cc |
left out of the network walk (including the driver node) |
Parasitics.cc reports |
tagged (ext) |
I haven't confirmed a timing difference with Arnoldi or Prima. In this test the port is the net's driver, and those calculators appear to use only the pin cap there.
Root cause (symptom 1): not yet traced
Losing the whole net doesn't fit "one node flagged external", which would lose only the 0.0576 on the port node. My guess is a net mismatch between where SpefReader stores the parasitic and where the driver lookup for in1 looks in -hier (flat net vs modnet). That would be the same dbNetwork::net(term) behavior reached by a different path, but I haven't verified it. SpefReader creates pin nodes through the same ensureParasiticNode(pin).
Possible fixes (symptom 2)
| # | fix | notes |
|---|---|---|
| 1 | Write *D_NET in SpefWriter as the sum of the *CAP entries |
Only fixes the file. The node stays wrongly external for Arnoldi/Prima. Rejected |
| 2 | Call highestNetAbove() in branch (A) |
One line in OpenSTA. A no-op for OpenSTA's own network, so it's redundant from OpenSTA's point of view, but it makes (A) consistent with (B). Needs upstream acceptance |
| 3 | Make dbNetwork::highestNetAbove() return the modnet in -hier |
Many changes (EST keys by dbNet in flat and by dbModNet in hier, plus dbNetwork and SpefWriter); risks bringing back the PRIMA issue |
| 4 | is_external = net == nullptr || !network->isConnected(net, net_) |
OpenSTA change. dbNetwork::isConnected(Net*, Net*) returns early on equality and otherwise compares flat nets, so it should be cheap in OpenROAD. The base Network::isConnected traverses |
| 5 | Make dbNetwork::net(const Term*) return the flat net (the existing TODO) |
OpenROAD-only. The TODO says the Verilog writer depends on the modnet |
It's still open whether fix 2 or 4 also fixes symptom 1.
Expected Behavior
-hierand flat give the same parasitics for every net.read_spefinto a-hierdesign annotatesin1with wire capacitance 0.776778, the same as flat.- The
in1port pin node is not external, so the*D_NETtotal forin1is 0.776778 in both modes and equals the sum of its*CAPentries.
Additional Context
- Only tested with the top-level port as the net's driver (an input port). An output port fed from inside a submodule goes through the same branch and is expected to behave the same way, but I haven't checked it.
- This matters most for flows that load an external SPEF into a
-hierdesign, such as RCX output withread_spef. In the normal estimated-parasitics flow the RC network goes to STA in memory, where it is correct apart from the external flag.
Expected Behavior
-hier and flat give the same parasitics for every net.
Environment
--This is too big---
To Reproduce
To Reproduce
Attached: https://drive.google.com/file/d/1SdEGggmlG8LQ-_UVgyW0a2_01epUvyDC/view?usp=drive_link hier_port_parasitics_repro.tar.gz (hier.v, hier.def, run.tcl). Run it from a directory that has a Nangate45 symlink to test/Nangate45. hier.def is src/grt/test/est_rc2.def with r1 renamed to h1/r1 and u2 to h1/u2, and with the NETS section removed; connectivity comes from hier.v.
ln -s <OpenROAD>/test/Nangate45 Nangate45
LINK_FLAG="" MODE=flat openroad -no_splash -no_init -exit run.tcl # writes flat.spef; run first
LINK_FLAG="-hier" MODE=hier openroad -no_splash -no_init -exit run.tcl
run.tcl:
read_lef Nangate45/Nangate45.lef
read_liberty Nangate45/Nangate45_typ.lib
read_verilog hier.v
link_design {*}$::env(LINK_FLAG) top
read_def -floorplan_initialize hier.def
set_routing_layers -signal metal2-metal10
global_route
estimate_parasitics -global_routing -spef_file $::env(MODE).spef
puts "=== estimated (in memory)"
report_net -digits 6 in1
read_spef flat.spef
puts "=== after read_spef flat.spef"
report_net -digits 6 in1
report_parasitic_annotation -report_unannotated
hier.v:
module sub (in1, a2, ck, zn);
input in1, a2, ck;
output zn;
wire r1q;
DFF_X1 r1 (.D(in1), .CK(ck), .Q(r1q));
AND2_X1 u2 (.A1(r1q), .A2(a2), .ZN(zn));
endmodule
module top (clk, in1, in2, out);
input clk, in1, in2;
output out;
wire r2q, u2z, clknet_0_clk, clknet_1_0_0_clk, clknet_1_1_0_clk;
sub h1 (.in1(in1), .a2(r2q), .ck(clknet_1_0_0_clk), .zn(u2z));
DFF_X1 r2 (.D(in2), .CK(clknet_1_0_0_clk), .Q(r2q));
DFF_X1 r3 (.D(u2z), .CK(clknet_1_1_0_clk), .Q(out));
BUF_X4 clkbuf_0_clk (.A(clk), .Z(clknet_0_clk));
CLKBUF_X1 clkbuf_1_0_0_clk (.A(clknet_0_clk), .Z(clknet_1_0_0_clk));
CLKBUF_X1 clkbuf_1_1_0_clk (.A(clknet_0_clk), .Z(clknet_1_1_0_clk));
endmodule
Relevant log output
# -hier run
[WARNING ORD-0011] Hierarchical flow (-hier) is currently in development and may cause multiple issues. Do not use in production environments.
=== estimated (in memory)
Wire capacitance: 0.776778
Total capacitance: 1.839121-1.917068
=== after read_spef flat.spef
Wire capacitance: 0.000000
Total capacitance: 1.062342-1.140290
Found 4 unannotated drivers.
in1
h1/r1/QN
r2/QN
r3/QN
Found 0 partially unannotated drivers.
Screenshots
No response
Additional Context
No response
- 主要言語
- Verilog
- スター
- 3.4k
- フォーク
- 1.1k
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 245
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
The-OpenROAD-Project/OpenROAD のほかの issue
-
odb LEF58_MINIMUMCUT: per-cut-class form never sets isPerCutClass, so drt silently drops the rule対応中かも @LucasYuki が 26 日前に担当しました。 オープンbug drt odb
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
The-OpenROAD-Project/OpenROAD#12176 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
drt: LEF58_SPACING ENDOFLINE MINLENGTH l TWOSIDES is checked one-sided (io passes the TWOEDGES flag as TWOSIDES)対応中かも @osamahammad21 が 26 日前に担当しました。 オープンbug drt
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
The-OpenROAD-Project/OpenROAD#12173 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
cleanup-opportunity: BUILD files never refer to mockturtle in third-partty/再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbazel enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
The-OpenROAD-Project/OpenROAD#12160 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
odb: Bazel build fails on linux/aarch64 — char fc compared to EOF in def/lef lexers対応中かも @shivarammysore が 33 日前に担当しました。 オープンbazel bug odb
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
The-OpenROAD-Project/OpenROAD#12095 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
syn: acd_resynth -apply segfaults on a database resynthesized in an earlier process再び着手できるかも @povik が 31 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug syn
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
The-OpenROAD-Project/OpenROAD#12046 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信