1 // OpenSTA, Static Timing Analyzer
2 // Copyright (c) 2021, 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 "ArcDelayCalc.hh"
20 
21 namespace sta {
22 
23 // Liberty table model lumped capacitance arc delay calculator.
24 // Wire delays are zero.
25 class LumpedCapDelayCalc : public ArcDelayCalc
26 {
27 public:
28   LumpedCapDelayCalc(StaState *sta);
29   virtual ArcDelayCalc *copy();
30   virtual Parasitic *findParasitic(const Pin *drvr_pin,
31 				   const RiseFall *rf,
32 				   const DcalcAnalysisPt *dcalc_ap);
33   virtual ReducedParasiticType reducedParasiticType() const;
34   virtual void inputPortDelay(const Pin *port_pin,
35 			      float in_slew,
36 			      const RiseFall *rf,
37 			      Parasitic *parasitic,
38 			      const DcalcAnalysisPt *dcalc_ap);
39   virtual void gateDelay(const LibertyCell *drvr_cell,
40 			 TimingArc *arc,
41 			 const Slew &in_slew,
42 			 float load_cap,
43 			 Parasitic *drvr_parasitic,
44 			 float related_out_cap,
45 			 const Pvt *pvt,
46 			 const DcalcAnalysisPt *dcalc_ap,
47 			 // Return values.
48 			 ArcDelay &gate_delay,
49 			 Slew &drvr_slew);
50   virtual void setMultiDrvrSlewFactor(float factor);
51   virtual void loadDelay(const Pin *load_pin,
52 			 // Return values.
53 			 ArcDelay &wire_delay,
54 			 Slew &load_slew);
55   virtual void checkDelay(const LibertyCell *cell,
56 			  TimingArc *arc,
57 			  const Slew &from_slew,
58 			  const Slew &to_slew,
59 			  float related_out_cap,
60 			  const Pvt *pvt,
61 			  const DcalcAnalysisPt *dcalc_ap,
62 			  // Return values.
63 			  ArcDelay &margin);
64   virtual float ceff(const LibertyCell *drvr_cell,
65 		     TimingArc *arc,
66 		     const Slew &in_slew,
67 		     float load_cap,
68 		     Parasitic *drvr_parasitic,
69 		     float related_out_cap,
70 		     const Pvt *pvt,
71 		     const DcalcAnalysisPt *dcalc_ap);
72   virtual void reportGateDelay(const LibertyCell *drvr_cell,
73 			       TimingArc *arc,
74 			       const Slew &in_slew,
75 			       float load_cap,
76 			       Parasitic *drvr_parasitic,
77 			       float related_out_cap,
78 			       const Pvt *pvt,
79 			       const DcalcAnalysisPt *dcalc_ap,
80 			       int digits,
81 			       string *result);
82   virtual void reportCheckDelay(const LibertyCell *cell,
83 				TimingArc *arc,
84 				const Slew &from_slew,
85 				const char *from_slew_annotation,
86 				const Slew &to_slew,
87 				float related_out_cap,
88 				const Pvt *pvt,
89 				const DcalcAnalysisPt *dcalc_ap,
90 				int digits,
91 				string *result);
92   virtual void finishDrvrPin();
93 
94 protected:
95   // Find the liberty library to use for logic/slew thresholds.
96   LibertyLibrary *thresholdLibrary(const Pin *load_pin);
97   // Adjust load_delay and load_slew from driver thresholds to load thresholds.
98   void thresholdAdjust(const Pin *load_pin,
99 		       ArcDelay &load_delay,
100 		       Slew &load_slew);
101 
102   Slew drvr_slew_;
103   float multi_drvr_slew_factor_;
104   const LibertyLibrary *drvr_library_;
105   const RiseFall *drvr_rf_;
106   // Parasitics returned by findParasitic that are reduced or estimated
107   // that can be deleted after delay calculation for the driver pin
108   // is finished.
109   Vector<Parasitic*> unsaved_parasitics_;
110   Vector<const Pin *> reduced_parasitic_drvrs_;
111 };
112 
113 ArcDelayCalc *
114 makeLumpedCapDelayCalc(StaState *sta);
115 
116 } // namespace
117