1 // *****************************************************************************
2 // *****************************************************************************
3 // Copyright 2012 - 2015, 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 lefiLayer_h
31 #define lefiLayer_h
32 
33 #include <stdio.h>
34 #include "lefiKRDefs.hpp"
35 #include "lefiMisc.hpp"
36 
37 BEGIN_LEFDEF_PARSER_NAMESPACE
38 
39 typedef enum lefiAntennaEnum {
40   lefiAntennaAR,
41   lefiAntennaDAR,
42   lefiAntennaCAR,
43   lefiAntennaCDAR,
44   lefiAntennaAF,
45   lefiAntennaSAR,
46   lefiAntennaDSAR,
47   lefiAntennaCSAR,
48   lefiAntennaCDSAR,
49   lefiAntennaSAF,
50   lefiAntennaO,
51   lefiAntennaADR
52 } lefiAntennaEnum;
53 
54 class lefiAntennaPWL {
55 public:
56   lefiAntennaPWL();
57   ~lefiAntennaPWL();
58 
59   lefiAntennaPWL(const lefiAntennaPWL& prev);
60   static lefiAntennaPWL* create();
61   void Init();
62   void clear();
63   void Destroy();
64 
65   void addAntennaPWL(double d, double r);
66 
67   int  numPWL() const;
68   double PWLdiffusion(int index);
69   double PWLratio(int index);
70 
71 protected:
72   int numAlloc_;
73   int numPWL_;
74   double* d_;
75   double* r_;
76 };
77 
78 class lefiLayerDensity {
79 public:
80   lefiLayerDensity();
81   ~lefiLayerDensity();
82 
83   lefiLayerDensity(const lefiLayerDensity& prev);
84   void Init(const char* type);
85   void Destroy();
86   void clear();
87 
88 
89   void setOneEntry(double entry);
90   void addFrequency(int num, double* frequency);
91   void addWidth(int num, double* width);
92   void addTableEntry(int num, double* entry);
93   void addCutarea(int num, double* cutarea);
94 
95   char* type() const;
96   int hasOneEntry() const;
97   double oneEntry() const;
98   int numFrequency() const;
99   double frequency(int index) const;
100   int numWidths() const;
101   double width(int index) const;
102   int numTableEntries() const;
103   double tableEntry(int index) const;
104   int numCutareas() const;
105   double cutArea(int index) const;
106 
107 protected:
108   char* type_;
109   double oneEntry_;
110   int numFrequency_;
111   double* frequency_;
112   int numWidths_;
113   double* widths_;
114   int numTableEntries_;
115   double* tableEntries_;
116   int numCutareas_;
117   double* cutareas_;
118 };
119 
120 // 5.5
121 class lefiParallel {
122 public:
123   lefiParallel();
124   ~lefiParallel();
125 
126   LEF_COPY_CONSTRUCTOR_H(lefiParallel);
127   LEF_ASSIGN_OPERATOR_H(lefiParallel);
128   void Init();
129   void clear();
130   void Destroy();
131 
132   void addParallelLength(int numLength, double* lengths);
133   void addParallelWidth(double width);
134   void addParallelWidthSpacing(int numSpacing, double* spacings);
135 
136   int  numLength() const;
137   int  numWidth() const;
138   double length(int iLength) const;
139   double width(int iWidth) const;
140   double widthSpacing(int iWidth, int iWidthSpacing) const;
141 
142 protected:
143   int numLength_;
144   int numWidth_;
145   int numWidthAllocated_;
146   double* length_;
147   double* width_;
148   double* widthSpacing_;
149 };
150 
151 // 5.5
152 class lefiInfluence {
153 public:
154   lefiInfluence();
155   ~lefiInfluence();
156 
157   LEF_COPY_CONSTRUCTOR_H (lefiInfluence);
158   LEF_ASSIGN_OPERATOR_H (lefiInfluence);
159   void Init();
160   void clear();
161   void Destroy();
162 
163   void addInfluence(double width, double distance, double spacing);
164 
165   int  numInfluenceEntry() const;
166   double width(int index) const;
167   double distance(int index) const;
168   double spacing(int index) const;
169 
170 protected:
171   int numAllocated_;
172   int numWidth_;
173   int numDistance_;
174   int numSpacing_;
175   double* width_;
176   double* distance_;
177   double* spacing_;
178 };
179 
180 // 5.7
181 class lefiTwoWidths {
182 public:
183   lefiTwoWidths();
184   ~lefiTwoWidths();
185 
186   lefiTwoWidths(const lefiTwoWidths& prev);
187   void Init();
188   void clear();
189   void Destroy();
190 
191   void addTwoWidths(double width, double runLength, int numSpacing,
192                     double* spacings, int hasPRL = 0);
193 
194   int    numWidth() const;
195   double width(int iWidth) const;
196   int    hasWidthPRL(int iWidth) const;
197   double widthPRL(int iWidth) const;
198   int    numWidthSpacing(int iWidth) const;
199   double widthSpacing(int iWidth, int iWidthSpacing) const;
200 
201 protected:
202   int numWidth_;
203   int numWidthAllocated_;
204   double* width_;
205   double* prl_;
206   int*    hasPRL_;
207   int*    numWidthSpacing_;   // each slot contains number of spacing of slot
208   double* widthSpacing_;
209   int*    atNsp_;             // accumulate total number of spacing
210 };
211 
212 // 5.5
213 class lefiSpacingTable {
214 public:
215   lefiSpacingTable();
216   ~lefiSpacingTable();
217 
218   LEF_COPY_CONSTRUCTOR_H(lefiSpacingTable);
219   LEF_ASSIGN_OPERATOR_H(lefiSpacingTable);
220   void Init();
221   void clear();
222   void Destroy();
223 
224   void addParallelLength(int numLength, double* lengths);
225   void addParallelWidth(double width);
226   void addParallelWidthSpacing(int numSpacing, double* spacing);
227   void setInfluence();
228   void addInfluence(double width, double distance, double spacing);
229   void addTwoWidths(double width, double runLength, int numSpacing,
230                     double* spacing, int hasPRL = 0);          // 5.7
231 
232   int isInfluence() const;
233   lefiInfluence* influence() const;
234   int isParallel() const;
235   lefiParallel*  parallel() const;
236   lefiTwoWidths* twoWidths() const;           // 5.7
237 
238 protected:
239   int hasInfluence_;
240   lefiInfluence*   influence_;
241   lefiParallel*    parallel_;
242   lefiTwoWidths*   twoWidths_;               // 5.7
243 };
244 
245 // 5.7
246 class lefiOrthogonal {
247 public:
248   lefiOrthogonal();
249   ~lefiOrthogonal();
250 
251   LEF_COPY_CONSTRUCTOR_H( lefiOrthogonal );
252   LEF_ASSIGN_OPERATOR_H( lefiOrthogonal );
253   void Init();
254   void Destroy();
255 
256   void addOrthogonal(double cutWithin, double ortho);
257 
258   int  numOrthogonal() const;
259   double cutWithin(int index) const;
260   double orthoSpacing(int index) const;
261 
262 protected:
263   int numAllocated_;
264   int numCutOrtho_;
265   double* cutWithin_;
266   double* ortho_;
267 };
268 
269 // 5.5
270 class lefiAntennaModel {
271 public:
272   lefiAntennaModel();
273   ~lefiAntennaModel();
274 
275   lefiAntennaModel( const lefiAntennaModel& prev);
276   void Init();
277   void Destroy();
278 
279   void setAntennaModel(int oxide);
280   void setAntennaAreaRatio(double value);
281   void setAntennaCumAreaRatio(double value);
282   void setAntennaAreaFactor(double value);
283   void setAntennaSideAreaRatio(double value);
284   void setAntennaCumSideAreaRatio(double value);
285   void setAntennaSideAreaFactor(double value);
286   void setAntennaValue(lefiAntennaEnum antennaType, double value);
287   void setAntennaDUO(lefiAntennaEnum antennaType);
288   void setAntennaPWL(lefiAntennaEnum antennaType, lefiAntennaPWL* pwl);
289   void setAntennaCumRoutingPlusCut();             // 5.7
290   void setAntennaGatePlusDiff(double value);      // 5.7
291   void setAntennaAreaMinusDiff(double value);     // 5.7
292 
293   int hasAntennaAreaRatio() const;
294   int hasAntennaDiffAreaRatio() const;
295   int hasAntennaDiffAreaRatioPWL() const;
296   int hasAntennaCumAreaRatio() const;
297   int hasAntennaCumDiffAreaRatio() const;
298   int hasAntennaCumDiffAreaRatioPWL() const;
299   int hasAntennaAreaFactor() const;
300   int hasAntennaAreaFactorDUO() const;
301   int hasAntennaSideAreaRatio() const;
302   int hasAntennaDiffSideAreaRatio() const;
303   int hasAntennaDiffSideAreaRatioPWL() const;
304   int hasAntennaCumSideAreaRatio() const;
305   int hasAntennaCumDiffSideAreaRatio() const;
306   int hasAntennaCumDiffSideAreaRatioPWL() const;
307   int hasAntennaSideAreaFactor() const;
308   int hasAntennaSideAreaFactorDUO() const;
309   int hasAntennaCumRoutingPlusCut() const;        // 5.7
310   int hasAntennaGatePlusDiff() const;             // 5.7
311   int hasAntennaAreaMinusDiff() const;            // 5.7
312   int hasAntennaAreaDiffReducePWL() const;        // 5.7
313 
314   char*  antennaOxide() const;
315   double antennaAreaRatio() const;
316   double antennaDiffAreaRatio() const;
317   lefiAntennaPWL* antennaDiffAreaRatioPWL() const;
318   double antennaCumAreaRatio() const;
319   double antennaCumDiffAreaRatio() const;
320   lefiAntennaPWL* antennaCumDiffAreaRatioPWL() const;
321   double antennaAreaFactor() const;
322   double antennaSideAreaRatio() const;
323   double antennaDiffSideAreaRatio() const;
324   lefiAntennaPWL* antennaDiffSideAreaRatioPWL() const;
325   double antennaCumSideAreaRatio() const;
326   double antennaCumDiffSideAreaRatio() const;
327   lefiAntennaPWL* antennaCumDiffSideAreaRatioPWL() const;
328   double antennaSideAreaFactor() const;
329   double antennaGatePlusDiff() const;                  // 5.7
330   double antennaAreaMinusDiff() const;                 // 5.7
331   lefiAntennaPWL* antennaAreaDiffReducePWL() const;    // 5.7
332 
333 protected:
334   int hasAntennaAreaRatio_;
335   int hasAntennaDiffAreaRatio_;
336   int hasAntennaDiffAreaRatioPWL_;
337   int hasAntennaCumAreaRatio_;
338   int hasAntennaCumDiffAreaRatio_;
339   int hasAntennaCumDiffAreaRatioPWL_;
340   int hasAntennaAreaFactor_;
341   int hasAntennaAreaFactorDUO_;
342   int hasAntennaSideAreaRatio_;
343   int hasAntennaDiffSideAreaRatio_;
344   int hasAntennaDiffSideAreaRatioPWL_;
345   int hasAntennaCumSideAreaRatio_;
346   int hasAntennaCumDiffSideAreaRatio_;
347   int hasAntennaCumDiffSideAreaRatioPWL_;
348   int hasAntennaSideAreaFactor_;
349   int hasAntennaSideAreaFactorDUO_;
350   int hasAntennaCumRoutingPlusCut_;        // 5.7
351   int hasAntennaGatePlusDiff_;             // 5.7
352   int hasAntennaAreaMinusDiff_;            // 5.7
353 
354   char*  oxide_;
355   double antennaAreaRatio_;
356   double antennaDiffAreaRatio_;
357   lefiAntennaPWL* antennaDiffAreaRatioPWL_;
358   double antennaCumAreaRatio_;
359   double antennaCumDiffAreaRatio_;
360   lefiAntennaPWL* antennaCumDiffAreaRatioPWL_;
361   double antennaAreaFactor_;
362   double antennaSideAreaRatio_;
363   double antennaDiffSideAreaRatio_;
364   lefiAntennaPWL* antennaDiffSideAreaRatioPWL_;
365   double antennaCumSideAreaRatio_;
366   double antennaCumDiffSideAreaRatio_;
367   lefiAntennaPWL* antennaCumDiffSideAreaRatioPWL_;
368   double antennaSideAreaFactor_;
369   double antennaGatePlusDiff_;                  // 5.7
370   double antennaAreaMinusDiff_;                 // 5.7
371   lefiAntennaPWL* antennaAreaDiffReducePWL_;    // 5.7
372 };
373 
374 class lefiLayer {
375 public:
376   lefiLayer();
377   void Init();
378 
379   lefiLayer(const lefiLayer& prev);
380   void Destroy();
381   ~lefiLayer();
382 
383   void clear();
384   void setName(const char* name); // calls clear to init
385   void setType(const char* typ);
386   void setPitch(double num);
387   void setMask(int num);                           // 5.8
388   void setPitchXY(double xdist, double ydist);     // 5.6
389   void setOffset(double num);
390   void setOffsetXY(double xdist, double ydist);    // 5.6
391   void setWidth(double num);
392   void setArea(double num);
393   void setDiagPitch(double dist);                  // 5.6
394   void setDiagPitchXY(double xdist, double ydist); // 5.6
395   void setDiagWidth(double width);                 // 5.6
396   void setDiagSpacing(double spacing);             // 5.6
397   void setSpacingMin(double dist);
398   void setSpacingName(const char* spacingName);    // for CUT layer
399   void setSpacingLayerStack();                     // 5.7 for CUT layer
400   void setSpacingAdjacent(int numCuts, double distance);  // 5.5for CUT layer
401   void setSpacingRange(double left, double right);
402   void setSpacingRangeUseLength();
403   void setSpacingRangeInfluence(double infLength);
404   void setSpacingRangeInfluenceRange(double min, double max);
405   void setSpacingRangeRange(double min, double max);
406   void setSpacingLength(double num);
407   void setSpacingLengthRange(double min, double max);
408   void setSpacingCenterToCenter();
409   void setSpacingParallelOverlap();                            // 5.7
410   void setSpacingArea(double cutArea);                         // 5.7
411   void setSpacingEol(double width, double within);             // 5.7
412   void setSpacingParSW(double space, double within);           // 5.7
413   void setSpacingParTwoEdges();                                // 5.7
414   void setSpacingAdjacentExcept();                             // 5.7
415   void setSpacingSamenet();                                    // 5.7
416   void setSpacingSamenetPGonly();                              // 5.7
417   void setSpacingTableOrtho();                                 // 5.7
418   void addSpacingTableOrthoWithin(double cutWithin, double ortho);  // 5.7
419   void setMaxFloatingArea(double num);                         // 5.7
420   void setArraySpacingLongArray();                             // 5.7
421   void setArraySpacingWidth(double viaWidth);                  // 5.7
422   void setArraySpacingCut(double cutSpacing);                  // 5.7
423   void addArraySpacingArray(int aCuts, double aSpacing);       // 5.7
424   void setSpacingNotchLength(double minNotchLength);           // 5.7
425   void setSpacingEndOfNotchWidth (double endOfNotchWidth,
426            double minNotchSpacing, double minNotchLength);     // 5.7
427   void setDirection(const char* dir);
428   void setResistance(double num);
429   void setCapacitance(double num);
430   void setHeight(double num);
431   void setWireExtension(double num);
432   void setThickness(double num);
433   void setShrinkage(double num);
434   void setCapMultiplier(double num);
435   void setEdgeCap(double num);
436   void setAntennaArea(double num);
437   void setAntennaLength(double num);
438   void setCurrentDensity(double num);
439   void setCurrentPoint(double width, double current);
440   void setResistancePoint(double width, double res);
441   void setCapacitancePoint(double width, double cap);
442   void addProp(const char* name, const char* value, const char type);
443   void addNumProp(const char* name, const double d,
444                   const char* value, const char type);
445   void addAccurrentDensity(const char* type);
446   void setAcOneEntry(double num);
447   void addAcFrequency();
448   void addAcCutarea();
449   void addAcTableEntry();
450   void addAcWidth();
451   void addDccurrentDensity(const char* type);
452   void setDcOneEntry(double num);
453   void addDcTableEntry();
454   void addDcWidth();
455   void addDcCutarea();
456   void addNumber(double num);
457   void setMaxwidth(double width);                                   // 5.5
458   void setMinwidth(double width);                                   // 5.5
459   void addMinenclosedarea(double area);                             // 5.5
460   void addMinenclosedareaWidth(double width);                       // 5.5
461   void addMinimumcut(int cuts, double width);                       // 5.5
462   void addMinimumcutWithin(double cutDistance);                     // 5.7
463   void addMinimumcutConnect(const char* direction);                 // 5.5
464   void addMinimumcutLengDis(double length, double distance);        // 5.5
465   void addParellelLength(double length);                            // 5.5
466   void addParellelSpacing(double width, double spacing);            // 5.5
467   void addParellelWidth(double width);                              // 5.5
468   void setProtrusion(double width, double length, double width2);   // 5.5
469 
470   // 5.6 - minstep switch to multiple and added more options
471   void addMinstep(double distance);                                 // 5.5
472   void addMinstepType(char* type);                                  // 5.6
473   void addMinstepLengthsum(double maxLength);                       // 5.6
474   void addMinstepMaxedges(int maxEdges);                            // 5.7
475   void addMinstepMinAdjLength(double minAdjLength);                 // 5.7
476   void addMinstepMinBetLength(double minBetLength);                 // 5.7
477   void addMinstepXSameCorners();                                    // 5.7
478 
479   int  getNumber();     // this is for the parser internal use only
480 
481   // 5.5 SPACINGTABLE
482   void addSpacingTable();
483   void addSpParallelLength();
484   void addSpParallelWidth(double width);
485   void addSpParallelWidthSpacing();
486   void setInfluence();
487   void setSpTwoWidthsHasPRL(int hasPRL);
488   void addSpInfluence(double width, double distance, double spacing);
489   void addSpTwoWidths(double width, double runLength);              // 5.7
490 
491 
492   // 5.6
493   void addEnclosure(char* enclRule, double overhang1, double overhang2);
494   void addEnclosureWidth(double minWidth);
495   void addEnclosureExceptEC(double cutWithin);       // 5.7
496   void addEnclosureLength(double minLength);         // 5.7
497   void addEnclosureExtraCut();                       // 5.7+
498   void addPreferEnclosure(char* enclRule, double overhang1, double overhang2);
499   void addPreferEnclosureWidth(double minWidth);
500   void setResPerCut(double value);
501   void setDiagMinEdgeLength(double value);
502   void setMinSize(lefiGeometries* geom);
503 
504   // 5.8
505   // POLYROUTING, MIMCAP, TSV, PASSIVATION, NWELL
506   void setLayerType(const char* lType) ;
507 
508   int hasType() const ;
509   int hasLayerType() const ;         // 5.8 - Some layers can be another types
510                                      //  ROUTING can be POLYROUTING or MIMCAP
511                                      //  CUT can be TSV or PASSIVATION
512                                      //  MASTERSLICE can be NWELL
513   int hasMask() const ;              // 5.8
514   int hasPitch() const ;
515   int hasXYPitch() const ;           // 5.6
516   int hasOffset() const ;
517   int hasXYOffset() const ;          // 5.6
518   int hasWidth() const ;
519   int hasArea() const ;
520   int hasDiagPitch() const;          // 5.6
521   int hasXYDiagPitch() const;        // 5.6
522   int hasDiagWidth() const;          // 5.6
523   int hasDiagSpacing() const;        // 5.6
524   int hasSpacingNumber() const ;
525   int hasSpacingName(int index) const ;
526   int hasSpacingLayerStack(int index) const ;            // 5.7
527   int hasSpacingAdjacent(int index) const ;
528   int hasSpacingCenterToCenter(int index) const ;
529   int hasSpacingRange(int index) const ;
530   int hasSpacingRangeUseLengthThreshold(int index) const;
531   int hasSpacingRangeInfluence(int index) const;
532   int hasSpacingRangeInfluenceRange(int index) const;
533   int hasSpacingRangeRange(int index) const;
534   int hasSpacingLengthThreshold(int index) const;
535   int hasSpacingLengthThresholdRange(int index) const;
536   int hasSpacingParallelOverlap(int index) const;        // 5.7
537   int hasSpacingArea(int index) const;                   // 5.7
538   int hasSpacingEndOfLine(int index) const;              // 5.7
539   int hasSpacingParellelEdge(int index) const;           // 5.7
540   int hasSpacingTwoEdges(int index) const;               // 5.7
541   int hasSpacingAdjacentExcept(int index) const;         // 5.7
542   int hasSpacingSamenet(int index) const;                // 5.7
543   int hasSpacingSamenetPGonly(int index) const;          // 5.7
544   int hasSpacingNotchLength(int index) const;            // 5.7
545   int hasSpacingEndOfNotchWidth(int index) const;        // 5.7
546   int hasDirection() const ;
547   int hasResistance() const ;
548   int hasResistanceArray() const ;
549   int hasCapacitance() const ;
550   int hasCapacitanceArray() const ;
551   int hasHeight() const ;
552   int hasThickness() const ;
553   int hasWireExtension() const ;
554   int hasShrinkage() const ;
555   int hasCapMultiplier() const ;
556   int hasEdgeCap() const ;
557   int hasAntennaLength() const ;
558   int hasAntennaArea() const ;
559   int hasCurrentDensityPoint() const ;
560   int hasCurrentDensityArray() const ;
561   int hasAccurrentDensity() const;
562   int hasDccurrentDensity() const;
563 
564   int numProps() const;
565   const char*  propName(int index) const;
566   const char*  propValue(int index) const;
567   double propNumber(int index) const;
568   char   propType(int index) const;
569   int    propIsNumber(int index) const;
570   int    propIsString(int index) const;
571 
572   int numSpacing() const;
573 
574   char* name() const ;
575   const char* type() const ;
576   const char* layerType() const ;           // 5.8
577   double pitch() const ;
578   int    mask() const;                      // 5.8
579   double pitchX() const ;                   // 5.6
580   double pitchY() const ;                   // 5.6
581   double offset() const ;
582   double offsetX() const ;                  // 5.6
583   double offsetY() const ;                  // 5.6
584   double width() const ;
585   double area() const ;
586   double diagPitch() const ;                // 5.6
587   double diagPitchX() const ;               // 5.6
588   double diagPitchY() const ;               // 5.6
589   double diagWidth() const ;                // 5.6
590   double diagSpacing() const ;              // 5.6
591   double spacing(int index) const ;
592   char*  spacingName(int index) const ;     // for CUT layer
593   int    spacingAdjacentCuts(int index) const ;   // 5.5 - for CUT layer
594   double spacingAdjacentWithin(int index) const ; // 5.5 - for CUT layer
595   double spacingArea(int index) const;            // 5.7 - for CUT layer
596   double spacingRangeMin(int index) const ;
597   double spacingRangeMax(int index) const ;
598   double spacingRangeInfluence(int index) const ;
599   double spacingRangeInfluenceMin(int index) const ;
600   double spacingRangeInfluenceMax(int index) const ;
601   double spacingRangeRangeMin(int index) const ;
602   double spacingRangeRangeMax(int index) const ;
603   double spacingLengthThreshold(int index) const;
604   double spacingLengthThresholdRangeMin(int index) const;
605   double spacingLengthThresholdRangeMax(int index) const;
606 
607   // 5.7 Spacing endofline
608   double spacingEolWidth(int index) const;
609   double spacingEolWithin(int index) const;
610   double spacingParSpace(int index) const;
611   double spacingParWithin(int index) const;
612 
613   // 5.7 Spacing Notch
614   double spacingNotchLength(int index) const;
615   double spacingEndOfNotchWidth(int index) const;
616   double spacingEndOfNotchSpacing(int index) const;
617   double spacingEndOfNotchLength(int index) const;
618 
619   // 5.5 Minimum cut rules
620   int    numMinimumcut() const;
621   int    minimumcut(int index) const;
622   double minimumcutWidth(int index) const;
623   int    hasMinimumcutWithin(int index) const;          // 5.7
624   double minimumcutWithin(int index) const;             // 5.7
625   int    hasMinimumcutConnection(int index) const;      // FROMABOVE|FROMBELOW
626   const  char* minimumcutConnection(int index) const;   // FROMABOVE|FROMBELOW
627   int    hasMinimumcutNumCuts(int index) const;
628   double minimumcutLength(int index) const;
629   double minimumcutDistance(int index) const;
630 
631   const char* direction() const ;
632   double resistance() const ;
633   double capacitance() const ;
634   double height() const ;
635   double wireExtension() const ;
636   double thickness() const ;
637   double shrinkage() const ;
638   double capMultiplier() const ;
639   double edgeCap() const ;
640   double antennaLength() const ;
641   double antennaArea() const ;
642   double currentDensityPoint() const ;
643   void currentDensityArray(int* numPoints,
644        double** widths, double** current) const ;
645   void capacitanceArray(int* numPoints,
646        double** widths, double** resValues) const ;
647   void resistanceArray(int* numPoints,
648        double** widths, double** capValues) const ;
649 
650   int numAccurrentDensity() const;
651   lefiLayerDensity* accurrent(int index) const;
652   int numDccurrentDensity() const;
653   lefiLayerDensity* dccurrent(int index) const;
654 
655   // 3/23/2000 - Wanda da Rosa.  The following are for 5.4 Antenna.
656   //             Only 5.4 or 5.3 are allowed in a lef file, but not both
657   void setAntennaAreaRatio(double value);
658   void setAntennaCumAreaRatio(double value);
659   void setAntennaAreaFactor(double value);
660   void setAntennaSideAreaRatio(double value);
661   void setAntennaCumSideAreaRatio(double value);
662   void setAntennaSideAreaFactor(double value);
663   void setAntennaValue(lefiAntennaEnum antennaType, double value);
664   void setAntennaDUO(lefiAntennaEnum antennaType);
665   void setAntennaPWL(lefiAntennaEnum antennaType, lefiAntennaPWL* pwl);
666   void setAntennaCumRoutingPlusCut();             // 5.7
667   void setAntennaGatePlusDiff(double value);      // 5.7
668   void setAntennaAreaMinusDiff(double value);     // 5.7
669   void addAntennaModel (int aOxide);  // 5.5
670 
671   // 5.5
672   int numAntennaModel() const;
673   lefiAntennaModel* antennaModel(int index) const;
674 
675   // The following is 8/21/01 5.4 enhancements
676   void setSlotWireWidth(double num);
677   void setSlotWireLength(double num);
678   void setSlotWidth(double num);
679   void setSlotLength(double num);
680   void setMaxAdjacentSlotSpacing(double num);
681   void setMaxCoaxialSlotSpacing(double num);
682   void setMaxEdgeSlotSpacing(double num);
683   void setSplitWireWidth(double num);
684   void setMinimumDensity(double num);
685   void setMaximumDensity(double num);
686   void setDensityCheckWindow(double length, double width);
687   void setDensityCheckStep(double num);
688   void setFillActiveSpacing(double num);
689 
690   int hasSlotWireWidth() const;
691   int hasSlotWireLength() const;
692   int hasSlotWidth() const;
693   int hasSlotLength() const;
694   int hasMaxAdjacentSlotSpacing() const;
695   int hasMaxCoaxialSlotSpacing() const;
696   int hasMaxEdgeSlotSpacing() const;
697   int hasSplitWireWidth() const;
698   int hasMinimumDensity() const;
699   int hasMaximumDensity() const;
700   int hasDensityCheckWindow() const;
701   int hasDensityCheckStep() const;
702   int hasFillActiveSpacing() const;
703   int hasMaxwidth() const;                     // 5.5
704   int hasMinwidth() const;                     // 5.5
705   int hasMinstep() const;                      // 5.5
706   int hasProtrusion() const;                   // 5.5
707 
708   double slotWireWidth() const;
709   double slotWireLength() const;
710   double slotWidth() const;
711   double slotLength() const;
712   double maxAdjacentSlotSpacing() const;
713   double maxCoaxialSlotSpacing() const;
714   double maxEdgeSlotSpacing() const;
715   double splitWireWidth() const;
716   double minimumDensity() const;
717   double maximumDensity() const;
718   double densityCheckWindowLength() const;
719   double densityCheckWindowWidth() const;
720   double densityCheckStep() const;
721   double fillActiveSpacing() const;
722   double maxwidth() const;                     // 5.5
723   double minwidth() const;                     // 5.5
724   double protrusionWidth1() const;             // 5.5
725   double protrusionLength() const;             // 5.5
726   double protrusionWidth2() const;             // 5.5
727 
728   int    numMinstep() const;                   // 5.6
729   double minstep(int index) const;             // 5.5, 5.6 switch to multiple
730   int    hasMinstepType(int index) const;      // 5.6
731   char*  minstepType(int index) const;         // 5.6
732   int    hasMinstepLengthsum(int index) const; // 5.6
733   double minstepLengthsum(int index) const;    // 5.6
734   int    hasMinstepMaxedges(int index) const;  // 5.7
735   int    minstepMaxedges(int index) const;     // 5.7
736   int    hasMinstepMinAdjLength(int index) const;  // 5.7
737   double minstepMinAdjLength(int index) const;     // 5.7
738   int    hasMinstepMinBetLength(int index) const;  // 5.7
739   double minstepMinBetLength(int index) const;     // 5.7
740   int    hasMinstepXSameCorners(int index) const;  // 5.7
741 
742   // 5.5 MINENCLOSEDAREA
743   int    numMinenclosedarea() const;
744   double minenclosedarea(int index) const;
745   int    hasMinenclosedareaWidth(int index) const;
746   double minenclosedareaWidth(int index) const;
747 
748   // 5.5 SPACINGTABLE FOR LAYER ROUTING
749   int               numSpacingTable();
750   lefiSpacingTable* spacingTable(int index);
751 
752   // 5.6 ENCLOSURE, PREFERENCLOSURE, RESISTANCEPERCUT & DIAGMINEDGELENGTH
753   int    numEnclosure() const;
754   int    hasEnclosureRule(int index) const;
755   char*  enclosureRule(int index) ;
756   double enclosureOverhang1(int index) const;
757   double enclosureOverhang2(int index) const;
758   int    hasEnclosureWidth(int index) const;
759   double enclosureMinWidth(int index) const;
760   int    hasEnclosureExceptExtraCut(int index) const;    // 5.7
761   double enclosureExceptExtraCut(int index) const;       // 5.7
762   int    hasEnclosureMinLength(int index) const;         // 5.7
763   double enclosureMinLength(int index) const;            // 5.7
764   int    numPreferEnclosure() const;
765   int    hasPreferEnclosureRule(int index) const;
766   char*  preferEnclosureRule(int index) ;
767   double preferEnclosureOverhang1(int index) const;
768   double preferEnclosureOverhang2(int index) const;
769   int    hasPreferEnclosureWidth(int index) const;
770   double preferEnclosureMinWidth(int index) const;
771   int    hasResistancePerCut() const;
772   double resistancePerCut() const;
773   int    hasDiagMinEdgeLength() const;
774   double diagMinEdgeLength() const;
775   int    numMinSize() const;
776   double minSizeWidth(int index) const;
777   double minSizeLength(int index) const;
778 
779   // 5.7
780   int    hasMaxFloatingArea() const;
781   double maxFloatingArea() const;
782   int    hasArraySpacing() const;
783   int    hasLongArray() const;
784   int    hasViaWidth() const;
785   double viaWidth() const;
786   double cutSpacing() const;
787   int    numArrayCuts() const;
788   int    arrayCuts(int index) const;
789   double arraySpacing(int index) const;
790   int    hasSpacingTableOrtho() const; // SPACINGTABLE ORTHOGONAL FOR LAYER CUT
791   lefiOrthogonal *orthogonal() const;
792 
793   void parse65nmRules();                  // 5.7
794   void parseLEF58Layer();                 // 5.8
795   int  need58PropsProcessing() const;     // 5.8
796 
797   // Debug print
798   void print(FILE* f) const;
799 
800 private:
801   void parseSpacing(int index);
802   void parseMaxFloating(int index);
803   void parseArraySpacing(int index);
804   void parseMinstep(int index);
805   void parseAntennaCumRouting(int index);
806   void parseAntennaGatePlus(int index);
807   void parseAntennaAreaMinus(int index);
808   void parseAntennaAreaDiff(int index);
809 
810   void parseLayerType(int index);         // 5.8
811   void parseLayerEnclosure(int index);    // 5.8
812   void parseLayerWidthTable(int indxe);   // 5.8
813 
814 protected:
815   char* name_;
816   int nameSize_;
817   char* type_;
818   int typeSize_;
819   char* layerType_;   // 5.8 - POLYROUTING, MIMCAP, TSV, PASSIVATION, NWELL
820 
821   int hasPitch_;
822   int hasMask_;                       // 5.8 native
823   int hasOffset_;
824   int hasWidth_;
825   int hasArea_;
826   int hasSpacing_;
827   int hasDiagPitch_;                  // 5.6
828   int hasDiagWidth_;                  // 5.6
829   int hasDiagSpacing_;                // 5.6
830   int* hasSpacingName_;               // 5.5
831   int* hasSpacingLayerStack_;         // 5.7
832   int* hasSpacingAdjacent_;           // 5.5
833   int* hasSpacingRange_;              // pcr 409334
834   int* hasSpacingUseLengthThreshold_; // pcr 282799, due to mult. spacing allow
835   int* hasSpacingLengthThreshold_;    // pcr 409334
836   int* hasSpacingCenterToCenter_;     // 5.6
837   int* hasSpacingParallelOverlap_;    // 5.7
838   int* hasSpacingCutArea_;            // 5.7
839   int* hasSpacingEndOfLine_;          // 5.7
840   int* hasSpacingParellelEdge_;       // 5.7
841   int* hasSpacingTwoEdges_;           // 5.7
842   int* hasSpacingAdjacentExcept_;     // 5.7
843   int* hasSpacingSamenet_;            // 5.7
844   int* hasSpacingSamenetPGonly_;      // 5.7
845   int hasArraySpacing_;               // 5.7
846   int hasDirection_;
847   int hasResistance_;
848   int hasCapacitance_;
849   int hasHeight_;
850   int hasWireExtension_;
851   int hasThickness_;
852   int hasShrinkage_;
853   int hasCapMultiplier_;
854   int hasEdgeCap_;
855   int hasAntennaArea_;
856   int hasAntennaLength_;
857   int hasCurrentDensityPoint_;
858 
859   double currentDensity_;
860   double pitchX_;                     // 5.6
861   double pitchY_;                     // 5.6
862   double offsetX_;                    // 5.6
863   double offsetY_;                    // 5.6
864   double diagPitchX_;                 // 5.6
865   double diagPitchY_;                 // 5.6
866   double diagWidth_;                  // 5.6
867   double diagSpacing_;                // 5.6
868   double width_;
869   double area_;
870   double wireExtension_;
871   int numSpacings_;
872   int spacingsAllocated_;
873   int maskNumber_;                     // 5.8
874   double* spacing_;          // for Cut & routing Layer, spacing is multiple
875   char**  spacingName_;
876   int*    spacingAdjacentCuts_;    // 5.5
877   double* spacingAdjacentWithin_;  // 5.5
878   double* spacingCutArea_;         // 5.7
879   double* rangeMin_;         // pcr 282799 & 408930, due to mult spacing allow
880   double* rangeMax_;         // pcr 282799 & 408930, due to mult spacing allow
881   double* rangeInfluence_;   // pcr 282799 & 408930, due to mult spacing allow
882   double* rangeInfluenceRangeMin_;          // pcr 388183 & 408930
883   double* rangeInfluenceRangeMax_;          // pcr 388183 & 408930
884   double* rangeRangeMin_;                   // pcr 408930
885   double* rangeRangeMax_;                   // pcr 408930
886   double* lengthThreshold_;                 // pcr 408930
887   double* lengthThresholdRangeMin_;         // pcr 408930
888   double* lengthThresholdRangeMax_;         // pcr 408930
889 
890   // 5.5
891   int     numMinimumcut_;
892   int     minimumcutAllocated_;
893   int*    minimumcut_;                       // pcr 409334
894   double* minimumcutWidth_;                  // pcr 409334
895   int*    hasMinimumcutWithin_;              // 5.7
896   double* minimumcutWithin_;                 // 5.7
897   int*    hasMinimumcutConnection_;
898   char**  minimumcutConnection_;
899   int*    hasMinimumcutNumCuts_;
900   double* minimumcutLength_;
901   double* minimumcutDistance_;
902 
903   double  maxwidth_;                          // 5.5
904   double  minwidth_;                          // 5.5
905   int     numMinenclosedarea_;                // 5.5
906   int     minenclosedareaAllocated_;          // 5.5
907   double* minenclosedarea_;                   // 5.5
908   double* minenclosedareaWidth_;              // 5.5
909   double  protrusionWidth1_;                  // 5.5
910   double  protrusionLength_;                  // 5.5
911   double  protrusionWidth2_;                  // 5.5
912 
913   int     numMinstep_;                        // 5.6
914   int     numMinstepAlloc_;                   // 5.6
915   double* minstep_;                           // 5.6, switch to multiple
916   char**  minstepType_;                       // INSIDECORNER|OUTSIDECORNER|STEP
917   double* minstepLengthsum_;
918   int*    minstepMaxEdges_;                   // 5.7
919   double* minstepMinAdjLength_;               // 5.7
920   double* minstepMinBetLength_;               // 5.7
921   int*    minstepXSameCorners_;               // 5.7
922 
923   char*  direction_;
924   double resistance_;
925   double capacitance_;
926   double height_;
927   double thickness_;
928   double shrinkage_;
929   double capMultiplier_;
930   double edgeCap_;
931   double antennaArea_;
932   double antennaLength_;
933 
934   int numCurrentPoints_;
935   int currentPointsAllocated_;
936   double* currentWidths_;
937   double* current_;
938 
939   int numCapacitancePoints_;
940   int capacitancePointsAllocated_;
941   double* capacitanceWidths_;
942   double* capacitances_;
943 
944   int numResistancePoints_;
945   int resistancePointsAllocated_;
946   double* resistanceWidths_;
947   double* resistances_;
948 
949   int numProps_;
950   int propsAllocated_;
951   char**  names_;
952   char**  values_;
953   double* dvalues_;
954   char*   types_;                     // I: integer, R: real, S:string
955                                       // Q: quotedstring
956   int numAccurrents_;                 // number of ACCURRENTDENSITY
957   int accurrentAllocated_;
958   lefiLayerDensity** accurrents_;
959   int numDccurrents_;                 // number of DCCURRENTDENSITY
960   int dccurrentAllocated_;
961   lefiLayerDensity** dccurrents_;
962   int numNums_;
963   int numAllocated_;
964   double* nums_;
965 
966   // 3/23/2000 - Wanda da Rosa.  The following is for 5.4 ANTENNA.
967   //             Either 5.4 or 5.3 are allowed, not both
968   int hasAntennaAreaRatio_;
969   int hasAntennaDiffAreaRatio_;
970   int hasAntennaDiffAreaRatioPWL_;
971   int hasAntennaCumAreaRatio_;
972   int hasAntennaCumDiffAreaRatio_;
973   int hasAntennaCumDiffAreaRatioPWL_;
974   int hasAntennaAreaFactor_;
975   int hasAntennaAreaFactorDUO_;
976   int hasAntennaSideAreaRatio_;
977   int hasAntennaDiffSideAreaRatio_;
978   int hasAntennaDiffSideAreaRatioPWL_;
979   int hasAntennaCumSideAreaRatio_;
980   int hasAntennaCumDiffSideAreaRatio_;
981   int hasAntennaCumDiffSideAreaRatioPWL_;
982   int hasAntennaSideAreaFactor_;
983   int hasAntennaSideAreaFactorDUO_;
984 
985   // 5.5 AntennaModel
986   lefiAntennaModel* currentAntennaModel_;
987   int numAntennaModel_;
988   int antennaModelAllocated_;
989   lefiAntennaModel** antennaModel_;
990 
991   // 8/29/2001 - Wanda da Rosa.  The following is for 5.4 enhancements.
992   int hasSlotWireWidth_;
993   int hasSlotWireLength_;
994   int hasSlotWidth_;
995   int hasSlotLength_;
996   int hasMaxAdjacentSlotSpacing_;
997   int hasMaxCoaxialSlotSpacing_;
998   int hasMaxEdgeSlotSpacing_;
999   int hasSplitWireWidth_;
1000   int hasMinimumDensity_;
1001   int hasMaximumDensity_;
1002   int hasDensityCheckWindow_;
1003   int hasDensityCheckStep_;
1004   int hasFillActiveSpacing_;
1005   int hasTwoWidthPRL_;
1006 
1007   double slotWireWidth_;
1008   double slotWireLength_;
1009   double slotWidth_;
1010   double slotLength_;
1011   double maxAdjacentSlotSpacing_;
1012   double maxCoaxialSlotSpacing_;
1013   double maxEdgeSlotSpacing_;
1014   double splitWireWidth_;
1015   double minimumDensity_;
1016   double maximumDensity_;
1017   double densityCheckWindowLength_;
1018   double densityCheckWindowWidth_;
1019   double densityCheckStep_;
1020   double fillActiveSpacing_;
1021 
1022   // 5.5 SPACINGTABLE
1023   int numSpacingTable_;
1024   int spacingTableAllocated_;
1025   lefiSpacingTable** spacingTable_;
1026 
1027   // 5.6
1028   int numEnclosure_;
1029   int enclosureAllocated_;
1030   char** enclosureRules_;
1031   double* overhang1_;
1032   double* overhang2_;
1033   double* encminWidth_;
1034   double* cutWithin_;
1035   double* minLength_;
1036   int numPreferEnclosure_;
1037   int preferEnclosureAllocated_;
1038   char** preferEnclosureRules_;
1039   double* preferOverhang1_;
1040   double* preferOverhang2_;
1041   double* preferMinWidth_;
1042   double  resPerCut_;
1043   double  diagMinEdgeLength_;
1044   int numMinSize_;
1045   double* minSizeWidth_;
1046   double* minSizeLength_;
1047 
1048   // 5.7
1049   double* eolWidth_;
1050   double* eolWithin_;
1051   double* parSpace_;
1052   double* parWithin_;
1053   double  maxArea_;
1054   int     hasLongArray_;
1055   double  viaWidth_;
1056   double  cutSpacing_;
1057   int     numArrayCuts_;
1058   int     arrayCutsAllocated_;
1059   int*    arrayCuts_;
1060   double* arraySpacings_;
1061   int     hasSpacingTableOrtho_;
1062   lefiOrthogonal* spacingTableOrtho_;
1063   double* notchLength_;
1064   double* endOfNotchWidth_;
1065   double* minNotchSpacing_;
1066   double* eonotchLength_;
1067 
1068   int     lef58WidthTableOrthoValues_;
1069   int     lef58WidthTableWrongDirValues_;
1070   double* lef58WidthTableOrtho_;
1071   double* lef58WidthTableWrongDir_;
1072 };
1073 
1074 END_LEFDEF_PARSER_NAMESPACE
1075 
1076 USE_LEFDEF_PARSER_NAMESPACE
1077 
1078 #endif
1079