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

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

# A

# DEF Reader and Writer Examples

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

| DEF Reader Example

| DEF Writer Example

## DEF Reader Example

#include <stdlib.h>

#include <stdio.h>

#include <string.h>

#include <time.h>

#ifndef WIN32

# include <unistd.h>

#endif /* not WIN32 */

#include "defrReader.hpp"

#include "defiAlias.hpp"

char defaultName[64];

char defaultOut[64];

// Global variables

FILE* fout;

int userData;

int numObjs;

int isSumSet; // to keep track if within SUM

int isProp = 0; // for PROPERTYDEFINITIONS

int begOperand; // to keep track for constraint, to print - as the 1st char

static double curVer = 0;

static int setSNetWireCbk = 0;

// TX_DIR:TRANSLATION ON

void myLogFunction(const char* errMsg){

fprintf(fout, "ERROR: found error: %s\n", errMsg);

}

void myWarningLogFunction(const char* errMsg){

fprintf(fout, "WARNING: found error: %s\n", errMsg);

}

void dataError() {

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

}

void checkType(defrCallbackType_e c) {

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

// OK

} else {

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

}

}

int done(defrCallbackType_e c, void* dummy, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

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

return 0;

}

int endfunc(defrCallbackType_e c, void* dummy, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

return 0;

}

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

}

int compf(defrCallbackType_e c, defiComponent* co, defiUserData ud) {

int i;

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "- %s %s ", co->defiComponent::id(),

co->defiComponent::name());

if (co->defiComponent::hasNets()) {

for (i = 0; i < co->defiComponent::numNets(); i++)

fprintf(fout, "%s ", co->defiComponent::net(i));

}

if (co->defiComponent::isFixed())

fprintf(fout, "+ FIXED %d %d %s ",

co->defiComponent::placementX(),

co->defiComponent::placementY(),

//orientStr(co->defiComponent::placementOrient()));

co->defiComponent::placementOrientStr());

if (co->defiComponent::isCover())

fprintf(fout, "+ COVER %d %d %s ",

co->defiComponent::placementX(),

co->defiComponent::placementY(),

orientStr(co->defiComponent::placementOrient()));

if (co->defiComponent::isPlaced())

fprintf(fout,"+ PLACED %d %d %s ",

co->defiComponent::placementX(),

co->defiComponent::placementY(),

orientStr(co->defiComponent::placementOrient()));

if (co->defiComponent::isUnplaced()) {

fprintf(fout,"+ UNPLACED ");

if ((co->defiComponent::placementX() != -1) ||

(co->defiComponent::placementY() != -1))

fprintf(fout,"%d %d %s ",

co->defiComponent::placementX(),

co->defiComponent::placementY(),

orientStr(co->defiComponent::placementOrient()));

}

if (co->defiComponent::hasSource())

fprintf(fout, "+ SOURCE %s ", co->defiComponent::source());

if (co->defiComponent::hasGenerate()) {

fprintf(fout, "+ GENERATE %s ", co->defiComponent::generateName());

if (co->defiComponent::macroName() &&

*(co->defiComponent::macroName()))

fprintf(fout, "%s ", co->defiComponent::macroName());

}

if (co->defiComponent::hasWeight())

fprintf(fout, "+ WEIGHT %d ", co->defiComponent::weight());

if (co->defiComponent::hasEEQ())

fprintf(fout, "+ EEQMASTER %s ", co->defiComponent::EEQ());

if (co->defiComponent::hasRegionName())

fprintf(fout, "+ REGION %s ", co->defiComponent::regionName());

if (co->defiComponent::hasRegionBounds()) {

int *xl, *yl, *xh, *yh;

int size;

co->defiComponent::regionBounds(&size, &xl, &yl, &xh, &yh);

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

fprintf(fout, "+ REGION %d %d %d %d \n",

xl[i], yl[i], xh[i], yh[i]);

}

}

if (co->defiComponent::hasHalo()) {

int left, bottom, right, top;

(void) co->defiComponent::haloEdges(&left, &bottom, &right, &top);

fprintf(fout, "+ HALO ");

if (co->defiComponent::hasHaloSoft())

fprintf(fout, "SOFT ");

fprintf(fout, "%d %d %d %d\n", left, bottom, right, top);

}

if (co->defiComponent::hasRouteHalo()) {

fprintf(fout, "+ ROUTEHALO %d %s %s\n", co->defiComponent::haloDist(),

co->defiComponent::minLayer(), co->defiComponent::maxLayer());

}

if (co->defiComponent::hasForeignName()) {

fprintf(fout, "+ FOREIGN %s %d %d %s %d ",

co->defiComponent::foreignName(), co->defiComponent::foreignX(),

co->defiComponent::foreignY(), co->defiComponent::foreignOri(),

co->defiComponent::foreignOrient());

}

if (co->defiComponent::numProps()) {

for (i = 0; i < co->defiComponent::numProps(); i++) {

fprintf(fout, "+ PROPERTY %s %s ", co->defiComponent::propName(i),

co->defiComponent::propValue(i));

switch (co->defiComponent::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");

--numObjs;

if (numObjs <= 0)

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

return 0;

}

int netpath(defrCallbackType_e c, defiNet* ppath, defiUserData ud) {

fprintf(fout, "\n");

fprintf (fout, "Callback of partial path for net\n");

return 0;

}

int netNamef(defrCallbackType_e c, const char* netName, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "- %s ", netName);

return 0;

}

int subnetNamef(defrCallbackType_e c, const char* subnetName, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

if (curVer >= 5.6)

fprintf(fout, " + SUBNET CBK %s ", subnetName);

return 0;

}

int nondefRulef(defrCallbackType_e c, const char* ruleName, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

if (curVer >= 5.6)

fprintf(fout, " + NONDEFAULTRULE CBK %s ", ruleName);

return 0;

}

int netf(defrCallbackType_e c, defiNet* net, defiUserData ud) {

// For net and special net.

int i, j, k, x, y, z, count, newLayer;

defiPath* p;

defiSubnet *s;

int path;

defiVpin *vpin;

// defiShield *noShield;

defiWire *wire;

checkType(c);

if ((long)ud != userData) dataError();

if (c != defrNetCbkType)

fprintf(fout, "BOGUS NET TYPE ");

if (net->defiNet::pinIsMustJoin(0))

fprintf(fout, "- MUSTJOIN ");

// compName & pinName

for (i = 0; i < net->defiNet::numConnections(); i++) {

// set the limit of only 5 items per line

count++;

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

fprintf(fout, "( %s %s ) ", net->defiNet::instance(i),

net->defiNet::pin(i));

if (net->defiNet::pinIsSynthesized(i))

fprintf(fout, "+ SYNTHESIZED ");

}

if (net->hasNonDefaultRule())

fprintf(fout, "+ NONDEFAULTRULE %s\n", net->nonDefaultRule());

for (i = 0; i < net->defiNet::numVpins(); i++) {

vpin = net->defiNet::vpin(i);

fprintf(fout, " + %s", vpin->name());

if (vpin->layer())

fprintf(fout, " %s", vpin->layer());

fprintf(fout, " %d %d %d %d", vpin->xl(), vpin->yl(), vpin->xh(),

vpin->yh());

if (vpin->status() != ' ') {

fprintf(fout, " %c", vpin->status());

fprintf(fout, " %d %d", vpin->xLoc(), vpin->yLoc());

if (vpin->orient() != -1)

fprintf(fout, " %s", orientStr(vpin->orient()));

}

fprintf(fout, "\n");

}

// regularWiring

if (net->defiNet::numWires()) {

for (i = 0; i < net->defiNet::numWires(); i++) {

newLayer = 0;

wire = net->defiNet::wire(i);

fprintf(fout, "\n + %s ", wire->wireType());

count = 0;

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_TAPERRULE:

fprintf(fout, "TAPERRULE %s ",p->defiPath::getTaperRule());

break;

case DEFIPATH_STYLE:

fprintf(fout, "STYLE %d ",p->defiPath::getStyle());

break;

}

}

}

fprintf(fout, "\n");

count = 0;

}

}

// SHIELDNET

if (net->defiNet::numShieldNets()) {

for (i = 0; i < net->defiNet::numShieldNets(); i++)

fprintf(fout, "\n + SHIELDNET %s", net->defiNet::shieldNet(i));

}

if (net->defiNet::hasSubnets()) {

for (i = 0; i < net->defiNet::numSubnets(); i++) {

s = net->defiNet::subnet(i);

fprintf(fout, "\n");

if (s->defiSubnet::numConnections()) {

if (s->defiSubnet::pinIsMustJoin(0))

fprintf(fout, "- MUSTJOIN ");

else

fprintf(fout, " + SUBNET %s ", s->defiSubnet::name());

for (j = 0; j < s->defiSubnet::numConnections(); j++)

fprintf(fout, " ( %s %s )\n", s->defiSubnet::instance(j),

s->defiSubnet::pin(j));

// regularWiring

if (s->defiSubnet::numWires()) {

for (k = 0; k < s->defiSubnet::numWires(); k++) {

newLayer = 0;

wire = s->defiSubnet::wire(k);

fprintf(fout, " %s ", wire->wireType());

count = 0;

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ",

p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

p->defiPath::getViaRotationStr());

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_TAPERRULE:

fprintf(fout, "TAPERRULE %s ",

p->defiPath::getTaperRule());

break;

case DEFIPATH_STYLE:

fprintf(fout, "STYLE %d ",

p->defiPath::getStyle());

break;

}

}

}

}

}

}

}

}

if (net->defiNet::numProps()) {

for (i = 0; i < net->defiNet::numProps(); i++) {

fprintf(fout, " + PROPERTY %s ", net->defiNet::propName(i));

switch (net->defiNet::propType(i)) {

case 'R': fprintf(fout, "%g REAL ", net->defiNet::propNumber(i));

break;

case 'I': fprintf(fout, "%g INTEGER ", net->defiNet::propNumber(i));

break;

case 'S': fprintf(fout, "%s STRING ", net->defiNet::propValue(i));

break;

case 'Q': fprintf(fout, "%s QUOTESTRING ", net->defiNet::propValue(i));

break;

case 'N': fprintf(fout, "%g NUMBER ", net->defiNet::propNumber(i));

break;

}

fprintf(fout, "\n");

}

}

if (net->defiNet::hasWeight())

fprintf(fout, "+ WEIGHT %d ", net->defiNet::weight());

if (net->defiNet::hasCap())

fprintf(fout, "+ ESTCAP %g ", net->defiNet::cap());

if (net->defiNet::hasSource())

fprintf(fout, "+ SOURCE %s ", net->defiNet::source());

if (net->defiNet::hasFixedbump())

fprintf(fout, "+ FIXEDBUMP ");

if (net->defiNet::hasFrequency())

fprintf(fout, "+ FREQUENCY %g ", net->defiNet::frequency());

if (net->defiNet::hasPattern())

fprintf(fout, "+ PATTERN %s ", net->defiNet::pattern());

if (net->defiNet::hasOriginal())

fprintf(fout, "+ ORIGINAL %s ", net->defiNet::original());

if (net->defiNet::hasUse())

fprintf(fout, "+ USE %s ", net->defiNet::use());

fprintf (fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

return 0;

}

int snetpath(defrCallbackType_e c, defiNet* ppath, defiUserData ud) {

int i, j, x, y, z, count, newLayer;

char* layerName;

double dist, left, right;

defiPath* p;

defiSubnet *s;

int path;

defiShield* shield;

defiWire* wire;

int numX, numY, stepX, stepY;

if (c != defrSNetPartialPathCbkType)

return 1;

if ((long)ud != userData) dataError();

fprintf (fout, "SPECIALNET partial data\n");

fprintf(fout, "- %s ", ppath->defiNet::name());

count = 0;

// compName & pinName

for (i = 0; i < ppath->defiNet::numConnections(); i++) {

// set the limit of only 5 items print out in one line

count++;

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

fprintf (fout, "( %s %s ) ", ppath->defiNet::instance(i),

ppath->defiNet::pin(i));

if (ppath->defiNet::pinIsSynthesized(i))

fprintf(fout, "+ SYNTHESIZED ");

}

// specialWiring

// POLYGON

if (ppath->defiNet::numPolygons()) {

struct defiPoints points;

for (i = 0; i < ppath->defiNet::numPolygons(); i++) {

fprintf(fout, "\n + POLYGON %s ", ppath->polygonName(i));

points = ppath->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

}

}

// RECT

if (ppath->defiNet::numRectangles()) {

for (i = 0; i < ppath->defiNet::numRectangles(); i++) {

fprintf(fout, "\n + RECT %s %d %d %d %d", ppath->defiNet::rectName(i),

ppath->defiNet::xl(i), ppath->defiNet::yl(i),

ppath->defiNet::xh(i), ppath->defiNet::yh(i));

}

}

// COVER, FIXED, ROUTED or SHIELD

if (ppath->defiNet::numWires()) {

newLayer = 0;

for (i = 0; i < ppath->defiNet::numWires(); i++) {

newLayer = 0;

wire = ppath->defiNet::wire(i);

fprintf(fout, "\n + %s ", wire->wireType());

if (strcmp (wire->wireType(), "SHIELD") == 0)

fprintf(fout, "%s ", wire->wireShieldNetName());

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_VIADATA:

p->defiPath::getViaData(&numX, &numY, &stepX, &stepY);

fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY,

stepX, stepY);

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

break;

}

}

}

fprintf(fout, "\n");

count = 0;

}

}

if (ppath->defiNet::hasSubnets()) {

for (i = 0; i < ppath->defiNet::numSubnets(); i++) {

s = ppath->defiNet::subnet(i);

if (s->defiSubnet::numConnections()) {

if (s->defiSubnet::pinIsMustJoin(0))

fprintf(fout, "- MUSTJOIN ");

else

fprintf(fout, "- %s ", s->defiSubnet::name());

for (j = 0; j < s->defiSubnet::numConnections(); j++) {

fprintf(fout, " ( %s %s )\n", s->defiSubnet::instance(j),

s->defiSubnet::pin(j));

}

}

// regularWiring

if (s->defiSubnet::numWires()) {

for (i = 0; i < s->defiSubnet::numWires(); i++) {

wire = s->defiSubnet::wire(i);

fprintf(fout, " + %s ", wire->wireType());

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->defiPath::print(fout);

}

}

}

}

}

if (ppath->defiNet::numProps()) {

for (i = 0; i < ppath->defiNet::numProps(); i++) {

if (ppath->defiNet::propIsString(i))

fprintf(fout, " + PROPERTY %s %s ", ppath->defiNet::propName(i),

ppath->defiNet::propValue(i));

if (ppath->defiNet::propIsNumber(i))

fprintf(fout, " + PROPERTY %s %g ", ppath->defiNet::propName(i),

ppath->defiNet::propNumber(i));

switch (ppath->defiNet::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");

}

}

// SHIELD

count = 0;

// testing the SHIELD for 5.3, obsolete in 5.4

if (ppath->defiNet::numShields()) {

for (i = 0; i < ppath->defiNet::numShields(); i++) {

shield = ppath->defiNet::shield(i);

fprintf(fout, "\n + SHIELD %s ", shield->defiShield::shieldName());

newLayer = 0;

for (j = 0; j < shield->defiShield::numPaths(); j++) {

p = shield->defiShield::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

if (newLayer)

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

else

fprintf(fout, "Str %s ",

p->defiPath::getViaRotationStr());

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

}

}

}

}

}

// layerName width

if (ppath->defiNet::hasWidthRules()) {

for (i = 0; i < ppath->defiNet::numWidthRules(); i++) {

ppath->defiNet::widthRule(i, &layerName, &dist);

fprintf (fout, "\n + WIDTH %s %g ", layerName, dist);

}

}

// layerName spacing

if (ppath->defiNet::hasSpacingRules()) {

for (i = 0; i < ppath->defiNet::numSpacingRules(); i++) {

ppath->defiNet::spacingRule(i, &layerName, &dist, &left, &right);

if (left == right)

fprintf (fout, "\n + SPACING %s %g ", layerName, dist);

else

fprintf (fout, "\n + SPACING %s %g RANGE %g %g ",

layerName, dist, left, right);

}

}

if (ppath->defiNet::hasFixedbump())

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

if (ppath->defiNet::hasFrequency())

fprintf(fout, "\n + FREQUENCY %g ", ppath->defiNet::frequency());

if (ppath->defiNet::hasVoltage())

fprintf(fout, "\n + VOLTAGE %g ", ppath->defiNet::voltage());

if (ppath->defiNet::hasWeight())

fprintf(fout, "\n + WEIGHT %d ", ppath->defiNet::weight());

if (ppath->defiNet::hasCap())

fprintf(fout, "\n + ESTCAP %g ", ppath->defiNet::cap());

if (ppath->defiNet::hasSource())

