Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/dbSta/include/db_sta/dbNetwork.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<odb::dbITerm, odb::dbChipNet*> bump_to_chip_net_;
// Die-side net -> the chip-net it reaches through one of its bump pads.
mutable odb::PtrMap<odb::dbNet, odb::dbChipNet*> net_to_chip_net_;
mutable odb::PtrMap<odb::dbChipInst, odb::dbUnfoldedChipInst*>
chip_inst_to_unfolded_;
mutable odb::PtrMap<odb::dbChipNet, odb::dbUnfoldedChipNet*>
Expand Down
111 changes: 93 additions & 18 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<dbITerm> 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
Expand All @@ -1205,22 +1220,44 @@ 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<dbITerm> 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
{
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<odb::dbChipInst*> path = uci->getChipInstPath();
Expand All @@ -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;
}
}
}
}
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
}

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -3756,9 +3815,17 @@ void dbNetwork::staToDb(const Instance* instance,

dbNet* dbNetwork::staToDb(const Net* net) const
{
dbNet* db_net = reinterpret_cast<dbNet*>(const_cast<Net*>(net));
assert(!db_net || db_net->getObjectType() == odb::dbNetObj);
return db_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. Check the type through the common
// base before casting.
dbObject* obj = reinterpret_cast<dbObject*>(const_cast<Net*>(net));
if (obj->getObjectType() != odb::dbNetObj) {
return nullptr;
}
return reinterpret_cast<dbNet*>(obj);
}

dbNet* dbNetwork::flatNet(const Net* net) const
Expand Down Expand Up @@ -4678,9 +4745,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;
Expand Down Expand Up @@ -6025,6 +6090,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.
Expand Down
11 changes: 5 additions & 6 deletions src/dbSta/test/3dic_cross.ok
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions src/dbSta/test/3dic_spef.a.spef
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions src/dbSta/test/3dic_spef.b.spef
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions src/dbSta/test/3dic_spef.bonds.spef
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// The die-to-die bond itself, at top scope: one resistor between the two bump
// pad pins, named <chip_inst>/<bump_inst>:<mterm> 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
46 changes: 46 additions & 0 deletions src/dbSta/test/3dic_spef.ok
Original file line number Diff line number Diff line change
@@ -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)


Loading
Loading