2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2025-01-22 02:54:33 +01:00
|
|
|
// Copyright (c) 2025, Parallax Software, Inc.
|
2018-09-28 17:54:21 +02:00
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-09-28 17:54:21 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-01-04 18:17:08 +01:00
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2025-01-22 02:54:33 +01:00
|
|
|
//
|
|
|
|
|
// The origin of this software must not be misrepresented; you must not
|
|
|
|
|
// claim that you wrote the original software.
|
|
|
|
|
//
|
|
|
|
|
// Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
// misrepresented as being the original software.
|
|
|
|
|
//
|
|
|
|
|
// This notice may not be removed or altered from any source distribution.
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "ReduceParasitics.hh"
|
2020-04-05 20:35:51 +02:00
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "Error.hh"
|
|
|
|
|
#include "Debug.hh"
|
|
|
|
|
#include "MinMax.hh"
|
|
|
|
|
#include "Liberty.hh"
|
|
|
|
|
#include "Network.hh"
|
|
|
|
|
#include "Sdc.hh"
|
|
|
|
|
#include "Corner.hh"
|
|
|
|
|
#include "Parasitics.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2021-02-05 22:12:09 +01:00
|
|
|
using std::max;
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
typedef Map<ParasiticNode*, double> ParasiticNodeValueMap;
|
2024-02-08 21:54:52 +01:00
|
|
|
typedef Map<ParasiticResistor*, double> ResistorCurrentMap;
|
|
|
|
|
typedef Set<ParasiticResistor*> ParasiticResistorSet;
|
2022-12-26 00:46:48 +01:00
|
|
|
typedef Set<ParasiticNode*> ParasiticNodeSet;
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
class ReduceToPi : public StaState
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ReduceToPi(StaState *sta);
|
2024-02-08 21:54:52 +01:00
|
|
|
void reduceToPi(const Parasitic *parasitic_network,
|
|
|
|
|
const Pin *drvr_pin,
|
2018-11-26 18:15:52 +01:00
|
|
|
ParasiticNode *drvr_node,
|
2018-09-28 17:54:21 +02:00
|
|
|
float coupling_cap_factor,
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2018-09-28 17:54:21 +02:00
|
|
|
const ParasiticAnalysisPt *ap,
|
2018-11-26 18:15:52 +01:00
|
|
|
float &c2,
|
|
|
|
|
float &rpi,
|
|
|
|
|
float &c1);
|
2019-04-11 05:36:48 +02:00
|
|
|
bool pinCapsOneValue() { return pin_caps_one_value_; }
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
protected:
|
2018-11-26 18:15:52 +01:00
|
|
|
void reducePiDfs(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
2021-02-05 22:12:09 +01:00
|
|
|
double src_resistance,
|
2018-11-26 18:15:52 +01:00
|
|
|
double &y1,
|
|
|
|
|
double &y2,
|
|
|
|
|
double &y3,
|
2021-02-05 22:12:09 +01:00
|
|
|
double &dwn_cap,
|
|
|
|
|
double &max_resistance);
|
2018-09-28 17:54:21 +02:00
|
|
|
void visit(ParasiticNode *node);
|
|
|
|
|
bool isVisited(ParasiticNode *node);
|
|
|
|
|
void leave(ParasiticNode *node);
|
2018-11-26 18:15:52 +01:00
|
|
|
void setDownstreamCap(ParasiticNode *node,
|
|
|
|
|
float cap);
|
2018-09-28 17:54:21 +02:00
|
|
|
float downstreamCap(ParasiticNode *node);
|
|
|
|
|
float pinCapacitance(ParasiticNode *node);
|
2024-02-08 21:54:52 +01:00
|
|
|
bool isLoopResistor(ParasiticResistor *resistor);
|
|
|
|
|
void markLoopResistor(ParasiticResistor *resistor);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2019-06-04 17:12:22 +02:00
|
|
|
bool includes_pin_caps_;
|
2018-09-28 17:54:21 +02:00
|
|
|
float coupling_cap_multiplier_;
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf_;
|
2018-09-28 17:54:21 +02:00
|
|
|
const Corner *corner_;
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max_;
|
|
|
|
|
const ParasiticAnalysisPt *ap_;
|
|
|
|
|
ParasiticNodeResistorMap resistor_map_;
|
|
|
|
|
ParasiticNodeCapacitorMap capacitor_map_;
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
ParasiticNodeSet visited_nodes_;
|
|
|
|
|
ParasiticNodeValueMap node_values_;
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistorSet loop_resistors_;
|
2019-04-11 05:36:48 +02:00
|
|
|
bool pin_caps_one_value_;
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ReduceToPi::ReduceToPi(StaState *sta) :
|
|
|
|
|
StaState(sta),
|
|
|
|
|
coupling_cap_multiplier_(1.0),
|
2019-11-11 23:30:19 +01:00
|
|
|
rf_(nullptr),
|
2019-03-13 01:25:53 +01:00
|
|
|
corner_(nullptr),
|
2024-02-08 21:54:52 +01:00
|
|
|
min_max_(nullptr),
|
2019-04-11 05:36:48 +02:00
|
|
|
pin_caps_one_value_(true)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// "Modeling the Driving-Point Characteristic of Resistive
|
|
|
|
|
// Interconnect for Accurate Delay Estimation", Peter O'Brien and
|
|
|
|
|
// Thomas Savarino, Proceedings of the 1989 Design Automation
|
|
|
|
|
// Conference.
|
|
|
|
|
void
|
2024-02-08 21:54:52 +01:00
|
|
|
ReduceToPi::reduceToPi(const Parasitic *parasitic_network,
|
|
|
|
|
const Pin *drvr_pin,
|
2018-11-26 18:15:52 +01:00
|
|
|
ParasiticNode *drvr_node,
|
2018-09-28 17:54:21 +02:00
|
|
|
float coupling_cap_factor,
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2018-09-28 17:54:21 +02:00
|
|
|
const ParasiticAnalysisPt *ap,
|
2018-11-26 18:15:52 +01:00
|
|
|
float &c2,
|
|
|
|
|
float &rpi,
|
|
|
|
|
float &c1)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-02-08 21:54:52 +01:00
|
|
|
includes_pin_caps_ = parasitics_->includesPinCaps(parasitic_network),
|
2018-09-28 17:54:21 +02:00
|
|
|
coupling_cap_multiplier_ = coupling_cap_factor;
|
2019-11-11 23:30:19 +01:00
|
|
|
rf_ = rf;
|
2018-09-28 17:54:21 +02:00
|
|
|
corner_ = corner;
|
2024-02-08 21:54:52 +01:00
|
|
|
min_max_ = min_max;
|
|
|
|
|
ap_ = ap;
|
|
|
|
|
resistor_map_ = parasitics_->parasiticNodeResistorMap(parasitic_network);
|
|
|
|
|
capacitor_map_ = parasitics_->parasiticNodeCapacitorMap(parasitic_network);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
double y1, y2, y3, dcap;
|
2021-02-05 22:12:09 +01:00
|
|
|
double max_resistance = 0.0;
|
2024-02-08 21:54:52 +01:00
|
|
|
reducePiDfs(drvr_pin, drvr_node, nullptr, 0.0,
|
2021-02-05 22:12:09 +01:00
|
|
|
y1, y2, y3, dcap, max_resistance);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
if (y2 == 0.0 && y3 == 0.0) {
|
|
|
|
|
// Capacitive load.
|
2019-04-11 05:36:48 +02:00
|
|
|
c1 = y1;
|
2018-09-28 17:54:21 +02:00
|
|
|
c2 = 0.0;
|
|
|
|
|
rpi = 0.0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-04-11 05:36:48 +02:00
|
|
|
c1 = y2 * y2 / y3;
|
|
|
|
|
c2 = y1 - y2 * y2 / y3;
|
|
|
|
|
rpi = -y3 * y3 / (y2 * y2 * y2);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "parasitic_reduce", 2,
|
2021-02-05 22:12:09 +01:00
|
|
|
" Pi model c2=%.3g rpi=%.3g c1=%.3g max_r=%.3g",
|
|
|
|
|
c2, rpi, c1, max_resistance);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find admittance moments.
|
|
|
|
|
void
|
|
|
|
|
ReduceToPi::reducePiDfs(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
2021-02-05 22:12:09 +01:00
|
|
|
double src_resistance,
|
2018-09-28 17:54:21 +02:00
|
|
|
double &y1,
|
|
|
|
|
double &y2,
|
|
|
|
|
double &y3,
|
2021-02-05 22:12:09 +01:00
|
|
|
double &dwn_cap,
|
|
|
|
|
double &max_resistance)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-09-06 01:21:07 +02:00
|
|
|
double coupling_cap = 0.0;
|
|
|
|
|
ParasiticCapacitorSeq &capacitors = capacitor_map_[node];
|
|
|
|
|
for (ParasiticCapacitor *capacitor : capacitors)
|
|
|
|
|
coupling_cap += parasitics_->value(capacitor);
|
|
|
|
|
|
|
|
|
|
dwn_cap = parasitics_->nodeGndCap(node)
|
|
|
|
|
+ coupling_cap * coupling_cap_multiplier_
|
|
|
|
|
+ pinCapacitance(node);
|
|
|
|
|
y1 = dwn_cap;
|
|
|
|
|
y2 = y3 = 0.0;
|
|
|
|
|
max_resistance = max(max_resistance, src_resistance);
|
|
|
|
|
|
|
|
|
|
visit(node);
|
|
|
|
|
ParasiticResistorSeq &resistors = resistor_map_[node];
|
|
|
|
|
for (ParasiticResistor *resistor : resistors) {
|
|
|
|
|
if (!isLoopResistor(resistor)) {
|
|
|
|
|
ParasiticNode *onode = parasitics_->otherNode(resistor, node);
|
|
|
|
|
// One commercial extractor creates resistors with identical from/to nodes.
|
|
|
|
|
if (onode != node
|
|
|
|
|
&& resistor != from_res) {
|
|
|
|
|
if (isVisited(onode)) {
|
|
|
|
|
// Resistor loop.
|
|
|
|
|
debugPrint(debug_, "parasitic_reduce", 2, " loop detected thru resistor %zu",
|
|
|
|
|
parasitics_->id(resistor));
|
|
|
|
|
markLoopResistor(resistor);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
double r = parasitics_->value(resistor);
|
|
|
|
|
double yd1, yd2, yd3, dcap;
|
|
|
|
|
reducePiDfs(drvr_pin, onode, resistor, src_resistance + r,
|
|
|
|
|
yd1, yd2, yd3, dcap, max_resistance);
|
|
|
|
|
// Rule 3. Upstream traversal of a series resistor.
|
|
|
|
|
// Rule 4. Parallel admittances add.
|
|
|
|
|
y1 += yd1;
|
|
|
|
|
y2 += yd2 - r * yd1 * yd1;
|
|
|
|
|
y3 += yd3 - 2 * r * yd1 * yd2 + r * r * yd1 * yd1 * yd1;
|
|
|
|
|
dwn_cap += dcap;
|
2021-02-05 22:12:09 +01:00
|
|
|
}
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-08 21:54:52 +01:00
|
|
|
}
|
2024-09-06 01:21:07 +02:00
|
|
|
|
|
|
|
|
setDownstreamCap(node, dwn_cap);
|
|
|
|
|
leave(node);
|
|
|
|
|
debugPrint(debug_, "parasitic_reduce", 3,
|
|
|
|
|
" node %s y1=%.3g y2=%.3g y3=%.3g cap=%.3g",
|
|
|
|
|
parasitics_->name(node), y1, y2, y3, dwn_cap);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float
|
|
|
|
|
ReduceToPi::pinCapacitance(ParasiticNode *node)
|
|
|
|
|
{
|
2024-02-08 21:54:52 +01:00
|
|
|
const Pin *pin = parasitics_->pin(node);
|
2018-09-28 17:54:21 +02:00
|
|
|
float pin_cap = 0.0;
|
|
|
|
|
if (pin) {
|
|
|
|
|
Port *port = network_->port(pin);
|
|
|
|
|
LibertyPort *lib_port = network_->libertyPort(port);
|
2018-11-26 18:15:52 +01:00
|
|
|
if (lib_port) {
|
2019-06-04 17:12:22 +02:00
|
|
|
if (!includes_pin_caps_) {
|
2024-02-08 21:54:52 +01:00
|
|
|
pin_cap = sdc_->pinCapacitance(pin, rf_, corner_, min_max_);
|
2019-04-11 05:36:48 +02:00
|
|
|
pin_caps_one_value_ &= lib_port->capacitanceIsOneValue();
|
|
|
|
|
}
|
2018-11-26 18:15:52 +01:00
|
|
|
}
|
2018-09-28 17:54:21 +02:00
|
|
|
else if (network_->isTopLevelPort(pin))
|
2024-02-08 21:54:52 +01:00
|
|
|
pin_cap = sdc_->portExtCap(port, rf_, corner_, min_max_);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
return pin_cap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ReduceToPi::visit(ParasiticNode *node)
|
|
|
|
|
{
|
|
|
|
|
visited_nodes_.insert(node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
ReduceToPi::isVisited(ParasiticNode *node)
|
|
|
|
|
{
|
|
|
|
|
return visited_nodes_.hasKey(node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ReduceToPi::leave(ParasiticNode *node)
|
|
|
|
|
{
|
2019-04-11 05:36:48 +02:00
|
|
|
visited_nodes_.erase(node);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2024-02-08 21:54:52 +01:00
|
|
|
ReduceToPi::isLoopResistor(ParasiticResistor *resistor)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-02-08 21:54:52 +01:00
|
|
|
return loop_resistors_.hasKey(resistor);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2024-02-08 21:54:52 +01:00
|
|
|
ReduceToPi::markLoopResistor(ParasiticResistor *resistor)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-02-08 21:54:52 +01:00
|
|
|
loop_resistors_.insert(resistor);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2018-11-26 18:15:52 +01:00
|
|
|
ReduceToPi::setDownstreamCap(ParasiticNode *node,
|
|
|
|
|
float cap)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
node_values_[node] = cap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float
|
|
|
|
|
ReduceToPi::downstreamCap(ParasiticNode *node)
|
|
|
|
|
{
|
2019-04-11 05:36:48 +02:00
|
|
|
return node_values_[node];
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class ReduceToPiElmore : public ReduceToPi
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ReduceToPiElmore(StaState *sta);
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *makePiElmore(const Parasitic *parasitic_network,
|
|
|
|
|
const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
|
|
|
|
float coupling_cap_factor,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const ParasiticAnalysisPt *ap);
|
2018-09-28 17:54:21 +02:00
|
|
|
void reduceElmoreDfs(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
2018-09-28 17:54:21 +02:00
|
|
|
double elmore,
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *pi_elmore);
|
2018-09-28 17:54:21 +02:00
|
|
|
};
|
|
|
|
|
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *
|
2023-09-24 00:12:13 +02:00
|
|
|
reduceToPiElmore(const Parasitic *parasitic_network,
|
2018-11-26 18:15:52 +01:00
|
|
|
const Pin *drvr_pin,
|
2024-02-08 21:54:52 +01:00
|
|
|
const RiseFall *rf,
|
|
|
|
|
float coupling_cap_factor,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2018-09-28 17:54:21 +02:00
|
|
|
const ParasiticAnalysisPt *ap,
|
|
|
|
|
StaState *sta)
|
|
|
|
|
{
|
|
|
|
|
Parasitics *parasitics = sta->parasitics();
|
2024-02-27 18:00:48 +01:00
|
|
|
ParasiticNode *drvr_node =
|
|
|
|
|
parasitics->findParasiticNode(parasitic_network, drvr_pin);
|
2018-09-28 17:54:21 +02:00
|
|
|
if (drvr_node) {
|
2024-02-08 21:54:52 +01:00
|
|
|
debugPrint(sta->debug(), "parasitic_reduce", 1, "Reduce driver %s %s %s",
|
|
|
|
|
sta->network()->pathName(drvr_pin),
|
|
|
|
|
rf->asString(),
|
|
|
|
|
min_max->asString());
|
2018-09-28 17:54:21 +02:00
|
|
|
ReduceToPiElmore reducer(sta);
|
2024-02-08 21:54:52 +01:00
|
|
|
return reducer.makePiElmore(parasitic_network, drvr_pin, drvr_node,
|
|
|
|
|
coupling_cap_factor, rf, corner,
|
|
|
|
|
min_max, ap);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2024-02-08 21:54:52 +01:00
|
|
|
return nullptr;
|
2019-04-11 05:36:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReduceToPiElmore::ReduceToPiElmore(StaState *sta) :
|
|
|
|
|
ReduceToPi(sta)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *
|
2023-09-24 00:12:13 +02:00
|
|
|
ReduceToPiElmore::makePiElmore(const Parasitic *parasitic_network,
|
2019-04-11 05:36:48 +02:00
|
|
|
const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
|
|
|
|
float coupling_cap_factor,
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf,
|
2019-04-11 05:36:48 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2019-04-11 05:36:48 +02:00
|
|
|
const ParasiticAnalysisPt *ap)
|
|
|
|
|
{
|
|
|
|
|
float c2, rpi, c1;
|
2024-02-08 21:54:52 +01:00
|
|
|
reduceToPi(parasitic_network, drvr_pin, drvr_node, coupling_cap_factor,
|
|
|
|
|
rf, corner, min_max, ap, c2, rpi, c1);
|
2019-11-11 23:30:19 +01:00
|
|
|
Parasitic *pi_elmore = parasitics_->makePiElmore(drvr_pin, rf, ap,
|
2019-04-11 05:36:48 +02:00
|
|
|
c2, rpi, c1);
|
|
|
|
|
parasitics_->setIsReducedParasiticNetwork(pi_elmore, true);
|
2024-02-08 21:54:52 +01:00
|
|
|
reduceElmoreDfs(drvr_pin, drvr_node, 0, 0.0, pi_elmore);
|
|
|
|
|
return pi_elmore;
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find elmore delays on 2nd DFS search using downstream capacitances
|
|
|
|
|
// set by reducePiDfs.
|
|
|
|
|
void
|
|
|
|
|
ReduceToPiElmore::reduceElmoreDfs(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
2018-09-28 17:54:21 +02:00
|
|
|
double elmore,
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *pi_elmore)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-02-08 21:54:52 +01:00
|
|
|
const Pin *pin = parasitics_->pin(node);
|
2018-09-28 17:54:21 +02:00
|
|
|
if (from_res && pin) {
|
|
|
|
|
if (network_->isLoad(pin)) {
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "parasitic_reduce", 2, " Load %s elmore=%.3g",
|
|
|
|
|
network_->pathName(pin),
|
|
|
|
|
elmore);
|
2019-04-11 05:36:48 +02:00
|
|
|
parasitics_->setElmore(pi_elmore, pin, elmore);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
visit(node);
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistorSeq &resistors = resistor_map_[node];
|
|
|
|
|
for (ParasiticResistor *resistor : resistors) {
|
|
|
|
|
ParasiticNode *onode = parasitics_->otherNode(resistor, node);
|
|
|
|
|
if (resistor != from_res
|
|
|
|
|
&& !isVisited(onode)
|
|
|
|
|
&& !isLoopResistor(resistor)) {
|
|
|
|
|
float r = parasitics_->value(resistor);
|
|
|
|
|
double onode_elmore = elmore + r * downstreamCap(onode);
|
|
|
|
|
reduceElmoreDfs(drvr_pin, onode, resistor, onode_elmore, pi_elmore);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
leave(node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class ReduceToPiPoleResidue2 : public ReduceToPi
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ReduceToPiPoleResidue2(StaState *sta);
|
|
|
|
|
~ReduceToPiPoleResidue2();
|
2023-09-24 00:12:13 +02:00
|
|
|
void findPolesResidues(const Parasitic *parasitic_network,
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *pi_pole_residue,
|
2018-11-26 18:15:52 +01:00
|
|
|
const Pin *drvr_pin,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticNode *drvr_node);
|
|
|
|
|
Parasitic *makePiPoleResidue2(const Parasitic *parasitic_network,
|
|
|
|
|
const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
|
|
|
|
float coupling_cap_factor,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const Corner *corner,
|
|
|
|
|
const MinMax *min_max,
|
|
|
|
|
const ParasiticAnalysisPt *ap);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
private:
|
2018-11-26 18:15:52 +01:00
|
|
|
void findMoments(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
2024-02-08 21:54:52 +01:00
|
|
|
int moment_count);
|
2018-11-26 18:15:52 +01:00
|
|
|
void findMoments(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
|
|
|
|
double from_volt,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
|
|
|
|
int moment_index);
|
2018-11-26 18:15:52 +01:00
|
|
|
double findBranchCurrents(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
|
|
|
|
int moment_index);
|
2018-11-26 18:15:52 +01:00
|
|
|
double moment(ParasiticNode *node,
|
|
|
|
|
int moment_index);
|
|
|
|
|
void setMoment(ParasiticNode *node,
|
|
|
|
|
double moment,
|
|
|
|
|
int moment_index);
|
2024-02-08 21:54:52 +01:00
|
|
|
double current(ParasiticResistor *res);
|
|
|
|
|
void setCurrent(ParasiticResistor *res,
|
2018-11-26 18:15:52 +01:00
|
|
|
double i);
|
|
|
|
|
void findPolesResidues(Parasitic *pi_pole_residue,
|
|
|
|
|
const Pin *drvr_pin,
|
|
|
|
|
const Pin *load_pin,
|
|
|
|
|
ParasiticNode *load_node);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
// Resistor/capacitor currents.
|
2024-02-08 21:54:52 +01:00
|
|
|
ResistorCurrentMap currents_;
|
2018-09-28 17:54:21 +02:00
|
|
|
ParasiticNodeValueMap *moments_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ReduceToPiPoleResidue2::ReduceToPiPoleResidue2(StaState *sta) :
|
|
|
|
|
ReduceToPi(sta),
|
2019-03-13 01:25:53 +01:00
|
|
|
moments_(nullptr)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The interconnect moments are found using RICE.
|
|
|
|
|
// "RICE: Rapid Interconnect Circuit Evaluation Using AWE",
|
|
|
|
|
// Curtis Ratzlaff and Lawrence Pillage, IEEE Transactions on
|
|
|
|
|
// Computer-Aided Design of Integrated Circuits and Systems,
|
|
|
|
|
// Vol 13, No 6, June 1994, pg 763-776.
|
|
|
|
|
//
|
|
|
|
|
// The poles and residues are found using these algorithms.
|
|
|
|
|
// "An Explicit RC-Circuit Delay Approximation Based on the First
|
|
|
|
|
// Three Moments of the Impulse Response", Proceedings of the 33rd
|
|
|
|
|
// Design Automation Conference, 1996, pg 611-616.
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *
|
2023-09-24 00:12:13 +02:00
|
|
|
reduceToPiPoleResidue2(const Parasitic *parasitic_network,
|
2018-11-26 18:15:52 +01:00
|
|
|
const Pin *drvr_pin,
|
2024-02-08 21:54:52 +01:00
|
|
|
const RiseFall *rf,
|
2018-09-28 17:54:21 +02:00
|
|
|
float coupling_cap_factor,
|
|
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2018-09-28 17:54:21 +02:00
|
|
|
const ParasiticAnalysisPt *ap,
|
|
|
|
|
StaState *sta)
|
|
|
|
|
{
|
|
|
|
|
Parasitics *parasitics = sta->parasitics();
|
2024-02-27 18:00:48 +01:00
|
|
|
ParasiticNode *drvr_node =
|
|
|
|
|
parasitics->findParasiticNode(parasitic_network, drvr_pin);
|
2018-09-28 17:54:21 +02:00
|
|
|
if (drvr_node) {
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(sta->debug(), "parasitic_reduce", 1, "Reduce driver %s",
|
|
|
|
|
sta->network()->pathName(drvr_pin));
|
2018-09-28 17:54:21 +02:00
|
|
|
ReduceToPiPoleResidue2 reducer(sta);
|
2024-02-08 21:54:52 +01:00
|
|
|
return reducer.makePiPoleResidue2(parasitic_network, drvr_pin, drvr_node,
|
|
|
|
|
coupling_cap_factor, rf,
|
|
|
|
|
corner, min_max, ap);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2024-02-08 21:54:52 +01:00
|
|
|
return nullptr;
|
2019-04-11 05:36:48 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *
|
2023-09-24 00:12:13 +02:00
|
|
|
ReduceToPiPoleResidue2::makePiPoleResidue2(const Parasitic *parasitic_network,
|
2019-04-11 05:36:48 +02:00
|
|
|
const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
|
|
|
|
float coupling_cap_factor,
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf,
|
2019-04-11 05:36:48 +02:00
|
|
|
const Corner *corner,
|
2024-02-08 21:54:52 +01:00
|
|
|
const MinMax *min_max,
|
2019-04-11 05:36:48 +02:00
|
|
|
const ParasiticAnalysisPt *ap)
|
|
|
|
|
{
|
|
|
|
|
float c2, rpi, c1;
|
2024-02-08 21:54:52 +01:00
|
|
|
reduceToPi(parasitic_network, drvr_pin, drvr_node,
|
|
|
|
|
coupling_cap_factor, rf, corner, min_max, ap,
|
2019-04-11 05:36:48 +02:00
|
|
|
c2, rpi, c1);
|
|
|
|
|
Parasitic *pi_pole_residue = parasitics_->makePiPoleResidue(drvr_pin,
|
2019-11-11 23:30:19 +01:00
|
|
|
rf, ap,
|
2019-04-11 05:36:48 +02:00
|
|
|
c2, rpi, c1);
|
|
|
|
|
parasitics_->setIsReducedParasiticNetwork(pi_pole_residue, true);
|
2024-02-08 21:54:52 +01:00
|
|
|
findPolesResidues(parasitic_network, pi_pole_residue, drvr_pin, drvr_node);
|
|
|
|
|
return pi_pole_residue;
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReduceToPiPoleResidue2::~ReduceToPiPoleResidue2()
|
|
|
|
|
{
|
|
|
|
|
delete [] moments_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2023-09-24 00:12:13 +02:00
|
|
|
ReduceToPiPoleResidue2::findPolesResidues(const Parasitic *parasitic_network,
|
2024-02-08 21:54:52 +01:00
|
|
|
Parasitic *pi_pole_residue,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Pin *drvr_pin,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticNode *drvr_node)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
moments_ = new ParasiticNodeValueMap[4];
|
2024-02-08 21:54:52 +01:00
|
|
|
findMoments(drvr_pin, drvr_node, 4);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
PinConnectedPinIterator *pin_iter = network_->connectedPinIterator(drvr_pin);
|
|
|
|
|
while (pin_iter->hasNext()) {
|
2023-01-19 19:23:45 +01:00
|
|
|
const Pin *pin = pin_iter->next();
|
2018-09-28 17:54:21 +02:00
|
|
|
if (network_->isLoad(pin)) {
|
2024-02-27 18:00:48 +01:00
|
|
|
ParasiticNode *load_node =
|
|
|
|
|
parasitics_->findParasiticNode(parasitic_network, pin);
|
2018-09-28 17:54:21 +02:00
|
|
|
if (load_node) {
|
|
|
|
|
findPolesResidues(pi_pole_residue, drvr_pin, pin, load_node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete pin_iter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ReduceToPiPoleResidue2::findMoments(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *drvr_node,
|
2024-02-08 21:54:52 +01:00
|
|
|
int moment_count)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
// Driver model thevenin resistance.
|
|
|
|
|
double rd = 0.0;
|
|
|
|
|
// Zero'th moments are all 1 because Vin(0)=1 and there is no
|
|
|
|
|
// current thru the resistors. Thus, there is no point in doing a
|
|
|
|
|
// pass to find the zero'th moments.
|
|
|
|
|
for (int moment_index = 1; moment_index < moment_count; moment_index++) {
|
2024-02-08 21:54:52 +01:00
|
|
|
double rd_i = findBranchCurrents(drvr_pin, drvr_node, 0, moment_index);
|
2018-09-28 17:54:21 +02:00
|
|
|
double rd_volt = rd_i * rd;
|
|
|
|
|
setMoment(drvr_node, 0.0, moment_index);
|
2024-02-08 21:54:52 +01:00
|
|
|
findMoments(drvr_pin, drvr_node, -rd_volt, 0, moment_index);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double
|
|
|
|
|
ReduceToPiPoleResidue2::findBranchCurrents(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
|
|
|
|
int moment_index)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
visit(node);
|
|
|
|
|
double branch_i = 0.0;
|
|
|
|
|
double coupling_cap = 0.0;
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistorSeq &resistors = resistor_map_[node];
|
|
|
|
|
for (ParasiticResistor *resistor : resistors) {
|
|
|
|
|
ParasiticNode *onode = parasitics_->otherNode(resistor, node);
|
|
|
|
|
// One commercial extractor creates resistors with identical from/to nodes.
|
|
|
|
|
if (onode != node
|
|
|
|
|
&& resistor != from_res
|
|
|
|
|
&& !isVisited(onode)
|
|
|
|
|
&& !isLoopResistor(resistor)) {
|
|
|
|
|
branch_i += findBranchCurrents(drvr_pin, onode, resistor, moment_index);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticCapacitorSeq &capacitors = capacitor_map_[node];
|
|
|
|
|
for (ParasiticCapacitor *capacitor : capacitors)
|
|
|
|
|
coupling_cap += parasitics_->value(capacitor);
|
|
|
|
|
|
|
|
|
|
double cap = parasitics_->nodeGndCap(node)
|
2018-09-28 17:54:21 +02:00
|
|
|
+ coupling_cap * coupling_cap_multiplier_
|
|
|
|
|
+ pinCapacitance(node);
|
|
|
|
|
branch_i += cap * moment(node, moment_index - 1);
|
|
|
|
|
leave(node);
|
|
|
|
|
if (from_res) {
|
|
|
|
|
setCurrent(from_res, branch_i);
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "parasitic_reduce", 3, " res i=%.3g", branch_i);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
return branch_i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2018-11-26 18:15:52 +01:00
|
|
|
ReduceToPiPoleResidue2::findMoments(const Pin *drvr_pin,
|
|
|
|
|
ParasiticNode *node,
|
2018-09-28 17:54:21 +02:00
|
|
|
double from_volt,
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistor *from_res,
|
|
|
|
|
int moment_index)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
visit(node);
|
2024-02-08 21:54:52 +01:00
|
|
|
ParasiticResistorSeq &resistors = resistor_map_[node];
|
|
|
|
|
for (ParasiticResistor *resistor : resistors) {
|
|
|
|
|
ParasiticNode *onode = parasitics_->otherNode(resistor, node);
|
|
|
|
|
// One commercial extractor creates resistors with identical from/to nodes.
|
|
|
|
|
if (onode != node
|
|
|
|
|
&& resistor != from_res
|
|
|
|
|
&& !isVisited(onode)
|
|
|
|
|
&& !isLoopResistor(resistor)) {
|
|
|
|
|
double r = parasitics_->value(resistor);
|
|
|
|
|
double r_volt = r * current(resistor);
|
|
|
|
|
double onode_volt = from_volt - r_volt;
|
|
|
|
|
setMoment(onode, onode_volt, moment_index);
|
|
|
|
|
debugPrint(debug_, "parasitic_reduce", 3, " moment %s %d %.3g",
|
|
|
|
|
parasitics_->name(onode),
|
|
|
|
|
moment_index,
|
|
|
|
|
onode_volt);
|
|
|
|
|
findMoments(drvr_pin, onode, onode_volt, resistor, moment_index);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
leave(node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double
|
2018-11-26 18:15:52 +01:00
|
|
|
ReduceToPiPoleResidue2::moment(ParasiticNode *node,
|
|
|
|
|
int moment_index)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
// Zero'th moments are all 1.
|
|
|
|
|
if (moment_index == 0)
|
|
|
|
|
return 1.0;
|
|
|
|
|
else {
|
|
|
|
|
ParasiticNodeValueMap &map = moments_[moment_index];
|
|
|
|
|
return map[node];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2018-11-26 18:15:52 +01:00
|
|
|
ReduceToPiPoleResidue2::setMoment(ParasiticNode *node,
|
|
|
|
|
double moment,
|
2018-09-28 17:54:21 +02:00
|
|
|
int moment_index)
|
|
|
|
|
{
|
|
|
|
|
// Zero'th moments are all 1.
|
|
|
|
|
if (moment_index > 0) {
|
|
|
|
|
ParasiticNodeValueMap &map = moments_[moment_index];
|
|
|
|
|
map[node] = moment;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double
|
2024-02-08 21:54:52 +01:00
|
|
|
ReduceToPiPoleResidue2::current(ParasiticResistor *res)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
return currents_[res];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2024-02-08 21:54:52 +01:00
|
|
|
ReduceToPiPoleResidue2::setCurrent(ParasiticResistor *res,
|
2018-11-26 18:15:52 +01:00
|
|
|
double i)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
currents_[res] = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ReduceToPiPoleResidue2::findPolesResidues(Parasitic *pi_pole_residue,
|
|
|
|
|
const Pin *,
|
|
|
|
|
const Pin *load_pin,
|
|
|
|
|
ParasiticNode *load_node)
|
|
|
|
|
{
|
|
|
|
|
double m1 = moment(load_node, 1);
|
|
|
|
|
double m2 = moment(load_node, 2);
|
|
|
|
|
double m3 = moment(load_node, 3);
|
|
|
|
|
double p1 = -m2 / m3;
|
|
|
|
|
double p2 = p1 * (1.0 / m1 - m1 / m2) / (m1 / m2 - m2 / m3);
|
|
|
|
|
if (p1 <= 0.0
|
|
|
|
|
|| p2 <= 0.0
|
|
|
|
|
// Coincident poles. Not handled by delay calculator.
|
|
|
|
|
|| p1 == p2
|
|
|
|
|
|| m1 / m2 == m2 / m3) {
|
|
|
|
|
double p1 = -1.0 / m1;
|
|
|
|
|
double k1 = 1.0;
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "parasitic_reduce", 3, " load %s p1=%.3g k1=%.3g",
|
|
|
|
|
network_->pathName(load_pin), p1, k1);
|
2018-09-28 17:54:21 +02:00
|
|
|
ComplexFloatSeq *poles = new ComplexFloatSeq(1);
|
|
|
|
|
ComplexFloatSeq *residues = new ComplexFloatSeq(1);
|
2019-04-11 05:36:48 +02:00
|
|
|
(*poles)[0] = ComplexFloat(p1, 0.0);
|
|
|
|
|
(*residues)[0] = ComplexFloat(k1, 0.0);
|
2018-09-28 17:54:21 +02:00
|
|
|
parasitics_->setPoleResidue(pi_pole_residue, load_pin, poles, residues);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
double k1 = p1 * p1 * (1.0 + m1 * p2) / (p1 - p2);
|
|
|
|
|
double k2 = -p2 * p2 * (1.0 + m1 * p1) / (p1 - p2);
|
|
|
|
|
if (k1 < 0.0 && k2 > 0.0) {
|
|
|
|
|
// Swap p1 and p2.
|
|
|
|
|
double p = p2, k = k2;
|
|
|
|
|
p2 = p1;
|
|
|
|
|
k2 = k1;
|
|
|
|
|
p1 = p;
|
|
|
|
|
k1 = k;
|
|
|
|
|
}
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "parasitic_reduce", 3,
|
|
|
|
|
" load %s p1=%.3g p2=%.3g k1=%.3g k2=%.3g",
|
|
|
|
|
network_->pathName(load_pin), p1, p2, k1, k2);
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
ComplexFloatSeq *poles = new ComplexFloatSeq(2);
|
|
|
|
|
ComplexFloatSeq *residues = new ComplexFloatSeq(2);
|
2019-04-11 05:36:48 +02:00
|
|
|
(*poles)[0] = ComplexFloat(p1, 0.0);
|
|
|
|
|
(*residues)[0] = ComplexFloat(k1, 0.0);
|
|
|
|
|
(*poles)[1] = ComplexFloat(p2, 0.0);
|
|
|
|
|
(*residues)[1] = ComplexFloat(k2, 0.0);
|
2018-09-28 17:54:21 +02:00
|
|
|
parasitics_->setPoleResidue(pi_pole_residue, load_pin, poles, residues);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|