fprintf(fout, "\n + SOURCE %s ", ppath->defiNet::source());

if (ppath->defiNet::hasPattern())

fprintf(fout, "\n + PATTERN %s ", ppath->defiNet::pattern());

if (ppath->defiNet::hasOriginal())

fprintf(fout, "\n + ORIGINAL %s ", ppath->defiNet::original());

if (ppath->defiNet::hasUse())

fprintf(fout, "\n + USE %s ", ppath->defiNet::use());

fprintf(fout, "\n");

return 0;

}

int snetwire(defrCallbackType_e c, defiNet* ppath, defiUserData ud) {

int i, j, x, y, z, count = 0, newLayer;

defiPath* p;

int path;

defiWire* wire;

defiShield* shield;

int numX, numY, stepX, stepY;

if (c != defrSNetWireCbkType)

return 1;

if ((long)ud != userData) dataError();

fprintf (fout, "SPECIALNET wire data\n");

fprintf(fout, "- %s ", ppath->defiNet::name());

// specialWiring

if (ppath->defiNet::numWires()) {

newLayer = 0;

for (i = 0; i < ppath->defiNet::numWires(); i++) {

newLayer = 0;

wire = ppath->defiNet::wire(i);

fprintf(fout, "\n + %s ", wire->wireType());

if (strcmp (wire->wireType(), "SHIELD") == 0)

fprintf(fout, "%s ", wire->wireShieldNetName());

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_VIADATA:

p->defiPath::getViaData(&numX, &numY, &stepX, &stepY);

fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY,

stepX, stepY);

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

break;

}

}

}

fprintf(fout, "\n");

count = 0;

}

} else if (ppath->defiNet::numShields()) {

for (i = 0; i < ppath->defiNet::numShields(); i++) {

shield = ppath->defiNet::shield(i);

fprintf(fout, "\n + SHIELD %s ", shield->defiShield::shieldName());

newLayer = 0;

for (j = 0; j < shield->defiShield::numPaths(); j++) {

p = shield->defiShield::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

break;

}

}

}

}

}

fprintf(fout, "\n");

return 0;

}

int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) {

// For net and special net.

int i, j, x, y, z, count, newLayer;

char* layerName;

double dist, left, right;

defiPath* p;

defiSubnet *s;

int path;

defiShield* shield;

defiWire* wire;

int numX, numY, stepX, stepY;

checkType(c);

if ((long)ud != userData) dataError();

if (c != defrSNetCbkType)

fprintf(fout, "BOGUS NET TYPE ");

count = 0;

// compName & pinName

for (i = 0; i < net->defiNet::numConnections(); i++) {

// set the limit of only 5 items print out in one line

count++;

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

fprintf (fout, "( %s %s ) ", net->defiNet::instance(i),

net->defiNet::pin(i));

if (net->defiNet::pinIsSynthesized(i))

fprintf(fout, "+ SYNTHESIZED ");

}

// specialWiring

if (net->defiNet::numWires()) {

newLayer = 0;

for (i = 0; i < net->defiNet::numWires(); i++) {

newLayer = 0;

wire = net->defiNet::wire(i);

fprintf(fout, "\n + %s ", wire->wireType());

if (strcmp (wire->wireType(), "SHIELD") == 0)

fprintf(fout, "%s ", wire->wireShieldNetName());

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_VIADATA:

p->defiPath::getViaData(&numX, &numY, &stepX, &stepY);

fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY,

stepX, stepY);

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

break;

}

}

}

fprintf(fout, "\n");

count = 0;

}

}

// POLYGON

if (net->defiNet::numPolygons()) {

struct defiPoints points;

for (i = 0; i < net->defiNet::numPolygons(); i++) {

fprintf(fout, "\n + POLYGON %s ", net->polygonName(i));

points = net->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

}

}

// RECT

if (net->defiNet::numRectangles()) {

for (i = 0; i < net->defiNet::numRectangles(); i++) {

fprintf(fout, "\n + RECT %s %d %d %d %d", net->defiNet::rectName(i),

net->defiNet::xl(i), net->defiNet::yl(i), net->defiNet::xh(i),

net->defiNet::yh(i));

}

}

if (net->defiNet::hasSubnets()) {

for (i = 0; i < net->defiNet::numSubnets(); i++) {

s = net->defiNet::subnet(i);

if (s->defiSubnet::numConnections()) {

if (s->defiSubnet::pinIsMustJoin(0))

fprintf(fout, "- MUSTJOIN ");

else

fprintf(fout, "- %s ", s->defiSubnet::name());

for (j = 0; j < s->defiSubnet::numConnections(); j++) {

fprintf(fout, " ( %s %s )\n", s->defiSubnet::instance(j),

s->defiSubnet::pin(j));

}

}

// regularWiring

if (s->defiSubnet::numWires()) {

for (i = 0; i < s->defiSubnet::numWires(); i++) {

wire = s->defiSubnet::wire(i);

fprintf(fout, " + %s ", wire->wireType());

for (j = 0; j < wire->defiWire::numPaths(); j++) {

p = wire->defiWire::path(j);

p->defiPath::print(fout);

}

}

}

}

}

if (net->defiNet::numProps()) {

for (i = 0; i < net->defiNet::numProps(); i++) {

if (net->defiNet::propIsString(i))

fprintf(fout, " + PROPERTY %s %s ", net->defiNet::propName(i),

net->defiNet::propValue(i));

if (net->defiNet::propIsNumber(i))

fprintf(fout, " + PROPERTY %s %g ", net->defiNet::propName(i),

net->defiNet::propNumber(i));

switch (net->defiNet::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");

}

}

// SHIELD

count = 0;

// testing the SHIELD for 5.3, obsolete in 5.4

if (net->defiNet::numShields()) {

for (i = 0; i < net->defiNet::numShields(); i++) {

shield = net->defiNet::shield(i);

fprintf(fout, "\n + SHIELD %s ", shield->defiShield::shieldName());

newLayer = 0;

for (j = 0; j < shield->defiShield::numPaths(); j++) {

p = shield->defiShield::path(j);

p->initTraverse();

while ((path = (int)p->defiPath::next()) != DEFIPATH_DONE) {

count++;

// Don't want the line to be too long

if (count >= 5) {

fprintf(fout, "\n");

count = 0;

}

switch (path) {

case DEFIPATH_LAYER:

if (newLayer == 0) {

fprintf(fout, "%s ", p->defiPath::getLayer());

newLayer = 1;

} else

fprintf(fout, "NEW %s ", p->defiPath::getLayer());

break;

case DEFIPATH_VIA:

fprintf(fout, "%s ", p->defiPath::getVia());

break;

case DEFIPATH_VIAROTATION:

fprintf(fout, "%s ",

orientStr(p->defiPath::getViaRotation()));

break;

case DEFIPATH_WIDTH:

fprintf(fout, "%d ", p->defiPath::getWidth());

break;

case DEFIPATH_POINT:

p->defiPath::getPoint(&x, &y);

fprintf(fout, "( %d %d ) ", x, y);

break;

case DEFIPATH_FLUSHPOINT:

p->defiPath::getFlushPoint(&x, &y, &z);

fprintf(fout, "( %d %d %d ) ", x, y, z);

break;

case DEFIPATH_TAPER:

fprintf(fout, "TAPER ");

break;

case DEFIPATH_SHAPE:

fprintf(fout, "+ SHAPE %s ", p->defiPath::getShape());

break;

case DEFIPATH_STYLE:

fprintf(fout, "+ STYLE %d ", p->defiPath::getStyle());

break;

}

}

}

}

}

// layerName width

if (net->defiNet::hasWidthRules()) {

for (i = 0; i < net->defiNet::numWidthRules(); i++) {

net->defiNet::widthRule(i, &layerName, &dist);

fprintf (fout, "\n + WIDTH %s %g ", layerName, dist);

}

}

// layerName spacing

if (net->defiNet::hasSpacingRules()) {

for (i = 0; i < net->defiNet::numSpacingRules(); i++) {

net->defiNet::spacingRule(i, &layerName, &dist, &left, &right);

if (left == right)

fprintf (fout, "\n + SPACING %s %g ", layerName, dist);

else

fprintf (fout, "\n + SPACING %s %g RANGE %g %g ",

layerName, dist, left, right);

}

}

if (net->defiNet::hasFixedbump())

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

if (net->defiNet::hasFrequency())

fprintf(fout, "\n + FREQUENCY %g ", net->defiNet::frequency());

if (net->defiNet::hasVoltage())

fprintf(fout, "\n + VOLTAGE %g ", net->defiNet::voltage());

if (net->defiNet::hasWeight())

fprintf(fout, "\n + WEIGHT %d ", net->defiNet::weight());

if (net->defiNet::hasCap())

fprintf(fout, "\n + ESTCAP %g ", net->defiNet::cap());

if (net->defiNet::hasSource())

fprintf(fout, "\n + SOURCE %s ", net->defiNet::source());

if (net->defiNet::hasPattern())

fprintf(fout, "\n + PATTERN %s ", net->defiNet::pattern());

if (net->defiNet::hasOriginal())

fprintf(fout, "\n + ORIGINAL %s ", net->defiNet::original());

if (net->defiNet::hasUse())

fprintf(fout, "\n + USE %s ", net->defiNet::use());

fprintf (fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

return 0;

}

int ndr(defrCallbackType_e c, defiNonDefault* nd, defiUserData ud) {

// For nondefaultrule

int i;

checkType(c);

if ((long)ud != userData) dataError();

if (c != defrNonDefaultCbkType)

fprintf(fout, "BOGUS NONDEFAULTRULE TYPE ");

fprintf(fout, "- %s\n", nd->defiNonDefault::name());

if (nd->defiNonDefault::hasHardspacing())

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

for (i = 0; i < nd->defiNonDefault::numLayers(); i++) {

fprintf(fout, " + LAYER %s", nd->defiNonDefault::layerName(i));

fprintf(fout, " WIDTH %d", nd->defiNonDefault::layerWidthVal(i));

if (nd->defiNonDefault::hasLayerDiagWidth(i))

fprintf(fout, " DIAGWIDTH %d",

nd->defiNonDefault::layerDiagWidthVal(i));

if (nd->defiNonDefault::hasLayerSpacing(i))

fprintf(fout, " SPACING %d", nd->defiNonDefault::layerSpacingVal(i));

if (nd->defiNonDefault::hasLayerWireExt(i))

fprintf(fout, " WIREEXT %d", nd->defiNonDefault::layerWireExtVal(i));

fprintf(fout, "\n");

}

for (i = 0; i < nd->defiNonDefault::numVias(); i++)

fprintf(fout, " + VIA %s\n", nd->defiNonDefault::viaName(i));

for (i = 0; i < nd->defiNonDefault::numViaRules(); i++)

fprintf(fout, " + VIARULE %s\n", nd->defiNonDefault::viaRuleName(i));

for (i = 0; i < nd->defiNonDefault::numMinCuts(); i++)

fprintf(fout, " + MINCUTS %s %d\n", nd->defiNonDefault::cutLayerName(i),

nd->defiNonDefault::numCuts(i));

for (i = 0; i < nd->defiNonDefault::numProps(); i++) {

fprintf(fout, " + PROPERTY %s %s ", nd->defiNonDefault::propName(i),

nd->defiNonDefault::propValue(i));

switch (nd->defiNonDefault::propType(i)) {

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

break;

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

break;

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

break;

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

break;

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

break;

}

}

--numObjs;

if (numObjs <= 0)

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

return 0;

}

int tname(defrCallbackType_e c, const char* string, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "TECHNOLOGY %s ;\n", string);

return 0;

}

int dname(defrCallbackType_e c, const char* string, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "DESIGN %s ;\n", string);

// Test changing the user data.

userData = 89;

defrSetUserData((void*)userData);

return 0;

}

char* address(const char* in) {

return ((char*)in);

}

int cs(defrCallbackType_e c, int num, defiUserData ud) {

char* name;

checkType(c);

if ((long)ud != userData) dataError();

switch (c) {

case defrComponentStartCbkType : name = address("COMPONENTS"); break;

case defrNetStartCbkType : name = address("NETS"); break;

case defrStartPinsCbkType : name = address("PINS"); break;

case defrViaStartCbkType : name = address("VIAS"); break;

case defrRegionStartCbkType : name = address("REGIONS"); break;

case defrSNetStartCbkType : name = address("SPECIALNETS"); break;

case defrGroupsStartCbkType : name = address("GROUPS"); break;

case defrScanchainsStartCbkType : name = address("SCANCHAINS"); break;

case defrIOTimingsStartCbkType : name = address("IOTIMINGS"); break;

case defrFPCStartCbkType : name = address("FLOORPLANCONSTRAINTS"); break;

case defrTimingDisablesStartCbkType : name = address("TIMING DISABLES"); break;

case defrPartitionsStartCbkType : name = address("PARTITIONS"); break;

case defrPinPropStartCbkType : name = address("PINPROPERTIES"); break;

case defrBlockageStartCbkType : name = address("BLOCKAGES"); break;

case defrSlotStartCbkType : name = address("SLOTS"); break;

case defrFillStartCbkType : name = address("FILLS"); break;

case defrNonDefaultStartCbkType : name = address("NONDEFAULTRULES"); break;

case defrStylesStartCbkType : name = address("STYLES"); break;

default : name = address("BOGUS"); return 1;

}

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

numObjs = num;

return 0;

}

int constraintst(defrCallbackType_e c, int num, defiUserData ud) {

// Handles both constraints and assertions

checkType(c);

if ((long)ud != userData) dataError();

if (c == defrConstraintsStartCbkType)

fprintf(fout, "\nCONSTRAINTS %d ;\n\n", num);

else

fprintf(fout, "\nASSERTIONS %d ;\n\n", num);

numObjs = num;

return 0;

}

void operand(defrCallbackType_e c, defiAssertion* a, int ind) {

int i, first = 1;

char* netName;

char* fromInst, * fromPin, * toInst, * toPin;

if (a->defiAssertion::isSum()) {

// Sum in operand, recursively call operand

fprintf(fout, "- SUM ( ");

a->defiAssertion::unsetSum();

isSumSet = 1;

begOperand = 0;

operand (c, a, ind);

fprintf(fout, ") ");

} else {

// operand

if (ind >= a->defiAssertion::numItems()) {

fprintf(fout, "ERROR: when writing out SUM in Constraints.\n");

return;

}

if (begOperand) {

fprintf(fout, "- ");

begOperand = 0;

}

for (i = ind; i < a->defiAssertion::numItems(); i++) {

if (a->defiAssertion::isNet(i)) {

a->defiAssertion::net(i, &netName);

if (!first)

fprintf(fout, ", "); // print , as separator

fprintf(fout, "NET %s ", netName);

} else if (a->defiAssertion::isPath(i)) {

a->defiAssertion::path(i, &fromInst, &fromPin, &toInst,

&toPin);

if (!first)

fprintf(fout, ", ");

fprintf(fout, "PATH %s %s %s %s ", fromInst, fromPin, toInst,

toPin);

} else if (isSumSet) {

// SUM within SUM, reset the flag

a->defiAssertion::setSum();

operand(c, a, i);

}

first = 0;

}

}

}

int constraint(defrCallbackType_e c, defiAssertion* a, defiUserData ud) {

// Handles both constraints and assertions

checkType(c);

if ((long)ud != userData) dataError();

if (a->defiAssertion::isWiredlogic())

// Wirelogic

fprintf(fout, "- WIREDLOGIC %s + MAXDIST %g ;\n",

a->defiAssertion::netName(), a->defiAssertion::fallMax());

else {

// Call the operand function

isSumSet = 0; // reset the global variable

begOperand = 1;

operand (c, a, 0);

// Get the Rise and Fall

if (a->defiAssertion::hasRiseMax())

fprintf(fout, "+ RISEMAX %g ", a->defiAssertion::riseMax());

if (a->defiAssertion::hasFallMax())

fprintf(fout, "+ FALLMAX %g ", a->defiAssertion::fallMax());

if (a->defiAssertion::hasRiseMin())

fprintf(fout, "+ RISEMIN %g ", a->defiAssertion::riseMin());

if (a->defiAssertion::hasFallMin())

fprintf(fout, "+ FALLMIN %g ", a->defiAssertion::fallMin());

fprintf(fout, ";\n");

}

--numObjs;

if (numObjs <= 0) {

if (c == defrConstraintCbkType)

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

else

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

}

return 0;

}

int propstart(defrCallbackType_e c, void* dummy, defiUserData ud) {

checkType(c);

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

isProp = 1;

return 0;

}

