2018-09-28 17:54:21 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2024-01-12 01:34:49 +01:00
|
|
|
// Copyright (c) 2024, 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/>.
|
2018-09-28 17:54:21 +02:00
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "LumpedCapDelayCalc.hh"
|
2020-04-05 20:35:51 +02:00
|
|
|
|
2023-06-15 20:04:22 +02:00
|
|
|
#include <cmath> // isnan
|
|
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "Debug.hh"
|
|
|
|
|
#include "Units.hh"
|
|
|
|
|
#include "TimingArc.hh"
|
|
|
|
|
#include "TimingModel.hh"
|
|
|
|
|
#include "Liberty.hh"
|
|
|
|
|
#include "Network.hh"
|
|
|
|
|
#include "Sdc.hh"
|
|
|
|
|
#include "Parasitics.hh"
|
|
|
|
|
#include "DcalcAnalysisPt.hh"
|
|
|
|
|
#include "GraphDelayCalc.hh"
|
2018-09-28 17:54:21 +02:00
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2023-06-15 20:04:22 +02:00
|
|
|
using std::isnan;
|
|
|
|
|
|
2018-09-28 17:54:21 +02:00
|
|
|
ArcDelayCalc *
|
|
|
|
|
makeLumpedCapDelayCalc(StaState *sta)
|
|
|
|
|
{
|
|
|
|
|
return new LumpedCapDelayCalc(sta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LumpedCapDelayCalc::LumpedCapDelayCalc(StaState *sta) :
|
2023-11-19 18:04:45 +01:00
|
|
|
ParallelDelayCalc(sta)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArcDelayCalc *
|
|
|
|
|
LumpedCapDelayCalc::copy()
|
|
|
|
|
{
|
|
|
|
|
return new LumpedCapDelayCalc(this);
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-11 05:36:48 +02:00
|
|
|
Parasitic *
|
2018-09-28 17:54:21 +02:00
|
|
|
LumpedCapDelayCalc::findParasitic(const Pin *drvr_pin,
|
2019-11-11 23:30:19 +01:00
|
|
|
const RiseFall *rf,
|
2019-04-11 05:36:48 +02:00
|
|
|
const DcalcAnalysisPt *dcalc_ap)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2023-10-01 21:00:18 +02:00
|
|
|
Parasitic *parasitic = nullptr;
|
2023-01-19 19:23:45 +01:00
|
|
|
const Corner *corner = dcalc_ap->corner();
|
2024-01-09 02:02:01 +01:00
|
|
|
// set_load net has precedence over parasitics.
|
2023-01-19 19:23:45 +01:00
|
|
|
if (!sdc_->drvrPinHasWireCap(drvr_pin, corner)) {
|
2018-09-28 17:54:21 +02:00
|
|
|
const ParasiticAnalysisPt *parasitic_ap = dcalc_ap->parasiticAnalysisPt();
|
2019-04-19 03:01:10 +02:00
|
|
|
if (parasitics_->haveParasitics()) {
|
|
|
|
|
// Prefer PiElmore.
|
2019-11-11 23:30:19 +01:00
|
|
|
parasitic = parasitics_->findPiElmore(drvr_pin, rf, parasitic_ap);
|
2023-10-01 21:00:18 +02:00
|
|
|
if (parasitic == nullptr) {
|
|
|
|
|
Parasitic *parasitic_network =
|
|
|
|
|
parasitics_->findParasiticNetwork(drvr_pin, parasitic_ap);
|
|
|
|
|
if (parasitic_network) {
|
|
|
|
|
parasitics_->reduceToPiElmore(parasitic_network, drvr_pin,
|
|
|
|
|
dcalc_ap->operatingConditions(),
|
|
|
|
|
corner,
|
|
|
|
|
dcalc_ap->constraintMinMax(),
|
|
|
|
|
parasitic_ap);
|
|
|
|
|
parasitic = parasitics_->findPiElmore(drvr_pin, rf, parasitic_ap);
|
|
|
|
|
reduced_parasitic_drvrs_.push_back(drvr_pin);
|
|
|
|
|
}
|
2019-04-19 03:01:10 +02:00
|
|
|
}
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2023-10-01 21:00:18 +02:00
|
|
|
else {
|
|
|
|
|
const MinMax *cnst_min_max = dcalc_ap->constraintMinMax();
|
|
|
|
|
Wireload *wireload = sdc_->wireload(cnst_min_max);
|
|
|
|
|
if (wireload) {
|
|
|
|
|
float pin_cap, wire_cap, fanout;
|
2023-11-19 18:04:45 +01:00
|
|
|
bool has_net_load;
|
2023-10-01 21:00:18 +02:00
|
|
|
graph_delay_calc_->netCaps(drvr_pin, rf, dcalc_ap,
|
2023-11-19 18:04:45 +01:00
|
|
|
pin_cap, wire_cap, fanout, has_net_load);
|
2023-10-01 21:00:18 +02:00
|
|
|
parasitic = parasitics_->estimatePiElmore(drvr_pin, rf, wireload,
|
|
|
|
|
fanout, pin_cap,
|
|
|
|
|
dcalc_ap->operatingConditions(),
|
|
|
|
|
corner,
|
|
|
|
|
cnst_min_max,
|
|
|
|
|
parasitic_ap);
|
|
|
|
|
// Estimated parasitics are not recorded in the "database", so save
|
|
|
|
|
// it for deletion after the drvr pin delay calc is finished.
|
|
|
|
|
if (parasitic)
|
|
|
|
|
unsaved_parasitics_.push_back(parasitic);
|
|
|
|
|
}
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-10-01 21:00:18 +02:00
|
|
|
return parasitic;
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
2024-01-07 21:44:04 +01:00
|
|
|
ArcDcalcResult
|
|
|
|
|
LumpedCapDelayCalc::inputPortDelay(const Pin *,
|
|
|
|
|
float in_slew,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
const Parasitic *,
|
|
|
|
|
const LoadPinIndexMap &load_pin_index_map,
|
|
|
|
|
const DcalcAnalysisPt *)
|
2020-12-01 03:25:27 +01:00
|
|
|
{
|
2024-01-07 21:44:04 +01:00
|
|
|
const LibertyLibrary *drvr_library = network_->defaultLibertyLibrary();
|
|
|
|
|
return makeResult(drvr_library,rf, 0.0, in_slew, load_pin_index_map);
|
2020-12-01 03:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
2024-01-07 21:44:04 +01:00
|
|
|
ArcDcalcResult
|
|
|
|
|
LumpedCapDelayCalc::gateDelay(const Pin *drvr_pin,
|
|
|
|
|
const TimingArc *arc,
|
2018-09-28 17:54:21 +02:00
|
|
|
const Slew &in_slew,
|
|
|
|
|
float load_cap,
|
2024-01-07 21:44:04 +01:00
|
|
|
const Parasitic *,
|
|
|
|
|
const LoadPinIndexMap &load_pin_index_map,
|
|
|
|
|
const DcalcAnalysisPt *dcalc_ap)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
GateTimingModel *model = gateModel(arc, dcalc_ap);
|
2021-01-01 20:46:51 +01:00
|
|
|
debugPrint(debug_, "delay_calc", 3,
|
2024-01-07 21:44:04 +01:00
|
|
|
" in_slew = %s load_cap = %s lumped",
|
2021-01-01 20:46:51 +01:00
|
|
|
delayAsString(in_slew, this),
|
2024-01-07 21:44:04 +01:00
|
|
|
units()->capacitanceUnit()->asString(load_cap));
|
|
|
|
|
const RiseFall *rf = arc->toEdge()->asRiseFall();
|
|
|
|
|
const LibertyLibrary *drvr_library = arc->to()->libertyLibrary();
|
2018-09-28 17:54:21 +02:00
|
|
|
if (model) {
|
2024-01-07 21:44:04 +01:00
|
|
|
ArcDelay gate_delay;
|
|
|
|
|
Slew drvr_slew;
|
2018-09-28 17:54:21 +02:00
|
|
|
float in_slew1 = delayAsFloat(in_slew);
|
2022-09-22 20:45:10 +02:00
|
|
|
// NaNs cause seg faults during table lookup.
|
2024-01-07 21:44:04 +01:00
|
|
|
if (isnan(load_cap) || isnan(delayAsFloat(in_slew)))
|
2024-01-08 03:23:53 +01:00
|
|
|
report_->error(1350, "gate delay input variable is NaN");
|
2024-01-07 21:44:04 +01:00
|
|
|
model->gateDelay(pinPvt(drvr_pin, dcalc_ap), in_slew1, load_cap, pocv_enabled_,
|
|
|
|
|
gate_delay, drvr_slew);
|
|
|
|
|
return makeResult(drvr_library, rf, gate_delay, drvr_slew, load_pin_index_map);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2024-01-07 21:44:04 +01:00
|
|
|
else
|
|
|
|
|
return makeResult(drvr_library, rf, delay_zero, delay_zero, load_pin_index_map);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
2024-01-07 21:44:04 +01:00
|
|
|
ArcDcalcResult
|
|
|
|
|
LumpedCapDelayCalc::makeResult(const LibertyLibrary *drvr_library,
|
|
|
|
|
const RiseFall *rf,
|
|
|
|
|
ArcDelay gate_delay,
|
|
|
|
|
Slew drvr_slew,
|
|
|
|
|
const LoadPinIndexMap &load_pin_index_map)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
2024-01-07 21:44:04 +01:00
|
|
|
ArcDcalcResult dcalc_result(load_pin_index_map.size());
|
|
|
|
|
dcalc_result.setGateDelay(gate_delay);
|
|
|
|
|
dcalc_result.setDrvrSlew(drvr_slew);
|
|
|
|
|
|
|
|
|
|
for (auto load_pin_index : load_pin_index_map) {
|
|
|
|
|
const Pin *load_pin = load_pin_index.first;
|
|
|
|
|
size_t load_idx = load_pin_index.second;
|
|
|
|
|
ArcDelay wire_delay = 0.0;
|
|
|
|
|
thresholdAdjust(load_pin, drvr_library, rf, wire_delay, drvr_slew);
|
|
|
|
|
dcalc_result.setWireDelay(load_idx, wire_delay);
|
|
|
|
|
dcalc_result.setLoadSlew(load_idx, drvr_slew);
|
|
|
|
|
}
|
|
|
|
|
return dcalc_result;
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-24 23:15:57 +01:00
|
|
|
string
|
2024-01-07 21:44:04 +01:00
|
|
|
LumpedCapDelayCalc::reportGateDelay(const Pin *check_pin,
|
|
|
|
|
const TimingArc *arc,
|
|
|
|
|
const Slew &in_slew,
|
|
|
|
|
float load_cap,
|
|
|
|
|
const Parasitic *,
|
|
|
|
|
const LoadPinIndexMap &,
|
|
|
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
|
|
|
int digits)
|
2018-09-28 17:54:21 +02:00
|
|
|
{
|
|
|
|
|
GateTimingModel *model = gateModel(arc, dcalc_ap);
|
|
|
|
|
if (model) {
|
|
|
|
|
float in_slew1 = delayAsFloat(in_slew);
|
2024-01-07 21:44:04 +01:00
|
|
|
return model->reportGateDelay(pinPvt(check_pin, dcalc_ap), in_slew1, load_cap,
|
2023-11-19 18:04:45 +01:00
|
|
|
false, digits);
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
2023-03-24 23:15:57 +01:00
|
|
|
return "";
|
2018-09-28 17:54:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|