1 // ***************************************************************************** 2 // ***************************************************************************** 3 // Copyright 2012 - 2014, 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: arakhman $ 24 // $Revision: #11 $ 25 // $Date: 2013/04/23 $ 26 // $State: $ 27 // ***************************************************************************** 28 // ***************************************************************************** 29 30 #ifndef lefrData_h 31 #define lefrData_h 32 33 #include <cstring> 34 #include <string> 35 #include <vector> 36 #include <map> 37 38 #include "lefiDefs.hpp" 39 #include "lefiUser.hpp" 40 #include "lefiLayer.hpp" 41 #include "lefiArray.hpp" 42 #include "lefiUtil.hpp" 43 #include "lefiMacro.hpp" 44 #include "lefiPropType.hpp" 45 #include "lefiCrossTalk.hpp" 46 #include "lefiProp.hpp" 47 #include "lefiNonDefault.hpp" 48 #include "lefiVia.hpp" 49 #include "lefiViaRule.hpp" 50 #include "lefiUnits.hpp" 51 #include "lefrReader.hpp" 52 53 #define CURRENT_VERSION 5.8 54 #define RING_SIZE 10 55 #define IN_BUF_SIZE 16384 56 #define TOKEN_SIZE 4096 57 58 BEGIN_LEFDEF_PARSER_NAMESPACE 59 60 struct lefCompareStrings 61 { operator ()lefCompareStrings62 bool operator()(const std::string &lhs, const std::string &rhs) const { 63 return std::strcmp(lhs.c_str(), rhs.c_str()) < 0; 64 } 65 }; 66 67 typedef std::map<std::string, std::string, lefCompareStrings> lefAliasMap; 68 69 typedef std::map<std::string, std::string, lefCompareStrings> lefStringMap; 70 71 typedef std::map<std::string, int, lefCompareStrings> lefIntMap; 72 73 typedef std::map<std::string, double, lefCompareStrings> lefDoubleMap; 74 75 76 class lefrData { 77 public: 78 lefrData(); 79 ~lefrData(); 80 81 static void reset(); 82 void initRead(); 83 void doubleBuffer(); 84 85 FILE* lefrFile; 86 FILE* lefrLog; 87 88 char lefPropDefType; 89 90 char* arrayName; 91 char* last; 92 char* layerName; 93 char* lefch; 94 char* lefrFileName; 95 char* macroName; 96 char* ndName; 97 char* next; 98 char* nonDefaultRuleName; 99 char* outMsg; 100 char* pinName; 101 char* shiftBuf; 102 char* siteName; 103 char* viaName; 104 char* viaRuleName; 105 106 double layerCutSpacing; 107 double lef_save_x; 108 double lef_save_y; // for interpreting (*) notation of LEF/DEF 109 double leflVal; 110 double lefrVal; 111 double versionNum; 112 113 int antennaInoutWarnings; 114 int antennaInputWarnings; 115 int antennaOutputWarnings; 116 int arrayCutsVal; 117 int arrayCutsWar; 118 int arrayWarnings; 119 int caseSensitiveWarnings; 120 int correctionTableWarnings; 121 int dielectricWarnings; 122 int doneLib; // keep track if the library is done parsing 123 int edgeRateScaleFactorWarnings; 124 int edgeRateThreshold1Warnings; 125 int edgeRateThreshold2Warnings; 126 int encrypted; 127 int first; 128 int first_buffer; 129 int ge56almostDone; // have reached the EXTENSION SECTION 130 int ge56done; // a 5.6 and it has END LIBRARY statement 131 int hasBusBit; 132 int hasDirection; 133 int hasDivChar; 134 int hasFixedMask; 135 int hasGeoLayer; 136 int hasInfluence; 137 int hasLayerMincut; 138 int hasManufactur; 139 int hasMask; 140 int hasMinfeature; 141 int hasNameCase; 142 int hasOpenedLogFile; 143 int hasPRP; 144 int hasParallel; 145 int hasPitch; 146 int hasSamenet; 147 int hasSite; 148 int hasSiteClass; 149 int hasSiteSize; 150 int hasSpCenter; 151 int hasSpLayer; 152 int hasSpParallel; 153 int hasSpSamenet; 154 int hasTwoWidths; 155 int hasType; 156 int hasVer; 157 int hasViaRule_layer; 158 int hasWidth; 159 int hasFatalError; // don't report errors after the file end. 160 int iRDropWarnings; 161 int ignoreVersion; // ignore checking version number 162 int inDefine; 163 int inoutAntennaWarnings; 164 int inputAntennaWarnings; 165 int input_level; 166 int isGenerate; 167 int layerCut; 168 int layerDir; 169 int layerMastOver; 170 int layerRout; 171 int layerWarnings; 172 int lefDefIf; 173 int lefDumbMode; 174 int lefErrMsgPrinted; 175 int lefFixedMask; //All the LEF MACRO PIN MASK assignments can be 176 int lefInfoMsgPrinted; 177 int lefInvalidChar; 178 int lefNdRule; 179 int lefNewIsKeyword; 180 int lefNlToken; 181 int lefNoNum; 182 int lefRetVal; 183 int lefWRetVal; 184 int lefWarnMsgPrinted; 185 int lef_errors; 186 int lef_nlines; 187 int lef_ntokens; 188 int lef_warnings; 189 int lefrDoGcell; 190 int lefrDoGeometries; 191 int lefrDoSite; 192 int lefrDoTrack; 193 int lefrHasLayer; // 5.5 this & lefrHasMaxVS is to keep track that 194 int lefrHasMaxVS; // MAXVIASTACK has to be after all layers 195 int lefrHasSpacing; // keep track of spacing in a layer 196 int lefrHasSpacingTbl; // keep track of spacing table in a layer 197 198 int macroWarnings; 199 int maxStackViaWarnings; 200 int minFeatureWarnings; 201 int msgCnt; 202 int namesCaseSensitive; // always true in 5.6 203 int ndLayer; 204 int ndLayerSpace; 205 int ndLayerWidth; 206 int ndRule; 207 int needGeometry; 208 int noWireExtensionWarnings; 209 int noiseMarginWarnings; 210 int noiseTableWarnings; 211 int nonDefaultWarnings; 212 int numVia; 213 int obsDef; 214 int origDef; 215 int outputAntennaWarnings; 216 int pinDef; 217 int pinWarnings; 218 int prtNewLine; // sometimes need to print a new line 219 int prtSemiColon; // sometimes ; is not printed yet 220 int ringPlace; 221 int shiftBufLength; 222 int siteDef; 223 int siteWarnings; 224 int sizeDef; 225 int spParallelLength; 226 int spaceMissing; 227 int spacingWarnings; 228 int symDef; 229 int timingWarnings; 230 int unitsWarnings; 231 int use5_3; 232 int use5_4; 233 int useLenThr; 234 int useMinSpacingWarnings; 235 int viaLayer; 236 int viaRuleHasDir; 237 int viaRuleHasEnc; 238 int viaRuleLayer; 239 int viaRuleWarnings; 240 int viaWarnings; 241 242 lefiAntennaEnum antennaType; 243 lefiAntennaPWL* lefrAntennaPWLPtr; 244 lefiArray lefrArray; 245 lefiCorrectionTable lefrCorrectionTable; 246 lefiDensity lefrDensity; 247 lefiGcellPattern* lefrGcellPatternPtr; 248 lefiGeometries* lefrGeometriesPtr; 249 lefiIRDrop lefrIRDrop; 250 lefiLayer lefrLayer; 251 lefiMacro lefrMacro; 252 lefiMaxStackVia lefrMaxStackVia; // 5.5 253 lefiMinFeature lefrMinFeature; 254 lefiNoiseMargin lefrNoiseMargin; 255 lefiNoiseTable lefrNoiseTable; 256 lefiNonDefault lefrNonDefault; 257 lefiNonDefault* nd; // PCR 909010 - For VIA in the nondefaultrule 258 lefiNum macroNum; 259 lefiObstruction lefrObstruction; 260 lefiPin lefrPin; 261 lefiProp lefrProp; 262 lefiSite lefrSite; 263 lefiSitePattern* lefrSitePatternPtr; 264 lefiSpacing lefrSpacing; 265 lefiTiming lefrTiming; 266 lefiTrackPattern* lefrTrackPatternPtr; 267 lefiUnits lefrUnits; 268 lefiUseMinSpacing lefrUseMinSpacing; 269 lefiVia lefrVia; 270 lefiViaRule lefrViaRule; 271 272 lefStringMap alias_set; 273 lefDoubleMap define_set; 274 lefIntMap defineb_set; 275 lefStringMap defines_set; 276 int tokenSize; 277 278 //ARRAYS 279 // Ring buffer storage 280 char *ring[RING_SIZE]; 281 int ringSizes[RING_SIZE]; 282 char lefDebug[100]; 283 284 char *current_token; 285 char *pv_token; 286 char *uc_token; 287 288 char current_buffer[IN_BUF_SIZE]; 289 const char *current_stack[20]; // the stack itself 290 291 char lefrErrMsg[1024]; 292 char temp_name[258]; 293 294 std::vector<char> Hist_text; 295 296 // to hold the msg limit, 0 - num of limit 297 // 1 - num of message printed, 4701 = 4700 + 1, message starts on 1 298 // 2 - warning printed 299 int msgLimit[2][MAX_LEF_MSGS]; 300 }; 301 302 extern lefrData *lefData; 303 304 END_LEFDEF_PARSER_NAMESPACE 305 306 #endif 307 308