int prop(defrCallbackType_e c, defiProp* p, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

if (strcmp(p->defiProp::propType(), "design") == 0)

fprintf(fout, "DESIGN %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "net") == 0)

fprintf(fout, "NET %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "component") == 0)

fprintf(fout, "COMPONENT %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "specialnet") == 0)

fprintf(fout, "SPECIALNET %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "group") == 0)

fprintf(fout, "GROUP %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "row") == 0)

fprintf(fout, "ROW %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "componentpin") == 0)

fprintf(fout, "COMPONENTPIN %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "region") == 0)

fprintf(fout, "REGION %s ", p->defiProp::propName());

else if (strcmp(p->defiProp::propType(), "nondefaultrule") == 0)

fprintf(fout, "NONDEFAULTRULE %s ", p->defiProp::propName());

if (p->defiProp::dataType() == 'I')

fprintf(fout, "INTEGER ");

if (p->defiProp::dataType() == 'R')

fprintf(fout, "REAL ");

if (p->defiProp::dataType() == 'S')

fprintf(fout, "STRING ");

if (p->defiProp::dataType() == 'Q')

fprintf(fout, "STRING ");

if (p->defiProp::hasRange()) {

fprintf(fout, "RANGE %g %g ", p->defiProp::left(),

p->defiProp::right());

}

if (p->defiProp::hasNumber())

fprintf(fout, "%g ", p->defiProp::number());

if (p->defiProp::hasString())

fprintf(fout, "\"%s\" ", p->defiProp::string());

fprintf(fout, ";\n");

return 0;

}

int propend(defrCallbackType_e c, void* dummy, defiUserData ud) {

checkType(c);

if (isProp) {

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

isProp = 0;

}

defrSetCaseSensitivity(1);

return 0;

}

int hist(defrCallbackType_e c, const char* h, defiUserData ud) {

checkType(c);

defrSetCaseSensitivity(0);

if ((long)ud != userData) dataError();

fprintf(fout, "HISTORY %s ;\n", h);

defrSetCaseSensitivity(1);

return 0;

}

int an(defrCallbackType_e c, const char* h, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "ARRAY %s ;\n", h);

return 0;

}

int fn(defrCallbackType_e c, const char* h, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "FLOORPLAN %s ;\n", h);

return 0;

}

int bbn(defrCallbackType_e c, const char* h, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "BUSBITCHARS \"%s\" ;\n", h);

return 0;

}

int vers(defrCallbackType_e c, double d, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "VERSION %g ;\n", d);

curVer = d;

defrAddAlias ("alias1", "aliasValue1", 1);

defrAddAlias ("alias2", "aliasValue2", 0);

defiAlias_itr *aliasStore;

aliasStore = (defiAlias_itr*)malloc(sizeof(defiAlias_itr*));

aliasStore->Init();

while (aliasStore->defiAlias_itr::Next()) {

fprintf(fout, "ALIAS %s %s %d ;\n", aliasStore->defiAlias_itr::Key(),

aliasStore->defiAlias_itr::Data(),

aliasStore->defiAlias_itr::Marked());

}

free(aliasStore);

return 0;

}

int versStr(defrCallbackType_e c, const char* versionName, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "VERSION %s ;\n", versionName);

return 0;

}

int units(defrCallbackType_e c, double d, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "UNITS DISTANCE MICRONS %g ;\n", d);

return 0;

}

int casesens(defrCallbackType_e c, int d, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

if (d == 1)

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

else

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

return 0;

}

int cls(defrCallbackType_e c, void* cl, defiUserData ud) {

defiSite* site; // Site and Canplace and CannotOccupy

defiBox* box; // DieArea and

defiPinCap* pc;

defiPin* pin;

int i, j;

defiRow* row;

defiTrack* track;

defiGcellGrid* gcg;

defiVia* via;

defiRegion* re;

defiGroup* group;

defiScanchain* sc;

defiIOTiming* iot;

defiFPC* fpc;

defiTimingDisable* td;

defiPartition* part;

defiPinProp* pprop;

defiBlockage* block;

defiSlot* slots;

defiFill* fills;

defiStyles* styles;

int xl, yl, xh, yh;

char *name, *a1, *b1;

char **inst, **inPin, **outPin;

int *bits;

int size;

int corner, typ;

const char *itemT;

char dir;

defiPinAntennaModel* aModel;

struct defiPoints points;

checkType(c);

if ((long)ud != userData) dataError();

switch (c) {

case defrSiteCbkType :

site = (defiSite*)cl;

fprintf(fout, "SITE %s %g %g %s ", site->defiSite::name(),

site->defiSite::x_orig(), site->defiSite::y_orig(),

orientStr(site->defiSite::orient()));

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

site->defiSite::x_num(), site->defiSite::y_num(),

site->defiSite::x_step(), site->defiSite::y_step());

break;

case defrCanplaceCbkType :

site = (defiSite*)cl;

fprintf(fout, "CANPLACE %s %g %g %s ", site->defiSite::name(),

site->defiSite::x_orig(), site->defiSite::y_orig(),

orientStr(site->defiSite::orient()));

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

site->defiSite::x_num(), site->defiSite::y_num(),

site->defiSite::x_step(), site->defiSite::y_step());

break;

case defrCannotOccupyCbkType :

site = (defiSite*)cl;

fprintf(fout, "CANNOTOCCUPY %s %g %g %s ",

site->defiSite::name(), site->defiSite::x_orig(),

site->defiSite::y_orig(), orientStr(site->defiSite::orient()));

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

site->defiSite::x_num(), site->defiSite::y_num(),

site->defiSite::x_step(), site->defiSite::y_step());

break;

case defrDieAreaCbkType :

box = (defiBox*)cl;

fprintf(fout, "DIEAREA %d %d %d %d ;\n",

box->defiBox::xl(), box->defiBox::yl(), box->defiBox::xh(),

box->defiBox::yh());

fprintf(fout, "DIEAREA ");

points = box->defiBox::getPoint();

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

fprintf(fout, "%d %d ", points.x[i], points.y[i]);

fprintf(fout, ";\n");

break;

case defrPinCapCbkType :

pc = (defiPinCap*)cl;

fprintf(fout, "MINPINS %d WIRECAP %g ;\n",

pc->defiPinCap::pin(), pc->defiPinCap::cap());

--numObjs;

if (numObjs <= 0)

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

break;

case defrPinCbkType :

pin = (defiPin*)cl;

fprintf(fout, "- %s + NET %s ", pin->defiPin::pinName(),

pin->defiPin::netName());

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

fprintf(fout, "+ DIRECTION %s ", pin->defiPin::direction());

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

fprintf(fout, "+ USE %s ", pin->defiPin::use());

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

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

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

fprintf(fout, "+ SUPPLYSENSITIVITY %s ",

pin->defiPin::supplySensitivity());

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

fprintf(fout, "+ GROUNDSENSITIVITY %s ",

pin->defiPin::groundSensitivity());

if (pin->defiPin::hasLayer()) {

struct defiPoints points;

for (i = 0; i < pin->defiPin::numLayer(); i++) {

fprintf(fout, "\n + LAYER %s ", pin->defiPin::layer(i));

if (pin->defiPin::hasLayerSpacing(i))

fprintf(fout, "SPACING %d ",

pin->defiPin::layerSpacing(i));

if (pin->defiPin::hasLayerDesignRuleWidth(i))

fprintf(fout, "DESIGNRULEWIDTH %d ",

pin->defiPin::layerDesignRuleWidth(i));

pin->defiPin::bounds(i, &xl, &yl, &xh, &yh);

fprintf(fout, "%d %d %d %d ", xl, yl, xh, yh);

}

for (i = 0; i < pin->defiPin::numPolygons(); i++) {

fprintf(fout, "\n + POLYGON %s ",

pin->defiPin::polygonName(i));

if (pin->defiPin::hasPolygonSpacing(i))

fprintf(fout, "SPACING %d ",

pin->defiPin::polygonSpacing(i));

if (pin->defiPin::hasPolygonDesignRuleWidth(i))

fprintf(fout, "DESIGNRULEWIDTH %d ",

pin->defiPin::polygonDesignRuleWidth(i));

points = pin->defiPin::getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

}

for (i = 0; i < pin->defiPin::numVias(); i++) {

fprintf(fout, "\n + VIA %s %d %d ", pin->defiPin::viaName(i),

pin->defiPin::viaPtX(i), pin->defiPin::viaPtY(i));

}

}

if (pin->defiPin::hasPort()) {

struct defiPoints points;

defiPinPort* port;

for (j = 0; j < pin->defiPin::numPorts(); j++) {

port = pin->defiPin::pinPort(j);

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

for (i = 0; i < port->defiPinPort::numLayer(); i++) {

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

port->defiPinPort::layer(i));

if (port->defiPinPort::hasLayerSpacing(i))

fprintf(fout, "SPACING %d ",

port->defiPinPort::layerSpacing(i));

if (port->defiPinPort::hasLayerDesignRuleWidth(i))

fprintf(fout, "DESIGNRULEWIDTH %d ",

port->defiPinPort::layerDesignRuleWidth(i));

port->defiPinPort::bounds(i, &xl, &yl, &xh, &yh);

fprintf(fout, "%d %d %d %d ", xl, yl, xh, yh);

}

for (i = 0; i < port->defiPinPort::numPolygons(); i++) {

fprintf(fout, "\n + POLYGON %s ",

port->defiPinPort::polygonName(i));

if (port->defiPinPort::hasPolygonSpacing(i))

fprintf(fout, "SPACING %d ",

port->defiPinPort::polygonSpacing(i));

if (port->defiPinPort::hasPolygonDesignRuleWidth(i))

fprintf(fout, "DESIGNRULEWIDTH %d ",

port->defiPinPort::polygonDesignRuleWidth(i));

points = port->defiPinPort::getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

}

for (i = 0; i < port->defiPinPort::numVias(); i++) {

fprintf(fout, "\n + VIA %s %g %g",

port->defiPinPort::viaName(i),

port->defiPinPort::viaPtX(i),

port->defiPinPort::viaPtY(i));

}

if (port->defiPinPort::hasPlacement()) {

if (port->defiPinPort::isPlaced()) {

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

fprintf(fout, "( %d %d ) %s ",

port->defiPinPort::placementX(),

port->defiPinPort::placementY(),

orientStr(port->defiPinPort::orient()));

}

if (port->defiPinPort::isCover()) {

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

fprintf(fout, "( %d %d ) %s ",

port->defiPinPort::placementX(),

port->defiPinPort::placementY(),

orientStr(port->defiPinPort::orient()));

}

if (port->defiPinPort::isFixed()) {

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

fprintf(fout, "( %d %d ) %s ",

port->defiPinPort::placementX(),

port->defiPinPort::placementY(),

orientStr(port->defiPinPort::orient()));

}

}

}

}

if (pin->defiPin::hasPlacement()) {

if (pin->defiPin::isPlaced()) {

fprintf(fout, "+ PLACED ");

fprintf(fout, "( %d %d ) %s ", pin->defiPin::placementX(),

pin->defiPin::placementY(),

orientStr(pin->defiPin::orient()));

}

if (pin->defiPin::isCover()) {

fprintf(fout, "+ COVER ");

fprintf(fout, "( %d %d ) %s ", pin->defiPin::placementX(),

pin->defiPin::placementY(),

orientStr(pin->defiPin::orient()));

}

if (pin->defiPin::isFixed()) {

fprintf(fout, "+ FIXED ");

fprintf(fout, "( %d %d ) %s ", pin->defiPin::placementX(),

pin->defiPin::placementY(),

orientStr(pin->defiPin::orient()));

}

if (pin->defiPin::isUnplaced())

fprintf(fout, "+ UNPLACED ");

}

if (pin->defiPin::hasSpecial()) {

fprintf(fout, "+ SPECIAL ");

}

if (pin->hasAPinPartialMetalArea()) {

for (i = 0; i < pin->defiPin::numAPinPartialMetalArea(); i++) {

fprintf(fout, "ANTENNAPINPARTIALMETALAREA %d",

pin->APinPartialMetalArea(i));

if (*(pin->APinPartialMetalAreaLayer(i)))

fprintf(fout, " LAYER %s",

pin->APinPartialMetalAreaLayer(i));

fprintf(fout, "\n");

}

}

if (pin->hasAPinPartialMetalSideArea()) {

for (i = 0; i < pin->defiPin::numAPinPartialMetalSideArea(); i++) {

fprintf(fout, "ANTENNAPINPARTIALMETALSIDEAREA %d",

pin->APinPartialMetalSideArea(i));

if (*(pin->APinPartialMetalSideAreaLayer(i)))

fprintf(fout, " LAYER %s",

pin->APinPartialMetalSideAreaLayer(i));

fprintf(fout, "\n");

}

}

if (pin->hasAPinDiffArea()) {

for (i = 0; i < pin->defiPin::numAPinDiffArea(); i++) {

fprintf(fout, "ANTENNAPINDIFFAREA %d", pin->APinDiffArea(i));

if (*(pin->APinDiffAreaLayer(i)))

fprintf(fout, " LAYER %s", pin->APinDiffAreaLayer(i));

fprintf(fout, "\n");

}

}

if (pin->hasAPinPartialCutArea()) {

for (i = 0; i < pin->defiPin::numAPinPartialCutArea(); i++) {

fprintf(fout, "ANTENNAPINPARTIALCUTAREA %d",

pin->APinPartialCutArea(i));

if (*(pin->APinPartialCutAreaLayer(i)))

fprintf(fout, " LAYER %s", pin->APinPartialCutAreaLayer(i));

fprintf(fout, "\n");

}

}

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

aModel = pin->antennaModel(j);

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

aModel->defiPinAntennaModel::antennaOxide());

if (aModel->hasAPinGateArea()) {

for (i = 0; i < aModel->defiPinAntennaModel::numAPinGateArea();

i++) {

fprintf(fout, "ANTENNAPINGATEAREA %d",

aModel->APinGateArea(i));

if (aModel->hasAPinGateAreaLayer(i))

fprintf(fout, " LAYER %s", aModel->APinGateAreaLayer(i));

fprintf(fout, "\n");

}

}

if (aModel->hasAPinMaxAreaCar()) {

for (i = 0;

i < aModel->defiPinAntennaModel::numAPinMaxAreaCar(); i++) {

fprintf(fout, "ANTENNAPINMAXAREACAR %d",

aModel->APinMaxAreaCar(i));

if (aModel->hasAPinMaxAreaCarLayer(i))

fprintf(fout,

" LAYER %s", aModel->APinMaxAreaCarLayer(i));

fprintf(fout, "\n");

}

}

if (aModel->hasAPinMaxSideAreaCar()) {

for (i = 0;

i < aModel->defiPinAntennaModel::numAPinMaxSideAreaCar();

i++) {

fprintf(fout, "ANTENNAPINMAXSIDEAREACAR %d",

aModel->APinMaxSideAreaCar(i));

if (aModel->hasAPinMaxSideAreaCarLayer(i))

fprintf(fout,

" LAYER %s", aModel->APinMaxSideAreaCarLayer(i));

fprintf(fout, "\n");

}

}

if (aModel->hasAPinMaxCutCar()) {

for (i = 0; i < aModel->defiPinAntennaModel::numAPinMaxCutCar();

i++) {

fprintf(fout, "ANTENNAPINMAXCUTCAR %d",

aModel->APinMaxCutCar(i));

if (aModel->hasAPinMaxCutCarLayer(i))

fprintf(fout, " LAYER %s",

aModel->APinMaxCutCarLayer(i));

fprintf(fout, "\n");

}

}

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrDefaultCapCbkType :

i = (long)cl;

fprintf(fout, "DEFAULTCAP %d\n", i);

numObjs = i;

break;

case defrRowCbkType :

row = (defiRow*)cl;

fprintf(fout, "ROW %s %s %g %g %s ", row->defiRow::name(),

row->defiRow::macro(), row->defiRow::x(), row->defiRow::y(),

orientStr(row->defiRow::orient()));

if (row->defiRow::hasDo()) {

fprintf(fout, "DO %g BY %g ",

row->defiRow::xNum(), row->defiRow::yNum());

if (row->defiRow::hasDoStep())

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

row->defiRow::xStep(), row->defiRow::yStep());

else

fprintf(fout, ";\n");

} else

fprintf(fout, ";\n");

if (row->defiRow::numProps() > 0) {

for (i = 0; i < row->defiRow::numProps(); i++) {

fprintf(fout, " + PROPERTY %s %s ",

row->defiRow::propName(i),

row->defiRow::propValue(i));

switch (row->defiRow::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");

}

break;

case defrTrackCbkType :

track = (defiTrack*)cl;

fprintf(fout, "TRACKS %s %g DO %g STEP %g LAYER ",

track->defiTrack::macro(), track->defiTrack::x(),

track->defiTrack::xNum(), track->defiTrack::xStep());

for (i = 0; i < track->defiTrack::numLayers(); i++)

fprintf(fout, "%s ", track->defiTrack::layer(i));

fprintf(fout, ";\n");

break;

case defrGcellGridCbkType :

gcg = (defiGcellGrid*)cl;

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

gcg->defiGcellGrid::macro(), gcg->defiGcellGrid::x(),

gcg->defiGcellGrid::xNum(), gcg->defiGcellGrid::xStep());

break;

case defrViaCbkType :

via = (defiVia*)cl;

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

if (via->defiVia::hasPattern())

fprintf(fout, "+ PATTERNNAME %s ", via->defiVia::pattern());

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

via->defiVia::layer(i, &name, &xl, &yl, &xh, &yh);

fprintf(fout, "+ RECT %s %d %d %d %d \n",

name, xl, yl, xh, yh);

}

