1 // ***************************************************************************** 2 // ***************************************************************************** 3 // Copyright 2012 - 2013, Cadence Design Systems 4 // 5 // This file is part of the Cadence LEF/DEF Open Source 6 // Distribution, Product Version 5.8. 7 // 8 // Licensed under the Apache License, Version 2.0 (the "License"); 9 // you may not use this file except in compliance with the License. 10 // You may obtain a copy of the License at 11 // 12 // http://www.apache.org/licenses/LICENSE-2.0 13 // 14 // Unless required by applicable law or agreed to in writing, software 15 // distributed under the License is distributed on an "AS IS" BASIS, 16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 17 // implied. See the License for the specific language governing 18 // permissions and limitations under the License. 19 // 20 // For updates, support, or to become part of the LEF/DEF Community, 21 // check www.openeda.org for details. 22 // 23 // $Author: dell $ 24 // $Revision: #1 $ 25 // $Date: 2017/06/06 $ 26 // $State: $ 27 // ***************************************************************************** 28 // ***************************************************************************** 29 30 #ifndef lefiViaRule_h 31 #define lefiViaRule_h 32 33 #include <stdio.h> 34 #include "lefiKRDefs.hpp" 35 36 BEGIN_LEFDEF_PARSER_NAMESPACE 37 38 class lefiViaRuleLayer { 39 public: 40 lefiViaRuleLayer(); 41 void Init(); 42 43 void Destroy(); 44 ~lefiViaRuleLayer(); 45 void clearLayerOverhang(); 46 47 void setName(const char* name); 48 void setHorizontal(); 49 void setVertical(); 50 void setEnclosure(double overhang1, double overhang2); // 5.5 51 void setWidth(double minW, double maxW); 52 void setOverhang(double d); 53 void setOverhangToEnclosure(double d); // 5.6 54 void setMetalOverhang(double d); 55 void setResistance(double d); 56 void setSpacing(double x, double y); 57 void setRect(double xl, double yl, double xh, double yh); 58 59 int hasDirection() const ; 60 int hasEnclosure() const ; // 5.5 61 int hasWidth() const ; 62 int hasResistance() const ; 63 int hasOverhang() const ; 64 int hasMetalOverhang() const ; 65 int hasSpacing() const ; 66 int hasRect() const ; 67 68 char* name() const ; 69 int isHorizontal() const ; 70 int isVertical() const ; 71 double enclosureOverhang1() const; // 5.5 72 double enclosureOverhang2() const; // 5.5 73 double widthMin() const ; 74 double widthMax() const ; 75 double overhang() const ; 76 double metalOverhang() const ; 77 double resistance() const ; 78 double spacingStepX() const ; 79 double spacingStepY() const ; 80 double xl() const ; 81 double yl() const ; 82 double xh() const ; 83 double yh() const ; 84 85 // Debug print 86 void print(FILE* f) const; 87 88 protected: 89 char* name_; 90 char direction_; 91 double overhang1_; // 5.5 92 double overhang2_; // 5.5 93 int hasWidth_; 94 int hasResistance_; 95 int hasOverhang_; 96 int hasMetalOverhang_; 97 int hasSpacing_; 98 int hasRect_; 99 double widthMin_; 100 double widthMax_; 101 double overhang_; 102 double metalOverhang_; 103 double resistance_; 104 double spacingStepX_; 105 double spacingStepY_; 106 double xl_, yl_, xh_, yh_; 107 }; 108 109 class lefiViaRule { 110 public: 111 lefiViaRule(); 112 void Init(); 113 114 void clear(); 115 void clearLayerOverhang(); 116 117 void Destroy(); 118 ~lefiViaRule(); 119 120 void setGenerate(); 121 void setDefault(); 122 123 // This should clear out all the old stuff. 124 void setName(const char* name); 125 126 // Add one of possibly many via names 127 void addViaName(const char* name); 128 129 // These routines set a part of the active layer. 130 void setRect(double xl, double yl, double xh, double yh); 131 void setSpacing(double x, double y); 132 void setWidth(double x, double y); 133 void setResistance(double d); 134 void setOverhang(double d); 135 void setOverhangToEnclosure(double d); // 5.6 136 void setMetalOverhang(double d); 137 void setVertical(); 138 void setHorizontal(); 139 void setEnclosure(double overhang1, double overhang2); 140 void addProp(const char* name, const char* value, const char type); 141 void addNumProp(const char* name, const double d, 142 const char* value, const char type); 143 144 // This routine sets and creates the active layer. 145 void setLayer(const char* name); 146 147 int hasGenerate() const ; 148 int hasDefault() const ; 149 char* name() const ; 150 151 // There are 2 or 3 layers in a rule. 152 // numLayers() tells how many. 153 // If a third layer exists then it is the cut layer. 154 int numLayers() const ; 155 lefiViaRuleLayer* layer(int index) const; 156 157 int numVias() const ; 158 char* viaName(int index) const ; 159 160 int numProps() const; 161 const char* propName(int index) const; 162 const char* propValue(int index) const; 163 double propNumber(int index) const; 164 char propType(int index) const; 165 int propIsNumber(int index) const; 166 int propIsString(int index) const; 167 168 // Debug print 169 void print(FILE* f) const; 170 171 protected: 172 char* name_; 173 int nameSize_; 174 175 int hasGenerate_; 176 int hasDefault_; 177 178 int numLayers_; 179 lefiViaRuleLayer layers_[3]; 180 181 int numVias_; 182 int viasAllocated_; 183 char** vias_; 184 185 int numProps_; 186 int propsAllocated_; 187 char** names_; 188 char** values_; 189 double* dvalues_; 190 char* types_; 191 }; 192 193 END_LEFDEF_PARSER_NAMESPACE 194 195 USE_LEFDEF_PARSER_NAMESPACE 196 197 #endif 198