View Library Table of Contents Previous Next Open PDF to print book Email Comments Help Using Documentation Shut Down Cadence Documentation Server


DEF 5.8 C/C++ Programming Interface (Open Licensing Program)


4 

DEF Reader Classes

This chapter contains the following sections:

ParagraphBullet
Introduction
ParagraphBullet
Callback Style Interface
ParagraphBullet
Retrieving Repeating DEF Data
ParagraphBullet
Deriving C Syntax from C++ Syntax
ParagraphBullet
DEF Reader Class Routines

Introduction

Every statement in the Cadence® Design Exchange Format (DEF) file is associated with a DEF reader class. When the DEF 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 DEF file.

Callback Style Interface

This programming interface uses a callback style interface. You register for the constructs that interest you, and the reader calls 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.

 
ParagraphBullet
Returned data is not static. If you want to keep the data, you must copy it.

Retrieving Repeating DEF Data

Many DEF objects contain repeating objects or specifications. The classes that correspond to these DEF 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< A->defiVia::numLayers(); i++) {
via -> defiVia::layer(i, &name, &x1, &y1, &xh, &yh);
printf("+ RECT %s %d %d %d %d \n", name x1, y1, xh, yh);

Deriving C Syntax from C++ Syntax

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 objects in C and C++ syntax.

C++ Syntax

class defiVia {
const char* name() const;
const char* pattern() const;
int hasPattern() const;
int numLayers() const;
void layer(int index, char** layer, int* xl, int* yl,
    int* xh, int* yh) const;}

C Syntax

const char * defiVia)name
( const defiVia * this );
const char * defiVia_hasPattern
( const defiVia * this );
int defiVia_hasPattern
( const defiVia * this );
int defiVia_numLayers
( const defiVia * this );
void defiVia_layer
( const defiVia * this,
    int index,
    char **layer,
    int *x1
    int *y1
    int *xh
    int *yh);

The C routine prototypes for the API functions can be found in the following files:

defiArray.h

defiNonDefault.h

defiViaRule.h

defiCrossTalk.h

defrCallBacks.h

defiProp.h

defrReader.h

defiDebug.h

defiDefs.h

defwWriter.h

defiLayer.h

defiUnits.h

defiUser.h

defiMacro.h

defiUtil.h

defiMisc.h

defiVia.h

 

DEF Reader Class Routines

The following table lists the class routines that apply to the DEF information.

DEF Information

DEF Class

Blockages

defiBlockage

Components

defiComponent
defiProp
defiComponentMaskShiftLayer

Fills

defiFill

GCell Grid

defiGcellGrid

Groups

defiGroup
defiProp

Nets

defiNet
defiPath
defiProp
defiSubnet
defiVpin
defiWire

Nondefault Rules

defiNonDefault

Pins

defiPin
defiPinAntennaModel
defiProp

Pin Properties

defiPinProp

Regions

defiRegion
defiProp

Rows

defiProp
defiRow
defiSite

Scan Chains

defiOrdered
defiScanchain

Slots

defiSlot

Special Nets

defiNet
defiPath
defiProp
defiShield
defiViaData
defiWire

Styles

defiStyles

Tracks

defiTrack

Vias

defiVia

Miscellaneous

defiBox
defiGeometries
defiPoints
defiUser (defined as void; can be any
user-defined pointer)

defiBlockage

Retrieves data from the BLOCKAGES statement in the DEF file. For syntax information about the DEF BLOCKAGES statement, see "Blockages" in the LEF/DEF Language Reference.

C++ Syntax

class defiBlockage {
int hasLayer() const;
int hasPlacement() const;
int hasComponent() const;
int hasSlots() const;
int hasFills() const;
int hasPushdown() const;
int hasExceptpgnet() const;
int hasSoft() const;
int hasPartial() const;
int hasSpacing() const;
int hasDesignRuleWidth() const;
int minSpacing() const;
int designRuleWidth() const;
double placementMaxDensity() const;
const char* layerName() const;
const char* layerComponentName() const;
const char* placementComponentName() const;
int numRectangles() const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;
int numPolygons() const;
struct defiPoints getPolygon(int index) const;
int hasMask() const;
int mask() const;}

defiBox

Retrieves data from the DIEAREA statement of the DEF file. For syntax information about the DEF DIEAREA statement, see "Die Area" in the LEF/DEF Language Reference.

C++ Syntax

class defiBox {
int xl() const;
int yl() const;
int xh() const;
int yh() const;
struct defiPoints getPoint() const;}

defiComponent

Retrieves data from the COMPONENTS statement in the DEF file. For syntax information about the DEF COMPONENTS statement, see "Components" in the LEF/DEF Language Reference.

C++ Syntax

class defiComponent {
const char* id() const;
const char* name() const;
int placementStatus() const;
int isUnplaced() const;
int isPlaced() const;
int isFixed() const;
int isCover() const;
int placementX() const;
int placementY() const;
int placementOrient() const;            // optional- For information,see
//"Orientation Codes"
const char* placementOrientStr() const;
int hasRegionName() const;
int hasRegionBounds() const;
int hasEEQ() const;
int hasGenerate() const;
int hasSource() const;
int hasWeight() const;
int weight() const;
int hasNets() const;
int numNets() const;
const char* net(int index) const;
const char* regionName() const;
const char* source() const;
const char* EEQ() const;
const char* generateName() const;
const char* macroName() const;
int hasHalo() const;
int hasHaloSoft() const;
int hasRouteHalo() const;
int haloDist() const;
const char* minLayer() const;
const char* maxLayer() const;
void haloEdges(int* left, int* bottom, int* right, int* top);
void regionBounds(int* size, int** xl, int** yl, int** xh, int** yh);
int hasForeignName() const;
const char* foreignName() const;
int foreignX() const;
int foreignY() const;
const char* foreignOri() const;
int hasFori() const;
int foreignOrient() const;
int numProps() 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;
int maskShiftSize();
int maskShift(int index) const;}