// POLYGON

if (via->defiVia::numPolygons()) {

struct defiPoints points;

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

fprintf(fout, "\n + POLYGON %s ", via->polygonName(i));

points = via->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

}

}

fprintf(fout, " ;\n");

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

char *vrn, *bl, *cl, *tl;

int xs, ys, xcs, ycs, xbe, ybe, xte, yte;

int cr, cc, xo, yo, xbo, ybo, xto, yto;

(void)via->defiVia::viaRule(&vrn, &xs, &ys, &bl, &cl, &tl, &xcs,

&ycs, &xbe, &ybe, &xte, &yte);

fprintf(fout, "+ VIARULE '%s'\n", vrn);

fprintf(fout, " + CUTSIZE %d %d\n", xs, ys);

fprintf(fout, " + LAYERS %s %s %s\n", bl, cl, tl);

fprintf(fout, " + CUTSPACING %d %d\n", xcs, ycs);

fprintf(fout, " + ENCLOSURE %d %d %d %d\n", xbe, ybe, xte, yte);

if (via->defiVia::hasRowCol()) {

(void)via->defiVia::rowCol(&cr, &cc);

fprintf(fout, " + ROWCOL %d %d\n", cr, cc);

}

if (via->defiVia::hasOrigin()) {

(void)via->defiVia::origin(&xo, &yo);

fprintf(fout, " + ORIGIN %d %d\n", xo, yo);

}

if (via->defiVia::hasOffset()) {

(void)via->defiVia::offset(&xbo, &ybo, &xto, &yto);

fprintf(fout, " + OFFSET %d %d %d %d\n", xbo, ybo, xto, yto);

}

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

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

}

--numObjs;

if (numObjs <= 0)

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

break;

case defrRegionCbkType :

re = (defiRegion*)cl;

fprintf(fout, "- %s ", re->defiRegion::name());

for (i = 0; i < re->defiRegion::numRectangles(); i++)

fprintf(fout, "%d %d %d %d \n", re->defiRegion::xl(i),

re->defiRegion::yl(i), re->defiRegion::xh(i),

re->defiRegion::yh(i));

if (re->defiRegion::hasType())

fprintf(fout, "+ TYPE %s\n", re->defiRegion::type());

