⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oalefoutviarule.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// LefOutViaRule.cpp//// This file contains the member functions for the LefOutViaRule class.//// *****************************************************************************// Except as specified in the OpenAccess terms of use of Cadence or Silicon// Integration Initiative, this material may not be copied, modified,// re-published, uploaded, executed, or distributed in any way, in any medium,// in whole or in part, without prior written permission from Cadence.////                Copyright 2002-2005 Cadence Design Systems, Inc.//                           All Rights Reserved.////  $Author: nitters $//  $Revision: 1.45 $//  $Date: 2005/03/18 08:57:15 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefOutViaRule::LefOutViaRule()// LefOutViaRule::~LefOutViaRule()//// This is the default constructor for the LefOutViaRule class.// *****************************************************************************LefOutViaRule::LefOutViaRule(LefOut &translator):   lefOut(translator){    translator.lefOutViaRule = this;}LefOutViaRule::~LefOutViaRule(){}// *****************************************************************************// LefOutViaRule::write()//// This function outputs all information of the VIARULE construct for the// current viaDef.// *****************************************************************************voidLefOutViaRule::write(oaViaDef *viaDefIn){    viaDef = viaDefIn;        // Ignore any vias that do not use routing layers.    if (viaDef->getLayer1()->getMaterial() != oacMetalMaterial	|| viaDef->getLayer2()->getMaterial() != oacMetalMaterial) {	return;    }    if (viaDef->getType() == oacStdViaDefType) {	writeGenerate();    } else {	writeRule();    }}// *****************************************************************************// LefOutVia::writeRule()//// This function outputs all information of the VIARULE construct for the// current viaSpec.//// Syntax ://     VIARULE viaRuleName//          LAYER layerName ;//             DIRECTION {HORIZONTAL | VERTICAL} ;//             [WIDTH minWidth TO maxWidth ;]//          LAYER layerName ;//             DIRECTION {HORIZONTAL | VERTICAL} ;//             [WIDTH minWidth TO maxWidth ;]//          VIA viaName ; ...//          [PROPERTY propName propVal...;]...//     END viaRuleName //// *****************************************************************************voidLefOutViaRule::writeRule(){    oaUInt4 l1Min;    oaUInt4 l1Max;    oaUInt4 l2Min;    oaUInt4 l2Max;        if (getViaSpec(l1Min, l1Max, l2Min, l2Max)) {	oaString	viaName;	viaDef->getName(viaName);	lefOut.output("VIARULE %s\n", (const char *) (viaName + "_rule"));	lefOut.incIndent();	writeLayer(viaDef->getLayer1(), l1Min, l1Max, true);	writeLayer(viaDef->getLayer2(), l2Min, l2Max, true);	lefOut.output("VIA %s ;\n", (const char*) viaName);	lefOut.decIndent();	lefOut.output("END %s\n\n", (const char *) (viaName + "_rule"));    }}// *****************************************************************************// LefOutViaRule::writeGenerate()//// This function outputs all information of the VIARULE GENERATE construct.// Syntax :////     VIARULE viaRuleName GENERATE//          LAYER routingLayerName ;//             DIRECTION {HORIZONTAL | VERTICAL} ;//             [WIDTH minWidth TO maxWidth ;]//             [OVERHANG overhang ;]//             [METALOVERHANG metalOverhang ;]//          LAYER routingLayerName ;//             DIRECTION {HORIZONTAL | VERTICAL} ;//             [WIDTH minWidth TO maxWidth ;]//             [OVERHANG overhang ;]//             [METALOVERHANG metalOverhang ;]//          LAYER cutLayerName ;//             RECT pt pt ;//             SPACING xSpacing BY ySpacing ;//             [RESISTANCE resistancePerCut ;] //     END viaRuleName // *****************************************************************************voidLefOutViaRule::writeGenerate(){    oaString viaRuleName;    viaDef->getName(viaRuleName);    lefOut.output("VIARULE %s GENERATE",		  (const char *) viaRuleName);    if (lefOut.getOptions()->getVersion() > cLefDefVersion55) {	writeDefault();    }        lefOut.outNoIndent("\n");    lefOut.incIndent();    oaUInt4 l1Min;    oaUInt4 l1Max;    oaUInt4 l2Min;    oaUInt4 l2Max;        getViaSpec(l1Min, l1Max, l2Min, l2Max);    oaViaParam	params;    ((oaStdViaDef*) viaDef)->getParams(params);    oaBoolean	direction = lefOut.getOptions()->getVersion() < cLefDefVersion55;    writeLayer(viaDef->getLayer1(), l1Min, l1Max, direction);    writeLayerEnclosure(viaDef->getLayer1(), params.getLayer1Enc());    writeLayer(viaDef->getLayer2(), l2Min, l2Max, direction);    writeLayerEnclosure(viaDef->getLayer2(), params.getLayer2Enc());    writeCutLayer(params);    lefOut.decIndent();    lefOut.output("END %s\n\n", (const char *) viaRuleName);}// *****************************************************************************// LefOutViaRule::writeDefault()//// This function outputs the default keyword for this via, syntax:// [DEFAULT] // *****************************************************************************voidLefOutViaRule::writeDefault(){    oaValue	*v = lefOut.getConstraint(lefOut.getDefaultRules(),					  oacValidRoutingVias);    if (v && v->getType() == oacViaDefArrayValueType) {	oaViaDefArray   viaDefArray;	((oaViaDefArrayValue*) v)->get(viaDefArray);	for (oaUInt4 i = 0; i < viaDefArray.getNumElements(); i++) {	    if (viaDef == viaDefArray[i]) {		lefOut.output(" DEFAULT");		return;	    }	}    }}// *****************************************************************************// LefOutViaRule::writeLayer()//// This function outputs any layers found on the current viaSpec//// Syntax:@@// *****************************************************************************voidLefOutViaRule::writeLayer(oaPhysicalLayer   *layer,			  oaUInt4	    minWidth,			  oaUInt4	    maxWidth,			  oaBoolean	    direction){    oaString layerName;    layer->getName(layerName);    lefOut.output("LAYER %s ;\n", (const char*) layerName);    lefOut.incIndent();        if (direction) {	if (layer->getPrefRoutingDir() == oacVertPrefRoutingDir) {	    lefOut.output("DIRECTION VERTICAL ;\n");	} else { 	    lefOut.output("DIRECTION HORIZONTAL ;\n");	}    }    if (minWidth != UINT_MAX) {	lefOut.output("WIDTH %.11g TO %.11g ;\n", lefOut.dbuToUU(minWidth),		      lefOut.dbuToUU(maxWidth - 1));    }    lefOut.decIndent();}// *****************************************************************************// LefOutViaRule::writeLayerEnclosure()//// This function outputs the ENCLOSURE attibute of the  VIARULE GENERATE// construct for the given layer.//// Syntax://          LAYER routingLayerName ;//             DIRECTION {HORIZONTAL | VERTICAL} ;//             [WIDTH minWidth TO maxWidth ;]//             [OVERHANG overhang ;]//             [METALOVERHANG metalOverhang ;]// *****************************************************************************voidLefOutViaRule::writeLayerEnclosure(oaPhysicalLayer  *layer,				   oaVector	    enclosure){    lefOut.incIndent();    if (lefOut.getOptions()->getVersion() > cLefDefVersion54) {        lefOut.output("ENCLOSURE %.11g %.11g ;\n",                      lefOut.dbuToUU(enclosure.x()),                      lefOut.dbuToUU(enclosure.y()));    } else {                oaUInt4	layerEnc(enclosure.y());        if (layer->getPrefRoutingDir() == oacVertPrefRoutingDir) {            layerEnc = enclosure.x();        }        if (layerEnc) {            lefOut.output("OVERHANG %.11g ;\n",                          lefOut.dbuToUU(layerEnc));        }            }    lefOut.decIndent();}// *****************************************************************************// LefOutViaRule::writeCutLayer()//// This function outputs the cut layer section of the VIARULE GENERATE construct// for the current oaViaCatalog.//// Syntax://          LAYER cutLayerName ;//             RECT pt pt ;//             SPACING xSpacing BY ySpacing ;//             [RESISTANCE resistancePerCut ;]// *****************************************************************************voidLefOutViaRule::writeCutLayer(const oaViaParam	&params){    oaLayer *layer = lefOut.getLayer(params.getCutLayer());    oaString layerName;        layer->getName(layerName);    lefOut.output("LAYER %s ;\n", (const char *) layerName);    lefOut.incIndent();            // RECT    oaInt4  cutSizeX = params.getCutWidth();    oaInt4  cutSizeY = params.getCutHeight();        lefOut.output("RECT -%.11g -%.11g %.11g %.11g ;\n",		  (lefOut.dbuToUU(cutSizeX)) / 2,		  (lefOut.dbuToUU(cutSizeY)) / 2,		  (lefOut.dbuToUU(cutSizeX)) / 2,		  (lefOut.dbuToUU(cutSizeY)) / 2);    // SPACING    oaInt4  spacingX = params.getCutSpacing().x() + cutSizeX;    oaInt4  spacingY = params.getCutSpacing().y() + cutSizeY;    lefOut.output("SPACING %.11g BY %.11g ;\n",		  lefOut.dbuToUU(spacingX),		  lefOut.dbuToUU(spacingY));    // RESISTANCE    oaFloat resistance = viaDef->getResistancePerCut();    if (resistance > 0.0) {	lefOut.output("RESISTANCE %f ;\n", resistance);    }    lefOut.decIndent();    return;}// *****************************************************************************// LefOutViaRule::getViaSpec()//// This function determines if the viaDef is listed in the viaSpec, and fills// out the width ranges this via rule is to be used in.// *****************************************************************************oaBooleanLefOutViaRule::getViaSpec(oaUInt4   &l1Min,			  oaUInt4   &l1Max,			  oaUInt4   &l2Min,			  oaUInt4   &l2Max){    l1Min = UINT_MAX;    l2Min = UINT_MAX;    l1Max = 0;    l2Max = 0;        oaViaSpec	*viaSpec = oaViaSpec::find(viaDef->getLayer1(),					   viaDef->getLayer2());        if (!viaSpec) {	return false;    }    oaValue	*v = viaSpec->getValue();    if (v && v->getType() == oacViaDef2DTblValueType) {	oa2DLookupTbl<oaInt4, oaInt4, oaViaDefArrayValue*>	tbl;	((oaViaDef2DTblValue*) v)->get(tbl);	for (oaUInt4 i = 0; i + 1 < tbl.getNumRows(); i++) {	    for (oaUInt4 j = 0; j + 1 < tbl.getNumCols(); j++) {		oaViaDefArrayValue *arrayValue = tbl.getValue(i, j);		if (arrayValue) {		    oaViaDefArray   array;		    arrayValue->get(array);		    for (oaUInt4 k = 0; k < array.getNumElements(); k++) {			if (array[k] == viaDef) {			    l1Min = oaMin<oaUInt4>(l1Min, tbl.getRowHeader(i));			    l2Min = oaMin<oaUInt4>(l2Min, tbl.getColHeader(j));			    l1Max = oaMax<oaUInt4>(l1Max, tbl.getRowHeader(i + 1));			    l2Max = oaMax<oaUInt4>(l2Max, tbl.getColHeader(j + 1));			    break;			}		    }		}	    }	}	if (l1Min != UINT_MAX) {	    return true;	}    }    v = viaSpec->getDefaultValue();    if (v && v->getType() == oacViaDefArrayValueType) {	oaViaDefArray   array;	((oaViaDefArrayValue*) v)->get(array);	for (oaUInt4 k = 0; k < array.getNumElements(); k++) {	    if (array[k] == viaDef) {		return true;	    }	}    }    return false;}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -