# LEF 5.8 C/C++ Programming Interface -- A
Describes the C/C++ programming interface used to read and write Library Exchange Format (LEF) files.
Author: Technical Publications

###
LEF 5.8 C/C++ Programming Interface (Open Licensing Program)

# A

# LEF Reader and Writer Examples

This appendix contains examples of the Cadence® Library Exchange Format (LEF) reader and writer.

| LEF Reader Program

| LEF Writer Program

## LEF Reader Program

#ifdef WIN32

#pragma warning (disable : 4786)

#endif

#include <stdio.h>

#include <string.h>

#include <iostream.h>

#include <malloc.h>

#ifndef WIN32

# include <unistd.h>

#else

# include <windows.h>

#endif /* not WIN32 */

#include "lefrReader.hpp"

#include "lefwWriter.hpp"

#include "lefiDebug.hpp"

#include "lefiEncryptInt.hpp"

#include "lefiUtil.hpp"

char defaultName[128];

char defaultOut[128];

FILE* fout;

int printing = 0; // Printing the output.

int parse65nm = 0;

// TX_DIR:TRANSLATION ON

void dataError() {

fprintf(fout, "ERROR: returned user data is not correct!\n");

}

void checkType(lefrCallbackType_e c) {

if (c >= 0 && c <= lefrLibraryEndCbkType) {

// OK

} else {

fprintf(fout, "ERROR: callback type is out of bounds!\n");

}

}

char* orientStr(int orient) {

switch (orient) {

case 0: return ((char*)"N");

case 1: return ((char*)"W");

case 2: return ((char*)"S");

case 3: return ((char*)"E");

case 4: return ((char*)"FN");

case 5: return ((char*)"FW");

case 6: return ((char*)"FS");

case 7: return ((char*)"FE");

};

return ((char*)"BOGUS");

}

void lefVia(lefiVia* via) {

int i, j;

lefrSetCaseSensitivity(1);

fprintf(fout, "VIA %s ", via->lefiVia::name());

if (via->lefiVia::hasDefault())

fprintf(fout, "DEFAULT");

else if (via->lefiVia::hasGenerated())

fprintf(fout, "GENERATED");

fprintf(fout, "\n");

if (via->lefiVia::hasTopOfStack())

fprintf(fout, " TOPOFSTACKONLY\n");

if (via->lefiVia::hasForeign()) {

fprintf(fout, " FOREIGN %s ", via->lefiVia::foreign());

if (via->lefiVia::hasForeignPnt()) {

fprintf(fout, "( %g %g ) ", via->lefiVia::foreignX(),

via->lefiVia::foreignY());

if (via->lefiVia::hasForeignOrient())

fprintf(fout, "%s ", orientStr(via->lefiVia::foreignOrient()));

}

fprintf(fout, ";\n");

}

if (via->lefiVia::hasProperties()) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < via->lefiVia::numProperties(); i++) {

fprintf(fout, "%s ", via->lefiVia::propName(i));

if (via->lefiVia::propIsNumber(i))

fprintf(fout, "%g ", via->lefiVia::propNumber(i));

if (via->lefiVia::propIsString(i))

fprintf(fout, "%s ", via->lefiVia::propValue(i));

switch (via->lefiVia::propType(i)) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

if (via->lefiVia::hasResistance())

fprintf(fout, " RESISTANCE %g ;\n", via->lefiVia::resistance());

if (via->lefiVia::numLayers() > 0) {

for (i = 0; i < via->lefiVia::numLayers(); i++) {

fprintf(fout, " LAYER %s\n", via->lefiVia::layerName(i));

for (j = 0; j < via->lefiVia::numRects(i); j++)

fprintf(fout, " RECT ( %f %f ) ( %f %f ) ;\n",

via->lefiVia::xl(i, j), via->lefiVia::yl(i, j),

via->lefiVia::xh(i, j), via->lefiVia::yh(i, j));

for (j = 0; j < via->lefiVia::numPolygons(i); j++) {

struct lefiGeomPolygon poly;

poly = via->lefiVia::getPolygon(i, j);

fprintf(fout, " POLYGON ");

for (int k = 0; k < poly.numPoints; k++)

fprintf(fout, " %g %g ", poly.x[k], poly.y[k]);

fprintf(fout, ";\n");

}

}

}

if (via->lefiVia::hasViaRule()) {

fprintf(fout, " VIARULE %s ;\n", via->lefiVia::viaRuleName());

fprintf(fout, " CUTSIZE %g %g ;\n", via->lefiVia::xCutSize(),

via->lefiVia::yCutSize());

fprintf(fout, " LAYERS %s %s %s ;\n", via->lefiVia::botMetalLayer(),

via->lefiVia::cutLayer(), via->lefiVia::topMetalLayer());

fprintf(fout, " CUTSPACING %g %g ;\n", via->lefiVia::xCutSpacing(),

via->lefiVia::yCutSpacing());

fprintf(fout, " ENCLOSURE %g %g %g %g ;\n", via->lefiVia::xBotEnc(),

via->lefiVia::yBotEnc(), via->lefiVia::xTopEnc(),

via->lefiVia::yTopEnc());

if (via->lefiVia::hasRowCol())

fprintf(fout, " ROWCOL %d %d ;\n", via->lefiVia::numCutRows(),

via->lefiVia::numCutCols());

if (via->lefiVia::hasOrigin())

fprintf(fout, " ORIGIN %g %g ;\n", via->lefiVia::xOffset(),

via->lefiVia::yOffset());

if (via->lefiVia::hasOffset())

fprintf(fout, " OFFSET %g %g %g %g ;\n", via->lefiVia::xBotOffset(),

via->lefiVia::yBotOffset(), via->lefiVia::xTopOffset(),

via->lefiVia::yTopOffset());

if (via->lefiVia::hasCutPattern())

fprintf(fout, " PATTERN %s ;\n", via->lefiVia::cutPattern());

}

fprintf(fout, "END %s\n", via->lefiVia::name());

return;

}

void lefSpacing(lefiSpacing* spacing) {

fprintf(fout, " SAMENET %s %s %g ", spacing->lefiSpacing::name1(),

spacing->lefiSpacing::name2(), spacing->lefiSpacing::distance());

if (spacing->lefiSpacing::hasStack())

fprintf(fout, "STACK ");

fprintf(fout,";\n");

return;

}

void lefViaRuleLayer(lefiViaRuleLayer* vLayer) {

fprintf(fout, " LAYER %s ;\n", vLayer->lefiViaRuleLayer::name());

if (vLayer->lefiViaRuleLayer::hasDirection()) {

if (vLayer->lefiViaRuleLayer::isHorizontal())

fprintf(fout, " DIRECTION HORIZONTAL ;\n");

if (vLayer->lefiViaRuleLayer::isVertical())

fprintf(fout, " DIRECTION VERTICAL ;\n");

}

if (vLayer->lefiViaRuleLayer::hasEnclosure()) {

fprintf(fout, " ENCLOSURE %g %g ;\n",

vLayer->lefiViaRuleLayer::enclosureOverhang1(),

vLayer->lefiViaRuleLayer::enclosureOverhang2());

}

if (vLayer->lefiViaRuleLayer::hasWidth())

fprintf(fout, " WIDTH %g TO %g ;\n",

vLayer->lefiViaRuleLayer::widthMin(),

vLayer->lefiViaRuleLayer::widthMax());

if (vLayer->lefiViaRuleLayer::hasResistance())

fprintf(fout, " RESISTANCE %g ;\n",

vLayer->lefiViaRuleLayer::resistance());

if (vLayer->lefiViaRuleLayer::hasOverhang())

fprintf(fout, " OVERHANG %g ;\n",

vLayer->lefiViaRuleLayer::overhang());

if (vLayer->lefiViaRuleLayer::hasMetalOverhang())

fprintf(fout, " METALOVERHANG %g ;\n",

vLayer->lefiViaRuleLayer::metalOverhang());

if (vLayer->lefiViaRuleLayer::hasSpacing())

fprintf(fout, " SPACING %g BY %g ;\n",

vLayer->lefiViaRuleLayer::spacingStepX(),

vLayer->lefiViaRuleLayer::spacingStepY());

if (vLayer->lefiViaRuleLayer::hasRect())

fprintf(fout, " RECT ( %f %f ) ( %f %f ) ;\n",

vLayer->lefiViaRuleLayer::xl(), vLayer->lefiViaRuleLayer::yl(),

vLayer->lefiViaRuleLayer::xh(), vLayer->lefiViaRuleLayer::yh());

return;

}

void prtGeometry(lefiGeometries* geometry) {

int numItems = geometry->lefiGeometries::numItems();

int i, j;

lefiGeomPath* path;

lefiGeomPathIter* pathIter;

lefiGeomRect* rect;

lefiGeomRectIter* rectIter;

lefiGeomPolygon* polygon;

lefiGeomPolygonIter* polygonIter;

lefiGeomVia* via;

lefiGeomViaIter* viaIter;

for (i = 0; i < numItems; i++) {

switch (geometry->lefiGeometries::itemType(i)) {

case lefiGeomClassE:

fprintf(fout, "CLASS %s ",

geometry->lefiGeometries::getClass(i));

break;

case lefiGeomLayerE:

fprintf(fout, " LAYER %s ;\n",

geometry->lefiGeometries::getLayer(i));

break;

case lefiGeomLayerExceptPgNetE:

fprintf(fout, " EXCEPTPGNET ;\n");

break;

case lefiGeomLayerMinSpacingE:

fprintf(fout, " SPACING %g ;\n",

geometry->lefiGeometries::getLayerMinSpacing(i));

break;

case lefiGeomLayerRuleWidthE:

fprintf(fout, " DESIGNRULEWIDTH %g ;\n",

geometry->lefiGeometries::getLayerRuleWidth(i));

break;

case lefiGeomWidthE:

fprintf(fout, " WIDTH %g ;\n",

geometry->lefiGeometries::getWidth(i));

break;

case lefiGeomPathE:

path = geometry->lefiGeometries::getPath(i);

fprintf(fout, " PATH ");

for (j = 0; j < path->numPoints; j++) {

if (j+1 == path->numPoints) // last one on the list

fprintf(fout, " ( %g %g ) ;\n", path->x[j], path->y[j]);

else

fprintf(fout, " ( %g %g )\n", path->x[j], path->y[j]);

}

break;

case lefiGeomPathIterE:

pathIter = geometry->lefiGeometries::getPathIter(i);

fprintf(fout, " PATH ITERATED ");

for (j = 0; j < pathIter->numPoints; j++)

fprintf(fout, " ( %g %g )\n", pathIter->x[j],

pathIter->y[j]);

fprintf(fout, " DO %g BY %g STEP %g %g ;\n", pathIter->xStart,

pathIter->yStart, pathIter->xStep, pathIter->yStep);

break;

case lefiGeomRectE:

rect = geometry->lefiGeometries::getRect(i);

fprintf(fout, " RECT ( %f %f ) ( %f %f ) ;\n", rect->xl,

rect->yl, rect->xh, rect->yh);

break;

case lefiGeomRectIterE:

rectIter = geometry->lefiGeometries::getRectIter(i);

fprintf(fout, " RECT ITERATE ( %f %f ) ( %f %f )\n",

rectIter->xl, rectIter->yl, rectIter->xh, rectIter->yh);

fprintf(fout, " DO %g BY %g STEP %g %g ;\n",

rectIter->xStart, rectIter->yStart, rectIter->xStep,

rectIter->yStep);

break;

case lefiGeomPolygonE:

polygon = geometry->lefiGeometries::getPolygon(i);

fprintf(fout, " POLYGON ");

for (j = 0; j < polygon->numPoints; j++) {

if (j+1 == polygon->numPoints) // last one on the list

fprintf(fout, " ( %g %g ) ;\n", polygon->x[j],

polygon->y[j]);

else

fprintf(fout, " ( %g %g )\n", polygon->x[j],

polygon->y[j]);

}

break;

case lefiGeomPolygonIterE:

polygonIter = geometry->lefiGeometries::getPolygonIter(i);

fprintf(fout, " POLYGON ITERATE");

for (j = 0; j < polygonIter->numPoints; j++)

fprintf(fout, " ( %g %g )\n", polygonIter->x[j],

polygonIter->y[j]);

fprintf(fout, " DO %g BY %g STEP %g %g ;\n",

polygonIter->xStart, polygonIter->yStart,

polygonIter->xStep, polygonIter->yStep);

break;

case lefiGeomViaE:

via = geometry->lefiGeometries::getVia(i);

fprintf(fout, " VIA ( %g %g ) %s ;\n", via->x, via->y,

via->name);

break;

case lefiGeomViaIterE:

viaIter = geometry->lefiGeometries::getViaIter(i);

fprintf(fout, " VIA ITERATE ( %g %g ) %s\n", viaIter->x,

viaIter->y, viaIter->name);

fprintf(fout, " DO %g BY %g STEP %g %g ;\n",

viaIter->xStart, viaIter->yStart,

viaIter->xStep, viaIter->yStep);

break;

default:

fprintf(fout, "BOGUS geometries type.\n");

break;

}

}

}

int antennaCB(lefrCallbackType_e c, double value, lefiUserData ud) {

checkType(c);

switch (c) {

case lefrAntennaInputCbkType:

fprintf(fout, "ANTENNAINPUTGATEAREA %g ;\n", value);

break;

case lefrAntennaInoutCbkType:

fprintf(fout, "ANTENNAINOUTDIFFAREA %g ;\n", value);

break;

case lefrAntennaOutputCbkType:

fprintf(fout, "ANTENNAOUTPUTDIFFAREA %g ;\n", value);

break;

case lefrInputAntennaCbkType:

fprintf(fout, "INPUTPINANTENNASIZE %g ;\n", value);

break;

case lefrOutputAntennaCbkType:

fprintf(fout, "OUTPUTPINANTENNASIZE %g ;\n", value);

break;

case lefrInoutAntennaCbkType:

fprintf(fout, "INOUTPINANTENNASIZE %g ;\n", value);

break;

default:

fprintf(fout, "BOGUS antenna type.\n");

break;

}

return 0;

}

int arrayBeginCB(lefrCallbackType_e c, const char* name, lefiUserData ud) {

int status;

checkType(c);

status = lefwStartArray(name);

if (status != LEFW_OK)

return status;

return 0;

}

int arrayCB(lefrCallbackType_e c, lefiArray* a, lefiUserData ud) {

int status, i, j, defCaps;

lefiSitePattern* pattern;

lefiTrackPattern* track;

lefiGcellPattern* gcell;

checkType(c);

if (a->lefiArray::numSitePattern() > 0) {

for (i = 0; i < a->lefiArray::numSitePattern(); i++) {

pattern = a->lefiArray::sitePattern(i);

status = lefwArraySite(pattern->lefiSitePattern::name(),

pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

pattern->lefiSitePattern::orient(),

pattern->lefiSitePattern::xStart(),

pattern->lefiSitePattern::yStart(),

pattern->lefiSitePattern::xStep(),

pattern->lefiSitePattern::yStep());

if (status != LEFW_OK)

dataError();

}

}

if (a->lefiArray::numCanPlace() > 0) {

for (i = 0; i < a->lefiArray::numCanPlace(); i++) {

pattern = a->lefiArray::canPlace(i);

status = lefwArrayCanplace(pattern->lefiSitePattern::name(),

pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

pattern->lefiSitePattern::orient(),

pattern->lefiSitePattern::xStart(),

pattern->lefiSitePattern::yStart(),

pattern->lefiSitePattern::xStep(),

pattern->lefiSitePattern::yStep());

if (status != LEFW_OK)

dataError();

}

}

if (a->lefiArray::numCannotOccupy() > 0) {

for (i = 0; i < a->lefiArray::numCannotOccupy(); i++) {

pattern = a->lefiArray::cannotOccupy(i);

status = lefwArrayCannotoccupy(pattern->lefiSitePattern::name(),

pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

pattern->lefiSitePattern::orient(),

pattern->lefiSitePattern::xStart(),

pattern->lefiSitePattern::yStart(),

pattern->lefiSitePattern::xStep(),

pattern->lefiSitePattern::yStep());

if (status != LEFW_OK)

dataError();

}

}

if (a->lefiArray::numTrack() > 0) {

for (i = 0; i < a->lefiArray::numTrack(); i++) {

track = a->lefiArray::track(i);

fprintf(fout, " TRACKS %s, %g DO %d STEP %g\n",

track->lefiTrackPattern::name(),

track->lefiTrackPattern::start(),

track->lefiTrackPattern::numTracks(),

track->lefiTrackPattern::space());

if (track->lefiTrackPattern::numLayers() > 0) {

fprintf(fout, " LAYER ");

for (j = 0; j < track->lefiTrackPattern::numLayers(); j++)

fprintf(fout, "%s ", track->lefiTrackPattern::layerName(j));

fprintf(fout, ";\n");

}

}

}

if (a->lefiArray::numGcell() > 0) {

for (i = 0; i < a->lefiArray::numGcell(); i++) {

gcell = a->lefiArray::gcell(i);

fprintf(fout, " GCELLGRID %s, %g DO %d STEP %g\n",

gcell->lefiGcellPattern::name(),

gcell->lefiGcellPattern::start(),

gcell->lefiGcellPattern::numCRs(),

gcell->lefiGcellPattern::space());

}

}

if (a->lefiArray::numFloorPlans() > 0) {

for (i = 0; i < a->lefiArray::numFloorPlans(); i++) {

status = lefwStartArrayFloorplan(a->lefiArray::floorPlanName(i));

if (status != LEFW_OK)

dataError();

for (j = 0; j < a->lefiArray::numSites(i); j++) {

pattern = a->lefiArray::site(i, j);

status = lefwArrayFloorplan(a->lefiArray::siteType(i, j),

pattern->lefiSitePattern::name(),

pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

pattern->lefiSitePattern::orient(),

(int)pattern->lefiSitePattern::xStart(),

(int)pattern->lefiSitePattern::yStart(),

pattern->lefiSitePattern::xStep(),

pattern->lefiSitePattern::yStep());

if (status != LEFW_OK)

dataError();

}

status = lefwEndArrayFloorplan(a->lefiArray::floorPlanName(i));

if (status != LEFW_OK)

dataError();

}

}

defCaps = a->lefiArray::numDefaultCaps();

if (defCaps > 0) {

status = lefwStartArrayDefaultCap(defCaps);

if (status != LEFW_OK)

dataError();

for (i = 0; i < defCaps; i++) {

status = lefwArrayDefaultCap(a->lefiArray::defaultCapMinPins(i),

a->lefiArray::defaultCap(i));

if (status != LEFW_OK)

dataError();

}

status = lefwEndArrayDefaultCap();

if (status != LEFW_OK)

dataError();

}

return 0;

}

int arrayEndCB(lefrCallbackType_e c, const char* name, lefiUserData ud) {

int status;

checkType(c);

status = lefwEndArray(name);

if (status != LEFW_OK)

return status;

return 0;

}

int busBitCharsCB(lefrCallbackType_e c, const char* busBit, lefiUserData ud)

{

int status;

checkType(c);

status = lefwBusBitChars(busBit);

if (status != LEFW_OK)

dataError();

return 0;

}

int caseSensCB(lefrCallbackType_e c, int caseSense, lefiUserData ud) {

checkType(c);

if (caseSense == TRUE)

fprintf(fout, "NAMESCASESENSITIVE ON ;\n");

else

fprintf(fout, "NAMESCASESENSITIVE OFF ;\n");

return 0;

}