if (re->defiRegion::numProps()) {

for (i = 0; i < re->defiRegion::numProps(); i++) {

fprintf(fout, "+ PROPERTY %s %s ", re->defiRegion::propName(i),

re->defiRegion::propValue(i));

switch (re->defiRegion::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");

--numObjs;

if (numObjs <= 0) {

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

}

break;

case defrGroupNameCbkType :

if ((char*)cl) {

fprintf(fout, "- %s", (char*)cl);

break;

}

case defrGroupMemberCbkType :

if ((char*)cl) {

fprintf(fout, " %s", (char*)cl);

break;

}

case defrGroupCbkType :

group = (defiGroup*)cl;

if (group->defiGroup::hasMaxX() | group->defiGroup::hasMaxY()

| group->defiGroup::hasPerim()) {

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

if (group->defiGroup::hasPerim())

fprintf(fout, "MAXHALFPERIMETER %d ",

group->defiGroup::perim());

if (group->defiGroup::hasMaxX())

fprintf(fout, "MAXX %d ", group->defiGroup::maxX());

if (group->defiGroup::hasMaxY())

fprintf(fout, "MAXY %d ", group->defiGroup::maxY());

}

if (group->defiGroup::hasRegionName())

fprintf(fout, "\n + REGION %s ", group->defiGroup::regionName());

if (group->defiGroup::hasRegionBox()) {

int *gxl, *gyl, *gxh, *gyh;

int size;

group->defiGroup::regionRects(&size, &gxl, &gyl, &gxh, &gyh);

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

fprintf(fout, "REGION %d %d %d %d ", gxl[i], gyl[i],

gxh[i], gyh[i]);

}

if (group->defiGroup::numProps()) {

for (i = 0; i < group->defiGroup::numProps(); i++) {

fprintf(fout, "\n + PROPERTY %s %s ",

group->defiGroup::propName(i),

group->defiGroup::propValue(i));

switch (group->defiGroup::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");

--numObjs;

if (numObjs <= 0)

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

break;

case defrScanchainCbkType :

sc = (defiScanchain*)cl;

fprintf(fout, "- %s\n", sc->defiScanchain::name());

if (sc->defiScanchain::hasStart()) {

sc->defiScanchain::start(&a1, &b1);

fprintf(fout, " + START %s %s\n", a1, b1);

}

if (sc->defiScanchain::hasStop()) {

sc->defiScanchain::stop(&a1, &b1);

fprintf(fout, " + STOP %s %s\n", a1, b1);

}

if (sc->defiScanchain::hasCommonInPin() ||

sc->defiScanchain::hasCommonOutPin()) {

fprintf(fout, " + COMMONSCANPINS ");

if (sc->defiScanchain::hasCommonInPin())

fprintf(fout, " ( IN %s ) ", sc->defiScanchain::commonInPin());

if (sc->defiScanchain::hasCommonOutPin())

fprintf(fout, " ( OUT %s ) ",sc->defiScanchain::commonOutPin());

fprintf(fout, "\n");

}

if (sc->defiScanchain::hasFloating()) {

sc->defiScanchain::floating(&size, &inst, &inPin, &outPin, &bits);

if (size > 0)

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

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

fprintf(fout, " %s ", inst[i]);

if (inPin[i])

fprintf(fout, "( IN %s ) ", inPin[i]);

if (outPin[i])

fprintf(fout, "( OUT %s ) ", outPin[i]);

if (bits[i] != -1)

fprintf(fout, "( BITS %d ) ", bits[i]);

fprintf(fout, "\n");

}

}

if (sc->defiScanchain::hasOrdered()) {

for (i = 0; i < sc->defiScanchain::numOrderedLists(); i++) {

sc->defiScanchain::ordered(i, &size, &inst, &inPin, &outPin,

&bits);

if (size > 0)

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

for (j = 0; j < size; j++) {

fprintf(fout, " %s ", inst[j]);

if (inPin[j])

fprintf(fout, "( IN %s ) ", inPin[j]);

if (outPin[j])

fprintf(fout, "( OUT %s ) ", outPin[j]);

if (bits[j] != -1)

fprintf(fout, "( BITS %d ) ", bits[j]);

fprintf(fout, "\n");

}

}

}

if (sc->defiScanchain::hasPartition()) {

fprintf(fout, " + PARTITION %s ",

sc->defiScanchain::partitionName());

if (sc->defiScanchain::hasPartitionMaxBits())

fprintf(fout, "MAXBITS %d ",

sc->defiScanchain::partitionMaxBits());

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrIOTimingCbkType :

iot = (defiIOTiming*)cl;

fprintf(fout, "- ( %s %s )\n", iot->defiIOTiming::inst(),

iot->defiIOTiming::pin());

if (iot->defiIOTiming::hasSlewRise())

fprintf(fout, " + RISE SLEWRATE %g %g\n",

iot->defiIOTiming::slewRiseMin(),

iot->defiIOTiming::slewRiseMax());

if (iot->defiIOTiming::hasSlewFall())

fprintf(fout, " + FALL SLEWRATE %g %g\n",

iot->defiIOTiming::slewFallMin(),

iot->defiIOTiming::slewFallMax());

if (iot->defiIOTiming::hasVariableRise())

fprintf(fout, " + RISE VARIABLE %g %g\n",

iot->defiIOTiming::variableRiseMin(),

iot->defiIOTiming::variableRiseMax());

if (iot->defiIOTiming::hasVariableFall())

fprintf(fout, " + FALL VARIABLE %g %g\n",

iot->defiIOTiming::variableFallMin(),

iot->defiIOTiming::variableFallMax());

if (iot->defiIOTiming::hasCapacitance())

fprintf(fout, " + CAPACITANCE %g\n",

iot->defiIOTiming::capacitance());

if (iot->defiIOTiming::hasDriveCell()) {

fprintf(fout, " + DRIVECELL %s ",

iot->defiIOTiming::driveCell());

if (iot->defiIOTiming::hasFrom())

fprintf(fout, " FROMPIN %s ",

iot->defiIOTiming::from());

if (iot->defiIOTiming::hasTo())

fprintf(fout, " TOPIN %s ",

iot->defiIOTiming::to());

if (iot->defiIOTiming::hasParallel())

fprintf(fout, "PARALLEL %g",

iot->defiIOTiming::parallel());

fprintf(fout, "\n");

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrFPCCbkType :

fpc = (defiFPC*)cl;

fprintf(fout, "- %s ", fpc->defiFPC::name());

if (fpc->defiFPC::isVertical())

fprintf(fout, "VERTICAL ");

if (fpc->defiFPC::isHorizontal())

fprintf(fout, "HORIZONTAL ");

if (fpc->defiFPC::hasAlign())

fprintf(fout, "ALIGN ");

if (fpc->defiFPC::hasMax())

fprintf(fout, "%g ", fpc->defiFPC::alignMax());

if (fpc->defiFPC::hasMin())

fprintf(fout, "%g ", fpc->defiFPC::alignMin());

if (fpc->defiFPC::hasEqual())

fprintf(fout, "%g ", fpc->defiFPC::equal());

for (i = 0; i < fpc->defiFPC::numParts(); i++) {

fpc->defiFPC::getPart(i, &corner, &typ, &name);

if (corner == 'B')

fprintf(fout, "BOTTOMLEFT ");

else

fprintf(fout, "TOPRIGHT ");

if (typ == 'R')

fprintf(fout, "ROWS %s ", name);

else

fprintf(fout, "COMPS %s ", name);

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrTimingDisableCbkType :

td = (defiTimingDisable*)cl;

if (td->defiTimingDisable::hasFromTo())

fprintf(fout, "- FROMPIN %s %s ",

td->defiTimingDisable::fromInst(),

td->defiTimingDisable::fromPin(),

td->defiTimingDisable::toInst(),

td->defiTimingDisable::toPin());

if (td->defiTimingDisable::hasThru())

fprintf(fout, "- THRUPIN %s %s ",

td->defiTimingDisable::thruInst(),

td->defiTimingDisable::thruPin());

if (td->defiTimingDisable::hasMacroFromTo())

fprintf(fout, "- MACRO %s FROMPIN %s %s ",

td->defiTimingDisable::macroName(),

td->defiTimingDisable::fromPin(),

td->defiTimingDisable::toPin());

if (td->defiTimingDisable::hasMacroThru())

fprintf(fout, "- MACRO %s THRUPIN %s %s ",

td->defiTimingDisable::macroName(),

td->defiTimingDisable::fromPin());

fprintf(fout, ";\n");

break;

case defrPartitionCbkType :

part = (defiPartition*)cl;

fprintf(fout, "- %s ", part->defiPartition::name());

if (part->defiPartition::isSetupRise() |

part->defiPartition::isSetupFall() |

part->defiPartition::isHoldRise() |

part->defiPartition::isHoldFall()) {

// has turnoff

fprintf(fout, "TURNOFF ");

if (part->defiPartition::isSetupRise())

fprintf(fout, "SETUPRISE ");

if (part->defiPartition::isSetupFall())

fprintf(fout, "SETUPFALL ");

if (part->defiPartition::isHoldRise())

fprintf(fout, "HOLDRISE ");

if (part->defiPartition::isHoldFall())

fprintf(fout, "HOLDFALL ");

}

itemT = part->defiPartition::itemType();

dir = part->defiPartition::direction();

if (strcmp(itemT, "CLOCK") == 0) {

if (dir == 'T') // toclockpin

fprintf(fout, "+ TOCLOCKPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

if (dir == 'F') // fromclockpin

fprintf(fout, "+ FROMCLOCKPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

if (part->defiPartition::hasMin())

fprintf(fout, "MIN %g %g ",

part->defiPartition::partitionMin(),

part->defiPartition::partitionMax());

if (part->defiPartition::hasMax())

fprintf(fout, "MAX %g %g ",

part->defiPartition::partitionMin(),

part->defiPartition::partitionMax());

fprintf(fout, "PINS ");

for (i = 0; i < part->defiPartition::numPins(); i++)

fprintf(fout, "%s ", part->defiPartition::pin(i));

} else if (strcmp(itemT, "IO") == 0) {

if (dir == 'T') // toiopin

fprintf(fout, "+ TOIOPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

if (dir == 'F') // fromiopin

fprintf(fout, "+ FROMIOPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

} else if (strcmp(itemT, "COMP") == 0) {

if (dir == 'T') // tocomppin

fprintf(fout, "+ TOCOMPPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

if (dir == 'F') // fromcomppin

fprintf(fout, "+ FROMCOMPPIN %s %s ",

part->defiPartition::instName(),

part->defiPartition::pinName());

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrPinPropCbkType :

pprop = (defiPinProp*)cl;

if (pprop->defiPinProp::isPin())

fprintf(fout, "- PIN %s ", pprop->defiPinProp::pinName());

else

fprintf(fout, "- %s %s ",

pprop->defiPinProp::instName(),

pprop->defiPinProp::pinName());

fprintf(fout, ";\n");

if (pprop->defiPinProp::numProps() > 0) {

for (i = 0; i < pprop->defiPinProp::numProps(); i++) {

fprintf(fout, " + PROPERTY %s %s ",

pprop->defiPinProp::propName(i),

pprop->defiPinProp::propValue(i));

switch (pprop->defiPinProp::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");

}

--numObjs;

if (numObjs <= 0)

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

break;

case defrBlockageCbkType :

block = (defiBlockage*)cl;

if (block->defiBlockage::hasLayer()) {

fprintf(fout, "- LAYER %s\n", block->defiBlockage::layerName());

if (block->defiBlockage::hasComponent())

fprintf(fout, " + COMPONENT %s\n",

block->defiBlockage::layerComponentName());

if (block->defiBlockage::hasSlots())

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

if (block->defiBlockage::hasFills())

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

if (block->defiBlockage::hasPushdown())

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

if (block->defiBlockage::hasExceptpgnet())

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

if (block->defiBlockage::hasSpacing())

fprintf(fout, " + SPACING %d\n",

block->defiBlockage::minSpacing());

if (block->defiBlockage::hasDesignRuleWidth())

fprintf(fout, " + DESIGNRULEWIDTH %d\n",

block->defiBlockage::designRuleWidth());

}

else if (block->defiBlockage::hasPlacement()) {

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

if (block->defiBlockage::hasSoft())

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

if (block->defiBlockage::hasPartial())

fprintf(fout, " + PARTIAL %g\n",

block->defiBlockage::placementMaxDensity());

if (block->defiBlockage::hasComponent())

fprintf(fout, " + COMPONENT %s\n",

block->defiBlockage::placementComponentName());

if (block->defiBlockage::hasPushdown())

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

}

for (i = 0; i < block->defiBlockage::numRectangles(); i++) {

fprintf(fout, " RECT %d %d %d %d\n",

block->defiBlockage::xl(i), block->defiBlockage::yl(i),

block->defiBlockage::xh(i), block->defiBlockage::yh(i));

}

for (i = 0; i < block->defiBlockage::numPolygons(); i++) {

fprintf(fout, " POLYGON ");

points = block->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

fprintf(fout, "\n");

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrSlotCbkType :

slots = (defiSlot*)cl;

if (slots->defiSlot::hasLayer())

fprintf(fout, "- LAYER %s\n", slots->defiSlot::layerName());

for (i = 0; i < slots->defiSlot::numRectangles(); i++) {

fprintf(fout, " RECT %d %d %d %d\n",

slots->defiSlot::xl(i), slots->defiSlot::yl(i),

slots->defiSlot::xh(i), slots->defiSlot::yh(i));

}

for (i = 0; i < slots->defiSlot::numPolygons(); i++) {

fprintf(fout, " POLYGON ");

points = slots->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

fprintf(fout, ";\n");

}

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

case defrFillCbkType :

fills = (defiFill*)cl;

if (fills->defiFill::hasLayer()) {

fprintf(fout, "- LAYER %s", fills->defiFill::layerName());

if (fills->defiFill::hasLayerOpc())

fprintf(fout, " + OPC");

fprintf(fout, "\n");

for (i = 0; i < fills->defiFill::numRectangles(); i++) {

fprintf(fout, " RECT %d %d %d %d\n",

fills->defiFill::xl(i), fills->defiFill::yl(i),

fills->defiFill::xh(i), fills->defiFill::yh(i));

}

for (i = 0; i < fills->defiFill::numPolygons(); i++) {

fprintf(fout, " POLYGON ");

points = fills->getPolygon(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

fprintf(fout, ";\n");

}

fprintf(fout, ";\n");

}

--numObjs;

if (fills->defiFill::hasVia()) {

fprintf(fout, "- VIA %s", fills->defiFill::viaName());

if (fills->defiFill::hasViaOpc())

fprintf(fout, " + OPC");

fprintf(fout, "\n");

for (i = 0; i < fills->defiFill::numViaPts(); i++) {

points = fills->getViaPts(i);

for (j = 0; j < points.numPoints; j++)

fprintf(fout, " %d %d", points.x[j], points.y[j]);

fprintf(fout, ";\n");

}

fprintf(fout, ";\n");

}

if (numObjs <= 0)

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

break;

case defrStylesCbkType :

struct defiPoints points;

styles = (defiStyles*)cl;

fprintf(fout, "- STYLE %d ", styles->defiStyles::style());

points = styles->defiStyles::getPolygon();

for (j = 0; j < points.numPoints; j++)

fprintf(fout, "%d %d ", points.x[j], points.y[j]);

fprintf(fout, ";\n");

--numObjs;

if (numObjs <= 0)

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

break;

default: fprintf(fout, "BOGUS callback to cls.\n"); return 1;

}

return 0;

}

int dn(defrCallbackType_e c, const char* h, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "DIVIDERCHAR \"%s\" ;\n",h);

return 0;

}

int ext(defrCallbackType_e t, const char* c, defiUserData ud) {

char* name;

checkType(t);

if ((long)ud != userData) dataError();

switch (t) {

case defrNetExtCbkType : name = address("net"); break;

case defrComponentExtCbkType : name = address("component"); break;

case defrPinExtCbkType : name = address("pin"); break;

case defrViaExtCbkType : name = address("via"); break;

case defrNetConnectionExtCbkType : name = address("net connection"); break;

case defrGroupExtCbkType : name = address("group"); break;

case defrScanChainExtCbkType : name = address("scanchain"); break;

case defrIoTimingsExtCbkType : name = address("io timing"); break;

case defrPartitionsExtCbkType : name = address("partition"); break;

default: name = address("BOGUS"); return 1;

}

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

return 0;

}

int extension(defrCallbackType_e c, const char* extsn, defiUserData ud) {

checkType(c);

if ((long)ud != userData) dataError();

fprintf(fout, "BEGINEXT %s\n", extsn);

return 0;

}

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

int num = 1734;

char* inFile[6];

char* outFile;

FILE* f;

int res;

int noCalls = 0;

int retStr = 0;

int numInFile = 0;

int fileCt = 0;

strcpy(defaultName, "def.in");

strcpy(defaultOut, "list");

inFile[0] = defaultName;

outFile = defaultOut;

fout = stdout;

userData = 0x01020304;

argc--;

argv++;

while (argc--) {

if (strcmp(*argv, "-d") == 0) {

argv++;

argc--;

sscanf(*argv, "%d", &num);

defiSetDebug(num, 1);

} else if (strcmp(*argv, "-nc") == 0) {

noCalls = 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 (argv[0][0] != '-') {

if (numInFile >= 6) {

fprintf(stderr, "ERROR: too many input files, max = 6.\n");

return 2;

}

inFile[numInFile++] = *argv;

} else if (strcmp(*argv, "-h") == 0) {

fprintf(stderr, "Usage: defrw [<defFilename>] [-o <outputFilename>]\n");

return 2;

} else if (strcmp(*argv, "-setSNetWireCbk") == 0) {

setSNetWireCbk = 1;

} else {

fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);

return 2;

}

argv++;

}

if (noCalls == 0) {

defrSetUserData((void*)3);

defrSetDesignCbk(dname);

defrSetTechnologyCbk(tname);

defrSetExtensionCbk(extension);

defrSetDesignEndCbk(done);

defrSetPropDefStartCbk(propstart);

defrSetPropCbk(prop);

defrSetPropDefEndCbk(propend);

defrSetNetCbk(netf);

defrSetNetNameCbk(netNamef);

defrSetNetNonDefaultRuleCbk(nondefRulef);

defrSetNetSubnetNameCbk(subnetNamef);

defrSetNetPartialPathCbk(netpath);

defrSetSNetCbk(snetf);

defrSetSNetPartialPathCbk(snetpath);

if (setSNetWireCbk)

defrSetSNetWireCbk(snetwire);

defrSetComponentCbk(compf);

defrSetAddPathToNet();

defrSetHistoryCbk(hist);

defrSetConstraintCbk(constraint);

defrSetAssertionCbk(constraint);

defrSetArrayNameCbk(an);

defrSetFloorPlanNameCbk(fn);

defrSetDividerCbk(dn);

defrSetBusBitCbk(bbn);

defrSetNonDefaultCbk(ndr);

defrSetAssertionsStartCbk(constraintst);

defrSetConstraintsStartCbk(constraintst);

defrSetComponentStartCbk(cs);

defrSetPinPropStartCbk(cs);

defrSetNetStartCbk(cs);

defrSetStartPinsCbk(cs);

defrSetViaStartCbk(cs);

defrSetRegionStartCbk(cs);

defrSetSNetStartCbk(cs);

defrSetGroupsStartCbk(cs);

defrSetScanchainsStartCbk(cs);

defrSetIOTimingsStartCbk(cs);

defrSetFPCStartCbk(cs);

defrSetTimingDisablesStartCbk(cs);

defrSetPartitionsStartCbk(cs);

defrSetBlockageStartCbk(cs);

defrSetSlotStartCbk(cs);

defrSetFillStartCbk(cs);

defrSetNonDefaultStartCbk(cs);

defrSetStylesStartCbk(cs);

// All of the extensions point to the same function.

defrSetNetExtCbk(ext);

defrSetComponentExtCbk(ext);

defrSetPinExtCbk(ext);

defrSetViaExtCbk(ext);

defrSetNetConnectionExtCbk(ext);

defrSetGroupExtCbk(ext);

defrSetScanChainExtCbk(ext);

defrSetIoTimingsExtCbk(ext);

defrSetPartitionsExtCbk(ext);

defrSetUnitsCbk(units);

if (!retStr)

defrSetVersionCbk(vers);

else

defrSetVersionStrCbk(versStr);

defrSetCaseSensitiveCbk(casesens);

// The following calls are an example of using one function "cls"

// to be the callback for many DIFFERENT types of constructs.

// We have to cast the function type to meet the requirements

// of each different set function.

defrSetSiteCbk((defrSiteCbkFnType)cls);

defrSetCanplaceCbk((defrSiteCbkFnType)cls);

defrSetCannotOccupyCbk((defrSiteCbkFnType)cls);

defrSetDieAreaCbk((defrBoxCbkFnType)cls);

defrSetPinCapCbk((defrPinCapCbkFnType)cls);

defrSetPinCbk((defrPinCbkFnType)cls);

defrSetPinPropCbk((defrPinPropCbkFnType)cls);

defrSetDefaultCapCbk((defrIntegerCbkFnType)cls);

defrSetRowCbk((defrRowCbkFnType)cls);

defrSetTrackCbk((defrTrackCbkFnType)cls);

defrSetGcellGridCbk((defrGcellGridCbkFnType)cls);

defrSetViaCbk((defrViaCbkFnType)cls);

defrSetRegionCbk((defrRegionCbkFnType)cls);

defrSetGroupNameCbk((defrStringCbkFnType)cls);

defrSetGroupMemberCbk((defrStringCbkFnType)cls);

defrSetGroupCbk((defrGroupCbkFnType)cls);

defrSetScanchainCbk((defrScanchainCbkFnType)cls);

defrSetIOTimingCbk((defrIOTimingCbkFnType)cls);

defrSetFPCCbk((defrFPCCbkFnType)cls);

defrSetTimingDisableCbk((defrTimingDisableCbkFnType)cls);

defrSetPartitionCbk((defrPartitionCbkFnType)cls);

defrSetBlockageCbk((defrBlockageCbkFnType)cls);

defrSetSlotCbk((defrSlotCbkFnType)cls);

defrSetFillCbk((defrFillCbkFnType)cls);

defrSetStylesCbk((defrStylesCbkFnType)cls);

defrSetAssertionsEndCbk(endfunc);

defrSetComponentEndCbk(endfunc);

defrSetConstraintsEndCbk(endfunc);

defrSetNetEndCbk(endfunc);

defrSetFPCEndCbk(endfunc);

defrSetFPCEndCbk(endfunc);

defrSetGroupsEndCbk(endfunc);

defrSetIOTimingsEndCbk(endfunc);

defrSetNetEndCbk(endfunc);

defrSetPartitionsEndCbk(endfunc);

defrSetRegionEndCbk(endfunc);

defrSetSNetEndCbk(endfunc);

defrSetScanchainsEndCbk(endfunc);

defrSetPinEndCbk(endfunc);

defrSetTimingDisablesEndCbk(endfunc);

defrSetViaEndCbk(endfunc);

defrSetPinPropEndCbk(endfunc);

defrSetBlockageEndCbk(endfunc);

defrSetSlotEndCbk(endfunc);

defrSetFillEndCbk(endfunc);

defrSetNonDefaultEndCbk(endfunc);

defrSetStylesEndCbk(endfunc);

defrSetMallocFunction(mallocCB);

defrSetReallocFunction(reallocCB);

defrSetFreeFunction(freeCB);

defrSetLineNumberFunction(lineNumberCB);

defrSetDeltaNumberLines(50);

// Testing to set the number of warnings

defrSetAssertionWarnings(3);

defrSetBlockageWarnings(3);

defrSetCaseSensitiveWarnings(3);

defrSetComponentWarnings(3);

defrSetConstraintWarnings(0);

defrSetDefaultCapWarnings(3);

defrSetGcellGridWarnings(3);

defrSetIOTimingWarnings(3);

defrSetNetWarnings(3);

defrSetNonDefaultWarnings(3);

defrSetPinExtWarnings(3);

defrSetPinWarnings(3);

defrSetRegionWarnings(3);

defrSetRowWarnings(3);

defrSetScanchainWarnings(3);

defrSetSNetWarnings(3);

defrSetStylesWarnings(3);

defrSetTrackWarnings(3);

defrSetUnitsWarnings(3);

defrSetVersionWarnings(3);

defrSetViaWarnings(3);

}

defrInit();

for (fileCt = 0; fileCt < numInFile; fileCt++) {

defrReset();

if ((f = fopen(inFile[fileCt],"r")) == 0) {

fprintf(stderr,"Couldn't open input file '%s'\n", inFile[fileCt]);

return(2);

}

// Set case sensitive to 0 to start with, in History & PropertyDefinition

// reset it to 1.

res = defrRead(f, inFile[fileCt], (void*)userData, 1);

if (res)

fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);

(void)defrPrintUnusedCallbacks(fout);

(void)defrReleaseNResetMemory();

}

fclose(fout);

return res;

}

## DEF Writer Example

#include <stdlib.h>

#include <stdio.h>

#include <string.h>

#ifndef WIN32

# include <unistd.h>

#endif /* not WIN32 */

#include "defwWriter.hpp"

char defaultOut[128];

// Global variables

FILE* fout;

#define CHECK_STATUS(status) \

if (status) { \

defwPrintError(status); \

return(status); \

}

int main(int argc, char** argv) {

char* outfile;

int status; // return code, if none 0 means error

int lineNumber = 0;

const char** layers;

const char** foreigns;

int *foreignX, *foreignY, *foreignOrient;

const char** foreignOrientStr;

const char **coorX, **coorY;

const char **coorValue;

const char **groupExpr;

int *xPoints, *yPoints;

double *xP, *yP;

// assign the default

strcpy(defaultOut, "def.in");

outfile = defaultOut;

fout = stdout;

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: defwrite [-o <filename>] [-help]\n");

return 1;

} else {

fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);

return 2;

}

argv++;

}

status = defwInitCbk(fout);

CHECK_STATUS(status);

status = defwVersion (5, 7);

CHECK_STATUS(status);

status = defwDividerChar(":");

CHECK_STATUS(status);

status = defwBusBitChars("[]");

CHECK_STATUS(status);

status = defwDesignName("muk");

CHECK_STATUS(status);

status = defwTechnology("muk");

CHECK_STATUS(status);

status = defwArray("core_array");

CHECK_STATUS(status);

status = defwFloorplan("DEFAULT");

CHECK_STATUS(status);

status = defwUnits(100);

CHECK_STATUS(status);

// initalize

status = defwNewLine();

CHECK_STATUS(status);

// history

status = defwHistory("Corrected STEP for ROW_9 and added ROW_10 of SITE CORE1 (def)");

CHECK_STATUS(status);

status = defwHistory("Removed NONDEFAULTRULE from the net XX100 (def)");

CHECK_STATUS(status);

status = defwHistory("Changed some cell orientations (def)");

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

// PROPERTYDEFINITIONS

status = defwStartPropDef();

CHECK_STATUS(status);

defwAddComment("defwPropDef is broken into 3 routines, defwStringPropDef");

defwAddComment("defwIntPropDef, and defwRealPropDef");

status = defwStringPropDef("REGION", "scum", 0, 0, 0 );

CHECK_STATUS(status);

status = defwIntPropDef("REGION", "center", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("REGION", "area", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("GROUP", "ggrp", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("GROUP", "site", 0, 25, 0);

CHECK_STATUS(status);

status = defwRealPropDef("GROUP", "maxarea", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("COMPONENT", "cc", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("COMPONENT", "index", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("COMPONENT", "size", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("NET", "alt", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("NET", "lastName", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("NET", "length", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("SPECIALNET", "contype", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("SPECIALNET", "ind", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("SPECIALNET", "maxlength", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("DESIGN", "title", 0, 0, "Buffer");

CHECK_STATUS(status);

status = defwIntPropDef("DESIGN", "priority", 0, 0, 14);

CHECK_STATUS(status);

status = defwRealPropDef("DESIGN", "howbig", 0, 0, 15.16);

CHECK_STATUS(status);

status = defwRealPropDef("ROW", "minlength", 1.0, 100.0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("ROW", "firstName", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("ROW", "idx", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("COMPONENTPIN", "dpIgnoreTerm", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("COMPONENTPIN", "dpBit", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("COMPONENTPIN", "realProperty", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("NET", "IGNOREOPTIMIZATION", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("SPECIALNET", "IGNOREOPTIMIZATION", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("NET", "FREQUENCY", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("SPECIALNET", "FREQUENCY", 0, 0, 0);

CHECK_STATUS(status);

status = defwStringPropDef("NONDEFAULTRULE", "ndprop1", 0, 0, 0);

CHECK_STATUS(status);

status = defwIntPropDef("NONDEFAULTRULE", "ndprop2", 0, 0, 0);

CHECK_STATUS(status);

status = defwRealPropDef("NONDEFAULTRULE", "ndprop3", 0, 0, 0.009);

CHECK_STATUS(status);

status = defwRealPropDef("NONDEFAULTRULE", "ndprop4", .1, 1.0, 0);

CHECK_STATUS(status);

status = defwEndPropDef();

CHECK_STATUS(status);

// DIEAREA

xPoints = (int*)malloc(sizeof(int)*6);

yPoints = (int*)malloc(sizeof(int)*6);

xPoints[0] = 2000;

yPoints[0] = 2000;

xPoints[1] = 3000;

yPoints[1] = 3000;

xPoints[2] = 4000;

yPoints[2] = 4000;

xPoints[3] = 5000;

yPoints[3] = 5000;

xPoints[4] = 6000;

yPoints[4] = 6000;

xPoints[5] = 7000;

yPoints[5] = 7000;

status = defwDieAreaList(6, xPoints, yPoints);

CHECK_STATUS(status);

free((char*)xPoints);

free((char*)yPoints);

status = defwNewLine();

CHECK_STATUS(status);

// ROW

status = defwRow("ROW_9", "CORE", -177320, -111250, 6, 911, 1, 360, 0);

CHECK_STATUS(status);

status = defwRealProperty("minlength", 50.5);

CHECK_STATUS(status);

status = defwStringProperty("firstName", "Only");

CHECK_STATUS(status);

status = defwIntProperty("idx", 1);

CHECK_STATUS(status);

status = defwRowStr("ROW_10", "CORE1", -19000, -11000, "FN", 1, 100, 0, 600);

CHECK_STATUS(status);

status = defwRowStr("ROW_11", "CORE1", -19000, -11000, "FN", 1, 100, 0, 0);

CHECK_STATUS(status);

status = defwRow("ROW_12", "CORE1", -19000, -11000, 3, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwRowStr("ROW_13", "CORE1", -19000, -11000, "FN", 0, 0, 0, 0);

CHECK_STATUS(status);

// TRACKS

layers = (const char**)malloc(sizeof(char*)*1);

layers[0] = strdup("M1");

status = defwTracks("X", 3000, 40, 120, 1, layers);

CHECK_STATUS(status);

free((char*)layers[0]);

layers[0] = strdup("M2");

status = defwTracks("Y", 5000, 10, 20, 1,layers);

CHECK_STATUS(status);

free((char*)layers[0]);

free((char*)layers);

status = defwNewLine();

CHECK_STATUS(status);

// GCELLGRID

status = defwGcellGrid("X", 0, 100, 600);

CHECK_STATUS(status);

status = defwGcellGrid("Y", 10, 120, 400);

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

// CANPLACE

status = defwCanPlaceStr("dp", 45, 64, "N", 35, 1, 39, 1);

CHECK_STATUS(status);

status = defwCanPlace("dp", 45, 64, 1, 35, 1, 39, 1);

CHECK_STATUS(status);

// CANNOTOCCUPY

status = defwCannotOccupyStr("dp", 54, 44, "S", 55, 2, 45, 3);

CHECK_STATUS(status);

// VIAS

status = defwStartVias(7);

CHECK_STATUS(status);

status = defwViaName("VIA_ARRAY");

CHECK_STATUS(status);

status = defwViaPattern("P1-435-543-IJ1FS");

CHECK_STATUS(status);

status = defwViaRect("M1", -40, -40, 40, 40);

CHECK_STATUS(status);

status = defwViaRect("V1", -40, -40, 40, 40);

CHECK_STATUS(status);

status = defwViaRect("M2", -50, -50, 50, 50);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

status = defwViaName("VIA_ARRAY1");

CHECK_STATUS(status);

status = defwViaRect("M1", -40, -40, 40, 40);

CHECK_STATUS(status);

status = defwViaRect("V1", -40, -40, 40, 40);

CHECK_STATUS(status);

status = defwViaRect("M2", -50, -50, 50, 50);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

status = defwViaName("myUnshiftedVia");

CHECK_STATUS(status);

status = defwViaViarule("myViaRule", 20, 20, "metal1", "cut12", "metal2",

5, 5, 0, 4, 0, 1);

CHECK_STATUS(status);

status = defwViaViaruleRowCol(2, 3);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

status = defwViaName("via2");

CHECK_STATUS(status);

status = defwViaViarule("viaRule2", 5, 6, "botLayer2", "cutLayer2",

"topLayer2", 6, 6, 1, 4, 1, 4);

CHECK_STATUS(status);

status = defwViaViaruleOrigin(10, -10);

CHECK_STATUS(status);

status = defwViaViaruleOffset(0, 0, 20, -20);

CHECK_STATUS(status);

status = defwViaViarulePattern("2_F0_2_F8_1_78");

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

status = defwViaName("via3");

CHECK_STATUS(status);

status = defwViaPattern("P2-435-543-IJ1FS");

CHECK_STATUS(status);

status = defwViaRect("M2", -40, -40, 40, 40);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

xP = (double*)malloc(sizeof(double)*6);

yP = (double*)malloc(sizeof(double)*6);

xP[0] = -2.1;

yP[0] = -1.0;

xP[1] = -2;

yP[1] = 1;

xP[2] = 2.1;

yP[2] = 1.0;

xP[3] = 2.0;

yP[3] = -1.0;

status = defwViaName("via4");

CHECK_STATUS(status);

status = defwViaPolygon("M3", 4, xP, yP);

CHECK_STATUS(status);

status = defwViaRect("M4", -40, -40, 40, 40);

CHECK_STATUS(status);

xP[0] = 100;

yP[0] = 100;

xP[1] = 200;

yP[1] = 200;

xP[2] = 300;

yP[2] = 300;

xP[3] = 400;

yP[3] = 400;

xP[4] = 500;

yP[4] = 500;

xP[5] = 600;

yP[5] = 600;

status = defwViaPolygon("M5", 6, xP, yP);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

xP[0] = 200;

yP[0] = 200;

xP[1] = 300;

yP[1] = 300;

xP[2] = 400;

yP[2] = 500;

xP[3] = 100;

yP[3] = 300;

xP[4] = 300;

yP[4] = 200;

status = defwViaName("via5");

CHECK_STATUS(status);

status = defwViaPolygon("M6", 5, xP, yP);

CHECK_STATUS(status);

status = defwOneViaEnd();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

status = defwEndVias();

CHECK_STATUS(status);

// REGIONS

status = defwStartRegions(2);

CHECK_STATUS(status);

status = defwRegionName("region1");

CHECK_STATUS(status);

status = defwRegionPoints(-500, -500, 300, 100);

CHECK_STATUS(status);

status = defwRegionPoints(500, 500, 1000, 1000);

CHECK_STATUS(status);

status = defwRegionType("FENCE");

CHECK_STATUS(status);

status = defwStringProperty("scum", "on top");

CHECK_STATUS(status);

status = defwIntProperty("center", 250);

CHECK_STATUS(status);

status = defwIntProperty("area", 730000);

CHECK_STATUS(status);

status = defwRegionName("region2");

CHECK_STATUS(status);

status = defwRegionPoints(4000, 0, 5000, 1000);

CHECK_STATUS(status);

status = defwStringProperty("scum", "on bottom");

CHECK_STATUS(status);

status = defwEndRegions();

CHECK_STATUS(status);

// COMPONENTS

foreigns = (const char**)malloc(sizeof(char*)*2);

foreignX = (int*)malloc(sizeof(int)*2);

foreignY = (int*)malloc(sizeof(int)*2);

foreignOrient = (int*)malloc(sizeof(int)*2);

foreignOrientStr = (const char**)malloc(sizeof(char*)*2);

status = defwStartComponents(11);

CHECK_STATUS(status);

status = defwComponent("Z38A01", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,

0, NULL, NULL, NULL, NULL, "PLACED", 18592, 5400, 6, 0,

NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponentHalo(100, 0, 50, 200);

CHECK_STATUS(status);

status = defwComponentStr("Z38A03", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,

0, NULL, NULL, NULL, NULL, "PLACED", 16576, 45600,

"FS", 0, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponentHalo(200, 2, 60, 300);

CHECK_STATUS(status);

status = defwComponent("Z38A05", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,

0, NULL, NULL, NULL, NULL, "PLACED", 51520, 9600, 6, 0,

NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponent("|i0", "INV_B", 0, NULL, "INV", NULL, NULL, NULL,

0, NULL, NULL, NULL, NULL, NULL, 0, 0, -1, 0,

"region1", 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponentHaloSoft(100, 0, 50, 200);

CHECK_STATUS(status);

status = defwComponent("|i1", "INV_B", 0, NULL, "INV", NULL, NULL, NULL,

0, NULL, NULL, NULL, NULL, "UNPLACED", 1000, 1000, 0,

0, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponent("cell1", "CHM6A", 0, NULL, NULL, "generator", NULL,

"USER", 0, NULL, NULL, NULL, NULL, "FIXED", 0, 10, 0,

100.4534535, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponent("cell2", "CHM6A", 0, NULL, NULL, NULL, NULL,

"NETLIST", 0, NULL, NULL, NULL, NULL, "COVER", 120,

10, 4, 2, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

foreigns[0] = strdup("gds2name");

foreignX[0] = -500;

foreignY[0] = -500;

foreignOrient[0] = 3;

status = defwComponent("cell3", "CHM6A", 0, NULL, NULL, NULL, NULL,

"TIMING", 1, foreigns, foreignX, foreignY,

foreignOrient, "PLACED", 240,

10, 0, 0, "region1", 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponentRouteHalo(100, "metal1", "metal3");

CHECK_STATUS(status);

free((char*)foreigns[0]);

foreigns[0] = strdup("gds3name");

foreignX[0] = -500;

foreignY[0] = -500;

foreignOrientStr[0] = strdup("FW");

foreigns[1] = strdup("gds4name");

foreignX[1] = -300;

foreignY[1] = -300;

foreignOrientStr[1] = strdup("FS");

status = defwComponentStr("cell4", "CHM3A", 0, NULL, "CHM6A", NULL, NULL,

"DIST", 2, foreigns, foreignX, foreignY,

foreignOrientStr, "PLACED", 360,

10, "W", 0, "region2", 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponentHaloSoft(100, 0, 50, 200);

CHECK_STATUS(status);

status = defwStringProperty("cc", "This is the copy list");

CHECK_STATUS(status);

status = defwIntProperty("index", 9);

CHECK_STATUS(status);

status = defwRealProperty("size", 7.8);

CHECK_STATUS(status);

status = defwComponent("scancell1", "CHK3A", 0, NULL, NULL, NULL, NULL,

NULL, 0, NULL, NULL, NULL, NULL, "PLACED", 500,

10, 7, 0, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwComponent("scancell2", "CHK3A", 0, NULL, NULL, NULL, NULL,

NULL, 0, NULL, NULL, NULL, NULL, "PLACED", 700,

10, 6, 0, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwEndComponents();

CHECK_STATUS(status);

free((char*)foreigns[0]);

free((char*)foreigns[1]);

free((char*)foreigns);

free((char*)foreignX);

free((char*)foreignY);

free((char*)foreignOrient);

free((char*)foreignOrientStr[0]);

free((char*)foreignOrientStr[1]);

free((char*)foreignOrientStr);

xP = (double*)malloc(sizeof(double)*6);

yP = (double*)malloc(sizeof(double)*6);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

// PINS

status = defwStartPins(11);

CHECK_STATUS(status);

status = defwPin("scanpin", "net1", 0, "INPUT", NULL, NULL, 0, 0, -1, NULL,

0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPinPolygon("metal1", 0, 1000, 6, xP, yP);

CHECK_STATUS(status);

status = defwPinNetExpr("power1 VDD1");

CHECK_STATUS(status);

status = defwPin("pin0", "net1", 0, "INPUT", "SCAN", NULL, 0, 0, -1, NULL,

0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPinStr("pin0.5", "net1", 0, "INPUT", "RESET", "FIXED", 0, 0, "S",

NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPinPolygon("metal2", 0, 0, 4, xP, yP);

CHECK_STATUS(status);

status = defwPinLayer("metal3", 500, 0, -5000, -100, -4950, -90);

CHECK_STATUS(status);

status = defwPin("pin1", "net1", 1, NULL, "POWER", NULL, 0, 0, -1, "M1",

-5000, -100, -4950, -90);

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalArea(4580, "M1");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalArea(4580, "M11");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalArea(4580, "M12");

CHECK_STATUS(status);

status = defwPinAntennaPinGateArea(4580, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinDiffArea(4580, "M3");

CHECK_STATUS(status);

status = defwPinAntennaPinDiffArea(4580, "M31");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxAreaCar(5000, "L1");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxSideAreaCar(5000, "M4");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialCutArea(4580, "M4");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxCutCar(5000, "L1");

CHECK_STATUS(status);

status = defwPin("pin2", "net2", 0, "INPUT", "SIGNAL", NULL, 0, 0, -1, "M1",

-5000, 0, -4950, 10);

CHECK_STATUS(status);

status = defwPinLayer("M1", 500, 0, -5000, 0, -4950, 10);

CHECK_STATUS(status);

status = defwPinPolygon("M2", 0, 0, 4, xP, yP);

CHECK_STATUS(status);

status = defwPinPolygon("M3", 0, 0, 3, xP, yP);

CHECK_STATUS(status);

status = defwPinLayer("M4", 0, 500, 0, 100, -400, 100);

CHECK_STATUS(status);

status = defwPinSupplySensitivity("vddpin1");

CHECK_STATUS(status);

status = defwPinGroundSensitivity("gndpin1");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalArea(5000, NULL);

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalSideArea(4580, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinGateArea(5000, NULL);

CHECK_STATUS(status);

status = defwPinAntennaPinPartialCutArea(5000, NULL);

CHECK_STATUS(status);

status = defwPin("INBUS[1]", "|INBUS[1]", 0, "INPUT", "SIGNAL", "FIXED",

45, -2160, 0, "M2", 0, 0, 30, 135);

CHECK_STATUS(status);

status = defwPinLayer("M2", 0, 0, 0, 0, 30, 135);

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalArea(1, "M1");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialMetalSideArea(2, "M1");

CHECK_STATUS(status);

status = defwPinAntennaPinDiffArea(4, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinPartialCutArea(5, "V1");

CHECK_STATUS(status);

status = defwPinAntennaModel("OXIDE1");

CHECK_STATUS(status);

status = defwPinAntennaPinGateArea(3, "M1");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxAreaCar(6, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxSideAreaCar(7, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxCutCar(8, "V1");

CHECK_STATUS(status);

status = defwPinAntennaModel("OXIDE2");

CHECK_STATUS(status);

status = defwPinAntennaPinGateArea(30, "M1");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxAreaCar(60, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxSideAreaCar(70, "M2");

CHECK_STATUS(status);

status = defwPinAntennaPinMaxCutCar(80, "V1");

CHECK_STATUS(status);

status = defwPin("INBUS<0>", "|INBUS<0>", 0, "INPUT", "SIGNAL", "PLACED",

-45, 2160, 1, "M2", 0, 0, 30, 134);

CHECK_STATUS(status);

status = defwPinLayer("M2", 0, 1000, 0, 0, 30, 134);

CHECK_STATUS(status);

status = defwPin("OUTBUS<1>", "|OUTBUS<1>", 0, "OUTPUT", "SIGNAL", "COVER",

2160, 645, 2, "M1", 0, 0, 30, 135);

CHECK_STATUS(status);

status = defwPinLayer("M1", 0, 0, 0, 0, 30, 134);

CHECK_STATUS(status);

status = defwPinNetExpr("gnd1 GND");

CHECK_STATUS(status);

status = defwPin("VDD", "VDD", 1, "INOUT", "POWER", NULL, 0, 0, -1, NULL,

0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPin("BUSA[0]", "BUSA[0]", 0, "INPUT", "SIGNAL", "PLACED",

0, 2500, 1, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPinLayer("M1", 0, 0, -25, 0, 25, 50);

CHECK_STATUS(status);

status = defwPinLayer("M2", 0, 0, -10, 0, 10, 75);

CHECK_STATUS(status);

status = defwPinVia("via12", 0, 25);

CHECK_STATUS(status);

status = defwPin("VDD", "VDD", 1, "INOUT", "POWER", NULL,

0, 0, -1, NULL, 0, 0, 0, 0);

CHECK_STATUS(status);

status = defwPinPort();

CHECK_STATUS(status);

status = defwPinPortLayer("M2", 0, 0, -25, 0, 25, 50);

CHECK_STATUS(status);

status = defwPinPortLocation("PLACED", 0, 2500, "S");

CHECK_STATUS(status);

status = defwPinPort();

CHECK_STATUS(status);

status = defwPinPortLayer("M1", 0, 0, -25, 0, 25, 50);

CHECK_STATUS(status);

status = defwPinPortLocation("COVER", 0, 2500, "S");

CHECK_STATUS(status);

status = defwPinPort();

CHECK_STATUS(status);

status = defwPinPortLayer("M1", 0, 0, -25, 0, 25, 50);

CHECK_STATUS(status);

status = defwPinPortLocation("FIXED", 0, 2500, "S");

CHECK_STATUS(status);

status = defwEndPins();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

// PINPROPERTIES

status = defwStartPinProperties(2);

CHECK_STATUS(status);

status = defwPinProperty("cell1", "PB1");

CHECK_STATUS(status);

status = defwStringProperty("dpBit", "1");

CHECK_STATUS(status);

status = defwRealProperty("realProperty", 3.4);

CHECK_STATUS(status);

status = defwPinProperty("cell2", "vdd");

CHECK_STATUS(status);

status = defwIntProperty("dpIgnoreTerm", 2);

CHECK_STATUS(status);

status = defwEndPinProperties();

CHECK_STATUS(status);

// SPECIALNETS

status = defwStartSpecialNets(7);

CHECK_STATUS(status);

status = defwSpecialNet("net1");

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell1", "VDD", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell2", "VDD", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell3", "VDD", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell4", "VDD", 0);

CHECK_STATUS(status);

status = defwSpecialNetWidth("M1", 200);

CHECK_STATUS(status);

status = defwSpecialNetWidth("M2", 300);

CHECK_STATUS(status);

status = defwSpecialNetVoltage(3.2);

CHECK_STATUS(status);

status = defwSpecialNetSpacing("M1", 200, 190, 210);

CHECK_STATUS(status);

status = defwSpecialNetSource("TIMING");

CHECK_STATUS(status);

status = defwSpecialNetOriginal("VDD");

CHECK_STATUS(status);

status = defwSpecialNetUse("POWER");

CHECK_STATUS(status);

status = defwSpecialNetWeight(30);

CHECK_STATUS(status);

status = defwStringProperty("contype", "star");

CHECK_STATUS(status);

status = defwIntProperty("ind", 1);

CHECK_STATUS(status);

status = defwRealProperty("maxlength", 12.13);

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

status = defwSpecialNet("VSS");

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell1", "GND", 1);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell2", "GND", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell3", "GND", 1);

CHECK_STATUS(status);

status = defwSpecialNetConnection("cell4", "GND", 0);

CHECK_STATUS(status);

status = defwSpecialNetUse("SCAN");

CHECK_STATUS(status);

status = defwSpecialNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M1");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(250);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("IOWIRE");

CHECK_STATUS(status);

coorX = (const char**)malloc(sizeof(char*)*3);

coorY = (const char**)malloc(sizeof(char*)*3);

coorValue = (const char**)malloc(sizeof(char*)*3);

coorX[0] = strdup("5");

coorY[0] = strdup("15");

coorValue[0] = NULL;

coorX[1] = strdup("125");

coorY[1] = strdup("*");

coorValue[1] = strdup("235");

coorX[2] = strdup("245");

coorY[2] = strdup("*");

coorValue[2] = strdup("255");

status = defwSpecialNetPathPointWithWireExt(3, coorX, coorY, coorValue);

CHECK_STATUS(status);

status = defwSpecialNetPathEnd();

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[0]);

free((char*)coorValue[1]);

free((char*)coorValue[2]);

free((char*)coorValue);

status = defwSpecialNetShieldStart("my_net");

CHECK_STATUS(status);

status = defwSpecialNetShieldLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetShieldWidth(90);

CHECK_STATUS(status);

status = defwSpecialNetShieldShape("STRIPE");

CHECK_STATUS(status);

coorX[0] = strdup("14100");

coorY[0] = strdup("342440");

coorX[1] = strdup("13920");

coorY[1] = strdup("*");

status = defwSpecialNetShieldPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldVia("M2_TURN");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

coorX[0] = strdup("*");

coorY[0] = strdup("263200");

status = defwSpecialNetShieldPoint(1, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldVia("M1_M2");

CHECK_STATUS(status);

status = defwSpecialNetShieldViaData(10, 20, 1000, 2000);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

coorX[0] = strdup("2400");

coorY[0] = strdup("*");

status = defwSpecialNetShieldPoint(1, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldEnd();

CHECK_STATUS(status);

status = defwSpecialNetShieldStart("my_net1");

CHECK_STATUS(status);

status = defwSpecialNetShieldLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetShieldWidth(90);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

coorX[0] = strdup("14100");

coorY[0] = strdup("342440");

coorX[1] = strdup("13920");

coorY[1] = strdup("*");

status = defwSpecialNetShieldPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldVia("M2_TURN");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

coorX[0] = strdup("*");

coorY[0] = strdup("263200");

status = defwSpecialNetShieldPoint(1, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldVia("M1_M2");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

coorX[0] = strdup("2400");

coorY[0] = strdup("*");

status = defwSpecialNetShieldPoint(1, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetShieldEnd();

CHECK_STATUS(status);

status = defwSpecialNetPattern("STEINER");

CHECK_STATUS(status);

status = defwSpecialNetEstCap(100);

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorX[2]);

free((char*)coorY[2]);

status = defwSpecialNet("VDD");

CHECK_STATUS(status);

status = defwSpecialNetConnection("*", "VDD", 0);

CHECK_STATUS(status);

status = defwSpecialNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("metal2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(100);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("RING");

CHECK_STATUS(status);

status = defwSpecialNetPathStyle(1);

CHECK_STATUS(status);

coorX[0] = strdup("0");

coorY[0] = strdup("0");

coorX[1] = strdup("100");

coorY[1] = strdup("100");

coorX[2] = strdup("200");

coorY[2] = strdup("100");

status = defwSpecialNetPathPoint(3, coorX, coorY);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorX[2]);

free((char*)coorY[2]);

status = defwSpecialNetPathStart("NEW");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(270);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("PADRING");

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwSpecialNetPathStart("NEW");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(270);

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetPathEnd();

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

status = defwSpecialNet("CLOCK");

CHECK_STATUS(status);

status = defwSpecialNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(200);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("BLOCKRING");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwSpecialNetPathStart("NEW");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(270);

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetPathEnd();

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwSpecialNet("VCC");

CHECK_STATUS(status);

status = defwSpecialNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(200);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("DRCFILL");

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwSpecialNetPathStart("NEW");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(270);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("STRIPE");

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetPathEnd();

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwSpecialNet("n1");

CHECK_STATUS(status);

status = defwSpecialNetConnection("PIN", "n1", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("driver1", "in", 0);

CHECK_STATUS(status);

status = defwSpecialNetConnection("bumpa1", "bumppin", 0);

CHECK_STATUS(status);

status = defwSpecialNetFixedbump();

CHECK_STATUS(status);

status = defwSpecialNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwSpecialNetPathLayer("M2");

CHECK_STATUS(status);

status = defwSpecialNetPathWidth(200);

CHECK_STATUS(status);

status = defwSpecialNetPathShape("FILLWIREOPC");

CHECK_STATUS(status);

coorX[0] = strdup("-45");

coorY[0] = strdup("1350");

coorX[1] = strdup("44865");

coorY[1] = strdup("*");

status = defwSpecialNetPathPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwSpecialNetPathEnd();

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorX);

free((char*)coorY);

status = defwSpecialNet("VSS1");

CHECK_STATUS(status);

status = defwSpecialNetUse("POWER");

CHECK_STATUS(status);

xP = (double*)malloc(sizeof(double)*6);

yP = (double*)malloc(sizeof(double)*6);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

status = defwSpecialNetPolygon("metal1", 4, xP, yP);

CHECK_STATUS(status);

status = defwSpecialNetPolygon("metal1", 6, xP, yP);

CHECK_STATUS(status);

status = defwSpecialNetRect("metal1", 0, 0, 100, 200);

CHECK_STATUS(status);

status = defwSpecialNetRect("metal2", 1, 1, 100, 200);

CHECK_STATUS(status);

status = defwSpecialNetEndOneNet();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

status = defwEndSpecialNets();

CHECK_STATUS(status);

// NETS

status = defwStartNets(12);

CHECK_STATUS(status);

status = defwNet("net1");

CHECK_STATUS(status);

status = defwNetConnection("Z38A01", "Q", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A03", "Q", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A05", "Q", 0);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("net2");

CHECK_STATUS(status);

status = defwNetConnection("cell1", "PB1", 0);

CHECK_STATUS(status);

status = defwNetConnection("cell2", "PB1", 0);

CHECK_STATUS(status);

status = defwNetConnection("cell3", "PB1", 0);

CHECK_STATUS(status);

status = defwNetEstCap(200);

CHECK_STATUS(status);

status = defwNetWeight(2);

CHECK_STATUS(status);

status = defwNetVpin("P1", NULL, 0, 0, 0, 0, "PLACED", 54, 64, 3);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("net3");

CHECK_STATUS(status);

status = defwNetConnection("cell4", "PA3", 0);

CHECK_STATUS(status);

status = defwNetConnection("cell2", "P10", 0);

CHECK_STATUS(status);

status = defwNetXtalk(30);

CHECK_STATUS(status);

status = defwNetOriginal("extra_crispy");

CHECK_STATUS(status);

status = defwNetSource("USER");

CHECK_STATUS(status);

status = defwNetUse("SIGNAL");

CHECK_STATUS(status);

status = defwNetFrequency(100);

CHECK_STATUS(status);

status = defwIntProperty("alt", 37);

CHECK_STATUS(status);

status = defwStringProperty("lastName", "Unknown");

CHECK_STATUS(status);

status = defwRealProperty("length", 10.11);

CHECK_STATUS(status);

status = defwNetPattern("BALANCED");

CHECK_STATUS(status);

status = defwNetVpinStr("P2", "L1", 45, 54, 3, 46, "FIXED", 23, 12, "FN");

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

coorX = (const char**)malloc(sizeof(char*)*5);

coorY = (const char**)malloc(sizeof(char*)*5);

coorValue = (const char**)malloc(sizeof(char*)*5);

status = defwNet("my_net");

CHECK_STATUS(status);

status = defwNetConnection("I1", "A", 0);

CHECK_STATUS(status);

status = defwNetConnection("BUF", "Z", 0);

CHECK_STATUS(status);

status = defwNetNondefaultRule("RULE1");

CHECK_STATUS(status);

status = defwNetUse("RESET");

CHECK_STATUS(status);

status = defwNetShieldnet("VSS");

CHECK_STATUS(status);

status = defwNetShieldnet("VDD");

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M2", 0, NULL);

CHECK_STATUS(status);

status = defwNetPathStyle(2);

CHECK_STATUS(status);

coorX[0] = strdup("14000");

coorY[0] = strdup("341440");

coorValue[0] = NULL;

coorX[1] = strdup("9600");

coorY[1] = strdup("*");

coorValue[1] = NULL;

coorX[2] = strdup("*");

coorY[2] = strdup("282400");

coorValue[2] = NULL;

status = defwNetPathPoint(3, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("nd1VIA12");

CHECK_STATUS(status);

coorX[0] = strdup("2400");

coorY[0] = strdup("*");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathStart("NEW");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 1, NULL);

CHECK_STATUS(status);

status = defwNetPathStyle(4);

CHECK_STATUS(status);

coorX[0] = strdup("2400");

coorY[0] = strdup("282400");

coorValue[0] = NULL;

coorX[1] = strdup("240");

coorY[1] = strdup("*");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorX[2]);

free((char*)coorY[2]);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetNoshieldStart("M2");

CHECK_STATUS(status);

coorX[0] = strdup("14100");

coorY[0] = strdup("341440");

coorX[1] = strdup("14000");

coorY[1] = strdup("*");

status = defwNetNoshieldPoint(2, coorX, coorY);

CHECK_STATUS(status);

status = defwNetNoshieldEnd();

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("|INBUS[1]");

CHECK_STATUS(status);

status = defwNetConnection("|i1", "A", 0);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("|INBUS<0>");

CHECK_STATUS(status);

status = defwNetConnection("|i0", "A", 0);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("|OUTBUS<1>");

CHECK_STATUS(status);

status = defwNetConnection("|i0", "Z", 0);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("MUSTJOIN");

CHECK_STATUS(status);

status = defwNetConnection("cell4", "PA1", 0);

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("XX100");

CHECK_STATUS(status);

status = defwNetConnection("Z38A05", "G", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A03", "G", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A01", "G", 0);

CHECK_STATUS(status);

status = defwNetVpin("V_SUB3_XX100", NULL, -333, -333, 333, 333, "PLACED",

189560, 27300, 0);

CHECK_STATUS(status);

status = defwNetVpin("V_SUB2_XX100", NULL, -333, -333, 333, 333, "PLACED",

169400, 64500, 0);

CHECK_STATUS(status);

status = defwNetVpin("V_SUB1_XX100", NULL, -333, -333, 333, 333, "PLACED",

55160, 31500, 0);

CHECK_STATUS(status);

status = defwNetSubnetStart("SUB1_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("Z38A05", "G");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB1_XX100");

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, "RULE1");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

coorX[0] = strdup("54040");

coorY[0] = strdup("30300");

coorValue[0] = strdup("0");

coorX[1] = strdup("*");

coorY[1] = strdup("30900");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathVia("nd1VIA12");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("*");

coorValue[0] = strdup("0");

coorX[1] = strdup("56280");

coorY[1] = strdup("*");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathViaWithOrient("nd1VIA23", 6);

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("31500");

coorValue[0] = NULL;

coorX[1] = strdup("55160");

coorY[1] = strdup("*");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetSubnetEnd();

CHECK_STATUS(status);

status = defwNetSubnetStart("SUB2_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("Z38A03", "G");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB2_XX100");

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("168280");

coorY[0] = strdup("63300");

coorValue[0] = strdup("7");

coorX[1] = strdup("*");

coorY[1] = strdup("64500");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathVia("M1_M2");

CHECK_STATUS(status);

coorX[0] = strdup("169400");

coorY[0] = strdup("*");

coorValue[0] = strdup("8");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

status = defwNetPathViaWithOrientStr("M2_M3", "SE");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetSubnetEnd();

CHECK_STATUS(status);

status = defwNetSubnetStart("SUB3_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("Z38A01", "G");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB3_XX100");

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("188400");

coorY[0] = strdup("26100");

coorValue[0] = strdup("0");

coorX[1] = strdup("*");

coorY[1] = strdup("27300");

coorValue[1] = strdup("0");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("M1_M2");

CHECK_STATUS(status);

coorX[0] = strdup("189560");

coorY[0] = strdup("*");

coorValue[0] = strdup("0");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

status = defwNetPathVia("M1_M2");

CHECK_STATUS(status);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetSubnetEnd();

CHECK_STATUS(status);

status = defwNetSubnetStart("SUB0_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB1_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB2_XX100");

CHECK_STATUS(status);

status = defwNetSubnetPin("VPIN", "V_SUB3_XX100");

CHECK_STATUS(status);

status = defwNetNondefaultRule("RULE1");

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M3", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("269400");

coorY[0] = strdup("64500");

coorValue[0] = strdup("0");

coorX[1] = strdup("*");

coorY[1] = strdup("54900");

coorValue[1] = NULL;

coorX[2] = strdup("170520");

coorY[2] = strdup("*");

coorValue[2] = NULL;

coorX[3] = strdup("*");

coorY[3] = strdup("37500");

coorValue[3] = NULL;

coorX[4] = strdup("*");

coorY[4] = strdup("30300");

coorValue[4] = NULL;

status = defwNetPathPoint(5, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorX[2]);

free((char*)coorY[2]);

free((char*)coorX[3]);

free((char*)coorY[3]);

free((char*)coorX[4]);

free((char*)coorY[4]);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

coorX[0] = strdup("171080");

coorY[0] = strdup("*");

coorValue[0] = NULL;

coorX[1] = strdup("17440");

coorY[1] = strdup("0");

coorValue[1] = strdup("0");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("*");

coorValue[0] = NULL;

coorX[1] = strdup("*");

coorY[1] = strdup("26700");

coorValue[1] = strdup("8");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

coorX[0] = strdup("177800");

coorY[0] = strdup("*");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("*");

coorValue[0] = strdup("8");

coorX[1] = strdup("*");

coorY[1] = strdup("30300");

coorValue[1] = strdup("8");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("nd1VIA23");

CHECK_STATUS(status);

coorX[0] = strdup("189560");

coorY[0] = strdup("*");

coorValue[0] = strdup("8");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

status = defwNetPathVia("nd1VIA12");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("27300");

coorValue[0] = strdup("0");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

status = defwNetPathStart("NEW");

CHECK_STATUS(status);

status = defwNetPathLayer("M3", 1, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("55160");

coorY[0] = strdup("31500");

coorValue[0] = strdup("8");

coorX[1] = strdup("*");

coorY[1] = strdup("34500");

coorValue[1] = strdup("0");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("M2_M3");

CHECK_STATUS(status);

coorX[0] = strdup("149800");

coorY[0] = strdup("*");

coorValue[0] = strdup("8");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

status = defwNetPathVia("M2_M3");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("35700");

coorValue[0] = NULL;

coorX[1] = strdup("*");

coorY[1] = strdup("37500");

coorValue[1] = NULL;

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

status = defwNetPathVia("M2_M3");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("*");

coorValue[0] = strdup("8");;

coorX[1] = strdup("170520");

coorY[1] = strdup("*");

coorValue[1] = strdup("0");

status = defwNetPathPoint(2, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

free((char*)coorValue[0]);

free((char*)coorX[1]);

free((char*)coorY[1]);

free((char*)coorValue[1]);

status = defwNetPathVia("M2_M3");

CHECK_STATUS(status);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("SCAN");

CHECK_STATUS(status);

status = defwNetConnection("scancell1", "P10", 1);

CHECK_STATUS(status);

status = defwNetConnection("scancell2", "PA0", 1);

CHECK_STATUS(status);

status = defwNetSource("TEST");

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwNet("testBug");

CHECK_STATUS(status);

status = defwNetConnection("Z38A05", "G", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A03", "G", 0);

CHECK_STATUS(status);

status = defwNetConnection("Z38A01", "G", 0);

CHECK_STATUS(status);

status = defwNetPathStart("ROUTED");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("1288210");

coorY[0] = strdup("580930");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH1W1W1");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("582820");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH2W1W1");

CHECK_STATUS(status);

status = defwNetPathStart("NEW");

CHECK_STATUS(status);

status = defwNetPathLayer("M3", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("1141350");

coorY[0] = strdup("582820");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH2W1W1");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("580930");

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH1W1W1");

CHECK_STATUS(status);

status = defwNetPathStart("NEW");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("1278410");

coorY[0] = strdup("275170");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathStart("NEW");

CHECK_STATUS(status);

status = defwNetPathLayer("M1", 0, NULL);

CHECK_STATUS(status);

coorX[0] = strdup("1141210");

coorY[0] = strdup("271250");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH1W1W1");

CHECK_STATUS(status);

coorX[0] = strdup("*");

coorY[0] = strdup("271460");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH2W1W1");

CHECK_STATUS(status);

coorX[0] = strdup("1142820");

coorY[0] = strdup("*");

coorValue[0] = NULL;

status = defwNetPathPoint(1, coorX, coorY, coorValue);

CHECK_STATUS(status);

free((char*)coorX[0]);

free((char*)coorY[0]);

status = defwNetPathVia("GETH3W1W1");

CHECK_STATUS(status);

status = defwNetPathEnd();

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

free((char*)coorX);

free((char*)coorY);

free((char*)coorValue);

status = defwNet("n1");

CHECK_STATUS(status);

status = defwNetConnection("PIN", "n1", 0);

CHECK_STATUS(status);

status = defwNetConnection("driver1", "in", 0);

CHECK_STATUS(status);

status = defwNetConnection("bumpa1", "bumppin", 0);

CHECK_STATUS(status);

status = defwNetFixedbump();

CHECK_STATUS(status);

status = defwNetEndOneNet();

CHECK_STATUS(status);

status = defwEndNets();

CHECK_STATUS(status);

// SCANCHAIN

status = defwStartScanchains(4);

CHECK_STATUS(status);

status = defwScanchain("the_chain");

CHECK_STATUS(status);

status = defwScanchainCommonscanpins("IN", "PA1", "OUT", "PA2");

CHECK_STATUS(status);

status = defwScanchainStart("PIN", "scanpin");

CHECK_STATUS(status);

status = defwScanchainStop("cell4", "PA2");

CHECK_STATUS(status);

status = defwScanchainOrdered("cell2", "IN", "PA0", NULL, NULL,

"cell1", "OUT", "P10", NULL, NULL);

CHECK_STATUS(status);

status = defwScanchainFloating("scancell1", "IN", "PA0", NULL, NULL);

CHECK_STATUS(status);

status = defwScanchainFloating("scancell2", "OUT", "P10", NULL, NULL);

CHECK_STATUS(status);

status = defwScanchain("chain1_clock1");

CHECK_STATUS(status);

status = defwScanchainPartition("clock1", -1);

CHECK_STATUS(status);

status = defwScanchainStart("block1/current_state_reg_0_QZ", NULL);

CHECK_STATUS(status);

status = defwScanchainFloating("block1/pgm_cgm_en_reg", "IN", "SD", "OUT", "QZ");

CHECK_STATUS(status);

status = defwScanchainFloating("block1/start_reset_dd_reg", "IN", "SD", "OUT", "QZ");

CHECK_STATUS(status);

status = defwScanchainStop("block1/start_reset_d_reg", NULL);

CHECK_STATUS(status);

status = defwScanchain("chain2_clock2");

CHECK_STATUS(status);

status = defwScanchainPartition("clock2", 1000);

CHECK_STATUS(status);

status = defwScanchainStart("block1/current_state_reg_0_QZ", NULL);

CHECK_STATUS(status);

status = defwScanchainFloating("block1/port2_phy_addr_reg_0_", "IN", "SD", "OUT", "QZ ");

CHECK_STATUS(status);

status = defwScanchainFloating("block1/port2_phy_addr_reg_4_", "IN", "SD", "OUT", "QZ");

CHECK_STATUS(status);

status = defwScanchainFloatingBits("block1/port3_intfc", "IN", "SD", "OUT", "QZ", 4);

CHECK_STATUS(status);

status = defwScanchainOrderedBits("block1/mux1", "IN", "A", "OUT", "X", 0,

"block1/ff2", "IN", "SD", "OUT", "Q", -1);

CHECK_STATUS(status);

status = defwScanchain("chain4_clock3");

CHECK_STATUS(status);

status = defwScanchainPartition("clock3", -1);

CHECK_STATUS(status);

status = defwScanchainStart("block1/prescaler_IO/lfsr_reg1", NULL);

CHECK_STATUS(status);

status = defwScanchainFloating("block1/dp1_timers", NULL, NULL, NULL, NULL);

CHECK_STATUS(status);

status = defwScanchainFloatingBits("block1/bus8", NULL, NULL, NULL, NULL, 8);

CHECK_STATUS(status);

status = defwScanchainOrderedBits("block1/dsl/ffl", "IN", "SD", "OUT", "Q",

-1, "block1/dsl/mux1", "IN", "B", "OUT", "Y", 0);

CHECK_STATUS(status);

status = defwScanchainOrderedBits("block1/dsl/ff2", "IN", "SD", "OUT", "Q",

-1, "block1/dsl/mux2", "IN", "B", "OUT", "Y", 0);

CHECK_STATUS(status);

status = defwScanchainStop("block1/start_reset_d_reg", NULL);

CHECK_STATUS(status);

status = defwEndScanchain();

CHECK_STATUS(status);

// GROUPS

groupExpr = (const char**)malloc(sizeof(char*)*2);

status = defwStartGroups(2);

CHECK_STATUS(status);

groupExpr[0] = strdup("cell2");

groupExpr[1] = strdup("cell3");

status = defwGroup("group1", 2, groupExpr);

CHECK_STATUS(status);

free((char*)groupExpr[0]);

free((char*)groupExpr[1]);

status = defwGroupRegion(0, 0, 0, 0, "region1");

CHECK_STATUS(status);

status = defwStringProperty("ggrp", "xx");

CHECK_STATUS(status);

status = defwIntProperty("side", 2);

CHECK_STATUS(status);

status = defwRealProperty("maxarea", 5.6);

CHECK_STATUS(status);

groupExpr[0] = strdup("cell1");

status = defwGroup("group2", 1, groupExpr);

CHECK_STATUS(status);

free((char*)groupExpr[0]);

status = defwGroupRegion(0, 10, 1000, 1010, NULL);

CHECK_STATUS(status);

status = defwStringProperty("ggrp", "after the fall");

CHECK_STATUS(status);

status = defwGroupSoft("MAXHALFPERIMETER", 4000, "MAXX", 10000, 0, 0);

CHECK_STATUS(status);

status = defwEndGroups();

CHECK_STATUS(status);

free((char*)groupExpr);

status = defwNewLine();

CHECK_STATUS(status);

// BLOCKAGES

xP = (double*)malloc(sizeof(double)*7);

yP = (double*)malloc(sizeof(double)*7);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

xP[6] = 8.1;

yP[6] = 8.1;

status = defwStartBlockages(12);

CHECK_STATUS(status);

status = defwBlockageLayer("m1", "comp1");

CHECK_STATUS(status);

status = defwBlockageRect(3456, 4535, 3000, 4000);

CHECK_STATUS(status);

status = defwBlockageRect(4500, 6500, 5500, 6000);

CHECK_STATUS(status);

status = defwBlockagePolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwBlockagePolygon(6, xP, yP);

CHECK_STATUS(status);

status = defwBlockageRect(5000, 6000, 4000, 5000);

CHECK_STATUS(status);

status = defwBlockagePlacementComponent("m2");

CHECK_STATUS(status);

status = defwBlockageRect(4000, 6000, 8000, 4000);

CHECK_STATUS(status);

status = defwBlockageRect(8000, 400, 600, 800);

CHECK_STATUS(status);

status = defwBlockageLayer("m3", 0);

CHECK_STATUS(status);

status = defwBlockageSpacing(1000);

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockageLayerSlots("m4");

CHECK_STATUS(status);

status = defwBlockageDesignRuleWidth(1000);

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockageLayerFills("m5");

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockageLayerPushdown("m6");

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockagePolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwBlockagePlacementComponent("m7");

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockagePlacementPushdown();

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockagePlacement();

CHECK_STATUS(status);

status = defwBlockageRect(3000, 4000, 6000, 5000);

CHECK_STATUS(status);

status = defwBlockagePlacementSoft();

CHECK_STATUS(status);

status = defwBlockageRect(4000, 6000, 8000, 4000);

CHECK_STATUS(status);

status = defwBlockagePlacementPartial (1.1);

CHECK_STATUS(status);

status = defwBlockageRect(4000, 6000, 8000, 4000);

CHECK_STATUS(status);

status = defwBlockageLayerExceptpgnet("metal1");

CHECK_STATUS(status);

status = defwBlockageSpacing(4);

CHECK_STATUS(status);

status = defwBlockagePolygon(3, xP, yP);

CHECK_STATUS(status);

status = defwEndBlockages();

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

// SLOTS

xP = (double*)malloc(sizeof(double)*7);

yP = (double*)malloc(sizeof(double)*7);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

xP[6] = 8.1;

yP[6] = 8.1;

status = defwStartSlots(2);

CHECK_STATUS(status);

status = defwSlotLayer("MET1");

CHECK_STATUS(status);

status = defwSlotPolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwSlotPolygon(3, xP, yP);

CHECK_STATUS(status);

status = defwSlotRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwSlotRect(2000, 2000, 2500, 4000);

CHECK_STATUS(status);

status = defwSlotRect(3000, 2000, 3500, 4000);

CHECK_STATUS(status);

status = defwSlotLayer("MET2");

CHECK_STATUS(status);

status = defwSlotRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwSlotPolygon(6, xP, yP);

CHECK_STATUS(status);

status = defwEndSlots();

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

// FILLS

xP = (double*)malloc(sizeof(double)*7);

yP = (double*)malloc(sizeof(double)*7);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

xP[6] = 8.1;

yP[6] = 8.1;

status = defwStartFills(5);

CHECK_STATUS(status);

status = defwFillLayer("MET1");

CHECK_STATUS(status);

status = defwFillRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwFillPolygon(5, xP, yP);

CHECK_STATUS(status);

status = defwFillRect(2000, 2000, 2500, 4000);

CHECK_STATUS(status);

status = defwFillPolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwFillRect(3000, 2000, 3500, 4000);

CHECK_STATUS(status);

status = defwFillLayer("MET2");

CHECK_STATUS(status);

status = defwFillRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwFillRect(1000, 4500, 1500, 6500);

CHECK_STATUS(status);

status = defwFillRect(1000, 7000, 1500, 9000);

CHECK_STATUS(status);

status = defwFillRect(1000, 9500, 1500, 11500);

CHECK_STATUS(status);

status = defwFillPolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwFillPolygon(6, xP, yP);

CHECK_STATUS(status);

status = defwFillLayer("metal1");

CHECK_STATUS(status);

status = defwFillLayerOPC();

CHECK_STATUS(status);

status = defwFillRect(100, 200, 150, 400);

CHECK_STATUS(status);

status = defwFillRect(300, 200, 350, 400);

CHECK_STATUS(status);

status = defwFillVia("via28");

CHECK_STATUS(status);

status = defwFillViaOPC();

CHECK_STATUS(status);

status = defwFillPoints(1, xP, yP);

CHECK_STATUS(status);

status = defwFillVia("via26");

CHECK_STATUS(status);

status = defwFillPoints(3, xP, yP);

CHECK_STATUS(status);

status = defwEndFills();

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

// SLOTS

xP = (double*)malloc(sizeof(double)*7);

yP = (double*)malloc(sizeof(double)*7);

xP[0] = 2.1;

yP[0] = 2.1;

xP[1] = 3.1;

yP[1] = 3.1;

xP[2] = 4.1;

yP[2] = 4.1;

xP[3] = 5.1;

yP[3] = 5.1;

xP[4] = 6.1;

yP[4] = 6.1;

xP[5] = 7.1;

yP[5] = 7.1;

xP[6] = 8.1;

yP[6] = 8.1;

status = defwStartSlots(2);

CHECK_STATUS(status);

status = defwSlotLayer("MET1");

CHECK_STATUS(status);

status = defwSlotRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwSlotPolygon(5, xP, yP);

CHECK_STATUS(status);

status = defwSlotRect(2000, 2000, 2500, 4000);

CHECK_STATUS(status);

status = defwSlotPolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwSlotRect(3000, 2000, 3500, 4000);

CHECK_STATUS(status);

status = defwSlotLayer("MET2");

CHECK_STATUS(status);

status = defwSlotRect(1000, 2000, 1500, 4000);

CHECK_STATUS(status);

status = defwSlotRect(1000, 4500, 1500, 6500);

CHECK_STATUS(status);

status = defwSlotRect(1000, 7000, 1500, 9000);

CHECK_STATUS(status);

status = defwSlotRect(1000, 9500, 1500, 11500);

CHECK_STATUS(status);

status = defwSlotPolygon(7, xP, yP);

CHECK_STATUS(status);

status = defwSlotPolygon(6, xP, yP);

CHECK_STATUS(status);

status = defwEndSlots();

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

// NONDEFAULTRULES

status = defwStartNonDefaultRules(4);

CHECK_STATUS(status);

status = defwNonDefaultRule("doubleSpaceRule", 1);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal1", 2, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal2", 2, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal3", 2, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRule("lowerResistance", 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal1", 6, 0, 0, 5);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal2", 5, 1, 6, 4);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal3", 5, 0, 0, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleMinCuts("cut12", 2);

CHECK_STATUS(status);

status = defwNonDefaultRuleMinCuts("cut23", 2);

CHECK_STATUS(status);

status = defwNonDefaultRule("myRule", 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal1", 2, 0, 0, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal2", 2, 0, 0, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal3", 2, 0, 0, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleViaRule("myvia12rule");

CHECK_STATUS(status);

status = defwNonDefaultRuleViaRule("myvia23rule");

CHECK_STATUS(status);

status = defwRealProperty("minlength", 50.5);

CHECK_STATUS(status);

status = defwStringProperty("firstName", "Only");

CHECK_STATUS(status);

status = defwIntProperty("idx", 1);

CHECK_STATUS(status);

status = defwNonDefaultRule("myCustomRule", 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal1", 5, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal2", 5, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleLayer("metal3", 5, 0, 1, 0);

CHECK_STATUS(status);

status = defwNonDefaultRuleVia("myvia12_custom1");

CHECK_STATUS(status);

status = defwNonDefaultRuleVia("myvia12_custom2");

CHECK_STATUS(status);

status = defwNonDefaultRuleVia("myvia23_custom1");

CHECK_STATUS(status);

status = defwNonDefaultRuleVia("myvia23_custom2");

CHECK_STATUS(status);

status = defwEndNonDefaultRules();

CHECK_STATUS(status);

status = defwNewLine();

CHECK_STATUS(status);

// STYLES

status = defwStartStyles(3);

CHECK_STATUS(status);

xP = (double*)malloc(sizeof(double)*6);

yP = (double*)malloc(sizeof(double)*6);

xP[0] = 30;

yP[0] = 10;

xP[1] = 10;

yP[1] = 30;

xP[2] = -10;

yP[2] = 30;

xP[3] = -30;

yP[3] = 10;

xP[4] = -30;

yP[4] = -10;

xP[5] = -10;

yP[5] = -30;

status = defwStyles(1, 6, xP, yP);

CHECK_STATUS(status);

status = defwStyles(2, 5, xP, yP);

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

xP = (double*)malloc(sizeof(double)*8);

yP = (double*)malloc(sizeof(double)*8);

xP[0] = 30;

yP[0] = 10;

xP[1] = 10;

yP[1] = 30;

xP[2] = -10;

yP[2] = 30;

xP[3] = -30;

yP[3] = 10;

xP[4] = -30;

yP[4] = -10;

xP[5] = -10;

yP[5] = -30;

xP[6] = 10;

yP[6] = -30;

xP[7] = 30;

yP[7] = -10;

status = defwStyles(3, 8, xP, yP);

CHECK_STATUS(status);

status = defwEndStyles();

CHECK_STATUS(status);

free((char*)xP);

free((char*)yP);

status = defwNewLine();

CHECK_STATUS(status);

// BEGINEXT

status = defwStartBeginext("tag");

CHECK_STATUS(status);

defwAddIndent();

status = defwBeginextCreator("CADENCE");

CHECK_STATUS(status);

status = defwBeginextSyntax("OTTER", "furry");

CHECK_STATUS(status);

status = defwStringProperty("arrg", "later");

CHECK_STATUS(status);

status = defwBeginextSyntax("SEAL", "cousin to WALRUS");

CHECK_STATUS(status);

status = defwEndBeginext();

CHECK_STATUS(status);

status = defwEnd();

CHECK_STATUS(status);

lineNumber = defwCurrentLineNumber();

if (lineNumber == 0)

fprintf(stderr, "ERROR: nothing has been read.\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.