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

📄 oalefoutgeom.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// LefOutGeom.cpp//// This file contains the member functions for the LefOutGeom 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.44 $//  $Date: 2005/06/14 11:02:01 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefOutGeom::LefOutGeom()// LefOutGeom::~LefOutGeom()//// This is the default constructor for the LefOutGeom class// *****************************************************************************LefOutGeom::LefOutGeom(LefOut &lefOutIn)    :   lefOut(lefOutIn),	fig(NULL),	lastLayer(oacNullIndex),	lastSpacing(0),	lastEffectiveWidth(0),	lastWidth(0){    lefOutIn.lefOutGeom = this;}LefOutGeom::~LefOutGeom(){}// *****************************************************************************// LefOutGeom::reset()//// This function resets the last values.// *****************************************************************************voidLefOutGeom::reset(){    lastLayer		= oacNullIndex;    lastSpacing		= 0;    lastEffectiveWidth	= 0;    lastWidth		= 0;}// *****************************************************************************// LefOutGeom::writeFig()//// This function outputs the given fig, preceded by a LAYER statement// *****************************************************************************voidLefOutGeom::writeFig(oaFig    *figIn){    fig = figIn;    switch (fig->getType()) {      case oacDotType:      case oacLineType:      case oacRectType:	writeLayer();	lefOut.incIndent();	writeRect();	lefOut.decIndent();	break;      case oacLayerBlockageType:      case oacPolygonType:	writeLayer();	lefOut.incIndent();	writePolygon();	lefOut.decIndent();	break;      case oacPathType:	writeLayer();	lefOut.incIndent();	writePath();	lefOut.decIndent();	break;      case oacCustomViaType:      case oacStdViaType:	writeVia();	break;    }}// *****************************************************************************// LefOutGeom::writeLayer()//// This function outputs the LAYER statement for the current fig, syntax:// LAYER layerName [SPACING minSpacing ; | DESIGNRULEWIDTH value ;] //   [WIDTH width ;]//// Note: LAYER statements are only printed if any of LayerNum, Spacing,//       RuleWidth or Width changes value.// *****************************************************************************voidLefOutGeom::writeLayer(){    oaLayerNum	layerNum;        if (fig->isBlockage()) {	layerNum = (((oaLayerBlockage*) fig)->getLayerNum());    } else {	layerNum = (((oaShape *)fig)->getLayerNum());    }    oaLayer	*layer = lefOut.getLayer(layerNum);    oaString	layerName;    layer->getName(layerName);        oaUInt4		    spacing = 0;    oaConstraintGroup	    *group  = fig->getConstraintGroup();    oaLayerConstraintDef    *def    = oaLayerConstraintDef::get(oacMinSpacing);    oaLayerConstraint	    *constr = oaLayerConstraint::find(group, layerNum, def);    if (constr) {	oaValue	*value = constr->getValue();	if (value->getType() == oacIntValueType) {	    spacing = ((oaIntValue*) value)->get();	}    }        oaUInt4 effectiveWidth = oacNullIndex;    if (fig->getType() == oacLayerBlockageType	&& ((oaLayerBlockage*) fig)->hasEffectiveWidth()) {	effectiveWidth = ((oaLayerBlockage*) fig)->getEffectiveWidth();    }        oaUInt4 width = 0;    if (fig->getType() == oacPathType) {	width = ((oaPath*) fig)->getWidth();    }    if (width && width == lefOut.getLayerWidth(lefOut.getDefaultRules(), layerNum)) {	width = 0;    }        if (layerNum != lastLayer || spacing != lastSpacing	|| effectiveWidth != lastEffectiveWidth || width != lastWidth) {	lefOut.output("LAYER %s", (const char*) layerName);	if (spacing) {	    lefOut.outNoIndent(" SPACING %.11g",			       lefOut.dbuToUU(spacing));	} else if (effectiveWidth != oacNullIndex) {	    lefOut.outNoIndent(" DESIGNRULEWIDTH %.11g",			       lefOut.dbuToUU(effectiveWidth));	}	lefOut.outNoIndent(" ;\n");	if (width) {	    lefOut.incIndent();	    lefOut.output("WIDTH %.11g ;\n",			  lefOut.dbuToUU(width));	    lefOut.decIndent();	}		lastLayer	    = layerNum;	lastSpacing	    = spacing;	lastEffectiveWidth  = effectiveWidth;	lastWidth	    = width;    }}// *****************************************************************************// LefOutLayer::writeRect()//// This function outputs a RECT statement for the given fig, syntax:// RECT pt pt ; // *****************************************************************************voidLefOutGeom::writeRect(){    oaBox   bBox;    fig->getBBox(bBox);        lefOut.output("RECT %.11g %.11g %.11g %.11g ;\n",		  lefOut.dbuToUU(bBox.left()), lefOut.dbuToUU(bBox.bottom()),		  lefOut.dbuToUU(bBox.right()), lefOut.dbuToUU(bBox.top()));}// *****************************************************************************// LefOutLayer::writePolygon()//// This function outputs a POLYGON statement for the given fig, syntax:// POLYGON pt pt pt pt... ; // *****************************************************************************voidLefOutGeom::writePolygon(){    oaPointArray    points;    if (fig->isBlockage()) {	((oaLayerBlockage*) fig)->getPoints(points);    } else {	((oaPolygon*) fig)->getPoints(points);    }    if (points.isRectangle()) {	return writeRect();    }    lefOut.output("POLYGON");        for (oaUInt4 i = 0; i < points.getNumElements(); i++) {	lefOut.outNoIndent(" %.11g %.11g",			   lefOut.dbuToUU(points[i].x()),			   lefOut.dbuToUU(points[i].y()));    }    lefOut.outNoIndent(" ;\n");}// *****************************************************************************// LefOutLayer::writePath()//// This function outputs a PATH statement for the given fig, syntax:// PATH pt... ; // *****************************************************************************voidLefOutGeom::writePath(){    oaPointArray    points;    ((oaPath*) fig)->getPoints(points);    lefOut.output("PATH");    for (oaUInt4 i = 0; i < points.getNumElements(); i++) {	lefOut.outNoIndent(" %.11g %.11g",			   lefOut.dbuToUU(points[i].x()),			   lefOut.dbuToUU(points[i].y()));    }    lefOut.outNoIndent(" ;\n");}// *****************************************************************************// LefOutLayer::writeVia()//// This function outputs a VIA statement for the given fig, syntax:// VIA pt name ; // Currently only support routes with one element; a via// *****************************************************************************voidLefOutGeom::writeVia(){    oaVia	*via = (oaVia *) fig;    oaString	name;    oaPoint	origin;    via->getOrigin(origin);    if (via->getType() == oacStdViaType) {	lefOut.getGenVia(((oaStdVia*) via)->getHeader(), name);    } else {	via->getViaDefName(name);    }        lefOut.output("VIA %.11g %.11g %s ;\n",		  lefOut.dbuToUU(origin.x()),		  lefOut.dbuToUU(origin.y()),		  (const char *) name);}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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