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 "Vector.hh" 20 #include "Map.hh" 21 #include "Set.hh" 22 23 namespace sta { 24 25 class Units; 26 class Unit; 27 class LibertyLibrary; 28 class LibertyCell; 29 class LibertyPort; 30 class Pvt; 31 class OperatingConditions; 32 class BusDcl; 33 class ModeDef; 34 class ModeValueDef; 35 class TestCell; 36 class TableTemplate; 37 class Table; 38 class TableModel; 39 class TableAxis; 40 class GateTimingModel; 41 class CheckTimingModel; 42 class ScaleFactors; 43 class Group; 44 class Wireload; 45 class WireloadSelection; 46 class TimingArcSet; 47 class TimingArc; 48 class InternalPower; 49 class LeakagePower; 50 class Sequential; 51 class FuncExpr; 52 class TimingModel; 53 class TimingRole; 54 class Transition; 55 class RiseFall; 56 class RiseFallBoth; 57 class LibertyCellSequentialIterator; 58 59 typedef Vector<LibertyLibrary*> LibertyLibrarySeq; 60 typedef Vector<LibertyCell*> LibertyCellSeq; 61 typedef Vector<Sequential*> SequentialSeq; 62 typedef Map<LibertyCell*, LibertyCellSeq*> LibertyCellEquivMap; 63 typedef Vector<LibertyPort*> LibertyPortSeq; 64 typedef Set<LibertyPort*> LibertyPortSet; 65 typedef std::pair<const LibertyPort*,const LibertyPort*> LibertyPortPair; 66 typedef Set<LibertyCell*> LibertyCellSet; 67 typedef Vector<float> FloatSeq; 68 typedef Vector<FloatSeq*> FloatTable; 69 70 enum class ScaleFactorType : unsigned { 71 pin_cap, 72 wire_cap, 73 wire_res, 74 min_period, 75 // Liberty attributes have rise/fall suffix. 76 cell, 77 hold, 78 setup, 79 recovery, 80 removal, 81 nochange, 82 skew, 83 leakage_power, 84 internal_power, 85 // Liberty attributes have rise/fall prefix. 86 transition, 87 // Liberty attributes have low/high suffix (indexed as rise/fall). 88 min_pulse_width, 89 unknown, 90 }; 91 const int scale_factor_type_count = int(ScaleFactorType::unknown) + 1; 92 // Enough bits to hold a ScaleFactorType enum. 93 const int scale_factor_bits = 4; 94 95 enum class WireloadTree { worst_case, best_case, balanced, unknown }; 96 97 enum class WireloadMode { top, enclosed, segmented, unknown }; 98 99 enum class TimingSense { 100 positive_unate, 101 negative_unate, 102 non_unate, 103 none, 104 unknown 105 }; 106 const int timing_sense_count = int(TimingSense::unknown) + 1; 107 const int timing_sense_bit_count = 3; 108 109 enum class TableAxisVariable { 110 total_output_net_capacitance, 111 equal_or_opposite_output_net_capacitance, 112 input_net_transition, 113 input_transition_time, 114 related_pin_transition, 115 constrained_pin_transition, 116 output_pin_transition, 117 connect_delay, 118 related_out_total_output_net_capacitance, 119 time, 120 iv_output_voltage, 121 input_noise_width, 122 input_noise_height, 123 input_voltage, 124 output_voltage, 125 path_depth, 126 path_distance, 127 normalized_voltage, 128 unknown 129 }; 130 131 enum class PathType { clk, data, clk_and_data }; 132 const int path_type_count = 2; 133 134 // Rise/fall to rise/fall. 135 const int timing_arc_index_bit_count = 2; 136 const int timing_arc_index_max = (1<<timing_arc_index_bit_count)-1; 137 const int timing_arc_set_index_bit_count = 18; 138 const int timing_arc_set_index_max=(1<<timing_arc_set_index_bit_count)-1; 139 140 class LibertyPortNameLess 141 { 142 public: 143 bool operator()(const LibertyPort *port1, const LibertyPort *port2) const; 144 }; 145 146 class LibertyPortPairLess 147 { 148 public: 149 bool operator()(const LibertyPortPair *pair1, 150 const LibertyPortPair *pair2) const; 151 bool operator()(const LibertyPortPair &pair1, 152 const LibertyPortPair &pair2) const; 153 }; 154 155 bool 156 timingArcSetLess(const TimingArcSet *set1, 157 const TimingArcSet *set2); 158 159 class TimingArcSetLess 160 { 161 public: 162 bool operator ()(const TimingArcSet * set1,const TimingArcSet * set2) const163 operator()(const TimingArcSet *set1, 164 const TimingArcSet *set2) const 165 { 166 return timingArcSetLess(set1, set2); 167 } 168 }; 169 170 } // namespace 171