int clearanceCB(lefrCallbackType_e c, const char* name, lefiUserData ud) {

checkType(c);

fprintf(fout, "CLEARANCEMEASURE %s ;\n", name);

return 0;

}

int dividerCB(lefrCallbackType_e c, const char* name, lefiUserData ud) {

checkType(c);

fprintf(fout, "DIVIDER %s ;\n", name);

return 0;

}

int noWireExtCB(lefrCallbackType_e c, const char* name, lefiUserData ud) {

checkType(c);

fprintf(fout, "NOWIREEXTENSION %s ;\n", name);

return 0;

}

int edge1CB(lefrCallbackType_e c, double name, lefiUserData ud) {

checkType(c);

fprintf(fout, "EDGERATETHRESHOLD1 %g ;\n", name);

return 0;

}

int edge2CB(lefrCallbackType_e c, double name, lefiUserData ud) {

checkType(c);

fprintf(fout, "EDGERATETHRESHOLD2 %g ;\n", name);

return 0;

}

int edgeScaleCB(lefrCallbackType_e c, double name, lefiUserData ud) {

checkType(c);

fprintf(fout, "EDGERATESCALEFACTORE %g ;\n", name);

return 0;

}

int dielectricCB(lefrCallbackType_e c, double dielectric, lefiUserData ud) {

checkType(c);

fprintf(fout, "DIELECTRIC %g ;\n", dielectric);

return 0;

}

int irdropBeginCB(lefrCallbackType_e c, void* ptr, lefiUserData ud){

checkType(c);

fprintf(fout, "IRDROP\n");

return 0;

}

int irdropCB(lefrCallbackType_e c, lefiIRDrop* irdrop, lefiUserData ud) {

int i;

checkType(c);

fprintf(fout, " TABLE %s ", irdrop->lefiIRDrop::name());

for (i = 0; i < irdrop->lefiIRDrop::numValues(); i++)

fprintf(fout, "%g %g ", irdrop->lefiIRDrop::value1(i),

irdrop->lefiIRDrop::value2(i));

fprintf(fout, ";\n");

return 0;

}

int irdropEndCB(lefrCallbackType_e c, void* ptr, lefiUserData ud){

checkType(c);

fprintf(fout, "END IRDROP\n");

return 0;

}

int layerCB(lefrCallbackType_e c, lefiLayer* layer, lefiUserData ud) {

int i, j, k;

int numPoints, propNum;

double *widths, *current;

lefiLayerDensity* density;

lefiAntennaPWL* pwl;

lefiSpacingTable* spTable;

lefiInfluence* influence;

lefiParallel* parallel;

lefiTwoWidths* twoWidths;

char pType;

int numMinCut, numMinenclosed;

lefiAntennaModel* aModel;

lefiOrthogonal* ortho;

checkType(c);

lefrSetCaseSensitivity(0);

if (parse65nm)

layer->lefiLayer::parse65nmRules();

fprintf(fout, "LAYER %s\n", layer->lefiLayer::name());

if (layer->lefiLayer::hasType())

fprintf(fout, " TYPE %s ;\n", layer->lefiLayer::type());

if (layer->lefiLayer::hasPitch())

fprintf(fout, " PITCH %g ;\n", layer->lefiLayer::pitch());

else if (layer->lefiLayer::hasXYPitch())

fprintf(fout, " PITCH %g %g ;\n", layer->lefiLayer::pitchX(),

layer->lefiLayer::pitchY());

if (layer->lefiLayer::hasOffset())

fprintf(fout, " OFFSET %g ;\n", layer->lefiLayer::offset());

else if (layer->lefiLayer::hasXYOffset())

fprintf(fout, " OFFSET %g %g ;\n", layer->lefiLayer::offsetX(),

layer->lefiLayer::offsetY());

if (layer->lefiLayer::hasDiagPitch())

fprintf(fout, " DIAGPITCH %g ;\n", layer->lefiLayer::diagPitch());

else if (layer->lefiLayer::hasXYDiagPitch())

fprintf(fout, " DIAGPITCH %g %g ;\n", layer->lefiLayer::diagPitchX(),

layer->lefiLayer::diagPitchY());

if (layer->lefiLayer::hasDiagWidth())

fprintf(fout, " DIAGWIDTH %g ;\n", layer->lefiLayer::diagWidth());

if (layer->lefiLayer::hasDiagSpacing())

fprintf(fout, " DIAGSPACING %g ;\n", layer->lefiLayer::diagSpacing());

if (layer->lefiLayer::hasWidth())

fprintf(fout, " WIDTH %g ;\n", layer->lefiLayer::width());

if (layer->lefiLayer::hasArea())

fprintf(fout, " AREA %g ;\n", layer->lefiLayer::area());

if (layer->lefiLayer::hasSlotWireWidth())

fprintf(fout, " SLOTWIREWIDTH %g ;\n", layer->lefiLayer::slotWireWidth());

if (layer->lefiLayer::hasSlotWireLength())

fprintf(fout, " SLOTWIRELENGTH %g ;\n",

layer->lefiLayer::slotWireLength());

if (layer->lefiLayer::hasSlotWidth())

fprintf(fout, " SLOTWIDTH %g ;\n", layer->lefiLayer::slotWidth());

if (layer->lefiLayer::hasSlotLength())

fprintf(fout, " SLOTLENGTH %g ;\n", layer->lefiLayer::slotLength());

if (layer->lefiLayer::hasMaxAdjacentSlotSpacing())

fprintf(fout, " MAXADJACENTSLOTSPACING %g ;\n",

layer->lefiLayer::maxAdjacentSlotSpacing());

if (layer->lefiLayer::hasMaxCoaxialSlotSpacing())

fprintf(fout, " MAXCOAXIALSLOTSPACING %g ;\n",

layer->lefiLayer::maxCoaxialSlotSpacing());

if (layer->lefiLayer::hasMaxEdgeSlotSpacing())

fprintf(fout, " MAXEDGESLOTSPACING %g ;\n",

layer->lefiLayer::maxEdgeSlotSpacing());

if (layer->lefiLayer::hasMaxFloatingArea()) // 5.7

fprintf(fout, " MAXFLOATINGAREA %g ;\n",

layer->lefiLayer::maxFloatingArea());

if (layer->lefiLayer::hasArraySpacing()) { // 5.7

fprintf(fout, " ARRAYSPACING ");

if (layer->lefiLayer::hasLongArray())

fprintf(fout, "LONGARRAY ");

if (layer->lefiLayer::hasViaWidth())

fprintf(fout, "WIDTH %g ", layer->lefiLayer::viaWidth());

fprintf(fout, "CUTSPACING %g", layer->lefiLayer::cutSpacing());

for (i = 0; i < layer->lefiLayer::numArrayCuts(); i++)

fprintf(fout, "\n\tARRAYCUTS %g SPACING %g",

layer->lefiLayer::arrayCuts(i),

layer->lefiLayer::arraySpacing(i));

fprintf(fout, " ;\n");

}

if (layer->lefiLayer::hasSplitWireWidth())

fprintf(fout, " SPLITWIREWIDTH %g ;\n",

layer->lefiLayer::splitWireWidth());

if (layer->lefiLayer::hasMinimumDensity())

fprintf(fout, " MINIMUMDENSITY %g ;\n",

layer->lefiLayer::minimumDensity());

if (layer->lefiLayer::hasMaximumDensity())

fprintf(fout, " MAXIMUMDENSITY %g ;\n",

layer->lefiLayer::maximumDensity());

if (layer->lefiLayer::hasDensityCheckWindow())

fprintf(fout, " DENSITYCHECKWINDOW %g %g ;\n",

layer->lefiLayer::densityCheckWindowLength(),

layer->lefiLayer::densityCheckWindowWidth());

if (layer->lefiLayer::hasDensityCheckStep())

fprintf(fout, " DENSITYCHECKSTEP %g ;\n",

layer->lefiLayer::densityCheckStep());

if (layer->lefiLayer::hasFillActiveSpacing())

fprintf(fout, " FILLACTIVESPACING %g ;\n",

layer->lefiLayer::fillActiveSpacing());

// 5.4.1

numMinCut = layer->lefiLayer::numMinimumcut();

if (numMinCut > 0) {

for (i = 0; i < numMinCut; i++) {

fprintf(fout, " MINIMUMCUT %d WIDTH %g ",

layer->lefiLayer::minimumcut(i),

layer->lefiLayer::minimumcutWidth(i));

if (layer->lefiLayer::hasMinimumcutWithin(i))

fprintf(fout, "WITHIN %g ", layer->lefiLayer::minimumcutWithin(i));

if (layer->lefiLayer::hasMinimumcutConnection(i))

fprintf(fout, "%s ", layer->lefiLayer::minimumcutConnection(i));

if (layer->lefiLayer::hasMinimumcutNumCuts(i))

fprintf(fout, "LENGTH %g WITHIN %g ",

layer->lefiLayer::minimumcutLength(i),

layer->lefiLayer::minimumcutDistance(i));

fprintf(fout, ";\n");

}

}

// 5.4.1

if (layer->lefiLayer::hasMaxwidth()) {

fprintf(fout, " MAXWIDTH %g ;\n", layer->lefiLayer::maxwidth());

}

// 5.5

if (layer->lefiLayer::hasMinwidth()) {

fprintf(fout, " MINWIDTH %g ;\n", layer->lefiLayer::minwidth());

}

// 5.5

numMinenclosed = layer->lefiLayer::numMinenclosedarea();

if (numMinenclosed > 0) {

for (i = 0; i < numMinenclosed; i++) {

fprintf(fout, " MINENCLOSEDAREA %g ",

layer->lefiLayer::minenclosedarea(i));

if (layer->lefiLayer::hasMinenclosedareaWidth(i))

fprintf(fout, "MINENCLOSEDAREAWIDTH %g ",

layer->lefiLayer::minenclosedareaWidth(i));

fprintf (fout, ";\n");

}

}

// 5.4.1 & 5.6

if (layer->lefiLayer::hasMinstep()) {

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));

if (layer->lefiLayer::hasMinstepMaxedges(i))

fprintf(fout, "MAXEDGES %d ", layer->lefiLayer::minstepMaxedges(i));

fprintf(fout, ";\n");

}

}

// 5.4.1

if (layer->lefiLayer::hasProtrusion()) {

fprintf(fout, " PROTRUSIONWIDTH %g LENGTH %g WIDTH %g ;\n",

layer->lefiLayer::protrusionWidth1(),

layer->lefiLayer::protrusionLength(),

layer->lefiLayer::protrusionWidth2());

}

if (layer->lefiLayer::hasSpacingNumber()) {

for (i = 0; i < layer->lefiLayer::numSpacing(); i++) {

fprintf(fout, " SPACING %g ", layer->lefiLayer::spacing(i));

if (layer->lefiLayer::hasSpacingName(i))

fprintf(fout, "LAYER %s ", layer->lefiLayer::spacingName(i));

if (layer->lefiLayer::hasSpacingLayerStack(i))

fprintf(fout, "STACK "); // 5.7

if (layer->lefiLayer::hasSpacingAdjacent(i))

fprintf(fout, "ADJACENTCUTS %d WITHIN %g ",

layer->lefiLayer::spacingAdjacentCuts(i),

layer->lefiLayer::spacingAdjacentWithin(i));

if (layer->lefiLayer::hasSpacingAdjacentExcept(i)) // 5.7

fprintf(fout, "EXCEPTSAMEPGNET ");

if (layer->lefiLayer::hasSpacingCenterToCenter(i))

fprintf(fout, "CENTERTOCENTER ");

if (layer->lefiLayer::hasSpacingSamenet(i)) // 5.7

fprintf(fout, "SAMENET ");

if (layer->lefiLayer::hasSpacingSamenetPGonly(i)) // 5.7

fprintf(fout, "PGONLY ");

if (layer->lefiLayer::hasSpacingArea(i)) // 5.7

fprintf(fout, "AREA %g ", layer->lefiLayer::spacingArea(i));

if (layer->lefiLayer::hasSpacingRange(i)) {

fprintf(fout, "RANGE %g %g ", layer->lefiLayer::spacingRangeMin(i),

layer->lefiLayer::spacingRangeMax(i));

if (layer->lefiLayer::hasSpacingRangeUseLengthThreshold(i))

fprintf(fout, "USELENGTHTHRESHOLD ");

else if (layer->lefiLayer::hasSpacingRangeInfluence(i)) {

fprintf(fout, "INFLUENCE %g ",

layer->lefiLayer::spacingRangeInfluence(i));

if (layer->lefiLayer::hasSpacingRangeInfluenceRange(i))

fprintf(fout, "RANGE %g %g ",

layer->lefiLayer::spacingRangeInfluenceMin(i),

layer->lefiLayer::spacingRangeInfluenceMax(i));

} else if (layer->lefiLayer::hasSpacingRangeRange(i))

fprintf(fout, "RANGE %g %g ",

layer->lefiLayer::spacingRangeRangeMin(i),

layer->lefiLayer::spacingRangeRangeMax(i));

} else if (layer->lefiLayer::hasSpacingLengthThreshold(i)) {

fprintf(fout, "LENGTHTHRESHOLD %g ",

layer->lefiLayer::spacingLengthThreshold(i));

if (layer->lefiLayer::hasSpacingLengthThresholdRange(i))

fprintf(fout, "RANGE %g %g",

layer->lefiLayer::spacingLengthThresholdRangeMin(i),

layer->lefiLayer::spacingLengthThresholdRangeMax(i));

} else if (layer->lefiLayer::hasSpacingNotchLength(i)) {// 5.7

fprintf(fout, "NOTCHLENGTH %g",

layer->lefiLayer::spacingNotchLength(i));

} else if (layer->lefiLayer::hasSpacingEndOfNotchWidth(i)) // 5.7

fprintf(fout, "ENDOFNOTCHWIDTH %g NOTCHSPACING %g, NOTCHLENGTH %g",

layer->lefiLayer::spacingEndOfNotchWidth(i),

layer->lefiLayer::spacingEndOfNotchSpacing(i),

layer->lefiLayer::spacingEndOfNotchLength(i));

if (layer->lefiLayer::hasSpacingParallelOverlap(i)) // 5.7

fprintf(fout, "PARALLELOVERLAP ");

if (layer->lefiLayer::hasSpacingEndOfLine(i)) { // 5.7

fprintf(fout, "ENDOFLINE %g WITHING %g ",

layer->lefiLayer::spacingEolWidth(i),

layer->lefiLayer::spacingEolWithin(i));

if (layer->lefiLayer::hasSpacingParellelEdge(i)) {

fprintf(fout, "PARALLELEDGE %g WITHING %g ",

layer->lefiLayer::spacingParSpace(i),

layer->lefiLayer::spacingParWithin(i));

if (layer->lefiLayer::hasSpacingTwoEdges(i)) {

fprintf(fout, "TWOEDGES ");

}

}

}

fprintf(fout, ";\n");

}

}

if (layer->lefiLayer::hasSpacingTableOrtho()) { // 5.7

fprintf(fout, "SPACINGTABLE ORTHOGONAL");

ortho = layer->lefiLayer::orthogonal();

for (i = 0; i < ortho->lefiOrthogonal::numOrthogonal(); i++) {

fprintf(fout, "\n WITHIN %g SPACING %g",

ortho->lefiOrthogonal::cutWithin(i),

ortho->lefiOrthogonal::orthoSpacing(i));

}

fprintf(fout, ";\n");

}

for (i = 0; i < layer->lefiLayer::numEnclosure(); i++) {

fprintf(fout, "ENCLOSURE ");

if (layer->lefiLayer::hasEnclosureRule(i))

fprintf(fout, "%s ", layer->lefiLayer::enclosureRule(i));

fprintf(fout, "%g %g ", layer->lefiLayer::enclosureOverhang1(i),

layer->lefiLayer::enclosureOverhang2(i));

if (layer->lefiLayer::hasEnclosureWidth(i))

fprintf(fout, "WIDTH %g ", layer->lefiLayer::enclosureMinWidth(i));

if (layer->lefiLayer::hasEnclosureExceptExtraCut(i))

fprintf(fout, "EXCEPTEXTRACUT %g ",

layer->lefiLayer::enclosureExceptExtraCut(i));

if (layer->lefiLayer::hasEnclosureMinLength(i))

fprintf(fout, "LENGTH %g ", layer->lefiLayer::enclosureMinLength(i));

fprintf(fout, ";\n");

}

for (i = 0; i < layer->lefiLayer::numPreferEnclosure(); i++) {

fprintf(fout, "PREFERENCLOSURE ");

if (layer->lefiLayer::hasPreferEnclosureRule(i))

fprintf(fout, "%s ", layer->lefiLayer::preferEnclosureRule(i));

fprintf(fout, "%g %g ", layer->lefiLayer::preferEnclosureOverhang1(i),

layer->lefiLayer::preferEnclosureOverhang2(i));

if (layer->lefiLayer::hasPreferEnclosureWidth(i))

fprintf(fout, "WIDTH %g ",layer->lefiLayer::preferEnclosureMinWidth(i));

fprintf(fout, ";\n");

}

if (layer->lefiLayer::hasResistancePerCut())

fprintf(fout, " RESISTANCE %g ;\n",

layer->lefiLayer::resistancePerCut());

if (layer->lefiLayer::hasCurrentDensityPoint())

fprintf(fout, " CURRENTDEN %g ;\n",

layer->lefiLayer::currentDensityPoint());

if (layer->lefiLayer::hasCurrentDensityArray()) {

layer->lefiLayer::currentDensityArray(&numPoints, &widths, &current);

for (i = 0; i < numPoints; i++)

fprintf(fout, " CURRENTDEN ( %g %g ) ;\n", widths[i], current[i]);

}

if (layer->lefiLayer::hasDirection())

fprintf(fout, " DIRECTION %s ;\n", layer->lefiLayer::direction());

if (layer->lefiLayer::hasResistance())

fprintf(fout, " RESISTANCE RPERSQ %g ;\n",

layer->lefiLayer::resistance());

if (layer->lefiLayer::hasCapacitance())

fprintf(fout, " CAPACITANCE CPERSQDIST %g ;\n",

layer->lefiLayer::capacitance());

if (layer->lefiLayer::hasEdgeCap())

fprintf(fout, " EDGECAPACITANCE %g ;\n", layer->lefiLayer::edgeCap());

if (layer->lefiLayer::hasHeight())

fprintf(fout, " TYPE %g ;\n", layer->lefiLayer::height());

if (layer->lefiLayer::hasThickness())

fprintf(fout, " THICKNESS %g ;\n", layer->lefiLayer::thickness());

if (layer->lefiLayer::hasWireExtension())

fprintf(fout, " WIREEXTENSION %g ;\n", layer->lefiLayer::wireExtension());

if (layer->lefiLayer::hasShrinkage())

fprintf(fout, " SHRINKAGE %g ;\n", layer->lefiLayer::shrinkage());

if (layer->lefiLayer::hasCapMultiplier())

fprintf(fout, " CAPMULTIPLIER %g ;\n", layer->lefiLayer::capMultiplier());

if (layer->lefiLayer::hasAntennaArea())

fprintf(fout, " ANTENNAAREAFACTOR %g ;\n",

layer->lefiLayer::antennaArea());

if (layer->lefiLayer::hasAntennaLength())

fprintf(fout, " ANTENNALENGTHFACTOR %g ;\n",

layer->lefiLayer::antennaLength());

