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 "DisallowCopyAssign.hh" 20 #include "MinMax.hh" 21 #include "LibertyClass.hh" 22 #include "NetworkClass.hh" 23 #include "RiseFallMinMax.hh" 24 25 namespace sta { 26 27 class InputDriveCell; 28 29 // Input drive description from 30 // set_driving_cell 31 // set_drive 32 // set_input_transition 33 class InputDrive 34 { 35 public: 36 explicit InputDrive(); 37 ~InputDrive(); 38 void setSlew(const RiseFallBoth *rf, 39 const MinMaxAll *min_max, 40 float slew); 41 void setDriveResistance(const RiseFallBoth *rf, 42 const MinMaxAll *min_max, 43 float res); 44 void driveResistance(const RiseFall *rf, 45 const MinMax *min_max, 46 float &res, 47 bool &exists); 48 bool hasDriveResistance(const RiseFall *rf, 49 const MinMax *min_max); 50 bool driveResistanceMinMaxEqual(const RiseFall *rf); 51 void setDriveCell(LibertyLibrary *library, 52 LibertyCell *cell, 53 LibertyPort *from_port, 54 float *from_slews, 55 LibertyPort *to_port, 56 const RiseFallBoth *rf, 57 const MinMaxAll *min_max); 58 void driveCell(const RiseFall *rf, 59 const MinMax *min_max, 60 LibertyCell *&cell, 61 LibertyPort *&from_port, 62 float *&from_slews, 63 LibertyPort *&to_port); 64 InputDriveCell *driveCell(const RiseFall *rf, 65 const MinMax *min_max); 66 bool hasDriveCell(const RiseFall *rf, 67 const MinMax *min_max); 68 // True if rise/fall/min/max drive cells are equal. 69 bool driveCellsEqual(); 70 void slew(const RiseFall *rf, 71 const MinMax *min_max, 72 float &slew, 73 bool &exists); slews()74 RiseFallMinMax *slews() { return &slews_; } 75 76 private: 77 DISALLOW_COPY_AND_ASSIGN(InputDrive); 78 79 RiseFallMinMax slews_; 80 RiseFallMinMax drive_resistances_; 81 // Separate rise/fall/min/max drive cells. 82 InputDriveCell *drive_cells_[RiseFall::index_count][MinMax::index_count]; 83 }; 84 85 class InputDriveCell 86 { 87 public: 88 InputDriveCell(LibertyLibrary *library, 89 LibertyCell *cell, 90 LibertyPort *from_port, 91 float *from_slews, 92 LibertyPort *to_port); library() const93 LibertyLibrary *library() const { return library_; } 94 void setLibrary(LibertyLibrary *library); cell() const95 LibertyCell *cell() const { return cell_; } 96 void setCell(LibertyCell *cell); fromPort() const97 LibertyPort *fromPort() const { return from_port_; } 98 void setFromPort(LibertyPort *from_port); fromSlews()99 float *fromSlews() { return from_slews_; } 100 void setFromSlews(float *from_slews); toPort() const101 LibertyPort *toPort() const { return to_port_; } 102 void setToPort(LibertyPort *to_port); 103 bool equal(InputDriveCell *drive) const; 104 105 private: 106 DISALLOW_COPY_AND_ASSIGN(InputDriveCell); 107 108 LibertyLibrary *library_; 109 LibertyCell *cell_; 110 LibertyPort *from_port_; 111 float from_slews_[RiseFall::index_count]; 112 LibertyPort *to_port_; 113 }; 114 115 } // namespace 116