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

📄 oalefoutndr.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// LefOutNDR.cpp//// This file contains the member functions for the LefOutNDR 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.13 $//  $Date: 2005/04/27 09:47:09 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefOutNDR::LefOutNDR()// LefOutNDR::~LefOutNDR()//// This is the default constructor for the LefOutNDR class// *****************************************************************************LefOutNDR::LefOutNDR(LefOut &lefOutIn):   lefOut(lefOutIn){    lefOutIn.lefOutNDR = this;}LefOutNDR::~LefOutNDR(){}// *****************************************************************************// LefOutNDR::write()//// This function outputs the information about this non-default-rule, syntax:// VIA viaStatement ...// [SPACING spacingStatement] *skipped*// [PROPERTY propName propValue ... ;] ... //// *****************************************************************************voidLefOutNDR::write(oaConstraintGroup *ndrIn){    ndr = ndrIn;        oaString name;    ndr->getName(name);    lefOut.output("NONDEFAULTRULE %s\n", (const char *) name);    lefOut.incIndent();    writeLayers();    writeVias();        if (lefOut.getOptions()->getVersion() > cLefDefVersion55) {	writeMinCuts();    }    lefOut.writeProperties(ndr, cLefDefNonDefaultRule);    lefOut.decIndent();    lefOut.output("END %s\n", (const char *) name);}// *****************************************************************************// LefOutNDR::writeLayers()// LefOutNDR::writeLayer()//// LAYER layerName//         WIDTH width ;//         SPACING minSpacing ; //         [WIREEXTENSION value ;]//         [RESISTANCE RPERSQ value ;] *skipped*//         [CAPACITANCE CPERSQDIST value ;] *skipped*//         [EDGECAPACITANCE value ;] *skipped*// END layerName...// *****************************************************************************voidLefOutNDR::writeLayers(){    oaValue *v = lefOut.getConstraint(ndr, oacValidRoutingLayers);    if (v && v->getType() == oacLayerArrayValueType) {	oaLayerArray    layerArray;	((oaLayerArrayValue*) v)->get(layerArray);	for (oaUInt4 i = 0; i < layerArray.getNumElements(); i++) {	    writeLayer(layerArray[i]);	}    }}voidLefOutNDR::writeLayer(oaLayerNum layerNum){    oaPhysicalLayer *layer = lefOut.getLayer(layerNum);    oaString layerName;    layer->getName(layerName);    lefOut.output("LAYER %s\n", (const char *) layerName);    lefOut.incIndent();    writeLayerWidth(layer);    if (lefOut.getOptions()->getVersion() > cLefDefVersion55) {	writeLayerDiagWidth(layer);    }    writeLayerSpacing(layer);    writeLayerExt(layer);    lefOut.decIndent();    lefOut.output("END %s\n", (const char *) layerName);}// *****************************************************************************// LefOutNDR::writeLayerWidth()//// WIDTH width ;// *****************************************************************************voidLefOutNDR::writeLayerWidth(oaPhysicalLayer    *layer){    oaValue *v = lefOut.getConstraint(ndr, oacMinWidth, layer->getNumber());    if (v && v->getType() == oacIntValueType) {	lefOut.output("WIDTH %g ;\n",	    lefOut.dbuToUU(((oaIntValue*) v)->get()));    }}// *****************************************************************************// LefOutNDR::writeLayerDiagWidth()//// DIAGWIDTH width ;// *****************************************************************************voidLefOutNDR::writeLayerDiagWidth(oaPhysicalLayer    *layer){    oaValue *v = lefOut.getConstraint(ndr, oacMinDiagonalWidth, layer->getNumber());    if (v && v->getType() == oacIntValueType) {	lefOut.output("DIAGWIDTH %g ;\n",		      lefOut.dbuToUU(((oaIntValue*) v)->get()));    }}// *****************************************************************************// LefOutNDR::writeLayerSpacing()//// This function writes out the layer spacing attribute. Note that this can be// a soft or a hard constraint.//// SPACING spacing ;// *****************************************************************************voidLefOutNDR::writeLayerSpacing(oaPhysicalLayer    *layer){   oaValue  *v = lefOut.getConstraint(ndr, oacMinSpacing, layer->getNumber(),				      NULL, false, false);   if (!v) {       v = lefOut.getConstraint(ndr, oacMinSpacing, layer->getNumber());   }   if (v && v->getType() == oacIntValueType) {       lefOut.output("SPACING %g ;\n",		     lefOut.dbuToUU(((oaIntValue*) v)->get()));   }}// *****************************************************************************// LefOutNDR::writeLayerExt()//// WIREEXTENSION ext ;// *****************************************************************************voidLefOutNDR::writeLayerExt(oaPhysicalLayer    *layer){    oaUInt4 ext = lefOut.getLayerExt(ndr, layer->getNumber());    oaUInt4 width = lefOut.getLayerWidth(ndr, layer->getNumber());    if (ext != width / 2) {	lefOut.output("WIREEXTENSION %g ;\n", lefOut.dbuToUU(ext));    }}// *****************************************************************************// LefOutNDR::writeVias()// LefOutNDR::writeVia()// LefOutNDR::writeUseVia()// LefOutNDR::writeUseViaRule()//// VIA viaName //          [DEFAULT] //          [TOPOFSTACKONLY]//          [FOREIGN foreignCellName [pt [orient]];]//          [RESISTANCE value ;]//          {LAYER layerName ; //                 {RECT pt pt ;} ...} ... //          [PROPERTY propName propVal ;] ... //      END viaName // *****************************************************************************voidLefOutNDR::writeVias(){    oaValue *v = lefOut.getConstraint(ndr, oacValidRoutingVias);    if (v && v->getType() == oacViaDefArrayValueType) {	oaViaDefArray   viaArray;	((oaViaDefArrayValue*) v)->get(viaArray);	for (oaUInt4 i = 0; i < viaArray.getNumElements(); i++) {	    if (lefOut.getOptions()->getVersion() < cLefDefVersion56) {		writeVia(viaArray[i]);	    } else {		if (viaArray[i]->getType() == oacCustomViaDefType) {		    writeUseVia((oaCustomViaDef*) viaArray[i]);		} else {		    writeUseViaRule((oaStdViaDef*) viaArray[i]);		}	    }   	}    }}voidLefOutNDR::writeVia(oaViaDef	*viaDef){    if (viaDef->getType() == oacCustomViaDefType) {	lefOut.lefOutVia->write((oaCustomViaDef*) viaDef, true);    }}voidLefOutNDR::writeUseVia(oaCustomViaDef    *viaDef){    oaString	name;    viaDef->getName(name);    lefOut.output("USEVIA %s ;\n", (const char*) name);}voidLefOutNDR::writeUseViaRule(oaStdViaDef   *viaDef){    oaString	name;    viaDef->getName(name);    lefOut.output("USEVIARULE %s ;\n", (const char*) name);}// *****************************************************************************// LefOutNDR::writeMinCuts()// LefOutNDR::writeMinCut()//// MINCUTS <layerName> <numCuts> ;// *****************************************************************************voidLefOutNDR::writeMinCuts(){    oaIter<oaLayer> layerIt(lefOut.tech()->getLayers());    while (oaLayer *layer = layerIt.getNext()) {	if (layer->getType() == oacPhysicalLayerType	    && ((oaPhysicalLayer*) layer)->getMaterial() == oacCutMaterial) {	    writeMinCut(layer);	}    }}voidLefOutNDR::writeMinCut(oaLayer   *layer){    oaValue *v = lefOut.getConstraint(ndr, oacMinNumCut,				      layer->getNumber(), NULL, false);    if (v && v->getType() == oacInt1DTblValueType) {	oa1DLookupTbl<oaInt4, oaInt4>	table(1, "minNumCut", 1);		((oaInt1DTblValue*) v)->get(table);	if (table.getNumItems()) {	    oaString	layerName;	    layer->getName(layerName);	    lefOut.output("MINCUTS %s %d ;\n", (const char*) layerName,			  table.getValue(0));	}    }}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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