mirror of
https://github.com/The-OpenROAD-Project/OpenSTA.git
synced 2026-05-30 00:24:12 +08:00
commit a78442d7d6672bfcbea5f5007803ab27891b9eab Author: James Cherry <cherry@parallaxsw.com> Date: Sun Jan 7 13:40:02 2024 -0700 rm OutputWaveforms::currentVoltage Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 074e1c93d4957425c0f2a3afdfce8f0e06ff98a1 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Dec 13 16:49:08 2023 -0700 MultiDrvrNet remove instead of update Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 0f6deec2ffcbe85a1c473525b93f6a6514692181 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Dec 13 16:43:24 2023 -0700 MultiDrvrNet remove instead of update Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 2f5f48fe09bacd101d1e909f45e087ba8c620561 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Dec 11 09:24:54 2023 -0700 compile errors Signed-off-by: James Cherry <cherry@parallaxsw.com> commit e8fc4292e325f7ac10bd8e5d57b5a8111abb05ed Author: James Cherry <cherry@parallaxsw.com> Date: Sat Dec 9 18:25:04 2023 -0700 ArcDcalcWaveforms Signed-off-by: James Cherry <cherry@parallaxsw.com> commit be114b10adca194d80ac9529e8635c11ed9c1c32 Author: James Cherry <cherry@parallaxsw.com> Date: Sat Dec 9 11:34:59 2023 -0700 GraphDelayCalc::findDriverArcDelays Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 7b71e137b088c1293e628e594dde6a8223927ee8 Author: James Cherry <cherry@parallaxsw.com> Date: Sat Dec 9 10:39:30 2023 -0700 GraphDelayCalc::findDriverArcDelays Signed-off-by: James Cherry <cherry@parallaxsw.com> commit b13a791cd57c5b9f9b454b3cf22959fbe3b9667e Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 8 13:14:09 2023 -0700 unused arg Signed-off-by: James Cherry <cherry@parallaxsw.com> commit abf90ca7c08fd349cfb68554bdeae5a9c3b91a23 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 8 13:12:52 2023 -0700 unused arg Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 6bda70448ef133586594503d78b8838421f7a52d Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 8 13:10:04 2023 -0700 gateDelay rm pvt arg Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 2f51ed07fa14f039a048c3a146ca1b017fb45f16 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 8 10:24:57 2023 -0700 dcalc api Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 362950b9d9aa52f3c331c1007a6ee6a34140812e Author: James Cherry <cherry@parallaxsw.com> Date: Wed Dec 6 17:00:45 2023 -0700 ArcDcalcResult gateDelay Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 91f1307ac04752e00dfde42b34e84f66fdb60a57 Author: James Cherry <cherry@parallaxsw.com> Date: Mon Dec 4 17:22:40 2023 -0700 ArcDcalcArg/Result Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 74d289e450edf54b1a9215b92c85b1d6a011820d Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 1 17:45:04 2023 -0700 multi drvr init Signed-off-by: James Cherry <cherry@parallaxsw.com> commit c956838aba74c2f27280253f0452e0350bb05c33 Author: James Cherry <cherry@parallaxsw.com> Date: Fri Dec 1 12:10:23 2023 -0800 arc dcalc api Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 5aa2c42833e5f68e901d4ac61d8bef426252e5ab Author: James Cherry <cherry@parallaxsw.com> Date: Thu Nov 30 15:42:43 2023 -0800 dcalc api Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 434327b7d80fdf8fe3410390c88b299b46e9139b Author: James Cherry <cherry@parallaxsw.com> Date: Thu Nov 30 11:36:21 2023 -0800 arc api Signed-off-by: James Cherry <cherry@parallaxsw.com> commit 263e1dee49d7133653fbe0bad9b8243ba5259548 Author: James Cherry <cherry@parallaxsw.com> Date: Wed Nov 29 18:48:32 2023 -0800 ArcDelayCalc api Signed-off-by: James Cherry <cherry@parallaxsw.com> commit a9f05513c09564d75cb377a5a89399a250ab5d6b Author: James Cherry <cherry@parallaxsw.com> Date: Mon Nov 27 10:48:59 2023 -0800 ArcDelayCalc api Signed-off-by: James Cherry <cherry@parallaxsw.com> Signed-off-by: James Cherry <cherry@parallaxsw.com>
316 lines
11 KiB
C++
316 lines
11 KiB
C++
// OpenSTA, Static Timing Analyzer
|
|
// Copyright (c) 2023, Parallax Software, Inc.
|
|
//
|
|
// 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
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include "Map.hh"
|
|
#include "NetworkClass.hh"
|
|
#include "GraphClass.hh"
|
|
#include "SearchClass.hh"
|
|
#include "DcalcAnalysisPt.hh"
|
|
#include "StaState.hh"
|
|
#include "Delay.hh"
|
|
#include "ArcDelayCalc.hh"
|
|
|
|
namespace sta {
|
|
|
|
using std::vector;
|
|
using std::map;
|
|
|
|
class DelayCalcObserver;
|
|
class MultiDrvrNet;
|
|
class FindVertexDelays;
|
|
class NetCaps;
|
|
|
|
typedef Map<const Vertex*, MultiDrvrNet*> MultiDrvrNetMap;
|
|
|
|
// This class traverses the graph calling the arc delay calculator and
|
|
// annotating delays on graph edges.
|
|
class GraphDelayCalc : public StaState
|
|
{
|
|
public:
|
|
GraphDelayCalc(StaState *sta);
|
|
virtual ~GraphDelayCalc();
|
|
virtual void copyState(const StaState *sta);
|
|
// Set the observer for edge delay changes.
|
|
virtual void setObserver(DelayCalcObserver *observer);
|
|
// Invalidate all delays/slews.
|
|
virtual void delaysInvalid();
|
|
// Invalidate vertex and downstream delays/slews.
|
|
virtual void delayInvalid(Vertex *vertex);
|
|
virtual void delayInvalid(const Pin *pin);
|
|
virtual void deleteVertexBefore(Vertex *vertex);
|
|
// Reset to virgin state.
|
|
virtual void clear();
|
|
// Find arc delays and vertex slews thru level.
|
|
virtual void findDelays(Level level);
|
|
// Find and annotate drvr_vertex gate and load delays/slews.
|
|
virtual void findDelays(Vertex *drvr_vertex);
|
|
// Returned string is owned by the caller.
|
|
virtual string reportDelayCalc(const Edge *edge,
|
|
const TimingArc *arc,
|
|
const Corner *corner,
|
|
const MinMax *min_max,
|
|
int digits);
|
|
// Percentage (0.0:1.0) change in delay that causes downstream
|
|
// delays to be recomputed during incremental delay calculation.
|
|
virtual float incrementalDelayTolerance();
|
|
virtual void setIncrementalDelayTolerance(float tol);
|
|
// Load pin_cap + wire_cap.
|
|
virtual float loadCap(const Pin *drvr_pin,
|
|
const RiseFall *drvr_rf,
|
|
const DcalcAnalysisPt *dcalc_ap) const;
|
|
// Load pin_cap + wire_cap including parasitic min/max for rise/fall.
|
|
virtual float loadCap(const Pin *drvr_pin,
|
|
const DcalcAnalysisPt *dcalc_ap) const;
|
|
// pin_cap = net pin capacitances + port external pin capacitance,
|
|
// wire_cap = annotated net capacitance + port external wire capacitance.
|
|
virtual void loadCap(const Pin *drvr_pin,
|
|
const Parasitic *parasitic,
|
|
const RiseFall *rf,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
// Return values.
|
|
float &pin_cap,
|
|
float &wire_cap) const;
|
|
// Load pin_cap + wire_cap including parasitic.
|
|
virtual float loadCap(const Pin *drvr_pin,
|
|
const Parasitic *parasitic,
|
|
const RiseFall *rf,
|
|
const DcalcAnalysisPt *dcalc_ap) const;
|
|
float loadCap(const Pin *drvr_pin,
|
|
const Parasitic *parasitic,
|
|
const RiseFall *rf,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
const MultiDrvrNet *multi_drvr) const;
|
|
virtual void netCaps(const Pin *drvr_pin,
|
|
const RiseFall *rf,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
// Return values.
|
|
float &pin_cap,
|
|
float &wire_cap,
|
|
float &fanout,
|
|
bool &has_set_load) const;
|
|
PinSeq loadPins(Vertex *drvr_vertex);
|
|
LoadPinIndexMap makeLoadPinIndexMap(Vertex *drvr_vertex);
|
|
void findDriverArcDelays(Vertex *drvr_vertex,
|
|
Edge *edge,
|
|
const TimingArc *arc,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
// Precedence:
|
|
// SDF annotation
|
|
// Liberty library
|
|
// (ignores set_min_pulse_width constraint)
|
|
void minPulseWidth(const Pin *pin,
|
|
const RiseFall *hi_low,
|
|
DcalcAPIndex ap_index,
|
|
const MinMax *min_max,
|
|
// Return values.
|
|
float &min_width,
|
|
bool &exists);
|
|
// Precedence:
|
|
// SDF annotation
|
|
// Liberty library
|
|
void minPeriod(const Pin *pin,
|
|
// Return values.
|
|
float &min_period,
|
|
bool &exists);
|
|
|
|
Slew edgeFromSlew(const Vertex *from_vertex,
|
|
const RiseFall *from_rf,
|
|
const Edge *edge,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
|
|
protected:
|
|
void seedInvalidDelays();
|
|
void initSlew(Vertex *vertex);
|
|
void seedRootSlew(Vertex *vertex,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void seedRootSlews();
|
|
void seedDrvrSlew(Vertex *vertex,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void seedNoDrvrSlew(Vertex *drvr_vertex,
|
|
const Pin *drvr_pin,
|
|
const RiseFall *rf,
|
|
DcalcAnalysisPt *dcalc_ap,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void seedNoDrvrCellSlew(Vertex *drvr_vertex,
|
|
const Pin *drvr_pin,
|
|
const RiseFall *rf,
|
|
InputDrive *drive,
|
|
DcalcAnalysisPt *dcalc_ap,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void seedLoadSlew(Vertex *vertex);
|
|
void setInputPortWireDelays(Vertex *vertex);
|
|
void findInputDriverDelay(const LibertyCell *drvr_cell,
|
|
const Pin *drvr_pin,
|
|
Vertex *drvr_vertex,
|
|
const RiseFall *rf,
|
|
const LibertyPort *from_port,
|
|
float *from_slews,
|
|
const LibertyPort *to_port,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
LibertyPort *driveCellDefaultFromPort(const LibertyCell *cell,
|
|
const LibertyPort *to_port);
|
|
int findPortIndex(const LibertyCell *cell,
|
|
const LibertyPort *port);
|
|
void findInputArcDelay(const Pin *drvr_pin,
|
|
Vertex *drvr_vertex,
|
|
const TimingArc *arc,
|
|
float from_slew,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
bool findDriverDelays(Vertex *drvr_vertex,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
MultiDrvrNet *findMultiDrvrNet(Vertex *drvr_pin);
|
|
MultiDrvrNet *makeMultiDrvrNet(PinSet &drvr_pins);
|
|
bool findDriverDelays1(Vertex *drvr_vertex,
|
|
MultiDrvrNet *multi_drvr,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void initLoadSlews(Vertex *drvr_vertex);
|
|
bool findDriverEdgeDelays(Vertex *drvr_vertex,
|
|
const MultiDrvrNet *multi_drvr,
|
|
Edge *edge,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
bool findDriverArcDelays(Vertex *drvr_vertex,
|
|
const MultiDrvrNet *multi_drvr,
|
|
Edge *edge,
|
|
const TimingArc *arc,
|
|
LoadPinIndexMap &load_pin_index_map,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
ArcDcalcArgSeq makeArcDcalcArgs(Vertex *drvr_vertex,
|
|
const MultiDrvrNet *multi_drvr,
|
|
Edge *edge,
|
|
const TimingArc *arc,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void findParallelEdge(Vertex *vertex,
|
|
Edge *drvr_edge,
|
|
const TimingArc *drvr_arc,
|
|
// Return values.
|
|
Edge *&edge,
|
|
const TimingArc *&arc);
|
|
void initWireDelays(Vertex *drvr_vertex);
|
|
void initRootSlews(Vertex *vertex);
|
|
void zeroSlewAndWireDelays(Vertex *drvr_vertex);
|
|
void findVertexDelay(Vertex *vertex,
|
|
ArcDelayCalc *arc_delay_calc,
|
|
bool propagate);
|
|
void enqueueTimingChecksEdges(Vertex *vertex);
|
|
bool annotateDelaysSlews(Edge *edge,
|
|
const TimingArc *arc,
|
|
ArcDcalcResult &dcalc_result,
|
|
LoadPinIndexMap &load_pin_index_map,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
|
|
bool annotateDelaySlew(Edge *edge,
|
|
const TimingArc *arc,
|
|
ArcDelay &gate_delay,
|
|
Slew &gate_slew,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
void annotateLoadDelays(Vertex *drvr_vertex,
|
|
const RiseFall *drvr_rf,
|
|
ArcDcalcResult &dcalc_result,
|
|
LoadPinIndexMap &load_pin_index_map,
|
|
const ArcDelay &extra_delay,
|
|
bool merge,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
void findLatchEdgeDelays(Edge *edge);
|
|
void findCheckEdgeDelays(Edge *edge,
|
|
ArcDelayCalc *arc_delay_calc);
|
|
void deleteMultiDrvrNets();
|
|
Slew checkEdgeClkSlew(const Vertex *from_vertex,
|
|
const RiseFall *from_rf,
|
|
const DcalcAnalysisPt *dcalc_ap);
|
|
bool bidirectDrvrSlewFromLoad(const Vertex *vertex) const;
|
|
MultiDrvrNet *multiDrvrNet(const Vertex *drvr_vertex) const;
|
|
void loadCap(const Parasitic *parasitic,
|
|
bool has_set_load,
|
|
// Return values.
|
|
float &pin_cap,
|
|
float &wire_cap) const;
|
|
|
|
// Observer for edge delay changes.
|
|
DelayCalcObserver *observer_;
|
|
bool delays_seeded_;
|
|
bool incremental_;
|
|
bool delays_exist_;
|
|
// Vertices with invalid -to delays.
|
|
VertexSet *invalid_delays_;
|
|
// Timing check edges with invalid delays.
|
|
EdgeSet invalid_check_edges_;
|
|
// Latch D->Q edges with invalid delays.
|
|
EdgeSet invalid_latch_edges_;
|
|
// shared by invalid_check_edges_ and invalid_latch_edges_
|
|
std::mutex invalid_edge_lock_;
|
|
SearchPred *search_pred_;
|
|
SearchPred *search_non_latch_pred_;
|
|
SearchPred *clk_pred_;
|
|
BfsFwdIterator *iter_;
|
|
MultiDrvrNetMap multi_drvr_net_map_;
|
|
bool multi_drvr_nets_found_;
|
|
// Percentage (0.0:1.0) change in delay that causes downstream
|
|
// delays to be recomputed during incremental delay calculation.
|
|
float incremental_delay_tolerance_;
|
|
|
|
friend class FindVertexDelays;
|
|
friend class MultiDrvrNet;
|
|
};
|
|
|
|
// Abstract base class for edge delay change observer.
|
|
class DelayCalcObserver
|
|
{
|
|
public:
|
|
DelayCalcObserver() {}
|
|
virtual ~DelayCalcObserver() {}
|
|
virtual void delayChangedFrom(Vertex *vertex) = 0;
|
|
virtual void delayChangedTo(Vertex *vertex) = 0;
|
|
virtual void checkDelayChangedTo(Vertex *vertex) = 0;
|
|
};
|
|
|
|
// Nets with multiple drivers (tristate, bidirect or output).
|
|
// Cache net caps to prevent N^2 net pin walk.
|
|
class MultiDrvrNet
|
|
{
|
|
public:
|
|
MultiDrvrNet(VertexSet *drvrs);
|
|
~MultiDrvrNet();
|
|
const VertexSet *drvrs() const { return drvrs_; }
|
|
VertexSet *drvrs() { return drvrs_; }
|
|
bool parallelGates(const Network *network) const;
|
|
Vertex *dcalcDrvr() const { return dcalc_drvr_; }
|
|
void setDcalcDrvr(Vertex *drvr);
|
|
void netCaps(const RiseFall *rf,
|
|
const DcalcAnalysisPt *dcalc_ap,
|
|
// Return values.
|
|
float &pin_cap,
|
|
float &wire_cap,
|
|
float &fanout,
|
|
bool &has_net_load) const;
|
|
void findCaps(const Sdc *sdc);
|
|
|
|
private:
|
|
// Driver that triggers delay calculation for all the drivers on the net.
|
|
Vertex *dcalc_drvr_;
|
|
VertexSet *drvrs_;
|
|
// [drvr_rf->index][dcalc_ap->index]
|
|
vector<NetCaps> net_caps_;
|
|
};
|
|
|
|
} // namespace
|