1 // OpenSTA, Static Timing Analyzer 2 // Copyright (c) 2020, Parallax Software, Inc. 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17 #pragma once 18 19 #include <string> 20 #include "DisallowCopyAssign.hh" 21 #include "GraphClass.hh" 22 #include "DcalcAnalysisPt.hh" 23 #include "StaState.hh" 24 25 namespace sta { 26 27 using std::string; 28 29 class BfsFwdIterator; 30 class SearchPred; 31 class DelayCalcObserver; 32 class Parasitic; 33 class Corner; 34 35 // Base class for graph delay calculator. 36 // This class annotates the arc delays and slews on the graph by calling 37 // the timing arc delay calculation primitive through an implementation 38 // of the ArcDelayCalc abstract class. 39 // This class does not traverse the graph or call an arc delay 40 // calculator. Use it with applications that use an external delay 41 // calculator and annotate all edge delays. 42 class GraphDelayCalc : public StaState 43 { 44 public: 45 explicit GraphDelayCalc(StaState *sta); ~GraphDelayCalc()46 virtual ~GraphDelayCalc() {} 47 virtual void copyState(const StaState *sta); 48 // Find arc delays and vertex slews thru level. findDelays(Level)49 virtual void findDelays(Level /* level */) {}; 50 // Find and annotate drvr_vertex gate and load delays/slews. findDelays(Vertex *)51 virtual void findDelays(Vertex * /* drvr_vertex */) {}; 52 // Invalidate all delays/slews. delaysInvalid()53 virtual void delaysInvalid() {}; 54 // Invalidate vertex and downstream delays/slews. delayInvalid(Vertex *)55 virtual void delayInvalid(Vertex * /* vertex */) {} 56 ; delayInvalid(const Pin *)57 virtual void delayInvalid(const Pin * /* pin */) {}; deleteVertexBefore(Vertex *)58 virtual void deleteVertexBefore(Vertex * /* vertex */) {}; 59 // Reset to virgin state. clear()60 virtual void clear() {} 61 // Returned string is owned by the caller. 62 virtual string *reportDelayCalc(Edge *edge, 63 TimingArc *arc, 64 const Corner *corner, 65 const MinMax *min_max, 66 int digits); 67 // Percentage (0.0:1.0) change in delay that causes downstream 68 // delays to be recomputed during incremental delay calculation. 69 virtual float incrementalDelayTolerance(); setIncrementalDelayTolerance(float)70 virtual void setIncrementalDelayTolerance(float /* tol */) {} 71 // Set the observer for edge delay changes. 72 virtual void setObserver(DelayCalcObserver *observer); 73 // pin_cap = net pin capacitances + port external pin capacitance, 74 // wire_cap = annotated net capacitance + port external wire capacitance. 75 virtual void loadCap(const Pin *drvr_pin, 76 Parasitic *drvr_parasitic, 77 const RiseFall *rf, 78 const DcalcAnalysisPt *dcalc_ap, 79 // Return values. 80 float &pin_cap, 81 float &wire_cap) const; 82 // Load pin_cap + wire_cap including parasitic. 83 virtual float loadCap(const Pin *drvr_pin, 84 const RiseFall *to_rf, 85 const DcalcAnalysisPt *dcalc_ap) const; 86 // Load pin_cap + wire_cap including parasitic min/max for rise/fall. 87 virtual float loadCap(const Pin *drvr_pin, 88 const DcalcAnalysisPt *dcalc_ap) const; 89 // Load pin_cap + wire_cap. 90 virtual float loadCap(const Pin *drvr_pin, 91 Parasitic *drvr_parasitic, 92 const RiseFall *rf, 93 const DcalcAnalysisPt *dcalc_ap) const; 94 virtual void netCaps(const Pin *drvr_pin, 95 const RiseFall *rf, 96 const DcalcAnalysisPt *dcalc_ap, 97 // Return values. 98 float &pin_cap, 99 float &wire_cap, 100 float &fanout, 101 bool &has_set_load) const; 102 virtual float ceff(Edge *edge, 103 TimingArc *arc, 104 const DcalcAnalysisPt *dcalc_ap); 105 // Precedence: 106 // SDF annotation 107 // Liberty library 108 // (ignores set_min_pulse_width constraint) 109 void minPulseWidth(const Pin *pin, 110 const RiseFall *hi_low, 111 DcalcAPIndex ap_index, 112 const MinMax *min_max, 113 // Return values. 114 float &min_width, 115 bool &exists); 116 // Precedence: 117 // SDF annotation 118 // Liberty library 119 void minPeriod(const Pin *pin, 120 // Return values. 121 float &min_period, 122 bool &exists); 123 124 private: 125 DISALLOW_COPY_AND_ASSIGN(GraphDelayCalc); 126 }; 127 128 // Abstract base class for edge delay change observer. 129 class DelayCalcObserver 130 { 131 public: DelayCalcObserver()132 DelayCalcObserver() {} ~DelayCalcObserver()133 virtual ~DelayCalcObserver() {} 134 virtual void delayChangedFrom(Vertex *vertex) = 0; 135 virtual void delayChangedTo(Vertex *vertex) = 0; 136 virtual void checkDelayChangedTo(Vertex *vertex) = 0; 137 138 private: 139 DISALLOW_COPY_AND_ASSIGN(DelayCalcObserver); 140 }; 141 142 } // namespace 143