// 5.5 AntennaModel

for (i = 0; i < layer->lefiLayer::numAntennaModel(); i++) {

aModel = layer->lefiLayer::antennaModel(i);

fprintf(fout, " ANTENNAMODEL %s ;\n",

aModel->lefiAntennaModel::antennaOxide());

if (aModel->lefiAntennaModel::hasAntennaAreaRatio())

fprintf(fout, " ANTENNAAREARATIO %g ;\n",

aModel->lefiAntennaModel::antennaAreaRatio());

if (aModel->lefiAntennaModel::hasAntennaDiffAreaRatio())

fprintf(fout, " ANTENNADIFFAREARATIO %g ;\n",

aModel->lefiAntennaModel::antennaDiffAreaRatio());

else if (aModel->lefiAntennaModel::hasAntennaDiffAreaRatioPWL()) {

pwl = aModel->lefiAntennaModel::antennaDiffAreaRatioPWL();

fprintf(fout, " ANTENNADIFFAREARATIO PWL ( ");

for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)

fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),

pwl->lefiAntennaPWL::PWLratio(j));

fprintf(fout, ") ;\n");

}

if (aModel->lefiAntennaModel::hasAntennaCumAreaRatio())

fprintf(fout, " ANTENNACUMAREARATIO %g ;\n",

aModel->lefiAntennaModel::antennaCumAreaRatio());

if (aModel->lefiAntennaModel::hasAntennaCumDiffAreaRatio())

fprintf(fout, " ANTENNACUMDIFFAREARATIO %g\n",

aModel->lefiAntennaModel::antennaCumDiffAreaRatio());

if (aModel->lefiAntennaModel::hasAntennaCumDiffAreaRatioPWL()) {

pwl = aModel->lefiAntennaModel::antennaCumDiffAreaRatioPWL();

fprintf(fout, " ANTENNACUMDIFFAREARATIO PWL ( ");

for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)

fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),

pwl->lefiAntennaPWL::PWLratio(j));

fprintf(fout, ") ;\n");

}

if (aModel->lefiAntennaModel::hasAntennaAreaFactor()) {

fprintf(fout, " ANTENNAAREAFACTOR %g ",

aModel->lefiAntennaModel::antennaAreaFactor());

if (aModel->lefiAntennaModel::hasAntennaAreaFactorDUO())

fprintf(fout, " DIFFUSEONLY ");

fprintf(fout, ";\n");

}

if (aModel->lefiAntennaModel::hasAntennaSideAreaRatio())

fprintf(fout, " ANTENNASIDEAREARATIO %g ;\n",

aModel->lefiAntennaModel::antennaSideAreaRatio());

if (aModel->lefiAntennaModel::hasAntennaDiffSideAreaRatio())

fprintf(fout, " ANTENNADIFFSIDEAREARATIO %g\n",

aModel->lefiAntennaModel::antennaDiffSideAreaRatio());

else if (aModel->lefiAntennaModel::hasAntennaDiffSideAreaRatioPWL()) {

pwl = aModel->lefiAntennaModel::antennaDiffSideAreaRatioPWL();

fprintf(fout, " ANTENNADIFFSIDEAREARATIO PWL ( ");

for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)

fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),

pwl->lefiAntennaPWL::PWLratio(j));

fprintf(fout, ") ;\n");

}

if (aModel->lefiAntennaModel::hasAntennaCumSideAreaRatio())

fprintf(fout, " ANTENNACUMSIDEAREARATIO %g ;\n",

aModel->lefiAntennaModel::antennaCumSideAreaRatio());

if (aModel->lefiAntennaModel::hasAntennaCumDiffSideAreaRatio())

fprintf(fout, " ANTENNACUMDIFFSIDEAREARATIO %g\n",

aModel->lefiAntennaModel::antennaCumDiffSideAreaRatio());

else if (aModel->lefiAntennaModel::hasAntennaCumDiffSideAreaRatioPWL()) {

pwl = aModel->lefiAntennaModel::antennaCumDiffSideAreaRatioPWL();

fprintf(fout, " ANTENNACUMDIFFSIDEAREARATIO PWL ( ");

for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)

fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),

pwl->lefiAntennaPWL::PWLratio(j));

fprintf(fout, ") ;\n");

}

if (aModel->lefiAntennaModel::hasAntennaSideAreaFactor()) {

fprintf(fout, " ANTENNASIDEAREAFACTOR %g ",

aModel->lefiAntennaModel::antennaSideAreaFactor());

if (aModel->lefiAntennaModel::hasAntennaSideAreaFactorDUO())

fprintf(fout, " DIFFUSEONLY ");

fprintf(fout, ";\n");

}

if (aModel->lefiAntennaModel::hasAntennaCumRoutingPlusCut())

fprintf(fout, " ANTENNACUMROUTINGPLUSCUT ;\n");

if (aModel->lefiAntennaModel::hasAntennaGatePlusDiff())

fprintf(fout, " ANTENNAGATEPLUSDIFF %g ;\n",

aModel->lefiAntennaModel::antennaGatePlusDiff());

if (aModel->lefiAntennaModel::hasAntennaAreaMinusDiff())

fprintf(fout, " ANTENNAAREAMINUSDIFF %g ;\n",

aModel->lefiAntennaModel::antennaAreaMinusDiff());

if (aModel->lefiAntennaModel::hasAntennaAreaDiffReducePWL()) {

pwl = aModel->lefiAntennaModel::antennaAreaDiffReducePWL();

fprintf(fout, " ANTENNAAREADIFFREDUCEPWL ( ");

for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)

fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),

pwl->lefiAntennaPWL::PWLratio(j));

fprintf(fout, ") ;\n");

}

}

if (layer->lefiLayer::numAccurrentDensity()) {

for (i = 0; i < layer->lefiLayer::numAccurrentDensity(); i++) {

density = layer->lefiLayer::accurrent(i);

fprintf(fout, " ACCURRENTDENSITY %s", density->type());

if (density->hasOneEntry())

fprintf(fout, " %g ;\n", density->oneEntry());

else {

fprintf(fout, "\n");

if (density->numFrequency()) {

fprintf(fout, " FREQUENCY");

for (j = 0; j < density->numFrequency(); j++)

fprintf(fout, " %g", density->frequency(j));

fprintf(fout, " ;\n");

}

if (density->numCutareas()) {

fprintf(fout, " CUTAREA");

for (j = 0; j < density->numCutareas(); j++)

fprintf(fout, " %g", density->cutArea(j));

fprintf(fout, " ;\n");

}

if (density->numWidths()) {

fprintf(fout, " WIDTH");

for (j = 0; j < density->numWidths(); j++)

fprintf(fout, " %g", density->width(j));

fprintf(fout, " ;\n");

}

if (density->numTableEntries()) {

k = 5;

fprintf(fout, " TABLEENTRIES");

for (j = 0; j < density->numTableEntries(); j++)

if (k > 4) {

fprintf(fout, "\n %g", density->tableEntry(j));

k = 1;

} else {

fprintf(fout, " %g", density->tableEntry(j));

k++;

}

fprintf(fout, " ;\n");

}

}

}

}

if (layer->lefiLayer::numDccurrentDensity()) {

for (i = 0; i < layer->lefiLayer::numDccurrentDensity(); i++) {

density = layer->lefiLayer::dccurrent(i);

fprintf(fout, " DCCURRENTDENSITY %s", density->type());

if (density->hasOneEntry())

fprintf(fout, " %g ;\n", density->oneEntry());

else {

fprintf(fout, "\n");

if (density->numCutareas()) {

fprintf(fout, " CUTAREA");

for (j = 0; j < density->numCutareas(); j++)

fprintf(fout, " %g", density->cutArea(j));

fprintf(fout, " ;\n");

}

if (density->numWidths()) {

fprintf(fout, " WIDTH");

for (j = 0; j < density->numWidths(); j++)

fprintf(fout, " %g", density->width(j));

fprintf(fout, " ;\n");

}

if (density->numTableEntries()) {

fprintf(fout, " TABLEENTRIES");

for (j = 0; j < density->numTableEntries(); j++)

fprintf(fout, " %g", density->tableEntry(j));

fprintf(fout, " ;\n");

}

}

}

}

for (i = 0; i < layer->lefiLayer::numSpacingTable(); i++) {

spTable = layer->lefiLayer::spacingTable(i);

fprintf(fout, " SPACINGTABLE\n");

if (spTable->lefiSpacingTable::isInfluence()) {

influence = spTable->lefiSpacingTable::influence();

fprintf(fout, " INFLUENCE");

for (j = 0; j < influence->lefiInfluence::numInfluenceEntry(); j++) {

fprintf(fout, "\n WIDTH %g WITHIN %g SPACING %g",

influence->lefiInfluence::width(j),

influence->lefiInfluence::distance(j),

influence->lefiInfluence::spacing(j));

}

fprintf(fout, " ;\n");

} else if (spTable->lefiSpacingTable::isParallel()){

parallel = spTable->lefiSpacingTable::parallel();

fprintf(fout, " PARALLELRUNLENGTH");

for (j = 0; j < parallel->lefiParallel::numLength(); j++) {

fprintf(fout, " %g", parallel->lefiParallel::length(j));

}

for (j = 0; j < parallel->lefiParallel::numWidth(); j++) {

fprintf(fout, "\n WIDTH %g",

parallel->lefiParallel::width(j));

for (k = 0; k < parallel->lefiParallel::numLength(); k++) {

fprintf(fout, " %g", parallel->lefiParallel::widthSpacing(j, k));

}

}

fprintf(fout, " ;\n");

} else { // 5.7 TWOWIDTHS

twoWidths = spTable->lefiSpacingTable::twoWidths();

fprintf(fout, " TWOWIDTHS");

for (j = 0; j < twoWidths->lefiTwoWidths::numWidth(); j++) {

fprintf(fout, "\n WIDTH %g ",

twoWidths->lefiTwoWidths::width(j));

if (twoWidths->lefiTwoWidths::hasWidthPRL(j))

fprintf(fout, "PRL %g ", twoWidths->lefiTwoWidths::widthPRL(j));

for (k = 0; k < twoWidths->lefiTwoWidths::numWidthSpacing(j); k++)

fprintf(fout, "%g ",twoWidths->lefiTwoWidths::widthSpacing(j, k));

}

fprintf(fout, " ;\n");

}

}

propNum = layer->lefiLayer::numProps();

if (propNum > 0) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < propNum; i++) {

// value can either be a string or number

fprintf(fout, "%s ", layer->lefiLayer::propName(i));

if (layer->lefiLayer::propIsNumber(i))

fprintf(fout, "%g ", layer->lefiLayer::propNumber(i));

if (layer->lefiLayer::propIsString(i))

fprintf(fout, "%s ", layer->lefiLayer::propValue(i));

pType = layer->lefiLayer::propType(i);

switch (pType) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

if (layer->lefiLayer::hasDiagMinEdgeLength())

fprintf(fout, " DIAGMINEDGELENGTH %g ;\n",

layer->lefiLayer::diagMinEdgeLength());

if (layer->lefiLayer::numMinSize()) {

fprintf(fout, " MINSIZE ");

for (i = 0; i < layer->lefiLayer::numMinSize(); i++) {

fprintf(fout, "%g %g ", layer->lefiLayer::minSizeWidth(i),

layer->lefiLayer::minSizeLength(i));

}

fprintf(fout, ";\n");

}

fprintf(fout, "END %s\n", layer->lefiLayer::name());

// Set it to case sensitive from here on

lefrSetCaseSensitivity(1);

return 0;

}

int macroBeginCB(lefrCallbackType_e c, const char* macroName, lefiUserData ud) {

checkType(c);

fprintf(fout, "MACRO %s\n", macroName);

return 0;

}

int macroClassTypeCB(lefrCallbackType_e c, const char* macroClassType,

lefiUserData ud) {

checkType(c);

fprintf(fout, "MACRO CLASS %s\n", macroClassType);

return 0;

}

int macroCB(lefrCallbackType_e c, lefiMacro* macro, lefiUserData ud) {

lefiSitePattern* pattern;

int propNum, i, hasPrtSym = 0;

checkType(c);

if (macro->lefiMacro::hasClass())

fprintf(fout, " CLASS %s ;\n", macro->lefiMacro::macroClass());

if (macro->lefiMacro::hasEEQ())

fprintf(fout, " EEQ %s ;\n", macro->lefiMacro::EEQ());

if (macro->lefiMacro::hasLEQ())

fprintf(fout, " LEQ %s ;\n", macro->lefiMacro::LEQ());

if (macro->lefiMacro::hasSource())

fprintf(fout, " SOURCE %s ;\n", macro->lefiMacro::source());

if (macro->lefiMacro::hasXSymmetry()) {

fprintf(fout, " SYMMETRY X ");

hasPrtSym = 1;

}

if (macro->lefiMacro::hasYSymmetry()) { // print X Y & R90 in one line

if (!hasPrtSym) {

fprintf(fout, " SYMMETRY Y ");

hasPrtSym = 1;

}

else

fprintf(fout, "Y ");

}

if (macro->lefiMacro::has90Symmetry()) {

if (!hasPrtSym) {

fprintf(fout, " SYMMETRY R90 ");

hasPrtSym = 1;

}

else

fprintf(fout, "R90 ");

}

if (hasPrtSym) {

fprintf (fout, ";\n");

hasPrtSym = 0;

}

if (macro->lefiMacro::hasSiteName())

fprintf(fout, " SITE %s ;\n", macro->lefiMacro::siteName());

if (macro->lefiMacro::hasSitePattern()) {

for (i = 0; i < macro->lefiMacro::numSitePattern(); i++ ) {

pattern = macro->lefiMacro::sitePattern(i);

if (pattern->lefiSitePattern::hasStepPattern()) {

fprintf(fout, " SITE %s %g %g %s DO %g BY %g STEP %g %g ;\n",

pattern->lefiSitePattern::name(), pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

orientStr(pattern->lefiSitePattern::orient()),

pattern->lefiSitePattern::xStart(),

pattern->lefiSitePattern::yStart(),

pattern->lefiSitePattern::xStep(),

pattern->lefiSitePattern::yStep());

} else {

fprintf(fout, " SITE %s %g %g %s ;\n",

pattern->lefiSitePattern::name(), pattern->lefiSitePattern::x(),

pattern->lefiSitePattern::y(),

orientStr(pattern->lefiSitePattern::orient()));

}

}

}

if (macro->lefiMacro::hasSize())

fprintf(fout, " SIZE %g BY %g ;\n", macro->lefiMacro::sizeX(),

macro->lefiMacro::sizeY());

if (macro->lefiMacro::hasForeign()) {

for (i = 0; i < macro->lefiMacro::numForeigns(); i++) {

fprintf(fout, " FOREIGN %s ", macro->lefiMacro::foreignName(i));

if (macro->lefiMacro::hasForeignPoint(i)) {

fprintf(fout, "( %g %g ) ", macro->lefiMacro::foreignX(i),

macro->lefiMacro::foreignY(i));

if (macro->lefiMacro::hasForeignOrient(i))

fprintf(fout, "%s ", macro->lefiMacro::foreignOrientStr(i));

}

fprintf(fout, ";\n");

}

}

if (macro->lefiMacro::hasOrigin())

fprintf(fout, " ORIGIN ( %g %g ) ;\n", macro->lefiMacro::originX(),

macro->lefiMacro::originY());

if (macro->lefiMacro::hasPower())

fprintf(fout, " POWER %g ;\n", macro->lefiMacro::power());

propNum = macro->lefiMacro::numProperties();

if (propNum > 0) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < propNum; i++) {

// value can either be a string or number

if (macro->lefiMacro::propValue(i)) {

fprintf(fout, "%s %s ", macro->lefiMacro::propName(i),

macro->lefiMacro::propValue(i));

}

else

fprintf(fout, "%s %g ", macro->lefiMacro::propName(i),

macro->lefiMacro::propNum(i));

switch (macro->lefiMacro::propType(i)) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

return 0;

}

int macroEndCB(lefrCallbackType_e c, const char* macroName, lefiUserData ud) {

checkType(c);

fprintf(fout, "END %s\n", macroName);

return 0;

}

int manufacturingCB(lefrCallbackType_e c, double num, lefiUserData ud) {

checkType(c);

fprintf(fout, "MANUFACTURINGGRID %g ;\n", num);

return 0;

}

int maxStackViaCB(lefrCallbackType_e c, lefiMaxStackVia* maxStack,

lefiUserData ud) {

checkType(c);

fprintf(fout, "MAXVIASTACK %d ", maxStack->lefiMaxStackVia::maxStackVia());

if (maxStack->lefiMaxStackVia::hasMaxStackViaRange())

fprintf(fout, "RANGE %s %s ",

maxStack->lefiMaxStackVia::maxStackViaBottomLayer(),

maxStack->lefiMaxStackVia::maxStackViaTopLayer());

fprintf(fout, ";\n");

return 0;

}

int minFeatureCB(lefrCallbackType_e c, lefiMinFeature* min, lefiUserData ud) {

checkType(c);

fprintf(fout, "MINFEATURE %g %g ;\n", min->lefiMinFeature::one(),

min->lefiMinFeature::two());

return 0;

}

int nonDefaultCB(lefrCallbackType_e c, lefiNonDefault* def, lefiUserData ud) {

int i;

lefiVia* via;

lefiSpacing* spacing;

checkType(c);

fprintf(fout, "NONDEFAULTRULE %s\n", def->lefiNonDefault::name());

if (def->lefiNonDefault::hasHardspacing())

fprintf(fout, " HARDSPACING ;\n");

for (i = 0; i < def->lefiNonDefault::numLayers(); i++) {

fprintf(fout, " LAYER %s\n", def->lefiNonDefault::layerName(i));

if (def->lefiNonDefault::hasLayerWidth(i))

fprintf(fout, " WIDTH %g ;\n", def->lefiNonDefault::layerWidth(i));

if (def->lefiNonDefault::hasLayerSpacing(i))

fprintf(fout, " SPACING %g ;\n",

def->lefiNonDefault::layerSpacing(i));

if (def->lefiNonDefault::hasLayerDiagWidth(i))

fprintf(fout, " DIAGWIDTH %g ;\n",

def->lefiNonDefault::layerDiagWidth(i));

if (def->lefiNonDefault::hasLayerWireExtension(i))

fprintf(fout, " WIREEXTENSION %g ;\n",

def->lefiNonDefault::layerWireExtension(i));

if (def->lefiNonDefault::hasLayerResistance(i))

fprintf(fout, " RESISTANCE RPERSQ %g ;\n",

def->lefiNonDefault::layerResistance(i));

if (def->lefiNonDefault::hasLayerCapacitance(i))

fprintf(fout, " CAPACITANCE CPERSQDIST %g ;\n",

def->lefiNonDefault::layerCapacitance(i));

if (def->lefiNonDefault::hasLayerEdgeCap(i))

fprintf(fout, " EDGECAPACITANCE %g ;\n",

def->lefiNonDefault::layerEdgeCap(i));

fprintf(fout, " END %s\n", def->lefiNonDefault::layerName(i));

}

// handle via in nondefaultrule

for (i = 0; i < def->lefiNonDefault::numVias(); i++) {

via = def->lefiNonDefault::viaRule(i);

lefVia(via);

}

// handle spacing in nondefaultrule

for (i = 0; i < def->lefiNonDefault::numSpacingRules(); i++) {

spacing = def->lefiNonDefault::spacingRule(i);

lefSpacing(spacing);

}

// handle usevia

for (i = 0; i < def->lefiNonDefault::numUseVia(); i++)

fprintf(fout, " USEVIA %s ;\n", def->lefiNonDefault::viaName(i));

// handle useviarule

for (i = 0; i < def->lefiNonDefault::numUseViaRule(); i++)

fprintf(fout, " USEVIARULE %s ;\n",

def->lefiNonDefault::viaRuleName(i));

// handle mincuts

for (i = 0; i < def->lefiNonDefault::numMinCuts(); i++) {

fprintf(fout, " MINCUTS %s %d ;\n", def->lefiNonDefault::cutLayerName(i),

def->lefiNonDefault::numCuts(i));

}

// handle property in nondefaultrule

if (def->lefiNonDefault::numProps() > 0) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < def->lefiNonDefault::numProps(); i++) {

fprintf(fout, "%s ", def->lefiNonDefault::propName(i));

if (def->lefiNonDefault::propIsNumber(i))

fprintf(fout, "%g ", def->lefiNonDefault::propNumber(i));

if (def->lefiNonDefault::propIsString(i))

fprintf(fout, "%s ", def->lefiNonDefault::propValue(i));

switch(def->lefiNonDefault::propType(i)) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

fprintf(fout, "END %s ;\n", def->lefiNonDefault::name());

return 0;

}

