4
This chapter contains the following sections:
Every statement in the Cadence® Library Exchange Format (LEF) file is associated with a LEF reader class. When the LEF reader uses a callback, it passes a pointer to the appropriate class. You can use the member functions in each class to retrieve data defined in the LEF file.
For a list of the LEF Reader Classes that correspond to LEF file syntax, see "LEF Reader Classes".
This programming interface uses a callback style interface. You register for the constructs that interest you, and the readers call your callback functions when one of those constructs is read. If you are not interested in a given set of information, you simply do not register the callback; the reader scans the information quickly and proceeds.
Many LEF objects contain repeating objects or specifications. The classes that correspond to these LEF objects contain an index and array of elements that let you retrieve the data iteratively.
You can use a for loop from 0 to the number of items specified in the index. In the loop, retrieve the data from the subsequent arrays. For example:
for (i = 0; i < layer->lefiLayer::numMinstep(); i++) {
fprintf(fout, " MINSTEP %g ", layer->lefiLayer::minstep(i));
if (layer->lefiLayer::hasMinstepType(i))
fprintf(fout, "%s ", layer->lefiLayer::minstepType(i));
if (layer->lefiLayer::hasMinstepLengthsum(i))
fprintf(fout, "LENGTHSUM %g ",
layer->lefiLayer::minstepLengthsum(i));
fprintf(fout, ";\n");
}
The Cadence application programming interface (API) provides both C and C++ interfaces. The C API is generated from the C++ source, so there is no functional difference. The C API has been created in a pseudo object-oriented style. Examining a simple case should enable you to understand the API organization.
The following examples show the same statements in C and C++ syntax.
class lefiSite {- const char* name() const;
- int hasClass() const;
- const char* siteClass() const;
- double sizeX() const;
- double sizeY() const;
- int numSites() const;
- char* siteName(int index) const;
- int siteOrient(int index) const;
- char* siteOrientStr(int index) const;
};
const char * lefiSite_name- ( const lefiSite * this );
int lefiSite_hasClass- ( const lefiSite * this );
const char * lefiSite_siteClass- ( const lefiSite * this );
double lefiSite_sizeX- ( const lefiSite * this );
double lefiSite_sizeY- ( const lefiSite * this );
int lefiSite_numSites- ( const lefiSite * this );
char * lefiSite_siteName- ( const lefiSite * this, int index );
int lefiSite_siteOrient- ( const lefiSite * this, int index );
char * lefiSite_siteOrientStr- ( const lefiSite * this, int index );
The C routine prototypes for the API functions can be found in the following files:
The following table lists the classes routines that apply to the LEF information.
The LEF LAYER routines include the following classes:
Retrieves antenna model information from a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiAntennaModel {- int hasAntennaAreaRatio() const;
- int hasAntennaDiffAreaRatio() const;
- int hasAntennaDiffAreaRatioPWL() const;
- int hasAntennaCumAreaRatio() const;
- int hasAntennaCumDiffAreaRatio() const
- int hasAntennaCumDiffAreaRatioPWL() const;
- int hasAntennaAreaFactor() const;
- int hasAntennaAreaFactorDUO() const;
- int hasAntennaSideAreaRatio() const;
- int hasAntennaDiffSideAreaRatio() const;
- int hasAntennaDiffSideAreaRatioPWL() const;
- int hasAntennaCumSideAreaRatio() const;
- int hasAntennaCumDiffSideAreaRatio() const;
- int hasAntennaCumDiffSideAreaRatioPWL() const;
- int hasAntennaSideAreaFactor() const;
- int hasAntennaSideAreaFactorDUO() const;
- int hasAntennaCumRoutingPlusCut() const;
- int hasAntennaGatePlusDiff() const;
- int hasAntennaAreaMinusDiff() const;
- int hasAntennaAreaDiffReducePWL() const;
- char* antennaOxide() const;
- double antennaAreaRatio() const;
- double antennaDiffAreaRatio() const;
lefiAntennaPWL* antennaDiffAreaRatioPWL() const;- double antennaCumAreaRatio() const;
- double antennaCumDiffAreaRatio() const;
- lefiAntennaPWL* antennaCumDiffAreaRatioPWL() const;
- double antennaAreaFactor() const;
- double antennaSideAreaRatio() const;
- double antennaDiffSideAreaRatio() const;
- lefiAntennaPWL* antennaDiffSideAreaRatioPWL() const;
- double antennaCumSideAreaRatio() const;
- double antennaCumDiffSideAreaRatio() const;
- lefiAntennaPWL* antennaCumDiffSideAreaRatioPWL() const;
- double antennaSideAreaFactor() const;
- double antennaGatePlusDiff() const;
- double antennaAreaMinusDiff() const;
- lefiAntennaPWL* antennaAreaDiffReducePWL() const; };
Retrieves antenna Piece-wise Linear Format (PWL) data from a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiAntennaPWL {- int numPWL() const;
- double PWLdiffusion(int index):
- double PWLratio(int index); };
Retrieves influence rule information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiInfluence {- int numInfluenceEntry() const;
- double width(int index) const;
- double distance(int index) const;
- double spacing(int index) const; };
Retrieves data from a LAYER section of the LEF file. This callback can be used for all layer types (cut, masterslice, implant, and routing). However, most of these functions apply to routing layers. Comments in the C++ syntax indicate those arguments that apply only to a particular layer type. All other arguments apply to all layer types.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," "Layer (Masterslice or Overlap)," and "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiLayer {- int hasType() const;
- int hasPitch() const; // Routing
- int hasXYPitch() const;
- int hasOffset() const; // Routing
- int hasXYOffset() const;
- int hasWidth() const; // Routing
- int hasArea() const;
- int hasDiagPitch() const;
- int hasXYDiagPitch() const;
- int hasDiagWidth() const;
- int hasDiagSpacing() const;
- int hasSpacingNumber() const;
- int hasSpacingName(int index) const;
- int hasSpacingLayerStack(int index) const;
- int hasSpacingAdjacent(int index) const;
- int hasSpacingCenterToCenter(int index) const;
- int hasSpacingRange(int index) const; // Routing
- int hasSpacingRangeUseLengthThreshold(int index) const;
- int hasSpacingRangeInfluence(int index) const;
- int hasSpacingRangeInfluenceRange(int index) const;
- int hasSpacingRangeRange(int index) const;
- int hasSpacingLengthThreshold(int index) const; // Routing
- int hasSpacingLengthThresholdRange(int index) const; // Routing
- int hasSpacingParallelOverlap(int index) const;
- int hasSpacingArea(int index) const;
- int hasSpacingEndOfLine(int index) const;
- int hasSpacingParellelEdge(int index) const;
- int hasSpacingTwoEdges(int index) const;
- int hasSpacingAdjacentExcept(int index) const;
- int hasSpacingSamenet(int index) const;
- int hasSpacingSamenetPGonly(int index) const;
- int hasSpacingNotchLength(int index) const;
int hasSpacingEndOfNotchWidth(int index) const;
int hasDirection() const; // Routing
int hasResistance() const; // Routing
int hasResistanceArray() const;
int hasCapacitance() const; // Routing
int hasCapacitanceArray() const;
int hasHeight() const; // Routing
int hasThickness() const; // Routing
int hasWireExtension() const; // Routing
int hasShrinkage() const; // Routing
int hasCapMultiplier() const; // Routing
int hasEdgeCap() const; // Routing
int hasAntennaLength() const; // Routing
int hasAntennaArea() const; // Routing
int hasCurrentDensityPoint() const;
int hasCurrentDensityArray() const;
int hasAccurrentDensity() const;
int hasDccurrentDensity() const;
int numProps() const;
const char* propName(int index) const;
const char* propValue(int index) const;
double propNumber(int index) const;
const char propType(int index) const;
int propIsNumber(int index) const;
int propIsString(int index) const;
int numSpacing() const; // Cut and Routing
char* name() const;
const char* type() const;
double pitch() const; // Routing
double pitchX() const;
double pitchY() const;
double offset() const; // Routing
double offsetX() const;
double offsetY() cont;
double width() const;
double area() const;
double diagPitch() const;
double diagPitchX() const;
double diagPitchY() const;
double diagWidth() const;
double diagSpacing() const;
double spacing(int index) const;
char* spacingName(int index) const; // Cut
int spacingAdjacentCuts(int index) const; // Cut
double spacingAdjacentWithin(int index) const; // Cut
double spacingArea(int index) const; // Cut
double spacingRangeMin(int index) const;
double spacingRangeMax(int index) const;
double spacingRangeInfluence(int index) const;
double spacingRangeInfluenceMin(int index) const;
double spacingRangeInfluenceMax(int index) const;
double spacingRangeRangeMin(int index) const;
double spacingRangeRangeMax(int index) const;
double spacingLengthThreshold(int index) const;
double spacingLengthThresholdRangeMin(int index) const;
double spacingLengthThresholdRangeMax(int index) const;
double spacingEolWidth(int index) const;
double spacingEolWithin(int index) const;
double spacingParSpace(int index) const;
double spacingParWithin(int index) const;
double spacingNotchLength(int index) const;
double spacingEndOfNotchWidth(int index) const;
double spacingEndOfNotchSpacing(int index) const;
double spacingEndOfNotchLength(int index) const;
int numMinimumcut() const;
int minimumcut(int index) const;
double minimumcutWidth(int index) const;
int hasMinimumcutWithin(int index) const;
double minimumcutWithin(int index) const;
int hasMinimumcutConnection(int index) const; // FROMABOVE | FROMBELOW
const char* minimumcutConnection(int index) const; // FROMABOVE | FROMBELOW
int hasMinimumcutNumCuts(int index) const;
double minimumcutLength(int index) const;
double minimumcutDistance(int index) const;
const char* direction() const; // Routing
double resistance() const; // Routing
double capacitance() const; // Routing
double height() const; // Routing
double wireExtension() const; // Routing
double thickness() const; // Routing
double shrinkage() const; // Routing
double capMultiplier() const; // Routing
double edgeCap() const; // Routing
double antennaLength() const; // Routing
double antennaArea() const; // Routing
double currentDensityPoint() const;
void currentDensityArray(int* numPoints, double** widths,
double** current) const;
void capacitanceArray(int* numPoints, double** widths,
double** resValues) const;
void resistanceArray(int* numPoints, double** widths,
double** capValues) const; // Routing
int numAccurrentDensity() const;
lefiLayerDensity* accurrent(int index) const;
int numDccurrentDensity() const;
lefiLayerDensity* dccurrent(int index) const;
int numAntennaModel() const;
lefiAntennaModel* antennaModel(int index) const;
int hasSlotWireWidth() const;
int hasSlotWireLength() const;
int hasSlotWidth() const;
int hasSlotLength() const;
int hasMaxAdjacentSlotSpacing() const;
int hasMaxCoaxialSlotSpacing() const;
int hasMaxEdgeSlotSpacing() const;
int hasSplitWireLength() const;
int hasMinimumDensity() const;
int hasMaximumDensity() const;
int hasDensityCheckWindow() const;
int hasDensityCheckStep() const;
int hasFillActiveSpacing() const;
int hasMaxwidth() const;
int hasMinwidth() const;
int hasMinstep() const;
int hasProtrusion() const;
double slotWireWidth() const;
double slotWireLength() const;
double slotWidth() const;
double slotLength() const;
double maxAdjecentSlotSpacing() const;
double maxCoaxialSlotSpacing() const;
double maxEdgeSlotSpacing() const;
double splitWireLength() const;
double minimumDensity() const
double maximumDensity() const;
double densityCheckWindowLength() const;
double densityCheckWindowWidth() const;
double densityCheckStep() const;
double fillActiveSpacing() const;
double maxwidth() const;
double minwidth() const;
double minstep() const;
double protrusionWidth1() const;
double protrusionLength() const;
double protrusionWidth2() const;
int numMistep() const;
double minstep(int index) const;
int hasMinstepType(int index) const;
char* minstepType(int index) const;
int hasMinstepLengthsum(int index) const;
double minstepLengthsum(int index) const;
int hasMinstepMaxedges(int index) const;
int minstepMaxedges(int index) const;
int numMinenclosedarea() const;
double minenclosedarea(int index) const;
int hasMinenclosedareaWidth(int index) const;
double minenclosedareaWidth(int index) const;
int numSpacingTable();
lefiSpacingTable* spacingTable(int index);
int numEnclosure() const;
int hasEnclosureRule(int index) const;
char* enclosureRule (int index);
double enclosureOverhang1(int index) const;
double enclosureOverhang2(int index) const;
int hasEnclosureWidth(int index) const;
double enclosureMinWidth(int index) const;
int hasEnclosureExceptExtraCut(int index) const;
double enclosureExceptExtraCut(int index) const;
int hasEnclosureMinLength(int index) const;
double enclosureMinLength(int index) const;
int numPreferEnclosure() const;
int hasPreferEnclosureRule(int index) const;
char* preferEnclosureRule(int index) const;
double preferEnclosureOverhang1(int index) const;
double preferEnclosureOverhang2(int index) const;
int hasPreferEnclosureWidth(int index) const;
double preferEnclosureMinWidth(int index) const;
int hasResistancePerCut() const;
double resistancePerCut() const;
int hasMinEdgeLength() const;
double minEdgeLength() const;
int hasDiagMinEdgeLength() const;
double diagMinEdgeLength() const;
int hasMinSize() const;
int numMinSize() const;
double minSizeWidth(int index) const;
double minSizeLength(int index)const ;
int hasMaxFloatingArea() const;
double maxFloatingArea() const;
int hasArraySpacing() const;
int hasLongArray() const;
int hasViaWidth() const;
double viaWidth() const;
double cutSpacing() const;
int numArrayCuts() const;
int arrayCuts(int index) const;
double arraySpacing(int index) const;
int hasSpacingTableOrtho() const;
lefiOrthogonal *orthogonal() const;
int hasMask() const; // Check the layer has color mask assigned or not.
int mask() const; }; // Return the color mask number of the layer.
Retrieves data from the LAYERDENSITY statement in a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiLayerDensity {- char* type();
- int hasOneEntry();
- double oneEntry();
- int numFrequency();
- double frequency(int index);
- int numWidths();
- double width(int index);
- int numTableEntries();
- double tableEntry(int index);
- int numCutareas();
- double cutArea(int index); };
Retrieves orthogonal spacing information from a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut) in the LEF/DEF Language Reference.
class lefiOrthogonal {- int numOrthogonal() const;
- double cutWithin(int index) const;
- double orthoSpacing(int index) const; };
Retrieves parallel run length information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiParallel {- int numLength() const;
- int numWidth() const;
- double length(int iLength) const;
- double width(int iWidth) const;
- double widthSpacing(int iWidth, int iWidthSpacing) const; };
Retrieves spacing table information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiSpacingTable {- int isInfluence() const;
lefiInfluence* influence() const;- int isParallel() const;
- lefiParallel* parallel() const;
- lefiTwoWidths* twoWidths() const; };
Retrieves two-width spacing information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the LEF/DEF Language Reference.
class lefiTwoWidths {- int numWidth() const;
- double width(int iWidth) const;
- int hasWidthPRL(int iWidth) const;
- double widthPRL(int iWidth) const;
- int numWidthSpacing(int iWidth) const;
- double widthSpacing(int iWidth, int iWidthSpacing) const; };
The LEF MACRO data routines include the following LEF classes:
Retrieves density information from the MACRO section of the LEF file.
For syntax information about the MACRO section, see "Macro" in the LEF/DEF Language Reference.
class lefiDensity {- int numLayer() const;
- char* layerName(int index) const;
- int numRects(int index) const;
- struct lefiGeomRect getRect(int index, int rectIndex) const;
- double densityValue(int index, int rectIndex) const; };
Retrieves data from the MACRO section of the LEF file.
For syntax information about the MACRO section, see "Macro" in the LEF/DEF Language Reference.
class lefiMacro {- int hasClass() const;
- int hasGenerator() const;
- int hasGenerate() const;
- int hasPower() const;
- int hasOrigin() const;
- int hasEEQ() const;
- int hasLEQ() const;
- int hasSource() const;
- int hasXSymmetry() const;
- int hasYSymmetry() const;
- int has90Symmetry() const;
- int hasSiteName() const;
- int hasSitePattern() const;
- int hasSize() const;
- int hasForeign() const;
- int hasForeignOrigin(int index = 0) const;
- int hasForeignOrient(int index = 0) const;
- int hasForeignPoint(int index = 0) const;
- int hasClockType() const;
- int isBuffer() const;
- int isInverter() const;
int numSitePattern() const;- int numProperties() const;
- const char* propName(int index) const;
- const char* propValue(int index) const;
- double propNum(int index) const;
- const char propType(int index) const;
- int propIsNumber(int index) const;
- int propIsString(int index) const;
const char* name() const;- const char* macroClass() const;
- const char* generator() const;
- const char* EEQ() const;
- const char* LEQ() const;
- const char* source() const;
- const char* clockType() const;
- double originX() const;
- double originY() const;
- double power() const;
- void generate(char** name1, char** name2) const;
- lefiSitePattern* sitePattern(int index) const;
- const char* siteName() const;
- double sizeX() const;
- double sizeY() const;
- int numForeigns() const;
- int foreignOrient(int index = 0) const; //optional - for information, see
- //
Orientation Codes - const char* foreignOrientStr(int index = 0) const;
- double foreignX(int index = 0) const;
- double foreignY(int index = 0) const;
- const char* foreignName(int index = 0) const; };
Retrieves data for in-place processing of a MACRO FOREIGN statement.
class lefiMacroForeign {- public:
- lefiMacroForeign(const char *name,
- int hasPts,
- double x,
- double y,
- int hasOrient,
- int orient);
- const char *cellName() const;
- int cellHasPts() const;
- double px() const;
- double py() const;
- int cellHasOrient() const;
- int cellOrient() const;
- protected:
- const char *cellName_;
- int cellHasPts_;
- double px_;
- double py_;
- int cellHasOrient_;
- int cellOrient_;
- };
Retrieves data for in-place processing of a MACRO SITE statement.
class lefiMacroSite {- public:
- lefiMacroSite(const char *name, const lefiSitePattern* pattern);
- const char *siteName() const;
- const lefiSitePattern *sitePattern() const;
- protected:
- const char *siteName_;
- const lefiSitePattern *sitePattern_;
- };
Returns the X and Y points for the ORIGIN and SIZE statements in the MACRO section.
struct lefiPoints {- double x;
- double y; };
typedef struct lefiPoints lefiNum;
The following example shows a callback routine with the type lefrMacroBeginCbkType, and the class const char*.
int macroBeginCB (lefrCallbackType_e type,- const char *macroName,
- lefiUserData userData) {
// Incorrect type was passed in, expecting the type- // lefiMacroBeginCbkType
- if (type != lefiMacroBeginCbkType) {
- printf("Type is not lefiMacroBeginCbkType, terminate
- parsing.\n");
- return 1;
- }
// Expect a non null char* macroName- if (!macroName || !*macroName) {
- printf("Macro name is null, terminate parsing.\n");
- return 1;
- }
// Write out the macro name- printf("Macro name is %s\n", macroName);
- return 0;}
The following example shows a callback routine with the type lefrMacroCbkType, and the class lefiMacro. This example only shows how to retrieve part of the data from the lefiMacro class.
int macroCB (lefrCallbackType_e type,- lefiMacro *macroInfo,
- lefiUserData userData) {
- int propNum, i, hasPrtSym = 0;
- lefiSitePattern* pattern;
// Check if the type is correct- if (type != lefrMacroCbkType) {
- printf("Type is not lefrMacroCbkType, terminate
- parsing.\n");
- return 1;
- }
- if (macroInfo->hasClass())
- printf(" CLASS %s\n", macroInfo->macroClass());
if (macroInfo->hasXSymmetry()) {- printf(" SYMMETRY X ");
- hasPrtSym = 1;
- }
- if (macroInfo->hasYSymmetry()) { // print X Y & R90 in one line
- if (!hasPrtSym) { // the line has not started yet
- printf(" SYMMETRY Y ");
- hasPrtSym = 1;
- }
- else // the line has already started
- printf("Y ");
- }
- if (macroInfo->has90Symmetry()) {
- if (!hasPrtSym) { // the line has not started yet
- printf(" SYMMETRY R90 ");
- hasPrtSym = 1;
- }
- else // the line has already started
- printf("R90 ");
- }
- if (hasPrtSym) {
- printf ("\n");
- hasPrtSym = 0;
- }
// Check if SITE pattern is defined in the macro- if (macroInfo->hasSitePattern()) {
- for (i = 0; i < macroInfo->numSitePattern(); i++ ) {
- pattern = macroInfo->sitePattern(i);
- printf(" SITE %s %g %g %d DO %g BY %g STEP %g %g\n",
- pattern->name(), pattern->x(), pattern->y(),
- pattern->orient(), pattern->xStart(),
- pattern->yStart(),
- pattern->xStep(), pattern->yStep());
- }
- }
// Check if PROPERTY is defined in the macro- propNum = macroInfo->numProperties();
- if (propNum > 0) {
- printf(" PROPERTY ");
- for (i = 0; i < propNum; i++) {
- // value can either be a string or number
- if (macroInfo->propValue(i)) {
- printf("%s %s ", macroInfo->propName(i),
- macroInfo->propValue(i));
- }
- else
- printf("%s %g ", macroInfo->propName(i),
- macroInfo->propNum(i));
- }
- printf("\n");
- }
- return 0;}
The LEF Macro Obstruction routines include the following LEF class:
Retrieves data from the Macro Obstruction (OBS) statement in the MACRO section of the LEF file. The Macro Obstruction statement defines sets of obstructions (blockages) on the macro.
For syntax information about the Macro Obstruction statement, see "Macro Obstruction Statement" in the LEF/DEF Language Reference.
class lefiObstruction {lefiGeometries* geometries() const;};
The following example shows a callback routine with the type lefrObstructionCbkType, and the class lefiObstruction.
int macroObsCB (lefrCallbackType_e type,- lefiObstruction* obsInfo,
- lefiUserData userData) {
- lefiGeometries* geometry;
- int numItems;
- int i, j;
- lefiGeomPath* path;
- lefiGeomPathIter* pathIter;
- lefiGeomRect* rect;
- lefiGeomRectIter* rectIter;
- lefiGeomPolygon* polygon;
- lefiGeomPolygonIter* polygonIter;
- lefiGeomVia* via;
- lefiGeomViaIter* viaIter;
- // Check if the type is correct
- if (type != lefrObstructionCbkType) {
- printf("Type is not lefrObstructionCbkType,
- terminate parsing.\n");
- return 1;}
printf("OBS\n");- geometry = obs->geometries();
- numItems = geometry->numItems();
- for (i = 0; i < numItems; i++) {
- switch (geometry->itemType(i)) {
- case lefiGeomClassE:
- printf(" CLASS %s\n", geometry->getClass(i));
- break;
- case lefiGeomLayerE:
- printf(" LAYER %s\n", geometry->getLayer(i));
- break;
- case lefiGeomWidthE:
- printf(" WIDTH %g\n", geometry->getWidth(i))
- break;
- case lefiGeomPathE:
- path = geometry->getPath(i);
- printf(" PATH");
- for (j = 0; j < path->numPoints; j++)
- printf(" ( %g %g )", path->x[j], path->y[j]);
- printf("\n");
- break;
- case lefiGeomPathIterE:
- pathIter = geometry->getPathIter(i);
- printf(" PATH ITERATED");
- for (j = 0; j < pathIter->numPoints; j++)
- printf(" ( %g %g )", pathIter->x[j],
- pathIter ->y[j]);
- printf("\n");
- printf(" DO %g BY %g STEP %g %g\n",
- pathIter->xStart, pathIter->yStart,
- pathIter->xStep, pathIter->yStep);
- break;
- case lefiGeomRectE:
- rect = geometry->getRect(i);
- printf(" RECT ( %g %g ) ( %g %g )\n", rect->xl,
- rect->yl, rect->xh, rect->yh);
- break;
case lefiGeomRectIterE:
rectIter = geometry->getRectIter(i);
printf(" RECT ITERATE ( %g %g ) ( %g %g )\n",
rectIter->xl, rectIter->yl,
rectIter->xh, rectIter->yh);
printf(" DO %g BY %g STEP %g %g\n",
rectIter->xStart, rectIter->yStart,
rectIter->xStep, rectIter->yStep);
break;
case lefiGeomPolygonE:
polygon = geometry->getPolygon(i);
printf(" POLYGON");
for (j = 0; j < polygon->numPoints; j++)
printf(" ( %g %g )", polygon->x[j], polygon-
>y[j]);
printf("\n");
break;
case lefiGeomPolygonIterE:
polygonIter = geometry->getPolygonIter(i);
printf(" POLYGON ITERATE");
for (j = 0; j < polygonIter->numPoints; j++)
printf(" ( %g %g )", polygonIter->x[j],
polygonIter->y[j]);
printf("\n");
printf(" DO %g BY %g STEP %g %g\n",
polygonIter->xStart, polygonIter->yStart,
polygonIter->xStep, polygonIter->yStep);
break;
case lefiGeomViaE:
via = geometry->getVia(i);
printf(" VIA ( %g %g ) %s\n", via->x,
via->y, via->name);
break;
case lefiGeomViaIterE:
viaIter = geometry->getViaIter(i);
printf(" VIA ITERATE ( %g %g ) %s\n",
viaIter->x, viaIter->y, viaIter->name);
printf(" DO %g BY %g STEP %g %g\n",
viaIter->xStart, viaIter->yStart,
viaIter->xStep, viaIter->yStep);
break;
}
}
return 0; }
The LEF Macro Pin routines include the following LEF classes:
Retrieves data from the PIN statement in the MACRO section of the LEF file. MACRO PIN statements are included in the LEF file for each macro.
For syntax information about the Macro Pin statement, see "Macro Pin Statement" in the
LEF/DEF Language Reference.
class lefiPin {- int hasForeign() const;
- int hasForeignOrient(int index = 0) const;
- int hasForeignPoint(int index = 0) const;
- int hasLEQ() const;
- int hasDirection() const;
- int hasUse() const;
- int hasShape() const;
- int hasMustjoin() const;
- int hasOutMargin() const;
- int hasOutResistance() const;
- int hasInMargin() const;
- int hasPower() const;
- int hasLeakage() const;
- int hasMaxload() const;
- int hasMaxdelay() const;
- int hasCapacitance() const;
- int hasResistance() const;
- int hasPulldownres() const;
- int hasTieoffr() const;
- int hasVHI() const;
- int hasVLO() const;
- int hasRiseVoltage() const;
- int hasFallVoltage() const;
- int hasRiseThresh() const;
- int hasFallThresh() const;
- int hasRiseSatcur() const;
- int hasFallSatcur() const;
- int hasCurrentSource() const;
- int hasTables() const;
- int hasAntennaSize() const;
- int hasAntennaMetalArea() const;
- int hasAntennaMetalLength() const;
- int hasAntennaPartialMetalArea() const;
- int hasAntennaPartialMetalSideArea() const;
- int hasAntennaPartialCutArea() const;
- int hasAntennaDiffArea() const;
- int hasAntennaModel() const;
- int hasTaperRule() const;
- int hasRiseSlewLimit() const;
- int hasFallSlewLimit() const;
- int hasNetExpr() const;
- int hasSupplySensitivity() const;
- int hasGroundSensitivity() const;
- const char* name() const;
- int numPorts() const;
lefiGeometries* port(int index) const;- int numForeigns() const;
- const char* foreignName(int index = 0) const;
- const char* taperRule() const;
- int foreignOrient(int index = 0) const; // optional - for information, see
- // Orientation Codes
- const char* foreignOrientStr(int index = 0) const;
double foreignX(int index = 0) const;
double foreignY(int index = 0) const;
const char* LEQ() const;
const char* direction() const;
const char* use() const;
const char* shape() const;
const char* mustjoin() const;
double outMarginHigh() const;
double outMarginLow() const;
double outResistanceHigh() const;
double outResistanceLow() const;
double inMarginHigh() const;
double inMarginLow() const;
double power() const;
double leakage() const;
double maxload() const;
double maxdelay() const;
double capacitance() const;
double resistance() const;
double pulldownres() const;
double tieoffr() const;
double VHI() const;
double VLO() const;
double riseVoltage() const;
double fallVoltage() const;
double riseThresh() const;
double fallThresh() const;
double riseSatcur() const;
double fallSatcur() const;
double riseSlewLimit() const;
double fallSlewLimit() const;
const char* currentSource() const;
const char* tableHighName() const;
const char* tableLowName() const;
int numAntennaSize() const;
double antennaSize(int index) const;
const char* antennaSizeLayer(int index) const;
int numAntennaMetalArea() const;
double antennaMetalArea(int index) const;
const char* antennaMetalAreaLayer(int index) const;
int numAntennaMetalLength() const;
double antennaMetalLength(int index) const;
const char* antennaMetalLengthLayer(int index) const;
int numAntennaPartialMetalArea() const;
double antennaPartialMetalArea(int index) const;
const char* antennaPartialMetalAreaLayer(int index) const;
int numAntennaPartialMetalSideArea() const;
double antennaPartialMetalSideArea(int index) const;
const char* antennaPartialMetalSideAreaLayer(int index) const;
int numAntennaPartialCutArea() const;
double antennaPartialCutArea(int index) const;
const char* antennaPartialCutAreaLayer(int index) const;
int numAntennaDiffArea() const;
double antennaDiffArea(int index) const;
const char* antennaDiffAreaLayer(int index) const;
const char* netExpr() const;
const char* supplySensitivity() const;
const char* groundSensitivity() const;
int numantennaModel() const;
lefiPinAntennaModel* antennaModel(int index) const;
int numProperties() const;
const char* propName(int index) const;
const char* propValue(int index) const;
double propNum(int index) const;
const char propType(int index) const;
int propIsNumber(int index) const;
int propIsString(int index) const; };
Retrieves antenna model information from Macro Pin statement of the LEF file.
For syntax information about the Macro Pin statement, see "Macro Pin Statement" in the
LEF/DEF Language Reference.
class lefiAntennaModel {- int hasAntennaGateArea() const;
- int hasAntennaMaxAreaCar() cons
- int hasAntennaMaxSideAreaCar() const;
- int hasAntennaMaxCutCar() const;
- char* antennaOxide() const;
- int numantennaGateArea() const;
- double antennaGateArea(int index) const;
- const char* antennaGateAreaLayer(int index) const;
- int numAntennaMaxAreaCar() const;
- double antennaMaxAreaCar(int index) const;
- const char* antennaMaxAreaCarLayer(int index) const;
- int numAntennaMaxSideAreaCar() conts;
- double antennaMaxSideAreaCar(int index) const;
- const char* antennaMaxSideAreaCarLayer(int index) const;
- int numAntennaMaxCutCar() const;
- double antennaMaxCutCar(int index) const;
- const char* antennaMaxCutCarLayer(int index) const; };
Retrieves data from the Macro Pin statement and from the Macro Obstruction statement in the MACRO section of the LEF file. These statements specify the pin port and obstruction geometries for the macro.
For syntax information about LEF geometries, see "Layer Geometries" in the LEF/DEF Language Reference.
class lefiGeometries {- int numItems() const;
- enum lefiGeomEnum itemType(int index) const;
- struct
lefiGeomRect* getRect(int index) const;- struct lefiGeomRectIter* getRectIter(int index) const;
- struct lefiGeomPath* getPath(int index) const;
- struct lefiGeomPathIter* getPathIter(int index) const;
- int hasLayerExceptPgNet(int index) const;
- char* getLayer(int index) const;
- double getLayerMinSpacing(int index) const;
- double getLayerRuleWidth(int index) const;
- double getWidth(int index) const;
- struct lefiGeomPolygon* getPolygon(int index) const;
- struct lefiGeomPolygonIter* getPolygonIter(int index) const;
- char* getClass(int index) const;
- struct lefiGeomVia* getVia(int index) const;
- struct lefiGeomViaIter* getViaIter(int index) const;
- int colorMask;
- };
Returns the type of geometry of a macro.
enum lefiGeomEnum {- lefiGeomunknown = 0,
- lefiGeomLayerE,
- lefiGeomLayerMinSpacingE,
- lefiGeomLayerRuleWidthE,
- lefiGeomWidthE,
- lefiGeomPathE,
- lefiGeomPathIterE,
- lefiGeomRectE,
- lefiGeomRectIterE,
- lefiGeomPolygonE,
- lefiGeomPolygonIterE,
- lefiGeomViaE,
- lefiGeomViaIterE,
- lefiGeomClassE,
- lefiGeomEnd };
Returns data from the RECT statement in the MACRO section.
struct lefiGeomRect {- double
xl;- double yl;
- double xh;
- double yh;
- int colorMask; }; //specify color mask number for the GeomRect
- //structure.
Returns data from the RECT ITERATE statement in the MACRO section.
struct lefiGeomRectIter {- double
xl;- double yl;
- double xh;
- double yh;
- double xStart;
- double yStart;
- double xStep;
- double yStep;
- int colorMask;}; //specify color mask number for the GeomRectIter
- //structure.
Note: For the following step pattern:
DO numX BY numY STEP spaceX spaceY
The values are mapped to the structure in the following way:
Returns data from the PATH statement in the MACRO section.
struct lefiGeomPath {- int
numPoints;- double* x;
- double* y;
- int colorMask; }; //specify color mask number for the GeomPath
- //structure.
Returns data from the PATH ITERATE statement in the MACRO section.
struct lefiGeomPathIter {- int
numPoints;- double* x;
- double* y;
- double xStart;
- double yStart;
- double xStep;
- double yStep;
- int colorMask; }; //specify color mask number for the GeomPathIter
- //structure.
Note: For the following step pattern:
DO numX BY numY STEP spaceX spaceY
The values are mapped to the structure in the following way:
Returns data from the POLYGON statement in the MACRO section.
struct lefiGeomPolygon {- int
numPoints;- double* x;
- double* y;
- int colorMask; }; //specify color mask number for the GeomPolygon
- //structure.
Returns data from the POLYGON ITERATE statement in the MACRO section.
struct lefiGeomPolygonIter {- int
numPoints;- double* x;
- double* y;
- double xStart;
- double yStart;
- double xStep;
- double yStep;
- int colorMask; }; //specify color mask number for the GeomPolygonIter
- //structure.
Note: For the following step pattern:
DO numX BY numY STEP spaceX spaceY
The values are mapped to the structure in the following way:
Returns data from the VIA statement in the MACRO section.
struct lefiGeomVia {- char*
name;- double x;
- double y;
- int topMaskNum; //define top mask number for the GeomVia structure.
- int cutMaskNum; //define cut mask number for the GeomVia structure.
- int bottomMaskNum;}; //define bottom mask number for the GeomVia structure.
Returns data from the VIA ITERATE statement in the MACRO section.
struct lefiGeomViaIter {- char*
name;- double x;
- double y;
- double xStart;
- double yStart;
- double xStep;
- double yStep;
- int topMaskNum; //define top mask number for the GeomViaIter structure.
- int cutMaskNum; //define cut mask number for the GeomViaIter structure.
- int bottomMaskNum;}; //define bottom mask number for the GeomViaIter
- //structure.
Note: For the following step pattern:
DO numX BY numY STEP spaceX spaceY
The values are mapped to the structure in the following way:
The following example shows a callback routine with the type lefrPinCbkType, and the class lefiPin. This example only shows how to retrieve part of the data from the lefiPin class.
int macroPinCB (lefrCallbackType_e type,- lefiPin* pinInfo,
- lefiUserData userData) {
- lefiGeometries* geometry;
- int numPorts;
- int numItems;
- int i, j;
- lefiGeomPath* path;
- lefiGeomPathIter* pathIter;
- lefiGeomRect* rect;
- lefiGeomRectIter* rectIter;
- lefiGeomPolygon* polygon;
- lefiGeomPolygonIter* polygonIter;
- lefiGeomVia* via;
- lefiGeomViaIter* viaIter;
// Check if the type is correct- if (type != lefrPinCbkType) {
- printf("Type is not lefrPinCbkType, terminate parsing.\n");
- return 1;
- }
printf("PIN %s\n", pin->name());- if (pin->hasForeign()) {
- if (pin->hasForeignOrient())
- printf(" FOREIGN %s STRUCTURE ( %g %g ) %d\n",
- pin->foreignName(), pin->foreignX(),
- pin->foreignY(), pin->foreignOrient());
- else if (pin->hasForeignPoint())
- printf(" FOREIGN %s STRUCTURE ( %g %g )\n",
- pin->foreignName(), pin->foreignX(),
- pin->foreignY());
- else
- printf(" FOREIGN %s\n", pin->foreignName());
- }
if (pin->hasLEQ())- printf(" LEQ %s\n", pin->LEQ());
if (pin->hasAntennaSize()) {- for (i = 0; i < pin->numAntennaSize(); i++) {
- printf(" ANTENNASIZE %g ", pin->antennaSize(i));
- if (pin->antennaSizeLayer(i))
- printf("LAYER %s ", pin->antennaSizeLayer(i));
- printf("\n");
- }
- }
numPorts = pin->numPorts();- for (i = 0; i < numPorts; i++) {
- printf(" PORT\n");
- geometry = pin->port(i);
- // A complete example can be found .
- numItems = geometry->numItems();
- for (j = 0; j < numItems; j++) {
- switch (geometry->itemType(j)) {
- case lefiGeomClassE:
- printf(" CLASS %s\n", geometry->getClass(j));
- break;
- case lefiGeomLayerE:
- printf(" LAYER %s\n", geometry->getLayer(j));
- break;
- case lefiGeomWidthE:
- printf(" WIDTH %g\n", geometry->getWidth(j));
- break;
- case lefiGeomPathE:
- ...
- break;
- case lefiGeomPathIterE:
- ...
- break;
- case lefiGeomRectE:
- rect = geometry->getRect(j);
- printf(" RECT ( %g %g ) ( %g %g )\n", rect->xl,
- rect->yl, rect->xh, rect->yh);
- break;
- case lefiGeomRectIterE:
- ...
- break;
- case lefiGeomPolygonE:
- ...
- break;
- case lefiGeomPolygonIterE:
- ...
- break;
- case lefiGeomViaE:
- ...
- break;
- case lefiGeomViaIterE:
- ...
- break;
- }
- }
- }
- return 0; }
The LEF MAXSTACKVIA routines include the following LEF class:
Retrieves data from the MAXVIASTACK statement in the LEF file.
For syntax information about the LEF MAXVIASTACK statement, see "Maximum Via Stack" in the LEF/DEF Language Reference.
class lefiMaxStackVia {- int maxStackVia() const;
- int hasMaxStackViaRange() const;
- const char* maxStackViaBottomLayer() const;
- const char* maxStackViaTopLayer() const; }
Miscellaneous routines include the following LEF class:
The user data can be set or changed at any time with the lefrSetUserData and lefrGetUserData calls. Every callback returns the user data as the third argument.
lefiUserData lefrGetUserData()
The LEF NONDEFAULT RULE routines include the following LEF class:
Retrieves data from the NONDEFAULTRULE statement in the LEF file.
For syntax information about the LEF NONDEFAULTRULE statement, see "Nondefault Rule" in the LEF/DEF Language Reference.
class lefiNonDefault {- const char* name() const;
- int hardSpacing() const;
- int numProps() const;
- const char* propName(int index) const;
- const char* propValue(int index) const;
- double propNumber(int index) const;
- const char propType(int index) const;
- int propIsNumber(int index) const;
- int propIsString(int index) const;
int numLayers() const;- const char* layerName(int index) const;
- int hasLayerWidth(int index) const;
- double layerWidth(int index) const;
- int hasLayerSpacing(int index) const;
- double layerSpacing(int index) const;
- int hasLayerWireExtension(int index) const;
- double layerWireExtension(int index) const;
- int hasLayerDiagWidth(int index) const;
- double layerDiagWidth(int index) const;
- int numVias() const;
lefiVia* viaRule(int index) const;
int numSpacingRules() const;lefiSpacing* spacingRule(int index) const;- int numUseVia() const;
- const char* viaName(int index) const;
- int numUseViaRule() const;
- const char* viaRuleName(int index) const;
- int numMinCuts() const;
- const char* cutLayerName(int index) const;
- int numCuts(int index) const; };
The following example shows a callback routine with the type lefrNonDefaultCbkType, and the class lefiNonDefault. This example only shows how to retrieve part of the data from the lefiNonDefault class. For examples of how to retrieve via and spacing data, see the Via Routines and Same-Net Spacing Routines sections.
int nonDefaultCB (lefrCallbackType_e type,- lefiNonDefault* nonDefInfo,
- lefiUserData userData) {
- int i;
- lefiVia* via;
- lefiSpacing* spacing;
// Check if the type is correct- if (type != lefrNonDefaultCbkType) {
- printf("Type is not lefrNonDefaultCbkType, terminate
- parsing.\n");
- return 1; }
- // Print out nondefaultrule data
- printf("NONDEFAULTRULE %s\n", def->name());
- for (i = 0; i < def->numLayers(); i++) {
- printf(" LAYER %s\n", def->layerName(i));
- if (def->hasLayerWidth(i))
- printf(" WIDTH %g\n", def->layerWidth(i));
- if (def->hasLayerSpacing(i))
- printf(" SPACING %g\n", def->layerSpacing(i));}
// handle via in nondefaultrule- for (i = 0; i < def->numVias(); i++) {
- via = def->viaRule(i);
- // handle spacing in nondefaultrule
- for (i = 0; i < def->numSpacingRules(); i++) {
- spacing = def->spacingRule(i);}
- return 0;}
The LEF PROPERTYDEFINITIONS routines include the following classes:
Retrieves data from the PROPERTYDEFINITIONS statement in the LEF file. The PROPERTYDEFINITIONS statement lists all properties used in the LEF file. You must define properties before you refer to them in other routines in the LEF file.
For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property Definitions" in the LEF/DEF Language Reference.
class lefiProp {- const char* string() const;
- const char* propType() const;
- const char* propName() const;
- char dataType() const;
- int hasNumber() const;
- int hasRange() const;
- int hasString() const;
- int hasNameMapString() const;
- double number() const;
- double left() const;
- double right() const;};
Retrieves the data type from the LEF PROPERTYDEFINITIONs statement in the LEF file, if the property is of type REAL or INTEGER.
For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property Definitions" in the LEF/DEF Language Reference.
class lefiPropType {- const char propType(char* name) const; };
The following example shows a callback routine with the type lefrPropBeginCbkType, and the class void *. This callback routine marks the beginning of the Property Definition section.
int propDefBeginCB (lefrCallbackType_e type,- void* dummy,
- lefiUserData userData) {
// Check if the type is correct- if (type != lefrPropBeginCbkType) {
- printf("Type is not lefrPropBeginCbkType, terminate
- parsing.\n");
- return 1;
- }
printf("PROPERTYDEFINITIONS\n");- return 0;}
The following example shows a callback routine with the type lefrPropCbkType, and the class lefiProp. This callback routine will be called for each defined property definition.
int propDefCB (lefrCallbackType_e type,- lefiProp* propInfo,
- lefiUserData userData) {
// Check if the type is correct- if (type != lefrPropCbkType) {
- printf("Type is not lefrPropCbkType, terminate
- parsing.\n");
- return 1;
- }
// Check the object type of the property definition- if (strcmp(propInfo->propType(), "library") == 0)
- printf("LIBRARY %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "pin") == 0)
- printf("PIN %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "macro") == 0)
- printf("MACRO %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "via") == 0)
- printf("VIA %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "viarule") == 0)
- printf("VIARULE %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "layer") == 0)
- printf("LAYER %s ", propInfo->propName());
- else if (strcmp(propInfo->propType(), "nondefaultrule") == 0
- printf("NONDEFAULTRULE %s ", propInfo->propName());
// Check the property type- if (propInfo->dataType() == 'I')
- printf("INTEGER ");
- if (propInfo->dataType() == 'R')
- printf("REAL ");
- if (propInfo->dataType() == 'S')
- printf("STRING ");
- if (propInfo->dataType() == 'Q')
- printf("STRING ");
- if (propInfo->hasRange()) {
- printf("RANGE %g %g ", propInfo->left(), propInfo-
- >right());
- }
- if (propInfo->hasNumber())
- printf("%g ", propInfo->number());
- if (propInfo->hasString())
- printf("'%s' ", propInfo->string());
- printf("\n");
- return 0;}
The following example shows a callback routine with the type lefrPropEndCbkType, and the class void *. This callback routine marks the end of the Property Definition section.
int propDefEndCB (lefrCallbackType_e type,- void* dummy,
- lefiUserData userData) {
// Check if the type is correct- if (type != lefrPropEndCbkType) {
- printf("Type is not lefrPropEndCbkType, terminate
- parsing.\n");
- return 1;}
- printf("END PROPERTYDEFINITIONS\n");
- return 0;}
The LEF SPACING routines include the following LEF class:
Retrieves data from the SPACING statement in the LEF file.
class lefiSpacing {- int hasStack() const;
- const char* name1() const;
- const char* name2() const;
- double distance() const;};
The following example shows a callback routine with the type lefrSpacingCbkType, and the class lefiSpacing. This callback routine is called for each defined spacing between callback routines with the types lefrSpacingBeginCbkType and lefrSpacingEndCbkType.
int spacingCB (lefrCallbackType_e type,- lefiSpacing* spacingInfo,
- lefiUserData userData) {
// Check if the type is correct- if (type != lefrSpacingCbkType) {
- printf("Type is not lefrSpacingCbkType, terminate
- parsing.\n");
- return 1;
- }
printf("SAMENET %s %s %g ", spacingInfo->name1(),- spacingInfo->name2(), spacingInfo->distance());
- if (spacingInfo->hasStack())
- printf("STACK ");
- printf("\n");
- return 0; }
The LEF SITE routines include the following LEF class:
Retrieves data from the SITE statement of the LEF file.
For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language Reference.
class lefiSite {- const char* name() const;
- int hasClass() const;
- const char* siteClass() const;
- double sizeX() const;
- double sizeY() const;
- int hasSize() const;
- int hasXSymmetry() const;
- int hasYSymmetry() const;
- int has90Symmetry() const;
- int hasRowPattern() const;
- int numSites() const;
- char* siteName(int index) const;
- int siteOrient(int index) const;
- char* siteOrientStr(int index) const; };
Retrieves site pattern information from the SITE statement of the LEF file.
For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language Reference.
lefiSitePattern {- const char* name() const;
- int orient() const;
- const char* orientStr() const;
- double x() const;
- double y() const;
- int hasStepPattern () const;
- double xStart() const;
- double yStart() const;
- double xStep() const;
- double yStep() const; };
The following example shows a callback routine with the type lefrSiteCbkType, and the class lefiSite.
int siteCB (lefrCallbackType_e type,- lefiSite* siteInfo,
- lefiUserData userData) {
- int hasPrtSym = 0;
// Check if the type is correct- if (type != lefrSiteCbkType) {
- printf("Type is not lefrSiteCbkType, terminate
- parsing.\n");
- return 1;
- }
printf("SITE %s\n", siteInfo->name());- if (siteInfo->hasClass())
- printf(" CLASS %s\n", siteInfo->siteClass());
- if (siteInfo->hasXSymmetry()) {
- printf(" SYMMETRY X ");
- hasPrtSym = 1; // set the flag that the keyword SYMMETRY
- has written
- }
- if (siteInfo->hasYSymmetry()) {
- if (hasPrtSym)
- printf("Y ");
- else { // keyword SYMMETRY has not been written yet
- printf(" SYMMETRY Y ");
- hasPrtSym = 1;
- }
- }
- if (siteInfo->has90Symmetry()) {
- if (hasPrtSym)
- printf("R90 ");
- else {
- printf(" SYMMETRY R90 ");
- hasPrtSym = 1;
- }
- }
- if (hasPrtSym)
- printf("\n");
if (siteInfo->hasSize())- printf(" SIZE %g BY %g\n", siteInfo->sizeX(),
- siteInfo->sizeY());
- printf("END %s\n", siteInfo->name());
- return 0;}
The LEF UNITS routines include the following LEF class:
Retrieves data from the UNITS statement of the LEF file. This statement defines the units of measure in LEF.
For syntax information about the LEF UNITS statement, see "Units" in the LEF/DEF Language Reference.
class lefiUnits {- int hasDatabase();
- int hasCapacitance();
- int hasResistance();
- int hasTime();
- int hasPower();
- int hasCurrent();
- int hasVoltage();
- int hasFrequency();
const char* databaseName();- double databaseNumber();
- double capacitance();
- double resistance();
- double time();
- double power();
- double current();
- double voltage();
- double frequency();};
The following example shows a callback routine with the type lefrUnitsCbkType, and the class lefiUnits.
int unitsCB (lefrCallbackType_e type,- lefiUnits* unitInfo,
- lefiUserData userData) {
// Check if the type is correct- if (type != lefrUnitsCbkType) {
- printf("Type is not lefrUnitsCbkType, terminate
- parsing.\n");
- return 1;}
printf("UNITS\n");- if (unitInfo->hasDatabase())
- printf(" DATABASE %s %g\n", unitInfo->databaseName(),
- unitInfo->databaseNumber());
- if (unitInfo->hasCapacitance())
- printf(" CAPACITANCE PICOFARADS %g\n",
- unitInfo->capacitance());
- if (unitInfo->hasResistance())
- printf(" RESISTANCE OHMS %g\n", unitInfo->resistance());
- if (unitInfo->hasPower())
- printf(" POWER MILLIWATTS %g\n", unitInfo->power());
- if (unitInfo->hasCurrent())
- printf(" CURRENT MILLIAMPS %g\n", unitInfo->current());
- if (unitInfo->hasVoltage())
- printf(" VOLTAGE VOLTS %g\n", unitInfo->voltage());
- if (unitInfo->hasFrequency())
- printf(" FREQUENCY MEGAHERTZ %g\n", unitInfo-
- >frequency());
- printf("END UNITS\n");
- return 0;};
The LEF USEMINSPACING routines include the following LEF class:
Retrieves data from the USEMINSPACING statement of the LEF file.
For syntax information about the LEF USEMINSPACING statement, see "Use Min Spacing" in the LEF/DEF Language Reference.
class lefiUseMinSpacing { - const char* name() const;
- int value() const;};
The LEF VIA routines include the following LEF classes:
Retrieves data from the VIA section of the LEF file.
For syntax information about the LEF VIA section, see "Via" in the LEF/DEF Language Reference.
class lefiVia {- int hasDefault() const ;
- int hasGenerated() const;
- int hasForeign() const ; // optional - for information, see
- //
Orientation Codes - int hasForeignPnt() const ;
- int hasForeignOrient() const ;
- int hasProperties() const ;
- int hasResistance() const ;
- int hasTopOfStack() const ;
int numLayers() const;- char* layerName(int layerNum) const;
- int numRects(int layerNum) const;
- double xl(int layerNum, int rectNum) const;
- double yl(int layerNum, int rectNum) const;
- double xh(int layerNum, int rectNum) const;
- double yh(int layerNum, int rectNum) const;
- int numPolygons(int layerNum) const;
- struct lefiGeomPolygon getPolygon(int layerNum, int polyNum) const;
- char* name() const ;
- double resistance() const ;
int numProperties() const ;- char* propName(int index) const;
- char* propValue(int index) const;
- double propNumber(int index) const;
- char propType(int index) const:
- int propIsNumber(int index) const;
- int propIsString(int index) const;
- char* foreign() const;
- double foreignX() const;
- double foreignY() const;
- int foreignOrient() const;
- char* foreignOrientStr() const;
- int hasViaRule() const;
- const char* viaRuleName() const;
- double xCutSize() const;
- double yCutSize() const;
- const char* botMetalLayer() const;
- const char* cutLayer() const;
- const char* topMetalLayer() const;
- double xCutSpacing() const;
- double yCutSpacing() const;
- double xBotEnc() const;
- double yBotEnc() const;
- double xTopEnc() const;
- double yTopEnc() const;
- int hasRowCol() const;
- int numCutRows() const;
- int numCutCols() const;
- int hasOrigin() const;
- double xOffset() const;
- double yOffset() const;
- int hasOffset() const;
- double xBotOffset() const;
- double yBotOffset() const;
- double xTopOffset() const;
- double yTopOffset() const;
- int hasCutPattern() const;
- const char* cutPattern() const;
- double
xl, - double yl,
- double xh,
- double yh);
- lefiGeometries* geom);
- int rectColorMask(int layerNum,
- int rectNum);
- int polyColorMask(int layerNum,
- int rectNum); };
Retrieves data from the LAYER statement within the VIA section of the LEF file. The members of the C++ class and C structures correspond to elements of the LAYER statement in the VIA section.
For syntax information about the LEF VIA section, see "Via" in the LEF/DEF Language Reference.
class lefiViaLayer {- int numRects();
- char* name();
- double xl(int index);
- double yl(int index);
- double xh(int index);
- double yh(int index);
- int numPolygons();
- struct lefiGeomPolygon* getPolygon(int index) const;
- double
xl,- double yl double xh double yn);
- lefiGeometries* geom);
- int rectColorMask(int index);
- int polyColorMask(int index); };
The following example shows a callback routine with the type lefrViaCbkType, and the class lefiVia.
int viaCB (lefrCallbackType_e type,- lefiVia* viaInfo,
- lefiUserData userData) {
int i, j;- // Check if the type is correct
- if (type != lefrViaCbkType) {
- printf("Type is not lefrViaCbkType, terminate
- parsing.\n");
- return 1;}
- printf("VIA %s ", viaInfo->lefiVia::name());
- if (viaInfo->hasDefault())
- printf("DEFAULT\n");
- else
- printf("\n");
- if (viaInfo->hasTopOfStack())
- printf(" TOPOFSTACKONLY\n");
- if (viaInfo->hasForeign()) {
- printf(" FOREIGN %s ", viaInfo->foreign());
- if (viaInfo->hasForeignPnt()) {
- printf("( %g %g ) ", viaInfo->foreignX(),
- viaInfo->foreignY());
- if (viaInfo->hasForeignOrient())
- printf("%s ", orientStr(viaInfo->foreignOrient()));
- }
- printf("\n");
- }
- if (viaInfo->hasProperties()) {
- printf(" PROPERTY ");
- for (i = 0; i < viaInfo->numProperties(); i++) {
- printf("%s ", viaInfo->propName(i));
- if (viaInfo->propIsNumber(i))
- printf("%g ", viaInfo->propNumber(i));
- if (viaInfo->propIsString(i))
- printf("%s ", viaInfo->propValue(i));
- }
- printf("\n");
- }
- if (viaInfo->hasResistance())
- printf(" RESISTANCE %g\n", viaInfo->resistance());
- if (viaInfo->numLayers() > 0) {
- for (i = 0; i < viaInfo->numLayers(); i++) {
- printf(" LAYER %s\n", viaInfo->layerName(i));
- for (j = 0; j < viaInfo->numRects(i); j++)
- printf(" RECT ( %g %g ) ( %g %g )\n",
viaInfo->xl(i, j), viaInfo->yl(i, j),
viaInfo->xh(i, j), viaInfo->yh(i, j));
}
}
printf("END %s\n", viaInfo->name());
return 0;}
The LEF VIARULE routines include the following LEF classes:
Retrieves data from the VIARULE and VIARULE GENERATE statements of the LEF file.
For syntax information about the LEF VIARULE and VIARULE GENERATE statements, see "Via Rule," and "Via Rule Generate" in the LEF/DEF Language Reference.
class lefiViaRule {- int hasGenerate() const;
- int hasDefault() const;
- char* name() const;
int numLayers() const;lefiViaRuleLayer* layer(int index);
int numVias() const;- char* viaName(int index) const;
int numProps() const;- const char* propName(int index) const;
- const char* propValue(int index) const;
- double propNumber(int index) const;
- const char propType(int index) const;
- int propIsNumber(int index) const;
- int propISString(int index) const; };
Retrieves data from the LAYER statement within the VIARULE and VIARULE GENERATE statements of the LEF file.
For syntax information about the LEF VIARULE and VIARULE GENERATE statements, see "Via Rule," and "Via Rule Generate" in the LEF/DEF Language Reference.
class lefiViaRuleLayer {- int hasDirection() const;
- int hasEnclosure() const;
- int hasWidth() const;
- int hasResistance() const;
- int hasOverhang() const;
- int hasMetalOverhang() const;
- int hasSpacing() const;
- int hasRect() const;
char* name() const;- int isHorizontal() const;
- int isVertical() const;
- double enclosureOverhang1() const;
- double enclosureOverhang2() const;
- double widthMin() const;
- double widthMax() const;
- double overhang() const;
- double metalOverhang() const;
- double resistance() const;
- double spacingStepX() const;
- double spacingStepY() const;
- double xl() const;
- double yl() const;
- double xh() const;
- double yh() const; };
The following example shows a callback routine with the type lefrViaRuleCbkType, and the class lefiViaRule. This example also shows how to retrieve data from the lefiViaRuleLayer class.
int viaRuleCB (lefrCallbackType_e type,- lefiViaRule* viaRuleInfo,
- lefiUserData userData) {
- int numLayers, numVias, i;
- lefiViaRuleLayer* vLayer;
- printf("VIARULE %s", viaRuleInfo->name());
- if (viaRuleInfo->hasGenerate())
- printf(" GENERATE\n");
- else
- printf("\n");
- numLayers = viaRuleInfo->numLayers();
- // If numLayers == 2, it is VIARULE without GENERATE and has
- // via name. If numLayers == 3, it is VIARULE with GENERATE, and
- // the 3rd layer is cut.
- for (i = 0; i < numLayers; i++) {
- vLayer = viaRuleInfo->layer(i);
- printf(" LAYER %s\n", vLayer->name());
- if (vLayer->hasDirection()) {
- if (vLayer->isHorizontal())
- printf(" DIRECTION HORIZONTAL\n");
- if (vLayer->isVertical())
- printf(" DIRECTION VERTICAL\n");
- }
- if (vLayer->hasWidth())
- printf(" WIDTH %g TO %g\n", vLayer->widthMin(),
- vLayer->widthMax());
- if (vLayer->hasResistance())
- printf(" RESISTANCE %g\n", vLayer->resistance());
- if (vLayer->hasOverhang())
- printf(" OVERHANG %g\n", vLayer->overhang());
- if (vLayer->hasMetalOverhang())
- printf(" METALOVERHANG %g\n", vLayer-
- >metalOverhang());
- if (vLayer->hasSpacing())
- printf(" SPACING %g BY %g\n", vLayer->spacingStepX(),
- vLayer->spacingStepY());
- if (vLayer->hasRect())
printf(" RECT ( %g %g ) ( %g %g )\n", vLayer->xl(),
vLayer->yl(), vLayer->xh(), vLayer->yh()); }
if (numLayers == 2) { // should have vianames
numVias = viaRuleInfo->numVias();
if (numVias == 0)
printf("Should have via names in VIARULE.\n");
else {
for (i = 0; i < numVias; i++)
printf(" VIA %s\n", viaRuleInfo->viaName(i));
}
}
printf("END %s\n", viaRuleInfo->name());
return 0;}