From d827c2978a6fe1e21d5e1395e4bd25dafd6f1d80 Mon Sep 17 00:00:00 2001 From: dsengupta0628 Date: Sat, 31 Oct 2026 18:59:46 +0000 Subject: [PATCH 1/2] dbSta: read cross-die parasitics on 3D-IC designs A cross-die net arrives from 3D RCX as three SPEF pieces: each die's wiring (read with -path ) and the die-to-die bond (read at top scope). read_spef left them on three different nets, so a driver found only its own die's piece. On the 3dic_cross fixture chipA's driver saw 2 fF instead of ~103 fF, and changing the bond resistance did not change timing at all. The dbChipNet above a bonded boundary is the net all three pieces belong to, and the net the bonds SPEF is written against. Three dbNetwork overrides ascend to it: - net(const Pin*) on a chiplet boundary bterm returns the chip net. SpefReader::dspfBegin climbs term -> pin -> net to pick the owning net of a -path read, so this is what merges the die pieces. - highestConnectedNet() on a bonded die net returns the chip net, so Parasitics::findParasiticNet lets a driver on either die find it. - highestNetAbove() must agree, or ensureParasiticNode marks every node of the merged network external. A die-net -> chip-net index is built with the existing unfolded maps. staToDb(const Net*) returns null for a chip net instead of casting it. Read the bonds SPEF before the die SPEFs: a top-scope read replaces a net's parasitic network, a -path read merges into it. Known limitation: Tcl net reports (report_net) walk the network through OpenSTA's generic traversal, which now climbs from a bonded die net to the chip net but does not descend into the other die, so they list the far die's bump pad but not its loads. Timing and SPEF reading use dbNetwork directly and are unaffected. Also not covered: estimate_parasitics and rsz build parasitics on the die net, which delay calculation no longer looks up for a bonded net on a 3D-IC design. This PR is for parasitics read from SPEF. New test 3dic_spef. 3dic_cross.ok updated for the report_net change. Signed-off-by: dsengupta0628 --- src/dbSta/include/db_sta/dbNetwork.hh | 13 ++++ src/dbSta/src/dbNetwork.cc | 103 ++++++++++++++++++++++---- src/dbSta/test/3dic_cross.ok | 11 ++- src/dbSta/test/3dic_spef.a.spef | 27 +++++++ src/dbSta/test/3dic_spef.b.spef | 27 +++++++ src/dbSta/test/3dic_spef.bonds.spef | 25 +++++++ src/dbSta/test/3dic_spef.ok | 46 ++++++++++++ src/dbSta/test/3dic_spef.tcl | 24 ++++++ src/dbSta/test/BUILD | 26 ++++--- src/dbSta/test/CMakeLists.txt | 1 + 10 files changed, 273 insertions(+), 30 deletions(-) create mode 100644 src/dbSta/test/3dic_spef.a.spef create mode 100644 src/dbSta/test/3dic_spef.b.spef create mode 100644 src/dbSta/test/3dic_spef.bonds.spef create mode 100644 src/dbSta/test/3dic_spef.ok create mode 100644 src/dbSta/test/3dic_spef.tcl diff --git a/src/dbSta/include/db_sta/dbNetwork.hh b/src/dbSta/include/db_sta/dbNetwork.hh index 26e56d97d71..84e20f6e91e 100644 --- a/src/dbSta/include/db_sta/dbNetwork.hh +++ b/src/dbSta/include/db_sta/dbNetwork.hh @@ -202,6 +202,17 @@ class dbNetwork : public ConcreteNetwork // A bump's timing pin is its pad inst's single dbITerm (flat model); // nullptr for spare (unbound) bumps. odb::dbITerm* bumpPadITerm(odb::dbUnfoldedChipBumpInst* bump) const; + // The chip-net above a chiplet boundary, reached from the boundary port, the + // die-side net, or the bump's pad iterm. Null if the boundary is unbonded. + // This is the net a cross-die parasitic network is keyed on, and the net the + // 3D RCX bonds SPEF is written at. + // + // Read the bonds SPEF before the per-die SPEFs. A top-scope read replaces a + // net's parasitic network where a -path read merges into it, so the other + // order discards the die contributions without warning. + odb::dbChipNet* chipNetAbove(odb::dbBTerm* bterm) const; + odb::dbChipNet* chipNetAboveNet(const Net* net) const; + odb::dbChipNet* chipNetOfPadITerm(odb::dbITerm* iterm) const; // Raw chip-inst / chip-net -> their per-unfold-path objects (built in // setTopChip). Used by the chip-aware iterators to enumerate unfolded bumps. odb::dbUnfoldedChipInst* unfoldedChipInst(odb::dbChipInst* chip_inst) const; @@ -619,6 +630,8 @@ class dbNetwork : public ConcreteNetwork // raw chip-inst -> its unfolded chip-inst (for the pin iterator) // raw chip-net -> its unfolded chip-net (for the net-pin iterator) mutable odb::PtrMap bump_to_chip_net_; + // Die-side net -> the chip-net it reaches through one of its bump pads. + mutable odb::PtrMap net_to_chip_net_; mutable odb::PtrMap chip_inst_to_unfolded_; mutable odb::PtrMap diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index b2212362820..bbdc686a7c3 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -930,6 +930,7 @@ void dbNetwork::clear() chip_master_cells_.clear(); chip_master_lib_ = nullptr; bump_to_chip_net_.clear(); + net_to_chip_net_.clear(); chip_inst_to_unfolded_.clear(); chip_net_to_unfolded_.clear(); } @@ -1073,6 +1074,7 @@ void dbNetwork::setTopChip(odb::dbChip* chip) block_to_chip_inst_.clear(); block_disc_.clear(); bump_to_chip_net_.clear(); + net_to_chip_net_.clear(); chip_inst_to_unfolded_.clear(); chip_net_to_unfolded_.clear(); unfolded_built_ = false; @@ -1197,6 +1199,19 @@ odb::dbChipInst* dbNetwork::chipInstOf(odb::dbBlock* block) const // ---- chip-object <-> STA-handle encode/decode ---- +// The single dbITerm of a chip bump's pad instance, or nullptr if the bump +// has no pad inst or the pad inst has no iterm. Does not check for a bound +// bterm; callers that need a logical endpoint do. +static odb::dbITerm* padITerm(odb::dbChipBump* chip_bump) +{ + odb::dbInst* pad_inst = chip_bump ? chip_bump->getInst() : nullptr; + if (pad_inst == nullptr) { + return nullptr; + } + dbSet iterms = pad_inst->getITerms(); + return iterms.empty() ? nullptr : *iterms.begin(); +} + // Resolve an unfolded bump to its pad inst's single dbITerm -- the bump's // timing pin (flat model: the pad iterm is the real leaf pin; it carries the // vertex id, its MTerm carries direction, and it sits directly on the @@ -1205,15 +1220,36 @@ odb::dbChipInst* dbNetwork::chipInstOf(odb::dbBlock* block) const odb::dbITerm* dbNetwork::bumpPadITerm(odb::dbUnfoldedChipBumpInst* bump) const { odb::dbChipBump* cb = bump->getChipBumpInst()->getChipBump(); - if (cb->getBTerm() == nullptr) { + return cb->getBTerm() == nullptr ? nullptr : padITerm(cb); +} + +odb::dbChipNet* dbNetwork::chipNetOfPadITerm(dbITerm* iterm) const +{ + if (iterm == nullptr) { return nullptr; } - odb::dbInst* pad_inst = cb->getInst(); - if (pad_inst == nullptr) { + ensureUnfoldedMapsFresh(); + auto it = bump_to_chip_net_.find(iterm); + return it == bump_to_chip_net_.end() ? nullptr : it->second; +} + +odb::dbChipNet* dbNetwork::chipNetAbove(dbBTerm* bterm) const +{ + return chipNetOfPadITerm(bterm ? padITerm(bterm->getChipBump()) : nullptr); +} + +odb::dbChipNet* dbNetwork::chipNetAboveNet(const Net* net) const +{ + dbNet* db_net = flatNet(net); + if (db_net == nullptr) { return nullptr; } - dbSet iterms = pad_inst->getITerms(); - return iterms.empty() ? nullptr : *iterms.begin(); + // Uses an index built in buildUnfoldedMaps. Delay calculation calls this per + // driver pin, so scanning the net's iterms would be O(fanout) every time -- + // including on big nets that never reach a bump. + ensureUnfoldedMapsFresh(); + auto it = net_to_chip_net_.find(db_net); + return it == net_to_chip_net_.end() ? nullptr : it->second; } void dbNetwork::buildUnfoldedMaps() const @@ -1221,6 +1257,7 @@ void dbNetwork::buildUnfoldedMaps() const chip_inst_to_unfolded_.clear(); chip_net_to_unfolded_.clear(); bump_to_chip_net_.clear(); + net_to_chip_net_.clear(); // raw chip-inst -> unfolded chip-inst (single-level: path is one element) for (odb::dbUnfoldedChipInst* uci : db_->getUnfoldedChipInsts()) { std::vector path = uci->getChipInstPath(); @@ -1240,6 +1277,9 @@ void dbNetwork::buildUnfoldedMaps() const for (odb::dbUnfoldedChipBumpInst* ub : ucn->getConnectedBumps()) { if (odb::dbITerm* pad_iterm = bumpPadITerm(ub)) { bump_to_chip_net_[pad_iterm] = chip_net; + if (dbNet* die_net = pad_iterm->getNet()) { + net_to_chip_net_[die_net] = chip_net; + } } } } @@ -2092,11 +2132,20 @@ Net* dbNetwork::net(const Pin* pin) const return dbToSta(dnet); } } - // only pins which act as bterms are top levels and have no net + // A bterm pin is a top-level port and has no net, except on a chiplet + // boundary. if (bterm) { - // dbNet* dnet = bterm -> getNet(); - // return dbToSta(dnet); - ; + // Return the chip-net above the boundary, not the die-side net below it. + // SpefReader::dspfBegin climbs term -> pin -> net to find which net owns a + // parasitic network, so this has to move up a level. Returning the die-side + // net would make that climb return where it started, and the unguarded + // recursions in ReportPath::hierPinsAbove and Network::hierarchyLevel then + // overflow the stack. + if (has3DicChip()) { + if (odb::dbChipNet* chip_net = chipNetAbove(bterm)) { + return dbToSta(chip_net); + } + } } if (moditerm) { if (odb::dbModNet* mnet = moditerm->getModNet()) { @@ -2748,15 +2797,25 @@ void dbNetwork::visitConnectedPins(const Net* net, // Caution: //- Network::highestConnectedNet(Net *net) retrieves the highest hierarchical // net connected to the given net. -// - But `dbNetwork::highestConnectedNet(Net* net)` retrieves the corresponding -// flat net for the given net. +// - `dbNetwork::highestConnectedNet(Net* net)` retrieves the corresponding +// flat net for the given net. On a 3DIC design it returns the dbChipNet above +// a bonded die-side net instead, which is neither a dbNet nor a dbModNet. // - It behaves differently to cope with the issue 9724. // - This redefinition may cause another issue later when // `Network::highestConnectedNet(Net *net)` is used elsewhere. const Net* dbNetwork::highestConnectedNet(const Net* net) const { const Net* flat = findFlatNet(net); - return flat ? flat : net; + const Net* highest = flat ? flat : net; + // A cross-die net's parasitics are merged into one network keyed on the + // chip-net. Parasitics::findParasiticNet looks parasitics up through here, so + // returning the chip-net is what lets a driver on either die find them. + if (has3DicChip()) { + if (odb::dbChipNet* chip_net = chipNetAboveNet(highest)) { + return dbToSta(chip_net); + } + } + return highest; } //////////////////////////////////////////////////////////////// @@ -3757,6 +3816,12 @@ void dbNetwork::staToDb(const Instance* instance, dbNet* dbNetwork::staToDb(const Net* net) const { dbNet* db_net = reinterpret_cast(const_cast(net)); + // net(pin) returns a dbChipNet on a chiplet boundary, so a caller expecting + // a flat net can arrive here with one. Return null rather than casting it: + // the assert below is compiled out under NDEBUG, leaving a garbage pointer. + if (db_net != nullptr && db_net->getObjectType() != odb::dbNetObj) { + return nullptr; + } assert(!db_net || db_net->getObjectType() == odb::dbNetObj); return db_net; } @@ -4678,9 +4743,7 @@ bool dbNetwork::isConnected(const Net* net, const Pin* pin) const if (iterm == nullptr) { return false; } - ensureUnfoldedMapsFresh(); - auto it = bump_to_chip_net_.find(iterm); - return it != bump_to_chip_net_.end() && it->second == chip_net; + return chipNetOfPadITerm(iterm) == chip_net; } dbNet* dbnet; @@ -6025,6 +6088,16 @@ const Net* dbNetwork::highestNetAbove(const Net* net) const staToDb(net, dbnet, modnet); if (dbnet) { + // Must return the same net as highestConnectedNet. ensureParasiticNode + // marks a node external when highestNetAbove(net(pin)) differs from the + // network's net, so returning the die-side net here would mark every node + // of a merged cross-die network external -- the node_count_ = 0 crash + // described below, reproducible with -delay_calculator arnoldi. + if (has3DicChip()) { + if (odb::dbChipNet* chip_net = chipNetAboveNet(net)) { + return dbToSta(chip_net); + } + } // If a flat net, return it. // - We should not return the highest modnet related to the flat net. // - Otherwise, it breaks estimate_parasitics function. diff --git a/src/dbSta/test/3dic_cross.ok b/src/dbSta/test/3dic_cross.ok index 4116c871a92..bd2bbdc31fe 100644 --- a/src/dbSta/test/3dic_cross.ok +++ b/src/dbSta/test/3dic_cross.ok @@ -23,19 +23,18 @@ Net chipA/q Pin capacitance: 0.88-0.97 Wire capacitance: 0.00 Total capacitance: 0.88-0.97 - Number of drivers: 2 - Number of loads: 1 - Number of pins: 2 + Number of drivers: 3 + Number of loads: 2 + Number of pins: 3 Driver pins chipA/buf/Z output (BUF_X1) (13, 6) chipA/bump_q/PAD bidirect (BUMP) (4, 4) + chipB/bump_d/PAD bidirect (BUMP) (4, 4) Load pins chipA/bump_q/PAD bidirect (BUMP) (4, 4) - -Hierarchical pins - chipA/q output + chipB/bump_d/PAD bidirect (BUMP) (4, 4) Net chipA/ext Pin capacitance: 0.00 diff --git a/src/dbSta/test/3dic_spef.a.spef b/src/dbSta/test/3dic_spef.a.spef new file mode 100644 index 00000000000..dd00a33179e --- /dev/null +++ b/src/dbSta/test/3dic_spef.a.spef @@ -0,0 +1,27 @@ +// chipA side of the bond net: driver out to the bump pad. +*SPEF "IEEE 1481-1999" +*DESIGN "flop_chip_a" +*DATE "Tue Aug 19 00:00:00 2026" +*VENDOR "The OpenROAD Project" +*PROGRAM "OpenROAD" +*VERSION "test" +*DESIGN_FLOW "NAME_SCOPE LOCAL" "PIN_CAP NONE" +*DIVIDER / +*DELIMITER : +*BUS_DELIMITER [] +*T_UNIT 1 NS +*C_UNIT 1 FF +*R_UNIT 1 OHM +*L_UNIT 1 HENRY + +*D_NET q 2 +*CONN +*I buf:Z O +*I bump_q:PAD I +*CAP +1 q:1 1 +2 bump_q:PAD 1 +*RES +1 buf:Z q:1 10 +2 q:1 bump_q:PAD 10 +*END diff --git a/src/dbSta/test/3dic_spef.b.spef b/src/dbSta/test/3dic_spef.b.spef new file mode 100644 index 00000000000..8b6dfc7ce1a --- /dev/null +++ b/src/dbSta/test/3dic_spef.b.spef @@ -0,0 +1,27 @@ +// chipB side of the bond net: bump pad in to the receiver. +*SPEF "IEEE 1481-1999" +*DESIGN "flop_chip_b" +*DATE "Tue Aug 19 00:00:00 2026" +*VENDOR "The OpenROAD Project" +*PROGRAM "OpenROAD" +*VERSION "test" +*DESIGN_FLOW "NAME_SCOPE LOCAL" "PIN_CAP NONE" +*DIVIDER / +*DELIMITER : +*BUS_DELIMITER [] +*T_UNIT 1 NS +*C_UNIT 1 FF +*R_UNIT 1 OHM +*L_UNIT 1 HENRY + +*D_NET d 100 +*CONN +*I bump_d:PAD I +*I buf:A I +*CAP +1 d:1 50 +2 buf:A 50 +*RES +1 bump_d:PAD d:1 10 +2 d:1 buf:A 10 +*END diff --git a/src/dbSta/test/3dic_spef.bonds.spef b/src/dbSta/test/3dic_spef.bonds.spef new file mode 100644 index 00000000000..a42db4b3e51 --- /dev/null +++ b/src/dbSta/test/3dic_spef.bonds.spef @@ -0,0 +1,25 @@ +// The die-to-die bond itself, at top scope: one resistor between the two bump +// pad pins, named /: the way the 3D RCX writer +// names them. +*SPEF "IEEE 1481-1999" +*DESIGN "top" +*DATE "Tue Aug 19 00:00:00 2026" +*VENDOR "The OpenROAD Project" +*PROGRAM "OpenROAD" +*VERSION "test" +*DESIGN_FLOW "NAME_SCOPE LOCAL" "PIN_CAP NONE" +*DIVIDER / +*DELIMITER : +*BUS_DELIMITER [] +*T_UNIT 1 NS +*C_UNIT 1 FF +*R_UNIT 1 OHM +*L_UNIT 1 HENRY + +*D_NET bridge 0 +*CONN +*I chipA/bump_q:PAD B +*I chipB/bump_d:PAD B +*RES +1 chipA/bump_q:PAD chipB/bump_d:PAD 2000 +*END diff --git a/src/dbSta/test/3dic_spef.ok b/src/dbSta/test/3dic_spef.ok new file mode 100644 index 00000000000..27d8e216035 --- /dev/null +++ b/src/dbSta/test/3dic_spef.ok @@ -0,0 +1,46 @@ +[INFO ODB-0227] LEF file: ../../odb/test/Nangate45/Nangate45_tech.lef, created 22 layers, 27 vias +[INFO ODB-0227] LEF file: ../../odb/test/Nangate45/Nangate45_stdcell.lef, created 135 library cells +[INFO ODB-0227] LEF file: ../../odb/test/Nangate45/fake_bumps.lef, created 1 library cells +[INFO ODB-0128] Design: flop_chip_a +[INFO ODB-0130] Created 1 pins. +[INFO ODB-0252] Updated 3 pins. +[INFO ODB-0131] Created 3 components and 14 component-terminals. +[INFO ODB-0133] Created 6 nets and 7 connections. +[WARNING STA-1140] ../../odb/test/Nangate45/Nangate45_typ.lib line 37, library NangateOpenCellLibrary already exists. +[INFO ODB-0128] Design: flop_chip_b +[INFO ODB-0252] Updated 3 pins. +[INFO ODB-0131] Created 3 components and 14 component-terminals. +[INFO ODB-0133] Created 5 nets and 7 connections. +Found 11 unannotated drivers. +Found 0 partially unannotated drivers. +Startpoint: chipA/ff (rising edge-triggered flip-flop clocked by clk) +Endpoint: chipB/ff (rising edge-triggered flip-flop clocked by clk) +Path Group: clk +Path Type: max + + Cap Delay Time Description +---------------------------------------------------------------- + 0.00 0.00 clock clk (rise edge) + 0.00 0.00 clock network delay (ideal) + 0.00 0.00 ^ chipA/ff/CK (DFF_X1) + 1.55 0.08 0.08 v chipA/ff/Q (DFF_X1) + 0.97 0.01 0.09 ^ chipA/inv/ZN (INV_X1) + 102.97 0.08 0.17 ^ chipA/buf/Z (BUF_X1) + 1.70 0.25 0.42 ^ chipB/buf/Z (BUF_X1) + 1.06 0.01 0.43 v chipB/inv/ZN (INV_X1) + 0.00 0.43 v chipB/ff/D (DFF_X1) + 0.43 data arrival time + + 1.00 1.00 clock clk (rise edge) + 0.00 1.00 clock network delay (ideal) + 0.00 1.00 clock reconvergence pessimism + 1.00 ^ chipB/ff/CK (DFF_X1) + -0.04 0.96 library setup time + 0.96 data required time +---------------------------------------------------------------- + 0.96 data required time + -0.43 data arrival time +---------------------------------------------------------------- + 0.54 slack (MET) + + diff --git a/src/dbSta/test/3dic_spef.tcl b/src/dbSta/test/3dic_spef.tcl new file mode 100644 index 00000000000..2b968fa94ea --- /dev/null +++ b/src/dbSta/test/3dic_spef.tcl @@ -0,0 +1,24 @@ +# Cross-die parasitics. One bond net arrives as three SPEF pieces -- chipA's +# wiring (2 fF), the die-to-die bond resistor (2 kohm), and chipB's wiring +# (100 fF). read_spef must merge them onto the chip-net so chipA's driver sees +# the far die's load through the bond; without that it sees only its own 2 fF +# and the path delay collapses from ~0.41 ns to ~0.15 ns. +# +# The bonds SPEF is top-scope and must be read first: a top-scope read replaces +# the net's parasitic network, while a -path read merges into it. +# +# The hierarchical_pin report at the end is a regression guard: it walks +# term -> pin -> net, which must ascend to the chip-net. If it ever resolves +# back to the die-side net the walk becomes a self-loop and this crashes. +source "helpers.tcl" + +read_3dbx 3dic_cross.3dbx + +create_clock -name clk -period 1.0 [get_pins -of_objects [get_nets clk_top]] + +read_spef 3dic_spef.bonds.spef +read_spef -path chipA 3dic_spef.a.spef +read_spef -path chipB 3dic_spef.b.spef + +report_parasitic_annotation +report_checks -path_delay max -group_path_count 1 -fields {cap hierarchical_pin} diff --git a/src/dbSta/test/BUILD b/src/dbSta/test/BUILD index 3cf10ec817c..7d73795d1ea 100644 --- a/src/dbSta/test/BUILD +++ b/src/dbSta/test/BUILD @@ -32,6 +32,7 @@ ALL_TESTS = [ "3dic_cross", "3dic_get_cells", "3dic_read_db", + "3dic_spef", "block_sta1", "check_axioms", "clock_pin", @@ -135,6 +136,20 @@ filegroup( ], ) +# The two-chiplet 3DIC fixture, shared by every test that reads 3dic_cross.3dbx. +# 3dic_cross itself omits the .3dbx because its own test_name + ".*" glob +# already picks it up. +_3DIC_CROSS_FIXTURES = [ + "//src/odb/test:regression_resources", + "3dic_cross.3dbx", + "3dic_cross_flop.3dbv", + "3dic_cross_flop_a.bmap", + "3dic_cross_flop_a.def", + "3dic_cross_flop_b.bmap", + "3dic_cross_flop_b.def", + "3dic_cross_top.v", +] + [ filegroup( name = test_name + "_resources", @@ -155,17 +170,10 @@ filegroup( "3dic_get_cells": [ "//src/odb/test:regression_resources", ], - "3dic_read_db": [ - "//src/odb/test:regression_resources", - "3dic_cross.3dbx", - "3dic_cross_flop.3dbv", - "3dic_cross_flop_a.bmap", - "3dic_cross_flop_a.def", - "3dic_cross_flop_b.bmap", - "3dic_cross_flop_b.def", - "3dic_cross_top.v", + "3dic_read_db": _3DIC_CROSS_FIXTURES + [ "3dic_read_db_reload.tcl", ], + "3dic_spef": _3DIC_CROSS_FIXTURES, "block_sta1": [ "example1_typ.lib", "example1.def", diff --git a/src/dbSta/test/CMakeLists.txt b/src/dbSta/test/CMakeLists.txt index a5af7df1bb4..183f92723ee 100644 --- a/src/dbSta/test/CMakeLists.txt +++ b/src/dbSta/test/CMakeLists.txt @@ -4,6 +4,7 @@ or_integration_tests( 3dic_cross 3dic_get_cells 3dic_read_db + 3dic_spef block_sta1 check_axioms clock_pin From dd04c7b1952c7356b2fda5cf1bace91885cdd041 Mon Sep 17 00:00:00 2001 From: dsengupta0628 Date: Sat, 31 Oct 2026 20:41:27 +0000 Subject: [PATCH 2/2] dbSta: check net type through dbObject in staToDb(const Net*) Calling getObjectType() through a dbNet* that may point at a dbChipNet is undefined behavior (sibling classes). Cast to the common dbObject base first, as staToDbChipNet() and staToDb(const Port*) already do. Signed-off-by: dsengupta0628 --- src/dbSta/src/dbNetwork.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index bbdc686a7c3..45e9b0dafce 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -3815,15 +3815,17 @@ void dbNetwork::staToDb(const Instance* instance, dbNet* dbNetwork::staToDb(const Net* net) const { - dbNet* db_net = reinterpret_cast(const_cast(net)); + if (net == nullptr) { + return nullptr; + } // net(pin) returns a dbChipNet on a chiplet boundary, so a caller expecting - // a flat net can arrive here with one. Return null rather than casting it: - // the assert below is compiled out under NDEBUG, leaving a garbage pointer. - if (db_net != nullptr && db_net->getObjectType() != odb::dbNetObj) { + // a flat net can arrive here with one. Check the type through the common + // base before casting. + dbObject* obj = reinterpret_cast(const_cast(net)); + if (obj->getObjectType() != odb::dbNetObj) { return nullptr; } - assert(!db_net || db_net->getObjectType() == odb::dbNetObj); - return db_net; + return reinterpret_cast(obj); } dbNet* dbNetwork::flatNet(const Net* net) const