Examples

The following example shows a callback routine with the type defrComponentCbkType. Callback routines for the type defrComponentStartCbkType and defrComponentEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int componentCB (defrCallbackType_e type,
defiComponent* compInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if ((type != defrComponentCbkType)) {
printf("Type is not defrComponentCbkType terminate
parsing.\n");
return 1;
}
printf("%s %s ", compInfo->id(), compInfo->name());
if (compInfo->hasNets()) {
for (i = 0; i < compInfo->numNets(); i++)
printf("%s ", compInfo->net(i));
printf("\n");
}
if (compInfo->isFixed())
printf(" FIXED %d %d %d\n", compInfo->placementX(),
compInfo->placementY(),
compInfo->placementOrient());
if (compInfo->isCover())
printf(" COVER %d %d %d\n", compInfo->placementX(),
compInfo->placementY(),
compInfo->placementOrient());
if (compInfo->isPlaced())
printf(fout," PLACED %d %d %d\n", compInfo->placementX(),
compInfo->placementY(),
compInfo->placementOrient());
if (compInfo->hasSource())
printf(" SOURCE %s\n", compInfo->source());
if (compInfo->hasWeight())
printf(" WEIGHT %d\n", compInfo->weight());
if (compInfo->hasEEQ())
printf(" EEQMASTER %s\n", compInfo->EEQ());
if (compInfo->hasRegionName())
printf(" REGION %s\n", compInfo->regionName());
if (compInfo->hasRegionBounds()) {
int *xl, *yl, *xh, *yh;
int size;
compInfo->regionBounds(&size, &xl, &yl, &xh, &yh);
for (i = 0; i < size; i++) {
printf(" REGION %d %d %d %d\n", xl[i], yl[i],
xh[i], yh[i]);
}
}
if (compInfo->hasForeignName()) {
printf(" FOREIGN %s %d %d %s\n", compInfo->foreignName(),
compInfo->foreignX(), compInfo->foreignY(),
compInfo->foreignOri());
    }
    // maskShiftArray[0] will always return the right most digit,since we     // allow the leading 0 and also omit the leading 0's.
    if (compInfo->maskShiftSize()) {
       printf(" MASKSHIFT");

       for (i = compInfo->maskShiftSize() -1; i >=0; i--) {
           printf("%d ", compInfo->maskShift(i);
       }
       printf("\n");
    }
return 0;
}

defiComponentMaskShiftLayer

Retrieves data from the COMPONENTMASKSHIFT statement in the DEF file.

For syntax information about the DEF COMPONENTMASKSHIFT statement, see "Component Mask Shift" in the LEF/DEF Language Reference.

C++ Syntax

class defiComponentMaskShiftLayer {
public:
     defiComponentMaskShiftLayer();
     ~defiComponentMaskShiftLayer();
void Init();
void Destroy();
void addMaskShiftLayer(const char* layer);
int numMaskShiftLayers() const;
void bumpLayers(int size);
void clear();
const char* maskShiftLayer(int index) const;};

defiFill

Retrieves data from the FILLS statement in the DEF file. For syntax information about the DEF FILLS statement, see "Fills" in the LEF/DEF Language Reference.

C++ Syntax

class defiFill {
int hasLayer() const;
const char* layerName() const;
int hasLayerOpc() const;
int numRectangles() const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;
int numPolygons() const;
struct defiPoints getPolygon(int index) const;
int hasVia() const;
const char* viaName() const;
int hasViaOpc() const;
int numViaPts() const;
struct defiPoints getViaPts(int index) const;
void setMask(int colorMask);
int layerMask() const
int viaTopMask() const;
int viaCutMask() const;
int viaBottomMask() const;}

defiGcellGrid

Retrieves data from the GCELLGRID statement in the DEF file. For syntax information about the DEF GCELLGRID statement, see "GCell Grid" in the LEF/DEF Language Reference.

C++ Syntax

class defiGcellGrid {
const char* macro() const;
int x() const;
int xNum() const;
double xStep() const;}

Examples

The following example shows a callback routine with the type defrGcellGridCbkType, and the class defiGcellGrid.

int gcellCB (defrCallbackType_e type,
defiGcellGrid* gcellInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if (type != defrGcellGridCbkType) {
printf("Type is not defrGcellGridCbkType, terminate
        parsing.\n");
return 1;
}
printf("GCELLGRID %s %d DO %d STEP %g\n", gcellInfo->macro(),
gcellInfo->x(), gcellInfo->xNum(), gcellInfo->xStep());
return 0;
}

defiGeometries

Retrieves geometry data from the BLOCKAGES, FILLS, NETS, and SLOTS statements of the DEF file. For syntax information, see "Blockages," "Fills," "Nets," and "Slots" in the LEF/DEF Language Reference.

C++ Syntax

class defiGeometries {
int numPoints() const;
void points(int index, int* x, int* y);}

defiGroup

Retrieves data from the GROUPS statement in the DEF file. For syntax information about the DEF GROUPS statement, see "Groups" in the LEF/DEF Language Reference.

C++ Syntax

class defiGroup {
const char* name() const;
const char* regionName() const;
int hasRegionBox() const;
int hasRegionName() const;
int hasMaxX() const;
int hasMaxY() const;
int hasPerim() const;
void regionRects(int* size, int** xl, int** yl, int** xh, int** yh);
int maxX() const;
int maxY() const;
int perim() 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; }

Examples

The following example shows callback routines for the types defrGroupNameCbkType, defrGroupMemberCbkType, and defrGroupCbkType. Callback routines for the type defrGroupsStartCbkType and defrGroupsEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int groupnameCB (defrCallbackType_e type,
const char* name,
defiUserData userData) {
// Check if the type is correct
if ((type != defrGroupNameCbkType)) {
printf("Type is not defrGroupNameCbkType terminate
parsing.\n");
return 1;
}
printf("Name is %s\n", name());
return 0;
}
int groupmemberCB (defrCallbackType_e type,
const char* name,
defiUserData userData) {
// Check if the type is correct
if ((type != defrGroupMemberCbkType)) {
printf("Type is not defrGroupMemberCbkType terminate
parsing.\n");
return 1;
}
printf(" %s\n", name());
return 0;
}
int groupCB (defrCallbackType_e type,
defiGroup grouInfo,
defiUserData userData) {
// Check if the type is correct
if ((type != defrGroupCbkType)) {
printf("Type is not defrGroupCbkType terminate
parsing.\n");
return 1;
}
if (group->hasMaxX() | group->hasMaxY() |
group->hasPerim())
{
printf(" SOFT ");
if (group->hasPerim())
printf("MAXHALFPERIMETER %d ", group->perim());
if (group->hasMaxX())
printf("MAXX %d ", group->maxX());
if (group->hasMaxY())
printf("MAXY %d ", group->maxY());
}
if (group->hasRegionName())
printf("REGION %s ", group->regionName());
if (group->hasRegionBox()) {
int *gxl, *gyl, *gxh, *gyh;
int size;
group->regionRects(&size, &gxl, &gyl, &gxh, &gyh);
for (i = 0; i < size; i++)
printf("REGION %d %d %d %d ", gxl[i], gyl[i], gxh[i],
gyh[i]);
}
printf("\n");
return 0;}

defiNet

Retrieves data from the NETS statement in the DEF file. For syntax information about the DEF NETS statement, see "Nets" in the LEF/DEF Language Reference.

C++ Syntax

class defiNet {
const char* name() const;
int weight() 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 numConnections() const;
const char* instance(int index) const;
const char* pin(int index) const;
int pinIsMustJoin(int index) const;
int pinIsSynthesized(int index) const;
int numSubnets() const;
defiSubnet* subnet(int index);
int isFixed() const;
int isRouted() const;
int isCover() const;
int numWires() const;
defiWire* wire(int index);
int numVpins() const;
defiVpin* vpin(int index) const;
int hasProps() const;
int hasWeight() const;
int hasSubnets() const;
int hasSource() const;
int hasFixedbump() const;
int hasFrequency() const;
int hasPattern() const;
int hasOriginal() const;
int hasCap() const;
int hasUse() const;
int hasStyle() const;
int hasNonDefaultRule() const;
int hasVoltage() const;
int hasSpacingRules() const;
int hasWidthRules() const;
int hasXTalk() const;
int numSpacingRules() const;
void spacingRule(int index, char** layer, double* dist,
    double* left, double* right);
int numWidthRules() const;
void widthRule(int index, char** layer, double* dist);
double voltage() const;
int XTalk() const;
const char* source() const;
double frequency() const;
const char* original() const;
const char* pattern() const;
double cap() const;
const char* use() const;
int style() const;
const char* nonDefaultRule() const;
int numPaths() const;
defiPath* path(int index);

int numShields() const;
defiShield* shield(int index);
int numShieldNets() const;
const char* shieldNet(int index) const;
int numNoShields() const;
defiShield* noShield(int index);

int numPolygons() const;
const char* polygonName(int index) const;
struct defiPoints getPolygon(int index) const;
int numRectangles() const;
const char* rectName(int index) const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;
int polyMask(int index) const;
int rectMask(int index) const;
int topMaskNum(int index) const;
int cutMaskNum(int index) const;
int bottomMask(int index) const;}

Examples

The following example shows a callback routine with the type defrSNetCbkType. Callback routines for the type defrSNetStartCbkType and defrSNetEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section. This example only shows how to retrieve part of the data from the defiNet class.

int snetCB (defrCallbackType_e type,
defiNet* snetInfo,
defiUserData userData) {
int i, x, y, newLayer;
char* layerName;
double dist, left, right;
defiPath* p;
int path;
defiShield* shield;
// Check if the type is correct
if ((type != defrSNetCbkType)) {
printf("Type is not defrSNetCbkType terminate
parsing.\n");
return 1;
}
// compName & pinName
for (i = 0; i < net->numConnections(); i++)
printf ("( %s %s )\n", net->instance(i), net->pin(i));
// specialWiring
if (net->isFixed()) {
printf("FIXED\n");
}
    if (net->numPaths()) {
newLayer = 0;
for (i = 0; i < net->numPaths(); i++) {
p = net->path(i);
p->initTraverse();
while ((path = (int)p->next()) != DEFIPATH_DONE) {
switch (path) {
case DEFIPATH_LAYER:
if (newLayer == 0) {
printf("%s ", p->getLayer());
newLayer = 1;
} else
printf("NEW %s ", p->getLayer());
break;
                case DEFIPATH_VIA:
printf("%s ", p->getVia());
break;
                case DEFIPATH_WIDTH:
printf("%d ", p->getWidth());
break;
                case DEFIPATH_POINT:
p->getPoint(&x, &y);
printf("( %d %d ) ", x, y);
break;
                case DEFIPATH_TAPER:
printf("TAPER ");
break;
                case DEFIPATH_SHAPE:
printf(" SHAPE %s ", p->getShape());
break;
}
}
printf("\n");
}
}
// SHIELD
// testing the SHIELD for 5.3
    if (net->numShields()) {
for (i = 0; i < net->numShields(); i++) {
shield = net->shield(i);
printf("\n+ SHIELD %s ",
shield->defiShield::shieldName());
newLayer = 0;
for (j = 0; j < shield->defiShield::numPaths(); j++) {
p = shield->defiShield::path(j);
p->initTraverse();
while ((path = (int)p->next()) != DEFIPATH_DONE) {
switch (path) {
case DEFIPATH_LAYER:
if (newLayer == 0) {
printf("%s ", p->getLayer());
newLayer = 1;
} else
printf("NEW %s ", p->getLayer());
break;
                    case DEFIPATH_VIA:
printf("%s ", p->getVia());
break;
                    case DEFIPATH_WIDTH:
printf("%d ", p->getWidth());
break;
                    case DEFIPATH_POINT:
p->getPoint(&x, &y);
printf("( %d %d ) ", x, y);
break;
                    case DEFIPATH_TAPER:
printf("TAPER ");
break;
                }
}
printf("\n");
}
}
}
    // layerName spacing
    if (net->hasSpacingRules()) {
for (i = 0; i < net->numSpacingRules(); i++) {
net->spacingRule(i, &layerName, &dist, &left, &right);
if (left == right)
printf("SPACING %s %g\n", layerName, dist);
else
printf("SPACING %s %g RANGE %g %g\n",
layerName, dist, left, right);
}
}
return 0;
}

defiNonDefault

Retrieves data from the NONDEFAULTRULES statement in the DEF file. For syntax information about the DEF NONDEFAULTRULES statement, see "Nondefault Rules," in the LEF/DEF Language Reference.

C++ Syntax

class defiNonDefault {
const char* name() const;
int hasHardspacing() 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 hasLayerDiagWidth(int index) const;
int hasLayerSpacing(int index) const;
int hasLayerWireExt(int index) const;
int numVias() const;
const char* viaName(int index) const;
int numViaRules() const;
const char* viaRuleName(int index) const;
int hasMinCuts() const;
void minCuts(const char **cutLayerName, int *numCuts) const;}

defiOrdered

Retrieves data from the ORDERED statement in the SCANCHAINS statement of the DEF file. For syntax information about the DEF SCANCHAINS statement, see "Scan Chains" in the
LEF/DEF Language Reference.

C++ Syntax

class defiOrdered {
int num() const;
char** inst() const;
char** in() const;
char** out() const;
int* bits() const; }

defiPath

Retrieves data from the regularWiring and specialWiring specifications in the NETS and SPECIALNETS sections of the DEF file. For syntax information about the DEF SPECIALNETS and NETS statements, see "Special Nets" and "Nets" in the LEF/DEF Language Reference.

C++ Syntax

class defiPath {
void initTraverse();
void initTraverseBackwards();
int next();
int prev();
const char* getLayer(); .
const char* getTaperRule();
const char* getVia();
const char* getShape();
int getStyle();
int getViaRotation();
const char* getViaRotationStr();
void getViaData(int* numX, int* numY, int* stepX, int* stepY);
int getWidth();
void getPoint(int* x, int* y);
void getFlushPoint(int* x, int* y, int* ext);
int getMask();
int getViaTopMask();
int getViaCutMask();
int getViaBottomMask();
int getRectMask();}

Examples

For a defiPath example, see the example in the defiNet section.

defiPin

Retrieves data from the PINS statement in the DEF file. For syntax information about the DEF PINS statement, see "Pins" in the LEF/DEF Language Reference.

C++ Syntax

class defiPin {
const char* pinName() const;
const char* netName() const;
int hasDirection() const;
int hasUse() const;
int hasLayer() const;
int hasPlacement() const;
int isUnplaced() const;
int isPlaced() const;
int isCover() const;
int isFixed() const;
int placementX() const;
int placementY() const;
const char* direction() const;
const char* use() const;
int numLayer() const;
const char* layer(int index) const;
void bounds(int index, int* xl, int* yl, int* xh, int* yh) const;
int hasLayerSpacing(int index) const;
int hasLayerDesignRuleWidth(int index) const;
int layerSpacing(int index) const;
int layerDesignRuleWidth(int index) const;
int numPolygons() const;
const char* polygonName(int index) const;
struct defiPoints getPolygon(int index) const;
int hasPolygonSpacing(int index) const;
int hasPolygonDesignRuleWidth(int index) const;
int polygonSpacing(int index) const;
int polygonDesignRuleWidth(int index) const;
int hasNetExpr() const;
int hasSupplySensitivity() const;
int hasGroundSensitivity() const;
const char* netExpr() const;
const char* supplySensitivity() const;
const char* groundSensitivity() const;
int orient() const;                      // optional- For information, see
           //"Orientation Codes"
const char* orientStr() const;
int hasSpecial() const;
int numVias() const;
const char* viaName(int index) const;
int viaPtX (int index) const;
int viaPtY (int index) const;
int hasAPinPartialMetalArea() const;
int numAPinPartialMetalArea() const;
int APinPartialMetalArea(int index) const;
int hasAPinPartialMetalAreaLayer(int index) const;
const char* APinPartialMetalAreaLayer(int index) const;

int hasAPinPartialMetalSideArea() const;
int numAPinPartialMetalSideArea() const;
int APinPartialMetalSideArea(int index) const;
int hasAPin PartialMetalSideAreaLayer(int index) const;
const char* APinPartialMetalSideAreaLayer(int index) const;

int hasAPinDiffArea() const;
int numAPinDiffArea() const;
int APinDiffArea(int index) const;
int hasAPinDiffAreaLayer(int index) const;
const char* APinDiffAreaLayer(int index) const;

int hasAPinPartialCutArea() const;
int numAPinPartialCutArea() const;
int APinPartialCutArea(int index) const;
int hadAPinPartialCutAreaLayer(int index) const;
const char* APinPartialCutAreaLayer(int index) const;

int numAntennaModel() const;
defiPinAntennaModel* antennaModel(int index) const;

int hasPort() const;
int numPorts() const;
defiPinPort* pinPort(int index) const;
int layerMask(int index) const;
int polygonMask(int index) const;
int viaTopMask(int index) const;
int viaCutMask(int index) const;
int viaBottomMask(int index) const;}

Examples

The following example shows a callback routine with the type defrPinCbkType. Callback routines for the type defrStartPinsCbkType and defrPinEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int pinCB (defrCallbackType_e type,
defiPin* pinInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if ((type != defrPinCbkType)) {
printf("Type is not defrPinCbkType terminate parsing.\n");
return 1;
}
    printf("%s NET %s\n", pinInfo->pinName(),
pinInfo->netName());
if (pinInfo->hasDirection())
printf(" DIRECTION %s\n", pinInfo->direction());
if (pinInfo->hasUse())
printf(" USE %s\n", pinInfo->use());
if (pinInfo->hasLayer()) {
printf(" LAYER %s ", pinInfo->layer());
pinInfo->bounds(&xl, &yl, &xh, &yh);
printf("%d %d %d %d\n", xl, yl, xh, yh);
}
    if (pinInfo->hasPlacement()) {
if (pinInfo->isPlaced())
printf(" PLACED\n");
if (pinInfo->isCover())
printf(" COVER\n");
if (pinInfo->isFixed())
printf(" FIXED\n");
printf("( %d %d ) %d ", pinInfo->placementX(),
pinInfo->placementY(),
pinInfo->orient());
}
if (pinInfo->hasSpecial())
printf(" SPECIAL\n");
return 0;}

defiPinAntennaModel

Retrieves antenna model information in the PINS statement in the DEF file. For syntax information about the DEF PINS statement, see "Pins" in the LEF/DEF Language Reference.

C++ Syntax

class defiPinAntennaModel {
char* antennaOxide() const;
int hasAPinGateArea() const;
int numAPinGateArea() const;
int APinGateArea(int index) const;
int hasAPinGateAreaLayer(int index) const;
const char* APinGateAreaLayer(int index) const;
int hasAPinMaxAreaCar() const;
int numAPinMaxAreaCar() const;
int APinMaxAreaCar(int index) const;
int hasAPinMaxAreaCarLayer(int index) const;
const char* APinMaxAreaCarLayer(int index) const;
int hasAPinMaxSideAreaCar() const;
int numAPinMaxSideAreaCar() const;
int APinMaxSideAreaCar(int index) const;
int hasAPinMaxSideAreaCarLayer(int index) const;
const char* APinMaxSideAreaCarLayer(int index) const;
int hasAPinMaxCutCar() const;
int numAPinMaxCutCar() const;
int APinMaxCutCar(int index) const;
int hasAPinMaxCutCarLayer(int index) const;
const char* APinMaxCutCarLayer(int index) const; }

defiPinPort

Retrieves data from the PINS PORT statement in the DEF file. For syntax information about the DEF PINS PORT statement, see "Pins" in the LEF/DEF Language Reference.

C++ Syntax

class defiPinPort {
int numLayer() const;
const char* layer(int index) const;
int hasLayerSpacing(int index) const;
int hasLayerDesignRuleWidth(int index) const;
int layerSpacing(int index) const;
int layerDesignRuleWidth(int index) const;
int numPolygons() const;
const char* polygonName(int index) const;
struct defiPoints getPolygon(int index) const;
int hasPolygonSpacing(int index) const;
int hasPolygonDesignRuleWidth(int index) const;
int polygonSpacing(int index) const;
int polygonDesignRuleWidth(int index) const;
int numVias() const;
const char* viaName(int index) const;
int viaPtX (int index) const;
int viaPtY (int index) const;
int hasPlacement() const;
int isPlaced() const;
int isCover() const;
int isFixed() const;
int placementX() const;
int placementY() const;
int orient() const;
const char* orientStr() const;
int layerMask(int index) const;
int polygonMask(int index) const;
int viaTopMask(int index) const;
int viaCutMask(int index) const;
int viaBottomMask(int index) const;};}

defiPinProp

Retrieves data from the PINPROPERTIES statement in the DEF file. For syntax information about the DEF PINPROPERTIES statement, see "Pin Properties" in the LEF/DEF Language Reference.

C++ Syntax

class defiPinProp {
int isPin() const;
const char* instName() const;
const char* pinName() 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); }

Examples

The following example shows a callback routine with the type defrPinPropCbkType. Callback routines for the type defrPinPropStartCbkType and defrPinPropEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int pinpropCB (defrCallbackType_e type,
defiPinProp* pinpropInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if ((type != defrPinCbkType)) {
printf("Type is not defrPinCbkType terminate parsing.\n");
return 1;
}
if (pinpropInfo->isPin())
printf("PIN %s\n", pinpropInfo->pinName());
else
printf("%s %s\n", pinpropInfo->instName(),
pinpropInfo->pinName());
if (pinpropInfo->numProps() > 0) {
for (i = 0; i < pinpropInfo->numProps(); i++) {
printf(" PROPERTY %s %s\n", pinpropInfo->propName(i),
pinpropInfo->propValue(i));
}
}
return 0;}

defiPoints

Retrieves a list of points for polygons in the DEF file.

C++ Syntax

struct defiPoints {
int numPoints;
int* x;
int* y;}

defiProp

Retrieves data from the PROPERTYDEFINITIONS statement in the DEF file. For syntax information about the DEF PROPERTYDEFINITIONS statement, see "Property Definitions" in the LEF/DEF Language Reference.

The string of the property is returned by the C++ function string or the C function defiProp_string. A property can have a number and a range, which are returned by the function hasNumber and hasRange. The actual values are returned by the functions number, left, and right.

C++ Syntax

class defiProp {
const char* string() const;
const char* propType() const;
const char* propName() const;
char dataType() const;           // either I:integer, R:real, S:string,
                                 // Q:quotestring, or N:nameMapString
int hasNumber() const;
int hasRange() const;
int hasString() const;
int hasNameMapString() const;
double number() const;
double left() const;
double right() const;}

Examples

The following example shows a callback routine with the type defrPropDefStartCbkType, and void *. This callback routine marks the beginning of the Property Definitions section.

int propDefStartCB (defrCallbackType_e type,
void* dummy,
defiUserData userData) {
// Check if the type is correct
if (type != defrPropDefStartCbkType) {
printf("Type is not defrPropDefStartCbkType,
terminate parsing.\n");
return 1;
}
printf("PROPERTYDEFINITIONS\n");
return 0;}

The following example shows a callback routine with the type defrPropCbkType, and the class defiProp. This callback routine will be called for each defined property definition.

int propDefCB (defrCallbackType_e type,
defiProp* propInfo,
defiUserData userData) {
// Check if the type is correct
if (type != defrPropCbkType) {
printf("Type is not defrPropCbkType, terminate
parsing.\n");
return 1;
}
// Check the object type of the property definition
if (strcmp(propInfo->propType(), "design") == 0)
printf("DESIGN %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "net") == 0)
printf("NET %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "component") == 0)
printf("COMPONENT %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "specialnet") == 0)
printf("SPECIALNET %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "group") == 0)
printf("GROUP %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "row") == 0)
printf("ROW %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "componentpin") == 0)
printf("COMPONENTPIN %s ", propInfo->propName());
else if (strcmp(propInfo->propType(), "region") == 0)
printf("REGION %s ", propInfo->propName());
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 defrPropDefEndCbkType, and void *. This callback routine marks the end of the Property Definitions section.

int propDefEndCB (defrCallbackType_e type,
void* dummy,
defiUserData userData) {
// Check if the type is correct
if (type != defrPropDefEndCbkType) {
printf("Type is not defrPropDefEndCbkType,
terminate parsing.\n");
return 1;
}

defiRegion

Retrieves data from the REGIONS statement in the DEF file. For syntax information about the DEF REGIONS statement, see "Regions" in the LEF/DEF Language Reference.

C++ Syntax

class defiRegion {
const char* name() 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 hasType() const;
const char* type() const;
int numRectangles() const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;}

Examples

The following example shows a callback routine with the type defrRegionCbkType. Callback routines for the type defrRegionStartCbkType and defrRegionEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int regionCB (defrCallbackType_e type,
defiRegion* regionInfo,
defiUserData userData) {
int i;
char* name;
// Check if the type is correct
if ((type != defrRegionCbkType)) {
printf("Type is not defrRegionCbkType terminate
parsing.\n");
return 1;
}
for (i = 0; i < regionInfo->numRectangles(); i++)
printf("%d %d %d %d \n", regionInfo->xl(i),
regionInfo->yl(i), regionInfo->xh(i),
regionInfo->yh(i));
return 0;}

defiRow

Retrieves data from the ROW statement in the DEF file. For syntax information about the DEF ROW statement, see "Rows" in the LEF/DEF Language Reference.

C++ Syntax

class defiRow {
const char* name() const;
const char* macro() const;
double x() const;
double y() const;
int orient() const;                   // optional-For information,see
             //"Orientation Codes"
const char* orientStr() const;
int hasDo() const;
double xNum() const;
double yNum() const;
int hasDoStep() const;
double xStep() const;
double yStep() 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;}

Examples

The following example shows a die area routine using a callback routine with the type defrDieAreaCbkType, and the class defiRow.

int diearea (defrCallbackType_e type,
defiRow* dieareaInfo,
defiUserData userData) {
// Check if the type is correct
if (type != defrDieAreaCbkType) {
printf("Type is not defrDieAreaCbkType, terminate
parsing.\n");
return 1;
}
printf("DIEAREA %d %d %d %d\n", diearea->xl(), diearea->yl(),
diearea->xh(), diearea->yh());
return 0;}

The following example shows a row routine using a callback routine with the type defrRowCbkType, and the class defiRow.

int rowCB (defrCallbackType_e type,
defiRow* rowInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if (type != defrRowCbkType) {
printf("Type is not defrRowCbkType, terminate
parsing.\n");
return 1;
}
    printf("ROW %s %s %g %g %d ", rowInfo->name(),
rowInfo->macro(), rowInfo->x(), rowInfo->y(),
rowInfo->orient());
    printf("DO %g BY %g STEP %g %g\n", rowInfo->xNum(),
rowInfo->yNum(),rowInfo->xStep(), row->yStep());
    if (rowInfo->numProps() > 0) {
for (i = 0; i < rowInfo->numProps(); i++) {
printf(" PROPERTY %s %s\n", rowInfo->propName(i),
rowInfo->propValue(i));
}
}
return 0;}

defiScanchain

Retrieves data from the SCANCHAINS statement in the DEF file. For syntax information about the DEF SCANCHAINS statement, see "Scan Chains" in the LEF/DEF Language Reference.

C++ Syntax

class defiScanchain {
const char* name() const;
int hasStart() const;
int hasStop() const;
int hasFloating() const;
int hasOrdered() const;
int hasCommonInPin() const;
int hasCommonOutPin() const;
int hasPartition() const;
int hasPartitionMaxBits() const;
void start(char** inst, char** pin) const;
void stop(char** inst, char** pin) const;
int numOrdered() const;
void ordered(int index, int* size, char*** inst, char*** inPin,
    char*** outPin, int** bits) const;
void floating(int* size, char*** inst, char*** inPin,
    char*** outPin, int** bits) const;
const char* commonInPin() const;
const char* commonOutPin() const;
const char* partitionName() const;
int partitionMaxBits(); }

Examples

The following example shows a callback routine with the type defrScanchainCbkType. Callback routines for the type defrScanchainsStartCbkType and defrScanchainsEndCbkType are similar to the example for defrViaStartCbkType and defrViaEndCbkType in the Via section.

int scanchainCB (defrCallbackType_e type,
defiScanchain* scanchainInfo,
defiUserData userData) {
// Check if the type is correct
if ((type != defrScanchainCbkType)) {
printf("Type is not defrScanchainCbkType
terminate parsing.\n");
return 1;
}
    printf("%s\n", scanchainInfo->name());
if (scanchainInfo->hasStart()) {
scanchainInfo->start(&a1, &b1);
printf(" START %s %s\n", a1, b1);
}
if (scanchainInfo->hasStop()) {
scanchainInfo->stop(&a1, &b1);
printf(" STOP %s %s\n", a1, b1);
}
if (scanchainInfo->hasCommonInPin() ||
scanchainInfo->hasCommonOutPin()) {
printf(" COMMONSCANPINS ");
if (scanchainInfo->hasCommonInPin())
printf(" ( IN %s ) ", scanchainInfo->commonInPin());
if (scanchainInfo->hasCommonOutPin())
printf(" ( OUT %s ) ",scanchainInfo->commonOutPin());
printf("\n");
}
if (scanchainInfo->hasFloating()) {
scanchainInfo->floating(&size, &inst, &inPin, &outPin);
if (size > 0)
printf(" + FLOATING\n");
for (i = 0; i < size; i++) {
printf(" %s ", inst[i]);
if (inPin[i])
printf("( IN %s ) ", inPin[i]);
if (outPin[i])
printf("( OUT %s ) ", outPin[i]);
printf("\n");
}
printf("\n");
}
if (scanchainInfo->hasOrdered()) {
for (i = 0; i < scanchainInfo->numOrderedLists(); i++) {
scanchainInfo->ordered(i, &size, &inst, &inPin,
&outPin);
if (size > 0)
printf(" + ORDERED\n");
for (i = 0; i < size; i++) {
printf(" %s ", inst[i]);
if (inPin[i])
printf("( IN %s ) ", inPin[i]);
if (outPin[i])
printf("( OUT %s ) ", outPin[i]);
printf("\n");
}
}
printf("\n");
}
return 0;}

defiShield

Retrieves data from the SPECIALNETS statement in the DEF file. For syntax information about the DEF SPECIALNETS statement, see "Special Nets" in the LEF/DEF Language Reference.

C++ Syntax

class defiShield {
const char* shieldName() const;
int numPaths() const;
defiPath* path(int index);}

Examples

For a defiShield example, see the example in the defiNet section.

defiSite

Retrieves data from any obsolete SITE sections of the DEF file.

C++ Syntax

class defiSite {
double x_num() const;
double y_num() const;
double x_step() const;
double y_step() const;
double x_orig() const;
double y_orig() const;
int orient() const;               // optional- For information, see
    //"Orientation Codes"
const char* orientStr() const;
const char* name() const;}

Examples

The following example shows a callback routine with the type defrCanplaceCbk and defrCannotOccupyCbk.

int siteCB (defrCallbackType_e type,
defiSite siteInfo,
defiUserData userData) {
// Check if the type is correct
if ((type != defrCanplaceCbk) && (type !=
defrCannotOccupyCbk)) {
printf("Type is not defrCanplaceCbk and not
defrCannotOccupyCbk,\n");
printf("terminate parsing.\n");
return 1;
}
    printf("CANPLACE %s %g %g %s ", siteInfo->name(),
siteInfo->x_orig(), siteInfo->y_orig(),
orientStr(siteInfo->orient()));
printf("DO %d BY %d STEP %g %g ;\n", siteInfo->x_num(),
siteInfo->y_num(),
siteInfo->x_step(), siteInfo->y_step());
return 0;}

defiSlot

Retrieves data from the SLOTS statement in the DEF file. For syntax information about the DEF SLOTS statement, see "Slots" in the LEF/DEF Language Reference.

C++ Syntax

class defiSlot {
int hasLayer() const;
const char* layerName() const;
int numRectangles() const;
int xl(int index) const;
int yl(int index) const;
int xh(int index) const;
int yh(int index) const;
int numPolygons() const;
struct defiPoints getPolygon(int index) const;}

defiStyles

Retrieves data from the STYLES statement in the DEF file. For syntax information about the DEF STYLES statement, see "Styles," in the LEF/DEF Language Reference.

C++ Syntax

class defiStyles {
int style() const;
struct defiPoints getPolygon() const;}

defiSubnet

Retrieves data from the SUBNETS statement in the NETS statement in the DEF file. For syntax information about the DEF NETS statement, see "Nets" in the LEF/DEF Language Reference.

C++ Syntax

class defiSubnet {
const char* name() const;
int numConnections();
const char* instance(int index);
const char* pin(int index);
int pinIsSynthesized(int index);
int pinIsMustJoin(int index);
int isFixed() const;
int isRouted() const;
int isCover() const;
int hasNonDefaultRule() const;
int hasShield() const;
int hasShieldNet() const;
int hasNoShieldNet() const;
int numPaths() const;
defiPath* path(int index);
const char* nonDefaultRule() const;
int numWires() const;
defiWire* wire(int index);}

defiTrack

Retrieves data from the TRACKS statement in the DEF file. For syntax information about the DEF TRACKS statement, see "Tracks" in the LEF/DEF Language Reference.

C++ Syntax

class defiTrack {
const char* macro() const;
double x() const;
double xNum() const;
double xStep() const;
int numLayers() const;
const char* layer(int index) const;
int firstTrackMask() const;
int sameMask() const;}

Examples

The following example shows a callback routine with the type defrTrackCbkType, and the class defiTrack.

int trackCB (defrCallbackType_e type,
defiTrack* trackInfo,
defiUserData userData) {
int i;
// Check if the type is correct
if (type != defrTrackCbkType) {
printf("Type is not defrTrackCbkType, terminate
parsing.\n");
return 1;
}
printf("TRACKS %s %g DO %g STEP %g LAYER ",
trackInfo->macro(),
trackInfo->x(), trackInfo->xNum(), trackInfo->xStep());
for (i = 0; i < trackInfo->numLayers(); i++)
printf("%s ", trackInfo->layer(i));
    printf("\n");
return 0;}

defiVia

Retrieves data from the VIAS statement in the DEF file. For syntax information about the DEF VIAS statement, see "Vias" in the LEF/DEF Language Reference.

C++ Syntax

class defiVia {
const char* name() const;
const char* pattern() const;
int hasPattern() const;
int numLayers() const;
void layer(int index, char** layer, int* xl, int* yl,
    int* xh, int* yh) const;
int numPolygons() const;
const char* polygonName(int index) const;
struct defiPoints getPolygon(int index) const:
int hasViaRule() const;
void viaRule(char** viaRuleName, int* xSize, int* ySize,
    char** botLayer, char** cutLayer, char** topLayer,
    int* xCutSpacing, int* yCutSpacing, int* xBotEnc, int* yBotEnc,
    int* xTopEnc, int* yTopEnc) const;
int hasRowCol() const;
void rowCol(int* numCutRows, int* numCutCols) const;
int hasOrigin() const;
void origin(int* xOffset, int* yOffset) const;
int hasOffset() const;
void offset(int* xBotOffset, int* yBotOffset, int* xTopOffset
    int* yTopOffset) const;
int hasCutPattern() const;
const char* cutPattern() const;
int rectMask(int index) const;
int polyMask(int index) const; }

Examples

The following example shows a callback routine with the type defrViaStartCbkType.

int viaStartCB (defrCallbackType_e type,
int numVias,
defiUserData userData) {
// Check if the type is correct
if ((type != defrViaStartCbkType)) {
    printf("Type is not defrViaStartCbkType terminate
        parsing.\n");
    return 1;
}
printf("VIAS %d\n", numVias);
return 0;}

The following example shows a callback routine with the type defrViaCbkType.

int viaCB (defrCallbackType_e type,
defiVia* viaInfo,
defiUserData userData) {
int i, xl, yl, xh, yh;
char* name;
// Check if the type is correct
if ((type != defrViaCbkType)) {
       printf("Type is not defrViaCbkType terminate parsing.\n");
return 1;
}
printf("Via name is %s ", viaInfo->name());
if (viaInfo->hasPattern())
printf(" PATTERNNAME %s\n", viaInfo->pattern());
for (i = 0; i < viaInfo->numLayers(); i++) {
        viaInfo->layer(i, &name, &xl, &yl, &xh, &yh);
printf(" RECT %s %d %d %d %d \n", name, xl, yl, xh, yh);
}
return 0;}

The following example shows a callback routine with the type defrViaEndCbkType.

int viaEndCB (defrCallbackType_e type,
void* ptr,
defiUserData userData) {
// Check if the type is correct
if ((type != defrViaEndCbkType)) {
       printf("Type is not defrViaEndCbkType terminate
parsing.\n");
return 1;
}
     printf("END VIAS\n");
    return 0;}

defiViaData

Retrieves via array data from the SPECIALNETS statement in the DEF file. For syntax information about the DEF SPECIALNETS statement, see "Special Nets" in the LEF/DEF Language Reference.

C++ Syntax

struct defiViaData {
int numX;
int numY;
int stepX;
int stepY;}

defiVpin

Retrieves data from the VPIN statement in the NETS statement in the DEF file. For syntax information about the DEF NETS statement, see "Nets" and in the LEF/DEF Language Reference.

C++ Syntax

class defiVpin {
int xl() const;
int yl() const;
int xh() const;
int yh() const;
char status() const;
int orient() const;
const char* orientStr() const;
int xLoc() const;
int yLoc() const;
const char* name() const;
const char* layer() const;}

defiWire

Retrieves data from the regularWiring or specialWiring section of the NETS or SPECIALNETS statements in the DEF file. For syntax information about the DEF NETS and SPECIALNETS statements, see "Nets" and "Special Nets" in the LEF/DEF Language Reference.

C++ Syntax

class defiWire {
const char* wireType() const;
const char* wireShieldNetName() const;
int numPaths() const;
defiPath* path(int index);}

 


Return to top of page

View Library Table of Contents Previous Next Open PDF to print book Email Comments Help Using Documentation Shut Down Cadence Documentation Server

For support, see Cadence Online Support service.

Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.