int obstructionCB(lefrCallbackType_e c, lefiObstruction* obs,

lefiUserData ud) {

lefiGeometries* geometry;

checkType(c);

fprintf(fout, " OBS\n");

geometry = obs->lefiObstruction::geometries();

prtGeometry(geometry);

fprintf(fout, " END\n");

return 0;

}

int pinCB(lefrCallbackType_e c, lefiPin* pin, lefiUserData ud) {

int numPorts, i, j;

lefiGeometries* geometry;

lefiPinAntennaModel* aModel;

checkType(c);

fprintf(fout, " PIN %s\n", pin->lefiPin::name());

if (pin->lefiPin::hasForeign()) {

for (i = 0; i < pin->lefiPin::numForeigns(); i++) {

if (pin->lefiPin::hasForeignOrient(i))

fprintf(fout, " FOREIGN %s STRUCTURE ( %g %g ) %s ;\n",

pin->lefiPin::foreignName(i), pin->lefiPin::foreignX(i),

pin->lefiPin::foreignY(i),

pin->lefiPin::foreignOrientStr(i));

else if (pin->lefiPin::hasForeignPoint(i))

fprintf(fout, " FOREIGN %s STRUCTURE ( %g %g ) ;\n",

pin->lefiPin::foreignName(i), pin->lefiPin::foreignX(i),

pin->lefiPin::foreignY(i));

else

fprintf(fout, " FOREIGN %s ;\n", pin->lefiPin::foreignName(i));

}

}

if (pin->lefiPin::hasLEQ())

fprintf(fout, " LEQ %s ;\n", pin->lefiPin::LEQ());

if (pin->lefiPin::hasDirection())

fprintf(fout, " DIRECTION %s ;\n", pin->lefiPin::direction());

if (pin->lefiPin::hasUse())

fprintf(fout, " USE %s ;\n", pin->lefiPin::use());

if (pin->lefiPin::hasShape())

fprintf(fout, " SHAPE %s ;\n", pin->lefiPin::shape());

if (pin->lefiPin::hasMustjoin())

fprintf(fout, " MUSTJOIN %s ;\n", pin->lefiPin::mustjoin());

if (pin->lefiPin::hasOutMargin())

fprintf(fout, " OUTPUTNOISEMARGIN %g %g ;\n",

pin->lefiPin::outMarginHigh(), pin->lefiPin::outMarginLow());

if (pin->lefiPin::hasOutResistance())

fprintf(fout, " OUTPUTRESISTANCE %g %g ;\n",

pin->lefiPin::outResistanceHigh(),

pin->lefiPin::outResistanceLow());

if (pin->lefiPin::hasInMargin())

fprintf(fout, " INPUTNOISEMARGIN %g %g ;\n",

pin->lefiPin::inMarginHigh(), pin->lefiPin::inMarginLow());

if (pin->lefiPin::hasPower())

fprintf(fout, " POWER %g ;\n", pin->lefiPin::power());

if (pin->lefiPin::hasLeakage())

fprintf(fout, " LEAKAGE %g ;\n", pin->lefiPin::leakage());

if (pin->lefiPin::hasMaxload())

fprintf(fout, " MAXLOAD %g ;\n", pin->lefiPin::maxload());

if (pin->lefiPin::hasCapacitance())

fprintf(fout, " CAPACITANCE %g ;\n", pin->lefiPin::capacitance());

if (pin->lefiPin::hasResistance())

fprintf(fout, " RESISTANCE %g ;\n", pin->lefiPin::resistance());

if (pin->lefiPin::hasPulldownres())

fprintf(fout, " PULLDOWNRES %g ;\n", pin->lefiPin::pulldownres());

if (pin->lefiPin::hasTieoffr())

fprintf(fout, " TIEOFFR %g ;\n", pin->lefiPin::tieoffr());

if (pin->lefiPin::hasVHI())

fprintf(fout, " VHI %g ;\n", pin->lefiPin::VHI());

if (pin->lefiPin::hasVLO())

fprintf(fout, " VLO %g ;\n", pin->lefiPin::VLO());

if (pin->lefiPin::hasRiseVoltage())

fprintf(fout, " RISEVOLTAGETHRESHOLD %g ;\n",

pin->lefiPin::riseVoltage());

if (pin->lefiPin::hasFallVoltage())

fprintf(fout, " FALLVOLTAGETHRESHOLD %g ;\n",

pin->lefiPin::fallVoltage());

if (pin->lefiPin::hasRiseThresh())

fprintf(fout, " RISETHRESH %g ;\n", pin->lefiPin::riseThresh());

if (pin->lefiPin::hasFallThresh())

fprintf(fout, " FALLTHRESH %g ;\n", pin->lefiPin::fallThresh());

if (pin->lefiPin::hasRiseSatcur())

fprintf(fout, " RISESATCUR %g ;\n", pin->lefiPin::riseSatcur());

if (pin->lefiPin::hasFallSatcur())

fprintf(fout, " FALLSATCUR %g ;\n", pin->lefiPin::fallSatcur());

if (pin->lefiPin::hasRiseSlewLimit())

fprintf(fout, " RISESLEWLIMIT %g ;\n", pin->lefiPin::riseSlewLimit());

if (pin->lefiPin::hasFallSlewLimit())

fprintf(fout, " FALLSLEWLIMIT %g ;\n", pin->lefiPin::fallSlewLimit());

if (pin->lefiPin::hasCurrentSource())

fprintf(fout, " CURRENTSOURCE %s ;\n", pin->lefiPin::currentSource());

if (pin->lefiPin::hasTables())

fprintf(fout, " IV_TABLES %s %s ;\n", pin->lefiPin::tableHighName(),

pin->lefiPin::tableLowName());

if (pin->lefiPin::hasTaperRule())

fprintf(fout, " TAPERRULE %s ;\n", pin->lefiPin::taperRule());

if (pin->lefiPin::hasNetExpr())

fprintf(fout, " NETEXPR \"%s\" ;\n", pin->lefiPin::netExpr());

if (pin->lefiPin::hasSupplySensitivity())

fprintf(fout, " SUPPLYSENSITIVITY %s ;\n",

pin->lefiPin::supplySensitivity());

if (pin->lefiPin::hasGroundSensitivity())

fprintf(fout, " GROUNDSENSITIVITY %s ;\n",

pin->lefiPin::groundSensitivity());

if (pin->lefiPin::hasAntennaSize()) {

for (i = 0; i < pin->lefiPin::numAntennaSize(); i++) {

fprintf(fout, " ANTENNASIZE %g ", pin->lefiPin::antennaSize(i));

if (pin->lefiPin::antennaSizeLayer(i))

fprintf(fout, "LAYER %s ", pin->lefiPin::antennaSizeLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaMetalArea()) {

for (i = 0; i < pin->lefiPin::numAntennaMetalArea(); i++) {

fprintf(fout, " ANTENNAMETALAREA %g ",

pin->lefiPin::antennaMetalArea(i));

if (pin->lefiPin::antennaMetalAreaLayer(i))

fprintf(fout, "LAYER %s ", pin->lefiPin::antennaMetalAreaLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaMetalLength()) {

for (i = 0; i < pin->lefiPin::numAntennaMetalLength(); i++) {

fprintf(fout, " ANTENNAMETALLENGTH %g ",

pin->lefiPin::antennaMetalLength(i));

if (pin->lefiPin::antennaMetalLengthLayer(i))

fprintf(fout, "LAYER %s ", pin->lefiPin::antennaMetalLengthLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaPartialMetalArea()) {

for (i = 0; i < pin->lefiPin::numAntennaPartialMetalArea(); i++) {

fprintf(fout, " ANTENNAPARTIALMETALAREA %g ",

pin->lefiPin::antennaPartialMetalArea(i));

if (pin->lefiPin::antennaPartialMetalAreaLayer(i))

fprintf(fout, "LAYER %s ",

pin->lefiPin::antennaPartialMetalAreaLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaPartialMetalSideArea()) {

for (i = 0; i < pin->lefiPin::numAntennaPartialMetalSideArea(); i++) {

fprintf(fout, " ANTENNAPARTIALMETALSIDEAREA %g ",

pin->lefiPin::antennaPartialMetalSideArea(i));

if (pin->lefiPin::antennaPartialMetalSideAreaLayer(i))

fprintf(fout, "LAYER %s ",

pin->lefiPin::antennaPartialMetalSideAreaLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaPartialCutArea()) {

for (i = 0; i < pin->lefiPin::numAntennaPartialCutArea(); i++) {

fprintf(fout, " ANTENNAPARTIALCUTAREA %g ",

pin->lefiPin::antennaPartialCutArea(i));

if (pin->lefiPin::antennaPartialCutAreaLayer(i))

fprintf(fout, "LAYER %s ",

pin->lefiPin::antennaPartialCutAreaLayer(i));

fprintf(fout, ";\n");

}

}

if (pin->lefiPin::hasAntennaDiffArea()) {

for (i = 0; i < pin->lefiPin::numAntennaDiffArea(); i++) {

fprintf(fout, " ANTENNADIFFAREA %g ",

pin->lefiPin::antennaDiffArea(i));

if (pin->lefiPin::antennaDiffAreaLayer(i))

fprintf(fout, "LAYER %s ", pin->lefiPin::antennaDiffAreaLayer(i));

fprintf(fout, ";\n");

}

}

for (j = 0; j < pin->lefiPin::numAntennaModel(); j++) {

aModel = pin->lefiPin::antennaModel(j);

fprintf(fout, " ANTENNAMODEL %s ;\n",

aModel->lefiPinAntennaModel::antennaOxide());

if (aModel->lefiPinAntennaModel::hasAntennaGateArea()) {

for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaGateArea(); i++)

{

fprintf(fout, " ANTENNAGATEAREA %g ",

aModel->lefiPinAntennaModel::antennaGateArea(i));

if (aModel->lefiPinAntennaModel::antennaGateAreaLayer(i))

fprintf(fout, "LAYER %s ",

aModel->lefiPinAntennaModel::antennaGateAreaLayer(i));

fprintf(fout, ";\n");

}

}

if (aModel->lefiPinAntennaModel::hasAntennaMaxAreaCar()) {

for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxAreaCar();

i++) {

fprintf(fout, " ANTENNAMAXAREACAR %g ",

aModel->lefiPinAntennaModel::antennaMaxAreaCar(i));

if (aModel->lefiPinAntennaModel::antennaMaxAreaCarLayer(i))

fprintf(fout, "LAYER %s ",

aModel->lefiPinAntennaModel::antennaMaxAreaCarLayer(i));

fprintf(fout, ";\n");

}

}

if (aModel->lefiPinAntennaModel::hasAntennaMaxSideAreaCar()) {

for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxSideAreaCar();

i++) {

fprintf(fout, " ANTENNAMAXSIDEAREACAR %g ",

aModel->lefiPinAntennaModel::antennaMaxSideAreaCar(i));

if (aModel->lefiPinAntennaModel::antennaMaxSideAreaCarLayer(i))

fprintf(fout, "LAYER %s ",

aModel->lefiPinAntennaModel::antennaMaxSideAreaCarLayer(i));

fprintf(fout, ";\n");

}

}

if (aModel->lefiPinAntennaModel::hasAntennaMaxCutCar()) {

for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxCutCar(); i++)

{

fprintf(fout, " ANTENNAMAXCUTCAR %g ",

aModel->lefiPinAntennaModel::antennaMaxCutCar(i));

if (aModel->lefiPinAntennaModel::antennaMaxCutCarLayer(i))

fprintf(fout, "LAYER %s ",

aModel->lefiPinAntennaModel::antennaMaxCutCarLayer(i));

fprintf(fout, ";\n");

}

}

}

if (pin->lefiPin::numProperties() > 0) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < pin->lefiPin::numProperties(); i++) {

// value can either be a string or number

if (pin->lefiPin::propValue(i)) {

fprintf(fout, "%s %s ", pin->lefiPin::propName(i),

pin->lefiPin::propValue(i));

}

else

fprintf(fout, "%s %g ", pin->lefiPin::propName(i),

pin->lefiPin::propNum(i));

switch (pin->lefiPin::propType(i)) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

numPorts = pin->lefiPin::numPorts();

for (i = 0; i < numPorts; i++) {

fprintf(fout," PORT\n");

geometry = pin->lefiPin::port(i);

prtGeometry(geometry);

fprintf(fout, " END\n");

}

fprintf(fout, " END %s\n", pin->lefiPin::name());

return 0;

}

int densityCB(lefrCallbackType_e c, lefiDensity* density,

lefiUserData ud) {

struct lefiGeomRect rect;

checkType(c);

fprintf(fout, " DENSITY\n");

for (int i = 0; i < density->lefiDensity::numLayer(); i++) {

fprintf(fout, " LAYER %s ;\n", density->lefiDensity::layerName(i));

for (int j = 0; j < density->lefiDensity::numRects(i); j++) {

rect = density->lefiDensity::getRect(i,j);

fprintf(fout, " RECT %g %g %g %g ", rect.xl, rect.yl, rect.xh,

rect.yh);

fprintf(fout, "%g ;\n", density->lefiDensity::densityValue(i,j));

}

}

fprintf(fout, " END\n");

return 0;

}

int propDefBeginCB(lefrCallbackType_e c, void* ptr, lefiUserData ud) {

checkType(c);

fprintf(fout, "PROPERTYDEFINITIONS\n");

return 0;

}

int propDefCB(lefrCallbackType_e c, lefiProp* prop, lefiUserData ud) {

checkType(c);

fprintf(fout, " %s %s", prop->lefiProp::propType(),

prop->lefiProp::propName());

switch(prop->lefiProp::dataType()) {

case 'I':

fprintf(fout, " INTEGER");

break;

case 'R':

fprintf(fout, " REAL");

break;

case 'S':

fprintf(fout, " STRING");

break;

}

if (prop->lefiProp::hasNumber())

fprintf(fout, " %g", prop->lefiProp::number());

if (prop->lefiProp::hasRange())

fprintf(fout, " RANGE %g %g", prop->lefiProp::left(),

prop->lefiProp::right());

if (prop->lefiProp::hasString())

fprintf(fout, " %s", prop->lefiProp::string());

fprintf(fout, "\n");

return 0;

}

int propDefEndCB(lefrCallbackType_e c, void* ptr, lefiUserData ud) {

checkType(c);

fprintf(fout, "END PROPERTYDEFINITIONS\n");

return 0;

}

int siteCB(lefrCallbackType_e c, lefiSite* site, lefiUserData ud) {

int hasPrtSym = 0;

int i;

checkType(c);

fprintf(fout, "SITE %s\n", site->lefiSite::name());

if (site->lefiSite::hasClass())

fprintf(fout, " CLASS %s ;\n", site->lefiSite::siteClass());

if (site->lefiSite::hasXSymmetry()) {

fprintf(fout, " SYMMETRY X ");

hasPrtSym = 1;

}

if (site->lefiSite::hasYSymmetry()) {

if (hasPrtSym)

fprintf(fout, "Y ");

else {

fprintf(fout, " SYMMETRY Y ");

hasPrtSym = 1;

}

}

if (site->lefiSite::has90Symmetry()) {

if (hasPrtSym)

fprintf(fout, "R90 ");

else {

fprintf(fout, " SYMMETRY R90 ");

hasPrtSym = 1;

}

}

if (hasPrtSym)

fprintf(fout, ";\n");

if (site->lefiSite::hasSize())

fprintf(fout, " SIZE %g BY %g ;\n", site->lefiSite::sizeX(),

site->lefiSite::sizeY());

if (site->hasRowPattern()) {

fprintf(fout, " ROWPATTERN ");

for (i = 0; i < site->lefiSite::numSites(); i++)

fprintf(fout, " %s %s ", site->lefiSite::siteName(i),

site->lefiSite::siteOrientStr(i));

fprintf(fout, ";\n");

}

fprintf(fout, "END %s\n", site->lefiSite::name());

return 0;

}

int spacingBeginCB(lefrCallbackType_e c, void* ptr, lefiUserData ud){

checkType(c);

fprintf(fout, "SPACING\n");

return 0;

}

int spacingCB(lefrCallbackType_e c, lefiSpacing* spacing, lefiUserData ud) {

checkType(c);

lefSpacing(spacing);

return 0;

}

int spacingEndCB(lefrCallbackType_e c, void* ptr, lefiUserData ud){

checkType(c);

fprintf(fout, "END SPACING\n");

return 0;

}

int timingCB(lefrCallbackType_e c, lefiTiming* timing, lefiUserData ud) {

int i;

checkType(c);

fprintf(fout, "TIMING\n");

for (i = 0; i < timing->numFromPins(); i++)

fprintf(fout, " FROMPIN %s ;\n", timing->fromPin(i));

for (i = 0; i < timing->numToPins(); i++)

fprintf(fout, " TOPIN %s ;\n", timing->toPin(i));

fprintf(fout, " RISE SLEW1 %g %g %g %g ;\n", timing->riseSlewOne(),

timing->riseSlewTwo(), timing->riseSlewThree(),

timing->riseSlewFour());

if (timing->hasRiseSlew2())

fprintf(fout, " RISE SLEW2 %g %g %g ;\n", timing->riseSlewFive(),

timing->riseSlewSix(), timing->riseSlewSeven());

if (timing->hasFallSlew())

fprintf(fout, " FALL SLEW1 %g %g %g %g ;\n", timing->fallSlewOne(),

timing->fallSlewTwo(), timing->fallSlewThree(),

timing->fallSlewFour());

if (timing->hasFallSlew2())

fprintf(fout, " FALL SLEW2 %g %g %g ;\n", timing->fallSlewFive(),

timing->fallSlewSix(), timing->riseSlewSeven());

if (timing->hasRiseIntrinsic()) {

fprintf(fout, "TIMING RISE INTRINSIC %g %g ;\n",

timing->riseIntrinsicOne(), timing->riseIntrinsicTwo());

fprintf(fout, "TIMING RISE VARIABLE %g %g ;\n",

timing->riseIntrinsicThree(), timing->riseIntrinsicFour());

}

if (timing->hasFallIntrinsic()) {

fprintf(fout, "TIMING FALL INTRINSIC %g %g ;\n",

timing->fallIntrinsicOne(), timing->fallIntrinsicTwo());

fprintf(fout, "TIMING RISE VARIABLE %g %g ;\n",

timing->fallIntrinsicThree(), timing->fallIntrinsicFour());

}

if (timing->hasRiseRS())

fprintf(fout, "TIMING RISERS %g %g ;\n",

timing->riseRSOne(), timing->riseRSTwo());

if (timing->hasRiseCS())

fprintf(fout, "TIMING RISECS %g %g ;\n",

timing->riseCSOne(), timing->riseCSTwo());

if (timing->hasFallRS())

fprintf(fout, "TIMING FALLRS %g %g ;\n",

timing->fallRSOne(), timing->fallRSTwo());

if (timing->hasFallCS())

fprintf(fout, "TIMING FALLCS %g %g ;\n",

timing->fallCSOne(), timing->fallCSTwo());

if (timing->hasUnateness())

fprintf(fout, "TIMING UNATENESS %s ;\n", timing->unateness());

if (timing->hasRiseAtt1())

fprintf(fout, "TIMING RISESATT1 %g %g ;\n", timing->riseAtt1One(),

timing->riseAtt1Two());

if (timing->hasFallAtt1())

fprintf(fout, "TIMING FALLSATT1 %g %g ;\n", timing->fallAtt1One(),

timing->fallAtt1Two());

if (timing->hasRiseTo())

fprintf(fout, "TIMING RISET0 %g %g ;\n", timing->riseToOne(),

timing->riseToTwo());

if (timing->hasFallTo())

fprintf(fout, "TIMING FALLT0 %g %g ;\n", timing->fallToOne(),

timing->fallToTwo());

if (timing->hasSDFonePinTrigger())

fprintf(fout, " %s TABLEDIMENSION %g %g %g ;\n",

timing->SDFonePinTriggerType(), timing->SDFtriggerOne(),

timing->SDFtriggerTwo(), timing->SDFtriggerThree());

if (timing->hasSDFtwoPinTrigger())

fprintf(fout, " %s %s %s TABLEDIMENSION %g %g %g ;\n",

timing->SDFtwoPinTriggerType(), timing->SDFfromTrigger(),

timing->SDFtoTrigger(), timing->SDFtriggerOne(),

timing->SDFtriggerTwo(), timing->SDFtriggerThree());

fprintf(fout, "END TIMING\n");

return 0;

}

int unitsCB(lefrCallbackType_e c, lefiUnits* unit, lefiUserData ud) {

checkType(c);

fprintf(fout, "UNITS\n");

if (unit->lefiUnits::hasDatabase())

fprintf(fout, " DATABASE %s %g ;\n", unit->lefiUnits::databaseName(),

unit->lefiUnits::databaseNumber());

if (unit->lefiUnits::hasCapacitance())

fprintf(fout, " CAPACITANCE PICOFARADS %g ;\n",

unit->lefiUnits::capacitance());

if (unit->lefiUnits::hasResistance())

fprintf(fout, " RESISTANCE OHMS %g ;\n", unit->lefiUnits::resistance());

if (unit->lefiUnits::hasPower())

fprintf(fout, " POWER MILLIWATTS %g ;\n", unit->lefiUnits::power());

if (unit->lefiUnits::hasCurrent())

fprintf(fout, " CURRENT MILLIAMPS %g ;\n", unit->lefiUnits::current());

if (unit->lefiUnits::hasVoltage())

fprintf(fout, " VOLTAGE VOLTS %g ;\n", unit->lefiUnits::voltage());

if (unit->lefiUnits::hasFrequency())

fprintf(fout, " FREQUENCY MEGAHERTZ %g ;\n",

unit->lefiUnits::frequency());

fprintf(fout, "END UNITS\n");

return 0;

}

int useMinSpacingCB(lefrCallbackType_e c, lefiUseMinSpacing* spacing,

lefiUserData ud) {

checkType(c);

fprintf(fout, "USEMINSPACING %s ", spacing->lefiUseMinSpacing::name());

if (spacing->lefiUseMinSpacing::value())

fprintf(fout, "ON ;\n");

else

fprintf(fout, "OFF ;\n");

return 0;

}

int versionCB(lefrCallbackType_e c, double num, lefiUserData ud) {

checkType(c);

fprintf(fout, "VERSION %g ;\n", num);

return 0;

}

int versionStrCB(lefrCallbackType_e c, const char* versionName, lefiUserData ud) {

checkType(c);

fprintf(fout, "VERSION %s ;\n", versionName);

return 0;

}

int viaCB(lefrCallbackType_e c, lefiVia* via, lefiUserData ud) {

checkType(c);

lefVia(via);

return 0;

}

int viaRuleCB(lefrCallbackType_e c, lefiViaRule* viaRule, lefiUserData ud) {

int numLayers, numVias, i;

lefiViaRuleLayer* vLayer;

checkType(c);

fprintf(fout, "VIARULE %s", viaRule->lefiViaRule::name());

if (viaRule->lefiViaRule::hasGenerate())

fprintf(fout, " GENERATE");

if (viaRule->lefiViaRule::hasDefault())

fprintf(fout, " DEFAULT");

fprintf(fout, "\n");

numLayers = viaRule->lefiViaRule::numLayers();

for (i = 0; i < numLayers; i++) {

vLayer = viaRule->lefiViaRule::layer(i);

lefViaRuleLayer(vLayer);

}

if (numLayers == 2 && !(viaRule->lefiViaRule::hasGenerate())) {

numVias = viaRule->lefiViaRule::numVias();

if (numVias == 0)

fprintf(fout, "Should have via names in VIARULE.\n");

else {

for (i = 0; i < numVias; i++)

fprintf(fout, " VIA %s ;\n", viaRule->lefiViaRule::viaName(i));

}

}

if (viaRule->lefiViaRule::numProps() > 0) {

fprintf(fout, " PROPERTY ");

for (i = 0; i < viaRule->lefiViaRule::numProps(); i++) {

fprintf(fout, "%s ", viaRule->lefiViaRule::propName(i));

if (viaRule->lefiViaRule::propValue(i))

fprintf(fout, "%s ", viaRule->lefiViaRule::propValue(i));

switch (viaRule->lefiViaRule::propType(i)) {

case 'R': fprintf(fout, "REAL ");

break;

case 'I': fprintf(fout, "INTEGER ");

break;

case 'S': fprintf(fout, "STRING ");

break;

case 'Q': fprintf(fout, "QUOTESTRING ");

break;

case 'N': fprintf(fout, "NUMBER ");

break;

}

}

fprintf(fout, ";\n");

}

fprintf(fout, "END %s\n", viaRule->lefiViaRule::name());

return 0;

}

int extensionCB(lefrCallbackType_e c, const char* extsn, lefiUserData ud) {

checkType(c);

fprintf(fout, "BEGINEXT %s ;\n", extsn);

return 0;

}

int doneCB(lefrCallbackType_e c, void* ptr, lefiUserData ud) {

checkType(c);

fprintf(fout, "END LIBRARY\n");

return 0;

}

void errorCB(const char* msg) {

printf ("%s : %s\n", lefrGetUserData(), msg);

}

void warningCB(const char* msg) {

printf ("%s : %s\n", lefrGetUserData(), msg);

}

void* mallocCB(int size) {

return malloc(size);

}

void* reallocCB(void* name, int size) {

return realloc(name, size);

}

void freeCB(void* name) {

free(name);

return;

}

void lineNumberCB(int lineNo) {

fprintf(fout, "Parsed %d number of lines!!\n", lineNo);

return;

}

int

main(int argc, char** argv) {

char* inFile[100];

char* outFile;

FILE* f;

int res;

int noCalls = 0;

int num;

int status;

int retStr = 0;

int numInFile = 0;

int fileCt = 0;

int relax = 0;

char* version;

int setVer = 0;

char* userData;

int msgCb = 0;

userData = strdup ("(lefrw-5100)");

strcpy(defaultName,"lef.in");

strcpy(defaultOut,"list");

inFile[0] = defaultName;

outFile = defaultOut;

fout = stdout;

argc--;

argv++;

while (argc--) {

if (strcmp(*argv, "-d") == 0) {

argv++;

argc--;

sscanf(*argv, "%d", &num);

lefiSetDebug(num, 1);

} else if (strcmp(*argv, "-nc") == 0) {

noCalls = 1;

} else if (strcmp(*argv, "-p") == 0) {

printing = 1;

} else if (strcmp(*argv, "-m") == 0) { // use the user error/warning CB

msgCb = 1;

} else if (strcmp(*argv, "-o") == 0) {

argv++;

argc--;

outFile = *argv;

if ((fout = fopen(outFile, "w")) == 0) {

fprintf(stderr, "ERROR: could not open output file\n");

return 2;

}

} else if (strcmp(*argv, "-verStr") == 0) {

/* New to set the version callback routine to return a string */

/* instead of double. */

retStr = 1;

} else if (strcmp(*argv, "-relax") == 0) {

relax = 1;

} else if (strcmp(*argv, "-65nm") == 0) {

parse65nm = 1;

} else if (strcmp(*argv, "-ver") == 0) {

argv++;

argc--;

setVer = 1;

version = *argv;

} else if (argv[0][0] != '-') {

if (numInFile >= 100) {

fprintf(stderr, "ERROR: too many input files, max = 3.\n");

return 2;

}

inFile[numInFile++] = *argv;

} else {

fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);

return 2;

}

argv++;

}

if (noCalls == 0) {

lefrSetAntennaInputCbk(antennaCB);

lefrSetAntennaInoutCbk(antennaCB);

lefrSetAntennaOutputCbk(antennaCB);

lefrSetArrayBeginCbk(arrayBeginCB);

lefrSetArrayCbk(arrayCB);

lefrSetArrayEndCbk(arrayEndCB);

lefrSetBusBitCharsCbk(busBitCharsCB);

lefrSetCaseSensitiveCbk(caseSensCB);

lefrSetClearanceMeasureCbk(clearanceCB);

lefrSetDensityCbk(densityCB);

lefrSetDividerCharCbk(dividerCB);

lefrSetNoWireExtensionCbk(noWireExtCB);

lefrSetEdgeRateThreshold1Cbk(edge1CB);

lefrSetEdgeRateThreshold2Cbk(edge2CB);

lefrSetEdgeRateScaleFactorCbk(edgeScaleCB);

lefrSetExtensionCbk(extensionCB);

lefrSetDielectricCbk(dielectricCB);

lefrSetIRDropBeginCbk(irdropBeginCB);

lefrSetIRDropCbk(irdropCB);

lefrSetIRDropEndCbk(irdropEndCB);

lefrSetLayerCbk(layerCB);

lefrSetLibraryEndCbk(doneCB);

lefrSetMacroBeginCbk(macroBeginCB);

lefrSetMacroCbk(macroCB);

lefrSetMacroClassTypeCbk(macroClassTypeCB);

lefrSetMacroEndCbk(macroEndCB);

lefrSetManufacturingCbk(manufacturingCB);

lefrSetMaxStackViaCbk(maxStackViaCB);

lefrSetMinFeatureCbk(minFeatureCB);

lefrSetNonDefaultCbk(nonDefaultCB);

lefrSetObstructionCbk(obstructionCB);

lefrSetPinCbk(pinCB);

lefrSetPropBeginCbk(propDefBeginCB);

lefrSetPropCbk(propDefCB);

lefrSetPropEndCbk(propDefEndCB);

lefrSetSiteCbk(siteCB);

lefrSetSpacingBeginCbk(spacingBeginCB);

lefrSetSpacingCbk(spacingCB);

lefrSetSpacingEndCbk(spacingEndCB);

lefrSetTimingCbk(timingCB);

lefrSetUnitsCbk(unitsCB);

lefrSetUseMinSpacingCbk(useMinSpacingCB);

lefrSetUserData((void*)3);

if (!retStr)

lefrSetVersionCbk(versionCB);

else

lefrSetVersionStrCbk(versionStrCB);

lefrSetViaCbk(viaCB);

lefrSetViaRuleCbk(viaRuleCB);

lefrSetInputAntennaCbk(antennaCB);

lefrSetOutputAntennaCbk(antennaCB);

lefrSetInoutAntennaCbk(antennaCB);

if (msgCb) {

lefrSetLogFunction(errorCB);

lefrSetWarningLogFunction(warningCB);

}

lefrSetMallocFunction(mallocCB);

lefrSetReallocFunction(reallocCB);

lefrSetFreeFunction(freeCB);

lefrSetLineNumberFunction(lineNumberCB);

lefrSetDeltaNumberLines(50);

lefrSetRegisterUnusedCallbacks();

if (relax)

lefrSetRelaxMode();

if (setVer)

(void)lefrSetVersionValue(version);

lefrSetAntennaInoutWarnings(30);

lefrSetAntennaInputWarnings(30);

lefrSetAntennaOutputWarnings(30);

lefrSetArrayWarnings(30);

lefrSetCaseSensitiveWarnings(30);

lefrSetCorrectionTableWarnings(30);

lefrSetDielectricWarnings(30);

lefrSetEdgeRateThreshold1Warnings(30);

lefrSetEdgeRateThreshold2Warnings(30);

lefrSetEdgeRateScaleFactorWarnings(30);

lefrSetInoutAntennaWarnings(30);

lefrSetInputAntennaWarnings(30);

lefrSetIRDropWarnings(30);

lefrSetLayerWarnings(30);

lefrSetMacroWarnings(30);

lefrSetMaxStackViaWarnings(30);

lefrSetMinFeatureWarnings(30);

lefrSetNoiseMarginWarnings(30);

lefrSetNoiseTableWarnings(30);

lefrSetNonDefaultWarnings(30);

lefrSetNoWireExtensionWarnings(30);

lefrSetOutputAntennaWarnings(30);

lefrSetPinWarnings(30);

lefrSetSiteWarnings(30);

lefrSetSpacingWarnings(30);

lefrSetTimingWarnings(30);

lefrSetUnitsWarnings(30);

lefrSetUseMinSpacingWarnings(30);

lefrSetViaRuleWarnings(30);

lefrSetViaWarnings(30);

}

(void) lefrSetShiftCase(); // will shift name to uppercase if caseinsensitive

// is set to off or not set

lefrInit();

for (fileCt = 0; fileCt < numInFile; fileCt++) {

lefrReset();

if ((f = fopen(inFile[fileCt],"r")) == 0) {

fprintf(stderr,"Couldn't open input file '%s'\n", inFile[fileCt]);

return(2);

}

(void)lefrEnableReadEncrypted();

status = lefwInit(fout); // initialize the lef writer, need to be called 1st

if (status != LEFW_OK)

return 1;

res = lefrRead(f, inFile[fileCt], (void*)userData);

if (res)

fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);

(void)lefrPrintUnusedCallbacks(fout);

(void)lefrReleaseNResetMemory();

}

fclose(fout);

return 0;

}

## LEF Writer Program

#include <stdlib.h>

#include <stdio.h>

#include <string.h>

#ifndef WIN32

# include <unistd.h>

#endif /* not WIN32 */

#include "lefwWriter.hpp"

char defaultOut[128];

// Global variables

FILE* fout;

#define CHECK_STATUS(status) \

if (status) { \

lefwPrintError(status); \

return(status); \

}

int main(int argc, char** argv) {

char* outfile;

int status; // return code, if none 0 means error

int lineNum = 0;

// assign the default

strcpy(defaultOut, "lef.in");

outfile = defaultOut;

fout = stdout;

double *xpath;

double *ypath;

double *xl;

double *yl;

double *wthn, *spng;

argc--;

argv++;

while (argc--) {

if (strcmp(*argv, "-o") == 0) { // output filename

argv++;

argc--;

outfile = *argv;

if ((fout = fopen(outfile, "w")) == 0) {

fprintf(stderr, "ERROR: could not open output file\n");

return 2;

}

} else if (strncmp(*argv, "-h", 2) == 0) { // compare with -h[elp]

fprintf(stderr, "Usage: lefwrite [-o <filename>] [-help]\n");

return 1;

} else {

fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);

return 2;

}

argv++;

}

// initalize

status = lefwInit(fout);

CHECK_STATUS(status);

status = lefwVersion(5, 7);

CHECK_STATUS(status);

status = lefwBusBitChars("<>");

CHECK_STATUS(status);

status = lefwDividerChar(":");

CHECK_STATUS(status);

status = lefwManufacturingGrid(3.5);

CHECK_STATUS(status);

status = lefwUseMinSpacing("OBS", "OFF");

CHECK_STATUS(status);

status = lefwClearanceMeasure("EUCLIDEAN");

CHECK_STATUS(status);

status = lefwNewLine();

CHECK_STATUS(status);

// 5.4 ANTENNA

status = lefwAntennaInputGateArea(45);

CHECK_STATUS(status);

status = lefwAntennaInOutDiffArea(65);

CHECK_STATUS(status);

status = lefwAntennaOutputDiffArea(55);

CHECK_STATUS(status);

status = lefwNewLine();

CHECK_STATUS(status);

// UNITS

status = lefwStartUnits();

CHECK_STATUS(status);

status = lefwUnits(100, 10, 10000, 10000, 10000, 1000, 20000);

CHECK_STATUS(status);

status = lefwUnitsFrequency(10);

CHECK_STATUS(status);

status = lefwEndUnits();

CHECK_STATUS(status);

// PROPERTYDEFINITIONS

status = lefwStartPropDef();

CHECK_STATUS(status);

status = lefwStringPropDef("LIBRARY", "NAME", 0, 0, "Cadence96");

CHECK_STATUS(status);

status = lefwIntPropDef("LIBRARY", "intNum", 0, 0, 20);

CHECK_STATUS(status);

status = lefwRealPropDef("LIBRARY", "realNum", 0, 0, 21.22);

CHECK_STATUS(status);

status = lefwStringPropDef("PIN", "TYPE", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("PIN", "intProp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("PIN", "realProp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwStringPropDef("MACRO", "stringProp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("MACRO", "integerProp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("MACRO", "WEIGHT", 1.0, 100.0, 0);

CHECK_STATUS(status);

status = lefwStringPropDef("VIA", "stringProperty", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("VIA", "realProp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("VIA", "COUNT", 1, 100, 0);

CHECK_STATUS(status);

status = lefwStringPropDef("LAYER", "lsp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("LAYER", "lip", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("LAYER", "lrp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwStringPropDef("VIARULE", "vrsp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("VIARULE", "vrip", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("VIARULE", "vrrp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwStringPropDef("NONDEFAULTRULE", "ndrsp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwIntPropDef("NONDEFAULTRULE", "ndrip", 0, 0, 0);

CHECK_STATUS(status);

status = lefwRealPropDef("NONDEFAULTRULE", "ndrrp", 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndPropDef();

CHECK_STATUS(status);

// LAYERS

double *current;

double *diffs;

double *ratios;

double *area;

double *width;

current = (double*)malloc(sizeof(double)*15);

diffs = (double*)malloc(sizeof(double)*15);

ratios = (double*)malloc(sizeof(double)*15);

status = lefwStartLayer("POLYS", "MASTERSLICE");

CHECK_STATUS(status);

status = lefwStringProperty("lsp", "top");

CHECK_STATUS(status);

status = lefwIntProperty("lip", 1);

CHECK_STATUS(status);

status = lefwRealProperty("lrp", 2.3);

CHECK_STATUS(status);

status = lefwEndLayer("POLYS");

CHECK_STATUS(status);

status = lefwStartLayer("CUT01", "CUT");

CHECK_STATUS(status);

status = lefwLayerDCCurrentDensity("AVERAGE", 0);

CHECK_STATUS(status);

current[0] = 2.0;

current[1] = 5.0;

current[2] = 10.0;

status = lefwLayerDCCutarea(3, current);

CHECK_STATUS(status);

current[0] = 0.6E-6;

current[1] = 0.5E-6;

current[2] = 0.4E-6;

status = lefwLayerDCTableEntries(3, current);

CHECK_STATUS(status);

status = lefwEndLayer("CUT01");

CHECK_STATUS(status);

status = lefwStartLayerRouting("RX");

CHECK_STATUS(status);

status = lefwLayerRouting("HORIZONTAL", 1);

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingDiagPitch(1.5);

CHECK_STATUS(status);

status = lefwLayerRoutingDiagWidth(1.0);

CHECK_STATUS(status);

status = lefwLayerRoutingDiagSpacing(0.05);

CHECK_STATUS(status);

status = lefwLayerRoutingDiagMinEdgeLength(0.07);

CHECK_STATUS(status);

status = lefwLayerRoutingArea(34.1);

CHECK_STATUS(status);

xl = (double*)malloc(sizeof(double)*2);

yl = (double*)malloc(sizeof(double)*2);

xl[0] = 0.14;

yl[0] = 0.30;

xl[1] = 0.08;

yl[1] = 0.33;

status = lefwLayerRoutingMinsize(2, xl, yl);

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

status = lefwLayerRoutingWireExtension(0.75);

CHECK_STATUS(status);

status = lefwLayerRoutingOffset(0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.6);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRange(0.1, 9);

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("0.103");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("0.000156");

CHECK_STATUS(status);

status = lefwLayerRoutingHeight(9);

CHECK_STATUS(status);

status = lefwLayerRoutingThickness(1);

CHECK_STATUS(status);

status = lefwLayerRoutingShrinkage(0.1);

CHECK_STATUS(status);

status = lefwLayerRoutingEdgeCap(0.00005);

CHECK_STATUS(status);

status = lefwLayerRoutingCapMultiplier(1);

CHECK_STATUS(status);

status = lefwLayerRoutingMinwidth(0.15);

CHECK_STATUS(status);

status = lefwLayerRoutingAntennaArea(1);

CHECK_STATUS(status);

status = lefwLayerAntennaCumAreaRatio(6.7); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaCumRoutingPlusCut(); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaAreaMinusDiff(100.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaGatePlusDiff(2.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaCumDiffAreaRatio(1000); // 5.7

CHECK_STATUS(status);

xl = (double*)malloc(sizeof(double)*5);

yl = (double*)malloc(sizeof(double)*5);

xl[0] = 0.0;

yl[0] = 1.0;

xl[1] = 0.09999;

yl[1] = 1.0;

xl[2] = 0.1;

yl[2] = 0.2;

xl[3] = 1.0;

yl[3] = 0.1;

xl[4] = 100;

yl[4] = 0.1;

status = lefwLayerAntennaAreaDiffReducePwl(5, xl, yl); // 5.7

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

status = lefwLayerAntennaCumDiffAreaRatio(1000); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingAntennaLength(1);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("PEAK", 0);

CHECK_STATUS(status);

current[0] = 1E6;

current[1] = 100E6;

current[2] = 400E6;

status = lefwLayerACFrequency(3, current);

CHECK_STATUS(status);

current[0] = 0.4;

current[1] = 0.8;

current[2] = 10.0;

current[3] = 50.0;

status = lefwLayerACCutarea(4, current);

CHECK_STATUS(status);

current[0] = 0.4;

current[1] = 0.8;

current[2] = 10.0;

current[3] = 50.0;

current[4] = 100.0;

status = lefwLayerACWidth(5, current);

CHECK_STATUS(status);

current[0] = 2.0E-6;

current[1] = 1.9E-6;

current[2] = 1.8E-6;

current[3] = 1.7E-6;

current[4] = 1.5E-6;

current[5] = 1.4E-6;

current[6] = 1.3E-6;

current[7] = 1.2E-6;

current[8] = 1.1E-6;

current[9] = 1.0E-6;

current[10] = 0.9E-6;

current[11] = 0.8E-6;

current[12] = 0.7E-6;

current[13] = 0.6E-6;

current[14] = 0.4E-6;

status = lefwLayerACTableEntries(15, current);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("AVERAGE", 0);

CHECK_STATUS(status);

current[0] = 1E6;

current[1] = 100E6;

current[2] = 400E6;

status = lefwLayerACFrequency(3, current);

CHECK_STATUS(status);

current[0] = 0.6E-6;

current[1] = 0.5E-6;

current[2] = 0.4E-6;

status = lefwLayerACTableEntries(3, current);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("RMS", 0);

CHECK_STATUS(status);

current[0] = 1E6;

current[1] = 400E6;

current[2] = 800E6;

status = lefwLayerACFrequency(3, current);

CHECK_STATUS(status);

current[0] = 0.4;

current[1] = 0.8;

current[2] = 10.0;

current[3] = 50.0;

current[4] = 100.0;

status = lefwLayerACWidth(5, current);

CHECK_STATUS(status);

current[0] = 2.0E-6;

current[1] = 1.9E-6;

current[2] = 1.8E-6;

current[3] = 1.7E-6;

current[4] = 1.5E-6;

current[5] = 1.4E-6;

current[6] = 1.3E-6;

current[7] = 1.2E-6;

current[8] = 1.1E-6;

current[9] = 1.0E-6;

current[10] = 0.9E-6;

current[11] = 0.8E-6;

current[12] = 0.7E-6;

current[13] = 0.6E-6;

current[14] = 0.4E-6;

status = lefwLayerACTableEntries(15, current);

CHECK_STATUS(status);

status = lefwEndLayerRouting("RX");

CHECK_STATUS(status);

status = lefwStartLayer("CUT12", "CUT");

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.7);

CHECK_STATUS(status);

status = lefwLayerCutSpacingLayer("RX", 0);

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd();

CHECK_STATUS(status);

status = lefwLayerResistancePerCut(8.0);

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.22); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingAdjacent(3, 0.25, 0); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(1.5); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingParallel(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(1.2); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingAdjacent(2, 1.5, 0); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaModel("OXIDE1");

CHECK_STATUS(status);

status = lefwLayerAntennaAreaRatio(5.6);

CHECK_STATUS(status);

status = lefwLayerAntennaDiffAreaRatio(6.5);

CHECK_STATUS(status);

status = lefwLayerAntennaAreaFactor(5.4, 0);

CHECK_STATUS(status);

status = lefwLayerAntennaCumDiffAreaRatio(4.5);

CHECK_STATUS(status);

diffs[0] = 5.4;

ratios[0] = 5.4;

diffs[1] = 6.5;

ratios[1] = 6.5;

diffs[2] = 7.5;

ratios[2] = 7.5;

status = lefwLayerAntennaCumDiffAreaRatioPwl(3, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerAntennaCumAreaRatio(6.7);

CHECK_STATUS(status);

status = lefwLayerAntennaModel("OXIDE2");

CHECK_STATUS(status);

status = lefwLayerAntennaCumAreaRatio(300);

CHECK_STATUS(status);

status = lefwLayerAntennaCumRoutingPlusCut(); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaAreaMinusDiff(100.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaGatePlusDiff(2.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaDiffAreaRatio(1000); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaCumDiffAreaRatio(5000); // 5.7

CHECK_STATUS(status);

xl = (double*)malloc(sizeof(double)*5);

yl = (double*)malloc(sizeof(double)*5);

xl[0] = 0.0;

yl[0] = 1.0;

xl[1] = 0.09999;

yl[1] = 1.0;

xl[2] = 0.1;

yl[2] = 0.2;

xl[3] = 1.0;

yl[3] = 0.1;

xl[4] = 100;

yl[4] = 0.1;

status = lefwLayerAntennaAreaDiffReducePwl(5, xl, yl); // 5.7

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

diffs[0] = 1;

ratios[0] = 4;

diffs[1] = 2;

ratios[1] = 5;

status = lefwLayerAntennaCumDiffAreaRatioPwl(2, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("PEAK", 0);

CHECK_STATUS(status);

current[0] = 1E6;

current[1] = 100E6;

status = lefwLayerACFrequency(2, current);

CHECK_STATUS(status);

current[0] = 0.5E-6;

current[1] = 0.4E-6;

status = lefwLayerACTableEntries(2, current);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("AVERAGE", 0);

CHECK_STATUS(status);

current[0] = 1E6;

current[1] = 100E6;

status = lefwLayerACFrequency(2, current);

CHECK_STATUS(status);

current[0] = 0.6E-6;

current[1] = 0.5E-6;

status = lefwLayerACTableEntries(2, current);

CHECK_STATUS(status);

status = lefwLayerACCurrentDensity("RMS", 0);

CHECK_STATUS(status);

current[0] = 100E6;

current[1] = 800E6;

status = lefwLayerACFrequency(2, current);

CHECK_STATUS(status);

current[0] = 0.5E-6;

current[1] = 0.4E-6;

status = lefwLayerACTableEntries(2, current);

CHECK_STATUS(status);

status = lefwEndLayer("CUT12");

CHECK_STATUS(status);

status = lefwStartLayerRouting("PC");

CHECK_STATUS(status);

status = lefwLayerRouting("DIAG45", 1);

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingWireExtension(0.4);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.6);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(1.2); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEndOfLine(1.3, 0.6); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(1.3); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEndOfLine(1.4, 0.7); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEOLParallel(1.1, 0.5, 1); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(1.4); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEndOfLine(1.5, 0.8); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEOLParallel(1.2, 0.6, 0); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingOffsetXYDistance(0.9, 0.7);

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("PWL ( ( 1 0.103 ) )");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("PWL ( ( 1 0.000156 ) ( 10 0.001 ) )");

CHECK_STATUS(status);

status = lefwLayerAntennaAreaRatio(5.4);

CHECK_STATUS(status);

status = lefwLayerAntennaDiffAreaRatio(6.5);

CHECK_STATUS(status);

diffs[0] = 4.0;

ratios[0] = 4.1;

diffs[1] = 4.2;

ratios[1] = 4.3;

status = lefwLayerAntennaDiffAreaRatioPwl(2, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerAntennaCumAreaRatio(7.5);

CHECK_STATUS(status);

diffs[0] = 5.0;

ratios[0] = 5.1;

diffs[1] = 6.0;

ratios[1] = 6.1;

status = lefwLayerAntennaCumDiffAreaRatioPwl(2, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerAntennaAreaFactor(4.5, 0);

CHECK_STATUS(status);

status = lefwLayerAntennaSideAreaRatio(6.5);

CHECK_STATUS(status);

status = lefwLayerAntennaCumDiffSideAreaRatio(4.6);

CHECK_STATUS(status);

diffs[0] = 8.0;

ratios[0] = 8.1;

diffs[1] = 8.2;

ratios[1] = 8.3;

diffs[2] = 8.4;

ratios[2] = 8.5;

diffs[3] = 8.6;

ratios[3] = 8.7;

status = lefwLayerAntennaCumDiffSideAreaRatioPwl(4, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerAntennaCumSideAreaRatio(7.4);

CHECK_STATUS(status);

diffs[0] = 7.0;

ratios[0] = 7.1;

diffs[1] = 7.2;

ratios[1] = 7.3;

status = lefwLayerAntennaDiffSideAreaRatioPwl(2, diffs, ratios);

CHECK_STATUS(status);

status = lefwLayerAntennaSideAreaFactor(9.0, "DIFFUSEONLY");

CHECK_STATUS(status);

status = lefwLayerDCCurrentDensity("AVERAGE", 0);

CHECK_STATUS(status);

current[0] = 20.0;

current[1] = 50.0;

current[2] = 100.0;

status = lefwLayerDCWidth(3, current);

CHECK_STATUS(status);

current[0] = 1.0E-6;

current[1] = 0.7E-6;

current[2] = 0.5E-6;

status = lefwLayerDCTableEntries(3, current);

CHECK_STATUS(status);

status = lefwEndLayerRouting("PC");

CHECK_STATUS(status);

status = lefwStartLayer("CA", "CUT");

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.15); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingCenterToCenter(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosure("BELOW", 0.3, 0.01, 0);

CHECK_STATUS(status);

status = lefwLayerEnclosure("ABOVE", 0.5, 0.01, 0);

CHECK_STATUS(status);

status = lefwLayerPreferEnclosure("BELOW", 0.06, 0.01, 0);

CHECK_STATUS(status);

status = lefwLayerPreferEnclosure("ABOVE", 0.08, 0.02, 0);

CHECK_STATUS(status);

status = lefwLayerEnclosure("", 0.02, 0.02, 1.0);

CHECK_STATUS(status);

status = lefwLayerEnclosure(NULL, 0.05, 0.05, 2.0);

CHECK_STATUS(status);

status = lefwLayerEnclosure("BELOW", 0.07, 0.07, 1.0);

CHECK_STATUS(status);

status = lefwLayerEnclosure("ABOVE", 0.09, 0.09, 1.0);

CHECK_STATUS(status);

status = lefwLayerResistancePerCut(10.0);

CHECK_STATUS(status);

status = lefwLayerDCCurrentDensity("AVERAGE", 0);

CHECK_STATUS(status);

current[0] = 2.0;

current[1] = 5.0;

current[2] = 10.0;

status = lefwLayerDCWidth(3, current);

CHECK_STATUS(status);

current[0] = 0.6E-6;

current[1] = 0.5E-6;

current[2] = 0.4E-6;

status = lefwLayerDCTableEntries(3, current);

CHECK_STATUS(status);

status = lefwEndLayer("CA");

CHECK_STATUS(status);

status = lefwStartLayerRouting("M1");

CHECK_STATUS(status);

status = lefwLayerRouting("DIAG135", 1);

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.6);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRange(1.1, 100.1);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRangeUseLengthThreshold();

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.61);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRange(1.1, 100.1);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRangeInfluence(2.01, 2.0, 1000.0);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.62);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRange(1.1, 100.1);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingRangeRange(4.1, 6.5);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.63);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingLengthThreshold(1.34, 4.5, 6.5);

CHECK_STATUS(status);

status = lefwLayerRoutingWireExtension(7);

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("0.103");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("0.000156");

CHECK_STATUS(status);

current[0] = 0.00;

current[1] = 0.50;

current[2] = 3.00;

current[3] = 5.00;

status = lefwLayerRoutingStartSpacingtableParallel(4, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.15;

current[2] = 0.15;

current[3] = 0.15;

status = lefwLayerRoutingSpacingtableParallelWidth(0.00, 4, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.20;

current[2] = 0.20;

current[3] = 0.20;

status = lefwLayerRoutingSpacingtableParallelWidth(0.25, 4, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.50;

current[2] = 0.50;

current[3] = 0.50;

status = lefwLayerRoutingSpacingtableParallelWidth(1.50, 4, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.50;

current[2] = 1.00;

current[3] = 1.00;

status = lefwLayerRoutingSpacingtableParallelWidth(3.00, 4, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.50;

current[2] = 1.00;

current[3] = 2.00;

status = lefwLayerRoutingSpacingtableParallelWidth(5.00, 4, current);

CHECK_STATUS(status);

status = lefwLayerRoutineEndSpacingtable();

CHECK_STATUS(status);

status = lefwLayerRoutingStartSpacingtableInfluence();

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingInfluenceWidth(1.5, 0.5, 0.5);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingInfluenceWidth(3.0, 1.0, 1.0);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingInfluenceWidth(5.0, 2.0, 2.0);

CHECK_STATUS(status);

status = lefwLayerRoutineEndSpacingtable();

CHECK_STATUS(status);

status = lefwLayerRoutingStartSpacingtableInfluence();

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingInfluenceWidth(1.5, 0.5, 0.5);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingInfluenceWidth(5.0, 2.0, 2.0);

CHECK_STATUS(status);

status = lefwLayerRoutineEndSpacingtable();

CHECK_STATUS(status);

current[0] = 0.00;

current[1] = 0.50;

current[2] = 5.00;

status = lefwLayerRoutingStartSpacingtableParallel(3, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.15;

current[2] = 0.15;

status = lefwLayerRoutingSpacingtableParallelWidth(0.00, 3, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.20;

current[2] = 0.20;

status = lefwLayerRoutingSpacingtableParallelWidth(0.25, 3, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.50;

current[2] = 1.00;

status = lefwLayerRoutingSpacingtableParallelWidth(3.00, 3, current);

CHECK_STATUS(status);

current[0] = 0.15;

current[1] = 0.50;

current[2] = 2.00;

status = lefwLayerRoutingSpacingtableParallelWidth(5.00, 3, current);

CHECK_STATUS(status);

status = lefwLayerRoutineEndSpacingtable();

CHECK_STATUS(status);

free((char*)current);

free((char*)diffs);

free((char*)ratios);

status = lefwLayerAntennaGatePlusDiff(2.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaDiffAreaRatio(1000); // 5.7

CHECK_STATUS(status);

status = lefwLayerAntennaCumDiffAreaRatio(5000); // 5.7

CHECK_STATUS(status);

status = lefwEndLayerRouting("M1");

CHECK_STATUS(status);

status = lefwStartLayer("V1", "CUT");

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.6);

CHECK_STATUS(status);

status = lefwLayerCutSpacingLayer("CA", 0);

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd();

CHECK_STATUS(status);

status = lefwEndLayer("V1");

CHECK_STATUS(status);

status = lefwStartLayerRouting("M2");

CHECK_STATUS(status);

status = lefwLayerRouting("VERTICAL", 0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingWireExtension(8);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingLengthThreshold(100.9, 0, 0);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.5);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingLengthThreshold(0.9, 0, 0.1);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.6);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingLengthThreshold(1.9, 0, 0);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(1.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingSameNet(1); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(1.1); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingSameNet(0); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("0.0608");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("0.000184");

CHECK_STATUS(status);

status = lefwEndLayerRouting("M2");

CHECK_STATUS(status);

status = lefwStartLayer("V2", "CUT");

CHECK_STATUS(status);

status = lefwEndLayer("V2");

CHECK_STATUS(status);

status = lefwStartLayerRouting("M3");

CHECK_STATUS(status);

status = lefwLayerRouting("HORIZONTAL", 0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingPitchXYDistance(1.8, 1.5);

CHECK_STATUS(status);

status = lefwLayerRoutingDiagPitchXYDistance(1.5, 1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingWireExtension(8);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("0.0608");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("0.000184");

CHECK_STATUS(status);

status = lefwEndLayerRouting("M3");

CHECK_STATUS(status);

area = (double*)malloc(sizeof(double)*3);

width = (double*)malloc(sizeof(double)*3);

status = lefwStartLayerRouting("M4");

CHECK_STATUS(status);

status = lefwLayerRouting("HORIZONTAL", 0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcut(2, 0.50);

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcut(2, 0.70);

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcutConnections("FROMBELOW");

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcut(4, 1.0);

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcutConnections("FROMABOVE");

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcut(2, 1.1);

CHECK_STATUS(status);

status = lefwLayerRoutingMinimumcutLengthWithin(20.0, 5.0);

CHECK_STATUS(status);

area[0] = 0.40;

width[0] = 0;

area[1] = 0.40;

width[1] = 0.15;

area[2] = 0.80;

width[2] = 0.50;

status = lefwLayerRoutingMinenclosedarea(3, area, width);

CHECK_STATUS(status);

status = lefwLayerRoutingMaxwidth(10.0);

CHECK_STATUS(status);

status = lefwLayerRoutingProtrusion(0.30, 0.60, 1.20);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstep(0.20);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstep(0.05);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, NULL, 0.08);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, NULL, 0.16);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, "INSDECORNER", 0);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, "INSIDECORNER", 0.15);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, "STEP", 0);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.05, "STEP", 0.08);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepWithOptions(0.04, "STEP", 0);

CHECK_STATUS(status);

status = lefwLayerRoutingMinstepMaxEdges(1.0, 2); // 5.7

CHECK_STATUS(status);

status = lefwEndLayerRouting("M4");

CHECK_STATUS(status);

free((char*)area);

free((char*)width);

status = lefwStartLayer("implant1", "IMPLANT");

CHECK_STATUS(status);

status = lefwLayerWidth(0.50);

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.50);

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd();

CHECK_STATUS(status);

status = lefwEndLayer("implant1");

CHECK_STATUS(status);

status = lefwStartLayer("implant2", "IMPLANT");

CHECK_STATUS(status);

status = lefwLayerWidth(0.50);

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.50);

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd();

CHECK_STATUS(status);

status = lefwEndLayer("implant2");

CHECK_STATUS(status);

status = lefwStartLayer("V3", "CUT");

CHECK_STATUS(status);

status = lefwLayerWidth(0.60);

CHECK_STATUS(status);

status = lefwEndLayer("V3");

CHECK_STATUS(status);

status = lefwStartLayerRouting("MT");

CHECK_STATUS(status);

status = lefwLayerRouting("VERTICAL", 0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.8);

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.9);

CHECK_STATUS(status);

status = lefwLayerRoutingResistance("0.0608");

CHECK_STATUS(status);

status = lefwLayerRoutingCapacitance("0.000184");

CHECK_STATUS(status);

status = lefwEndLayerRouting("MT");

CHECK_STATUS(status);

status = lefwStartLayer("OVERLAP", "OVERLAP");

CHECK_STATUS(status);

status = lefwEndLayer("OVERLAP");

CHECK_STATUS(status);

status = lefwStartLayerRouting("MET2");

CHECK_STATUS(status);

status = lefwLayerRouting("VERTICAL", 0.9);

CHECK_STATUS(status);

status = lefwMinimumDensity(20.2);

CHECK_STATUS(status);

status = lefwMaximumDensity(80.0);

CHECK_STATUS(status);

status = lefwDensityCheckWindow(200.0, 200.0);

CHECK_STATUS(status);

status = lefwDensityCheckStep(100.0);

CHECK_STATUS(status);

status = lefwFillActiveSpacing(3.0);

CHECK_STATUS(status);

status = lefwEndLayerRouting("MET2");

CHECK_STATUS(status);

status = lefwStartLayer("via34", "CUT"); // 5.7

CHECK_STATUS(status);

status = lefwLayerWidth(0.25); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.1); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingCenterToCenter(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosure(0, .05, .01, 0); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosureLength(0, .05, 0, 0.7); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosure("BELOW", .07, .07, 1.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosure("ABOVE", .09, .09, 1.0); // 5.7

CHECK_STATUS(status);

status = lefwLayerEnclosureWidth(0, .03, .03, 1.0, 0.2); // 5.7

CHECK_STATUS(status);

status = lefwEndLayer("via34"); // 5.7

CHECK_STATUS(status);

status = lefwStartLayer("cut23", "CUT"); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.20); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingSameNet(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingLayer("cut12", 1); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.30); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingCenterToCenter(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingSameNet(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingArea(0.02); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.40); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingArea(0.5); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacing(0.10); // 5.7

CHECK_STATUS(status);

status = lefwLayerCutSpacingEnd(); // 5.7

CHECK_STATUS(status);

wthn = (double*)malloc(sizeof(double)*3); // 5.7

spng = (double*)malloc(sizeof(double)*3);

wthn[0] = 0.15;

spng[0] = 0.11;

wthn[1] = 0.13;

spng[1] = 0.13;

wthn[2] = 0.11;

spng[2] = 0.15;

status = lefwLayerCutSpacingTableOrtho(3, wthn, spng);

CHECK_STATUS(status);

wthn[0] = 3;

spng[0] = 1;

status = lefwLayerArraySpacing(0, 2.0, 0.2, 1, wthn, spng);

CHECK_STATUS(status);

wthn[0] = 3;

spng[0] = 1;

wthn[1] = 4;

spng[1] = 1.5;

wthn[2] = 5;

spng[2] = 2.0;

status = lefwLayerArraySpacing(1, 2.0, 0.2, 3, wthn, spng);

CHECK_STATUS(status);

free((char*)wthn);

free((char*)spng);

status = lefwEndLayer("cut23");

CHECK_STATUS(status);

status = lefwStartLayerRouting("cut24"); // 5.7

CHECK_STATUS(status);

status = lefwLayerRouting("HORIZONTAL", 1); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.2); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.10); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.12); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingNotchLength(0.15); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacing(0.14); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingSpacingEndOfNotchWidth(0.15, 0.16, 0.08); // 5.7

CHECK_STATUS(status);

status = lefwEndLayerRouting("cut24"); // 5.7

CHECK_STATUS(status);

status = lefwStartLayerRouting("cut25"); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingPitch(1.2); // 5.7

CHECK_STATUS(status);

status = lefwLayerRouting("HORIZONTAL", 1); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingWireExtension(7); // 5.7

CHECK_STATUS(status);

status = lefwLayerRoutingStartSpacingtableTwoWidths(); // 5.7

CHECK_STATUS(status);

wthn = (double*)malloc(sizeof(double)*4); // 5.7

wthn[0] = 0.15;

wthn[1] = 0.20;

wthn[2] = 0.50;

wthn[3] = 1.00;

status = lefwLayerRoutingSpacingtableTwoWidthsWidth(0.0, 0, 4, wthn); // 5.7

CHECK_STATUS(status);

wthn[0] = 0.20;

wthn[1] = 0.25;

wthn[2] = 0.50;

wthn[3] = 1.00;

status = lefwLayerRoutingSpacingtableTwoWidthsWidth(0.25, 0.1, 4, wthn);// 5.7

CHECK_STATUS(status);

wthn[0] = 0.50;

wthn[1] = 0.50;

wthn[2] = 0.60;

wthn[3] = 1.00;

status = lefwLayerRoutingSpacingtableTwoWidthsWidth(1.5, 1.5, 4, wthn);// 5.7

CHECK_STATUS(status);

wthn[0] = 1.00;

wthn[1] = 1.00;

wthn[2] = 1.00;

wthn[3] = 1.20;

status = lefwLayerRoutingSpacingtableTwoWidthsWidth(3.0, 3.0, 4, wthn);// 5.7

CHECK_STATUS(status);

free(wthn);

status = lefwLayerRoutineEndSpacingtable();

CHECK_STATUS(status);

status = lefwEndLayerRouting("cut25"); // 5.7

CHECK_STATUS(status);

// MAXVIASTACK

status = lefwMaxviastack(4, "m1", "m7");

CHECK_STATUS(status);

// VIA

status = lefwStartVia("RX_PC", "DEFAULT");

CHECK_STATUS(status);

status = lefwViaResistance(2);

CHECK_STATUS(status);

status = lefwViaLayer("RX");

CHECK_STATUS(status);

status = lefwViaLayerRect(-0.7, -0.7, 0.7, 0.7);

CHECK_STATUS(status);

status = lefwViaLayer("CUT12");

CHECK_STATUS(status);

status = lefwViaLayerRect(-0.25, -0.25, 0.25, 0.25);

CHECK_STATUS(status);

status = lefwViaLayer("PC");

CHECK_STATUS(status);

status = lefwViaLayerRect(-0.6, -0.6, 0.6, 0.6);

CHECK_STATUS(status);

status = lefwStringProperty("stringProperty", "DEFAULT");

CHECK_STATUS(status);

status = lefwRealProperty("realProperty", 32.33);

CHECK_STATUS(status);

status = lefwIntProperty("COUNT", 34);

CHECK_STATUS(status);

status = lefwEndVia("PC");

CHECK_STATUS(status);

status = lefwStartVia("M2_M3_PWR", NULL);

CHECK_STATUS(status);

status = lefwViaResistance(0.4);

CHECK_STATUS(status);

status = lefwViaLayer("M2");

CHECK_STATUS(status);

status = lefwViaLayerRect(-1.35, -1.35, 1.35, 1.35);

CHECK_STATUS(status);

status = lefwViaLayer("V2");

CHECK_STATUS(status);

status = lefwViaLayerRect(-1.35, -1.35, -0.45, 1.35);

CHECK_STATUS(status);

status = lefwViaLayerRect(0.45, -1.35, 1.35, -0.45);

CHECK_STATUS(status);

status = lefwViaLayerRect(0.45, 0.45, 1.35, 1.35);

CHECK_STATUS(status);

status = lefwViaLayer("M3");

CHECK_STATUS(status);

status = lefwViaLayerRect(-1.35, -1.35, 1.35, 1.35);

CHECK_STATUS(status);

status = lefwEndVia("M2_M3_PWR");

CHECK_STATUS(status);

xl = (double*)malloc(sizeof(double)*6);

yl = (double*)malloc(sizeof(double)*6);

status = lefwStartVia("IN1X", 0);

CHECK_STATUS(status);

status = lefwViaLayer("metal2");

CHECK_STATUS(status);

xl[0] = -2.1;

yl[0] = -1.0;

xl[1] = -0.2;

yl[1] = 1.0;

xl[2] = 2.1;

yl[2] = 1.0;

xl[3] = 0.2;

yl[3] = -1.0;

xl[4] = 0.2;

yl[4] = -1.0;

xl[5] = 0.2;

yl[5] = -1.0;

status = lefwViaLayerPolygon(6, xl, yl);

CHECK_STATUS(status);

xl[0] = -1.1;

yl[0] = -2.0;

xl[1] = -0.1;

yl[1] = 2.0;

xl[2] = 1.1;

yl[2] = 2.0;

xl[3] = 0.1;

yl[3] = -2.0;

status = lefwViaLayerPolygon(4, xl, yl);

CHECK_STATUS(status);

xl[0] = -3.1;

yl[0] = -2.0;

xl[1] = -0.3;

yl[1] = 2.0;

xl[2] = 3.1;

yl[2] = 2.0;

xl[3] = 0.3;

yl[3] = -2.0;

status = lefwViaLayerPolygon(4, xl, yl);

CHECK_STATUS(status);

xl[0] = -4.1;

yl[0] = -2.0;

xl[1] = -0.4;

yl[1] = 2.0;

xl[2] = 4.1;

yl[2] = 2.0;

xl[3] = 0.4;

yl[3] = -2.0;

status = lefwViaLayerPolygon(4, xl, yl);

CHECK_STATUS(status);

status = lefwViaLayer("cut23");

CHECK_STATUS(status);

status = lefwViaLayerRect(-0.4, -0.4, 0.4, 0.4);

CHECK_STATUS(status);

xl[0] = -2.1;

yl[0] = -1.0;

xl[1] = -0.2;

yl[1] = 1.0;

xl[2] = 2.1;

yl[2] = 1.0;

xl[3] = 0.2;

yl[3] = -1.0;

status = lefwViaLayerPolygon(4, xl, yl);

CHECK_STATUS(status);

status = lefwEndVia("IN1X");

CHECK_STATUS(status);

status = lefwStartVia("myBlockVia", NULL);

CHECK_STATUS(status);

status = lefwViaViarule("DEFAULT", 0.1, 0.1, "metal1", "via12", "metal2",

0.1, 0.1, 0.05, 0.01, 0.01, 0.05);

CHECK_STATUS(status);

status = lefwViaViaruleRowCol(1, 2);

CHECK_STATUS(status);

status = lefwViaViaruleOrigin(1.5, 2.5);

CHECK_STATUS(status);

status = lefwViaViaruleOffset(1.5, 2.5, 3.5, 4.5);

CHECK_STATUS(status);

status = lefwViaViarulePattern("2_1RF1RF1R71R0_3_R1FFFF");

CHECK_STATUS(status);

status = lefwEndVia("myBlockVia");

CHECK_STATUS(status);

status = lefwStartVia("myVia23", NULL);

CHECK_STATUS(status);

status = lefwViaLayer("metal2");

CHECK_STATUS(status);

status = lefwViaLayerPolygon(6, xl, yl);

CHECK_STATUS(status);

status = lefwViaLayer("cut23");

CHECK_STATUS(status);

status = lefwViaLayerRect(-0.4, -0.4, 0.4, 0.4);

CHECK_STATUS(status);

status = lefwViaLayer("metal3");

CHECK_STATUS(status);

status = lefwViaLayerPolygon(5, xl, yl);

CHECK_STATUS(status);

status = lefwEndVia("myVia23");

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

// VIARULE

status = lefwStartViaRule("VIALIST12");

CHECK_STATUS(status);

lefwAddComment("Break up the old lefwViaRule into 2 routines");

lefwAddComment("lefwViaRuleLayer and lefwViaRuleVia");

status = lefwViaRuleLayer("M1", NULL, 9.0, 9.6, 0, 0);

CHECK_STATUS(status);

status = lefwViaRuleLayer("M2", NULL, 3.0, 3.0, 0, 0);

CHECK_STATUS(status);

status = lefwViaRuleVia("VIACENTER12");

CHECK_STATUS(status);

status = lefwStringProperty("vrsp", "new");

CHECK_STATUS(status);

status = lefwIntProperty("vrip", 1);

CHECK_STATUS(status);

status = lefwRealProperty("vrrp", 4.5);

CHECK_STATUS(status);

status = lefwEndViaRule("VIALIST12");

CHECK_STATUS(status);

// VIARULE with GENERATE

lefwAddComment("Break up the old lefwViaRuleGenearte into 4 routines");

lefwAddComment("lefwStartViaRuleGen, lefwViaRuleGenLayer,");

lefwAddComment("lefwViaRuleGenLayer3, and lefwEndViaRuleGen");

status = lefwStartViaRuleGen("VIAGEN12");

CHECK_STATUS(status);

status = lefwViaRuleGenLayer("M1", NULL, 0.1, 19, 0, 0);

CHECK_STATUS(status);

status = lefwViaRuleGenLayer("M2", NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwViaRuleGenLayer3("V1", -0.8, -0.8, 0.8, 0.8, 5.6, 6.0, 0.2);

CHECK_STATUS(status);

status = lefwEndViaRuleGen("VIAGEN12");

CHECK_STATUS(status);

// VIARULE with GENERATE & ENCLOSURE & DEFAULT

status = lefwStartViaRuleGen("via12");

CHECK_STATUS(status);

status = lefwViaRuleGenDefault();

CHECK_STATUS(status);

status = lefwViaRuleGenLayerEnclosure("m1", 0.05, 0.005, 1.0, 100.0);

CHECK_STATUS(status);

status = lefwViaRuleGenLayerEnclosure("m2", 0.05, 0.005, 1.0, 100.0);

CHECK_STATUS(status);

status = lefwViaRuleGenLayer3("cut12", -0.07, -0.07, 0.07, 0.07, 0.16, 0.16, 0);

CHECK_STATUS(status);

status = lefwEndViaRuleGen("via12");

CHECK_STATUS(status);

// NONDEFAULTRULE

status = lefwStartNonDefaultRule("RULE1");

CHECK_STATUS(status);

status = lefwNonDefaultRuleHardspacing();

CHECK_STATUS(status);

status = lefwNonDefaultRuleLayer("RX", 10.0, 2.2, 6, 0, 0, 0);

CHECK_STATUS(status);

status = lefwNonDefaultRuleLayer("PC", 10.0, 2.2, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwNonDefaultRuleLayer("M1", 10.0, 2.2, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwStartVia("nd1VARX0", NULL);

CHECK_STATUS(status);

status = lefwViaResistance(0.2);

CHECK_STATUS(status);

status = lefwViaLayer("RX");

CHECK_STATUS(status);

status = lefwViaLayerRect(-3, -3, 3, 3);

CHECK_STATUS(status);

status = lefwViaLayer("CUT12");

CHECK_STATUS(status);

status = lefwViaLayerRect(-1.0, -1.0, 1.0, 1.0);

CHECK_STATUS(status);

status = lefwViaLayer("PC");

CHECK_STATUS(status);

status = lefwViaLayerRect(-3, -3, 3, 3);

CHECK_STATUS(status);

status = lefwEndVia("nd1VARX0");

CHECK_STATUS(status);

status = lefwStartSpacing();

CHECK_STATUS(status);

status = lefwSpacing("CUT01", "RX", 0.1, "STACK");

CHECK_STATUS(status);

status = lefwEndSpacing();

CHECK_STATUS(status);

status = lefwEndNonDefaultRule("RULE1");

CHECK_STATUS(status);

status = lefwStartNonDefaultRule("wide1_5x");

CHECK_STATUS(status);

status = lefwNonDefaultRuleLayer("fw", 4.8, 4.8, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwNonDefaultRuleStartVia("nd1VIARX0", "DEFAULT");

CHECK_STATUS(status);

status = lefwViaResistance(0.2);

CHECK_STATUS(status);

status = lefwViaLayer("RX");

CHECK_STATUS(status);

status = lefwViaLayerRect(-3, -3, 3, 3);

CHECK_STATUS(status);

status = lefwViaLayer("CUT12");

CHECK_STATUS(status);

status = lefwViaLayerRect(-1.0, -1.0, 1.0, 1.0);

CHECK_STATUS(status);

status = lefwViaLayer("PC");

CHECK_STATUS(status);

status = lefwViaLayerRect(-3, -3, 3, 3);

CHECK_STATUS(status);

status = lefwNonDefaultRuleEndVia("nd1VIARX0");

CHECK_STATUS(status);

status = lefwNonDefaultRuleUseVia("via12_fixed_analog_via");

CHECK_STATUS(status);

status = lefwNonDefaultRuleMinCuts("cut12", 2);

CHECK_STATUS(status);

status = lefwNonDefaultRuleUseVia("via23_fixed_analog_via");

CHECK_STATUS(status);

status = lefwNonDefaultRuleMinCuts("cut23", 2);

CHECK_STATUS(status);

status = lefwNonDefaultRuleUseViaRule("viaRule23_fixed_analog_via");

CHECK_STATUS(status);

status = lefwEndNonDefaultRule("wide1_5x");

CHECK_STATUS(status);

// SPACING

status = lefwStartSpacing();

CHECK_STATUS(status);

status = lefwSpacing("CUT01", "CA", 1.5, NULL);

CHECK_STATUS(status);

status = lefwSpacing("CA", "V1", 1.5, "STACK");

CHECK_STATUS(status);

status = lefwSpacing("M1", "M1", 3.5, "STACK");

CHECK_STATUS(status);

status = lefwSpacing("V1", "V2", 1.5, "STACK");

CHECK_STATUS(status);

status = lefwSpacing("M2", "M2", 3.5, "STACK");

CHECK_STATUS(status);

status = lefwSpacing("V2", "V3", 1.5, "STACK");

CHECK_STATUS(status);

status = lefwEndSpacing();

CHECK_STATUS(status);

// MINFEATURE & DIELECTRIC

status = lefwMinFeature(0.1, 0.1);

CHECK_STATUS(status);

status = lefwNewLine();

CHECK_STATUS(status);

// SITE

status = lefwSite("CORE1", "CORE", "X", 67.2, 6);

CHECK_STATUS(status);

status = lefwSiteRowPattern("Fsite", 0);

CHECK_STATUS(status);

status = lefwSiteRowPatternStr("Lsite", "N");

CHECK_STATUS(status);

status = lefwSiteRowPatternStr("Lsite", "FS");

CHECK_STATUS(status);

lefwEndSite("CORE1");

CHECK_STATUS(status);

status = lefwSite("CORE", "CORE", "Y", 3.6, 28.8);

CHECK_STATUS(status);

lefwEndSite("CORE");

CHECK_STATUS(status);

status = lefwSite("MRCORE", "CORE", "Y", 3.6, 28.8);

CHECK_STATUS(status);

lefwEndSite("MRCORE");

CHECK_STATUS(status);

status = lefwSite("IOWIRED", "PAD", NULL, 57.6, 432);

CHECK_STATUS(status);

lefwEndSite("IOWIRED");

CHECK_STATUS(status);

// ARRAY

status = lefwStartArray("M7E4XXX");

CHECK_STATUS(status);

status = lefwArraySite("CORE", -5021.450, -4998.000, 0, 14346, 595, 0.700,

16.800);

CHECK_STATUS(status);

status = lefwArraySiteStr("CORE", -5021.450, -4998.600, "FS", 14346, 595,

0.700, 16.800);

CHECK_STATUS(status);

status = lefwArraySite("IO", 6148.800, 5800.000, 3, 1, 1, 0.000, 0.000);

CHECK_STATUS(status);

status = lefwArraySiteStr("IO", 6148.800, 5240.000, "E", 1, 1, 0.000, 0.000);

CHECK_STATUS(status);

status = lefwArraySite("COVER", -7315.0, -7315.000, 1, 1, 1, 0.000, 0.000);

CHECK_STATUS(status);

status = lefwArraySiteStr("COVER", 7315.0, 7315.000, "FN", 1, 1, 0.000, 0.000);

CHECK_STATUS(status);

status = lefwArrayCanplace("COVER", -7315.000, -7315.000, 0, 1, 1, 0.000,

0.000);

CHECK_STATUS(status);

status = lefwArrayCanplaceStr("COVER", -7250.000, -7250.000, "N", 5, 1,

40.000, 0.000);

CHECK_STATUS(status);

status = lefwArrayCannotoccupy("CORE", -5021.450, -4989.600, 6, 100, 595,

0.700, 16.800);

CHECK_STATUS(status);

status = lefwArrayCannotoccupyStr("CORE", -5021.450, -4989.600, "N", 100, 595,

0.700, 16.800);

CHECK_STATUS(status);

status = lefwArrayTracks("X", -6148.800, 17569, 0.700, "RX");

CHECK_STATUS(status);

status = lefwArrayTracks("Y", -6148.800, 20497, 0.600, "RX");

CHECK_STATUS(status);

status = lefwStartArrayFloorplan("100%");

CHECK_STATUS(status);

status = lefwArrayFloorplan("CANPLACE", "COVER", -7315.000, -7315.000, 1, 1,

1, 0.000, 0.000);

CHECK_STATUS(status);

status = lefwArrayFloorplanStr("CANPLACE", "COVER", -7250.000, -7250.000,

"N", 5, 1, 40.000, 0.000);

CHECK_STATUS(status);

status = lefwArrayFloorplan("CANPLACE", "CORE", -5021.000, -4998.000, 1,

14346, 595, 0.700, 16.800);

CHECK_STATUS(status);

status = lefwArrayFloorplanStr("CANPLACE", "CORE", -5021.000, -4998.000, "FS",

100, 595, 0.700, 16.800);

CHECK_STATUS(status);

status = lefwArrayFloorplan("CANNOTOCCUPY", "CORE", -5021.000, -4998.000, 7,

14346, 595, 0.700, 16.800);

CHECK_STATUS(status);

status = lefwArrayFloorplanStr("CANNOTOCCUPY", "CORE", -5021.000, -4998.000,

"E", 100, 595, 0.700, 16.800);

CHECK_STATUS(status);

status = lefwEndArrayFloorplan("100%");

CHECK_STATUS(status);

status = lefwArrayGcellgrid("X", -6157.200, 1467, 8.400);

CHECK_STATUS(status);

status = lefwArrayGcellgrid("Y", -6157.200, 1467, 8.400);

CHECK_STATUS(status);

status = lefwEndArray("M7E4XXX");

CHECK_STATUS(status);

// MACRO

status = lefwStartMacro("CHK3A");

CHECK_STATUS(status);

status = lefwMacroClass("RING", NULL);

CHECK_STATUS(status);

status = lefwMacroOrigin(0.9, 0.9);

CHECK_STATUS(status);

status = lefwMacroSize(10.8, 28.8);

CHECK_STATUS(status);

status = lefwMacroSymmetry("X Y R90");

CHECK_STATUS(status);

status = lefwMacroSite("CORE");

CHECK_STATUS(status);

status = lefwStartMacroPin("GND");

CHECK_STATUS(status);

status = lefwMacroPinDirection("INOUT");

CHECK_STATUS(status);

status = lefwMacroPinMustjoin("PA3");

CHECK_STATUS(status);

status = lefwMacroPinTaperRule("RULE1");

CHECK_STATUS(status);

status = lefwMacroPinUse("GROUND");

CHECK_STATUS(status);

status = lefwMacroPinShape("ABUTMENT");

CHECK_STATUS(status);

status = lefwMacroPinSupplySensitivity("vddpin1");

CHECK_STATUS(status);

status = lefwMacroPinNetExpr("power1 VDD1");

CHECK_STATUS(status);

status = lefwMacroPinAntennaMetalArea(3, "M1");

CHECK_STATUS(status);

// MACRO - PIN

status = lefwStartMacroPinPort(NULL);

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("M1", 0.05);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(-0.9, 3, 9.9, 6, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwStringProperty("TYPE", "special");

CHECK_STATUS(status);

status = lefwIntProperty("intProp", 23);

CHECK_STATUS(status);

status = lefwRealProperty("realProp", 24.25);

CHECK_STATUS(status);

status = lefwMacroPinAntennaModel("OXIDE1");

CHECK_STATUS(status);

status = lefwEndMacroPin("GND");

CHECK_STATUS(status);

status = lefwStartMacroPin("VDD");

CHECK_STATUS(status);

status = lefwMacroPinDirection("INOUT");

CHECK_STATUS(status);

status = lefwMacroPinUse("POWER");

CHECK_STATUS(status);

status = lefwMacroPinShape("ABUTMENT");

CHECK_STATUS(status);

status = lefwMacroPinNetExpr("power2 VDD2");

CHECK_STATUS(status);

// MACRO - PIN - PORT

status = lefwStartMacroPinPort(NULL);

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("M1", 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(-0.9, 21, 9.9, 24, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroPinPortVia(100, 300, "nd1VIA12", 1, 2, 1, 2);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwStartMacroPinPort("BUMP");

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("M2", 0.06);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

xl = (double*)malloc(sizeof(double)*5);

yl = (double*)malloc(sizeof(double)*5);

xl[0] = 30.8;

yl[0] = 30.5;

xl[1] = 42;

yl[1] = 53.5;

xl[2] = 60.8;

yl[2] = 25.5;

xl[3] = 47;

yl[3] = 15.5;

xl[4] = 20.8;

yl[4] = 0.5;

status = lefwStartMacroPinPort("CORE");

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("P1", 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerPolygon(5, xl, yl, 5, 6, 454.6, 345.6);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerPolygon(5, xl, yl, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

status = lefwEndMacroPin("VDD");

CHECK_STATUS(status);

status = lefwStartMacroPin("PA3");

CHECK_STATUS(status);

status = lefwMacroPinDirection("INPUT");

CHECK_STATUS(status);

status = lefwMacroPinNetExpr("gnd1 GND");

CHECK_STATUS(status);

// 5.4

status = lefwMacroPinAntennaPartialMetalArea(4, "M1");

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialMetalArea(5, "M2");

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialMetalSideArea(5, "M2");

CHECK_STATUS(status);

status = lefwMacroPinAntennaGateArea(1, "M1");

CHECK_STATUS(status);

status = lefwMacroPinAntennaGateArea(2, 0);

CHECK_STATUS(status);

status = lefwMacroPinAntennaGateArea(3, "M3");

CHECK_STATUS(status);

status = lefwMacroPinAntennaDiffArea(1, "M1");

CHECK_STATUS(status);

status = lefwMacroPinAntennaMaxAreaCar(1, "L1");

CHECK_STATUS(status);

status = lefwMacroPinAntennaMaxSideAreaCar(1, 0);

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialCutArea(1, 0);

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialCutArea(2, "M2");

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialCutArea(3, 0);

CHECK_STATUS(status);

status = lefwMacroPinAntennaPartialCutArea(4, "M4");

CHECK_STATUS(status);

status = lefwMacroPinAntennaMaxCutCar(1, 0);

CHECK_STATUS(status);

status = lefwStartMacroPinPort("CORE");

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("M1", 0.02);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(1.35, -0.45, 2.25, 0.45, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(-0.45, -0.45, 0.45, 0.45, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwStartMacroPinPort(NULL);

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("PC", 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(-0.45, 12.15, 0.45, 13.05, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwStartMacroPinPort(NULL);

CHECK_STATUS(status);

status = lefwMacroPinPortDesignRuleWidth("PC", 2);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(8.55, 8.55, 9.45, 9.45, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(6.75, 6.75, 7.65, 7.65, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(6.75, 8.75, 7.65, 9.65, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerRect(6.75, 10.35, 7.65, 11.25, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwEndMacroPin("PA3");

CHECK_STATUS(status);

// MACRO - OBS

status = lefwStartMacroObs();

CHECK_STATUS(status);

status = lefwMacroObsLayer("M1", 5.6);

CHECK_STATUS(status);

status = lefwMacroObsLayerWidth(5.4);

CHECK_STATUS(status);

status = lefwMacroObsLayerRect(6.6, -0.6, 9.6, 0.6, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroObsLayerRect(4.8, 12.9, 9.6, 13.2, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroObsLayerRect(3, 13.8, 7.8, 16.8, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroObsLayerRect(3, -0.6, 6, 0.6, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroObs();

CHECK_STATUS(status);

status = lefwStringProperty("stringProp", "first");

CHECK_STATUS(status);

status = lefwIntProperty("integerProp", 1);

CHECK_STATUS(status);

status = lefwRealProperty("WEIGHT", 30.31);

CHECK_STATUS(status);

status = lefwEndMacro("CHK3A");

CHECK_STATUS(status);

// 2nd MACRO

status = lefwStartMacro("INV");

CHECK_STATUS(status);

status = lefwMacroEEQ("CHK1");

CHECK_STATUS(status);

status = lefwMacroClass("CORE", "SPACER");

CHECK_STATUS(status);

status = lefwMacroForeign("INVS", 0, 0, -1);

CHECK_STATUS(status);

status = lefwMacroSize(67.2, 24);

CHECK_STATUS(status);

status = lefwMacroSymmetry("X Y R90");

CHECK_STATUS(status);

status = lefwMacroSite("CORE1");

CHECK_STATUS(status);

status = lefwStartMacroDensity("metal1");

CHECK_STATUS(status);

status = lefwMacroDensityLayerRect(0, 0, 100, 100, 45.5);

CHECK_STATUS(status);

status = lefwMacroDensityLayerRect(100, 0, 200, 100, 42.2);

CHECK_STATUS(status);

status = lefwEndMacroDensity();

CHECK_STATUS(status);

status = lefwStartMacroDensity("metal2");

CHECK_STATUS(status);

status = lefwMacroDensityLayerRect(200, 1, 300, 200, 43.3);

CHECK_STATUS(status);

status = lefwEndMacroDensity();

CHECK_STATUS(status);

status = lefwStartMacroPin("Z");

CHECK_STATUS(status);

status = lefwMacroPinDirection("OUTPUT");

CHECK_STATUS(status);

status = lefwMacroPinUse("SIGNAL");

CHECK_STATUS(status);

status = lefwMacroPinShape("ABUTMENT");

CHECK_STATUS(status);

status = lefwMacroPinAntennaModel("OXIDE1");

CHECK_STATUS(status);

status = lefwStartMacroPinPort(NULL);

CHECK_STATUS(status);

status = lefwMacroPinPortLayer("M2", 0);

CHECK_STATUS(status);

status = lefwMacroPinPortLayerWidth(5.6);

CHECK_STATUS(status);

xpath = (double*)malloc(sizeof(double)*7);

ypath = (double*)malloc(sizeof(double)*7);

xpath[0] = 30.8;

ypath[0] = 9;

xpath[1] = 42;

ypath[1] = 9;

xpath[2] = 30.8;

ypath[2] = 9;

xpath[3] = 42;

ypath[3] = 9;

xpath[4] = 30.8;

ypath[4] = 9;

xpath[5] = 42;

ypath[5] = 9;

xpath[6] = 30.8;

ypath[6] = 9;

status = lefwMacroPinPortLayerPath(7, xpath, ypath, 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacroPinPort();

CHECK_STATUS(status);

status = lefwEndMacroPin("Z");

free((char*)xpath);

free((char*)ypath);

// MACRO - OBS

status = lefwStartMacroObs();

CHECK_STATUS(status);

status = lefwMacroObsDesignRuleWidth("M1", 2);

CHECK_STATUS(status);

status = lefwMacroObsLayerRect(24.1, 1.5, 43.5, 208.5, 0, 0, 0, 0);

CHECK_STATUS(status);

xpath = (double*)malloc(sizeof(double)*2);

ypath = (double*)malloc(sizeof(double)*2);

xpath[0] = 8.4;

ypath[0] = 3;

xpath[1] = 8.4;

ypath[1] = 124;

status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);

CHECK_STATUS(status);

xpath[0] = 58.8;

ypath[0] = 3;

xpath[1] = 58.8;

ypath[1] = 123;

status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);

CHECK_STATUS(status);

xpath[0] = 64.4;

ypath[0] = 3;

xpath[1] = 64.4;

ypath[1] = 123;

status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);

CHECK_STATUS(status);

free((char*)xpath);

free((char*)ypath);

xl = (double*)malloc(sizeof(double)*5);

yl = (double*)malloc(sizeof(double)*5);

xl[0] = 6.4;

xl[1] = 3.4;

xl[2] = 5.4;

xl[3] = 8.4;

xl[4] = 9.4;

yl[0] = 9.2;

yl[1] = 0.2;

yl[2] = 7.2;

yl[3] = 8.2;

yl[4] = 1.2;

status = lefwMacroObsLayerPolygon(5, xl, yl, 0, 0, 0, 0);

CHECK_STATUS(status);

free((char*)xl);

free((char*)yl);

status = lefwEndMacroObs();

CHECK_STATUS(status);

status = lefwEndMacro("INV");

CHECK_STATUS(status);

// 3rd MACRO

status = lefwStartMacro("DFF3");

CHECK_STATUS(status);

status = lefwMacroClass("CORE", "ANTENNACELL");

CHECK_STATUS(status);

status = lefwMacroForeignStr("DFF3S", 0, 0, "N");

CHECK_STATUS(status);

status = lefwMacroSize(67.2, 210);

CHECK_STATUS(status);

status = lefwMacroSymmetry("X Y R90");

CHECK_STATUS(status);

status = lefwMacroSitePattern("CORE", 34, 54, 7, 30, 3, 1, 1);

CHECK_STATUS(status);

status = lefwMacroSitePatternStr("CORE1", 21, 68, "S", 30, 3, 2, 2);

CHECK_STATUS(status);

status = lefwEndMacro("DFF3");

CHECK_STATUS(status);

status = lefwStartMacro("DFF4");

CHECK_STATUS(status);

status = lefwMacroClass("COVER", "BUMP");

CHECK_STATUS(status);

status = lefwMacroForeignStr("DFF3S", 0, 0, "");

CHECK_STATUS(status);

status = lefwEndMacro("DFF4");

CHECK_STATUS(status);

status = lefwStartMacro("DFF5");

CHECK_STATUS(status);

status = lefwMacroClass("COVER", NULL);

CHECK_STATUS(status);

status = lefwMacroForeignStr("DFF3S", 0, 0, "");

CHECK_STATUS(status);

status = lefwEndMacro("DFF5");

CHECK_STATUS(status);

status = lefwStartMacro("DFF6");

CHECK_STATUS(status);

status = lefwMacroClass("BLOCK", "BLACKBOX");

CHECK_STATUS(status);

status = lefwMacroForeignStr("DFF3S", 0, 0, "");

CHECK_STATUS(status);

status = lefwEndMacro("DFF6");

CHECK_STATUS(status);

status = lefwStartMacro("DFF7");

CHECK_STATUS(status);

status = lefwMacroClass("PAD", "AREAIO");

CHECK_STATUS(status);

status = lefwMacroForeignStr("DFF3S", 0, 0, "");

CHECK_STATUS(status);

status = lefwEndMacro("DFF7");

CHECK_STATUS(status);

status = lefwStartMacro("DFF8");

CHECK_STATUS(status);

status = lefwMacroClass("BLOCK", "SOFT");

CHECK_STATUS(status);

status = lefwEndMacro("DFF8");

CHECK_STATUS(status);

status = lefwStartMacro("DFF9");

CHECK_STATUS(status);

status = lefwMacroClass("CORE", "WELLTAP");

CHECK_STATUS(status);

status = lefwEndMacro("DFF9");

CHECK_STATUS(status);

status = lefwStartMacro("myTest");

CHECK_STATUS(status);

status = lefwMacroClass("CORE", NULL);

CHECK_STATUS(status);

status = lefwMacroSize(10.0, 14.0);

CHECK_STATUS(status);

status = lefwMacroSymmetry("X");

CHECK_STATUS(status);

status = lefwMacroSitePatternStr("Fsite", 0, 0, "N", 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwMacroSitePatternStr("Fsite", 0, 7.0, "FS", 30, 3, 2, 2);

CHECK_STATUS(status);

status = lefwMacroSitePatternStr("Fsite", 4.0, 0, "N", 0, 0, 0, 0);

CHECK_STATUS(status);

status = lefwEndMacro("myTest");

CHECK_STATUS(status);

// ANTENNA, this will generate error for 5.4 since I already have ANTENNA

// somewhere

status = lefwAntenna("INPUTPINANTENNASIZE", 1);

CHECK_STATUS(status);

status = lefwAntenna("OUTPUTPINANTENNASIZE", -1);

CHECK_STATUS(status);

status = lefwAntenna("INOUTPINANTENNASIZE", -1);

CHECK_STATUS(status);

status = lefwNewLine();

CHECK_STATUS(status);

// BEGINEXT

status = lefwStartBeginext("SIGNATURE");

CHECK_STATUS(status);

lefwAddIndent();

status = lefwBeginextCreator("CADENCE");

CHECK_STATUS(status);

status = lefwEndBeginext();

CHECK_STATUS(status);

status = lefwEnd();

CHECK_STATUS(status);

lineNum = lefwCurrentLineNumber();

if (lineNum == 0)

fprintf(stderr, "ERROR: Nothing has been written!!!\n");

fclose(fout);

return 0;

}

Return to top of page

For support, see Cadence Online Support service.
Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.