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

📄 oalefingeom.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// *****************************************************************************// *****************************************************************************// LefInGeom.cpp//// Functions to handle LEF MACRO layerGeometry constructs.//// *****************************************************************************// 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.78 $//  $Date: 2005/06/14 11:02:00 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefInGeom::LefInGeom()// LefInGeom::~LefInGeom()//// This is the constructor for the LefInGeom class. // *****************************************************************************LefInGeom::LefInGeom(LefIn  &translator):   lefIn(translator){}LefInGeom::~LefInGeom(){}// *****************************************************************************// LefInGeom::parseGeometries()// LefInGeom::parseGeom()//// These functions parse the datastructure provided by the parser and returns// a status. It treats pin and obstruction by calling the appropriate virtual//// For Pins this figure can be an oaDot, oaLine, oaRect, oaPath, oaPolygon// or oaVia. For Obstructions this figure will be an oaBlockage.//// The function parses the elements in the parser geometry array, starting// with "itemNum", and continuing until a new geometry item is found.// It then calls the appropriate function to create an OA figure// for that geometry.// Any Layer, Width or Spacing entries found in the parser geometry array// before the new figure, are stored and used when creating the OA figure.// *****************************************************************************voidLefInGeom::parseGeometries(lefiGeometries	*data){    lefGeom = data;    currentLayerNum = 0;    currentWidth = 0;    currentSpacing = 0;    currentEffectiveWidth = 0;    hasLayer = false;    for (oaInt4 itemNum = 0; itemNum < lefGeom->numItems();          itemNum++) {	 parseGeom(itemNum);    }}voidLefInGeom::parseGeom(oaInt4 itemNum){    switch (lefGeom->itemType(itemNum)) {      case lefiGeomLayerE:	parseLayer(lefGeom->getLayer(itemNum));	currentSpacing = 0;	currentEffectiveWidth = 0;	break;      case lefiGeomLayerMinSpacingE:	currentSpacing = lefIn.uuToDBU(lefGeom->getLayerMinSpacing(itemNum));	break;      case lefiGeomLayerRuleWidthE:	currentEffectiveWidth = lefIn.uuToDBU(lefGeom->getLayerRuleWidth(itemNum));	break;      case lefiGeomWidthE:	currentWidth = lefIn.uuToDBU(lefGeom->getWidth(itemNum));	break;      case lefiGeomPathE:	createPath(lefGeom->getPath(itemNum));	break;      case lefiGeomPathIterE:	createPath(lefGeom->getPathIter(itemNum));	break;      case lefiGeomRectE:	createRect(lefGeom->getRect(itemNum));	break;      case lefiGeomRectIterE:	createRect(lefGeom->getRectIter(itemNum));	break;      case lefiGeomPolygonE:	createPolygon(lefGeom->getPolygon(itemNum));	break;      case lefiGeomPolygonIterE:	createPolygon(lefGeom->getPolygonIter(itemNum));	break;      case lefiGeomViaE:	createVia(lefGeom->getVia(itemNum));	break;      case lefiGeomViaIterE:	createVia(lefGeom->getViaIter(itemNum));	break;    }}// *****************************************************************************// LefInGeom::createRect()//// This function is base class function which applies to pin and obstruction// statements.// It creates rectangle of an iter statement while calling // createRect(lefiGeomRect).// *****************************************************************************voidLefInGeom::createRect(lefiGeomRectIter    *lefRectIter){    lefiGeomRect    rect;    oaDouble        x;    oaDouble        y;       rect.xl = lefRectIter->xl;    rect.yl = lefRectIter->yl;    rect.xh = lefRectIter->xh;    rect.yh = lefRectIter->yh;    for (y = 0; y < lefRectIter->yStart; y++) {        for (x = 0; x < lefRectIter->xStart; x++) {            createRect(&rect, x * lefRectIter->xStep, y * lefRectIter->yStep);        }    }}// *****************************************************************************// LefInGeom::createRect()//// This function is base class function which applies to pin and obstruction// statements.//// For it creates a bbox (dot or line if appropriate).// *****************************************************************************voidLefInGeom::createRect(lefiGeomRect  *rect,		      oaDouble	    offsetX,		      oaDouble	    offsetY){        oaInt4  left(lefIn.uuToDBU((rect->xl + offsetX)));    oaInt4  right(lefIn.uuToDBU((rect->xh + offsetX)));    oaInt4  top(lefIn.uuToDBU((rect->yh + offsetY)));    oaInt4  bottom(lefIn.uuToDBU((rect->yl + offsetY)));        if ((left == right) && (top == bottom)) {        return createDot(oaPoint(left, bottom));    }    if ((left == right) || (top == bottom)) {        oaPointArray    pointArray(2);        pointArray[0].x() = left;        pointArray[0].y() = bottom;        pointArray[1].x() = right;        pointArray[1].y() = top;        pointArray.setNumElements(2);        return createLine(pointArray);       }    createRect(oaBox(oaMin(left, right), oaMin(top, bottom), oaMax(left, right),	       oaMax(top, bottom)));}// *****************************************************************************// LefInGeom::createPath()//// This function is base class function which applies to pin and obstruction// statements.// It creates paths of an iter statement while calling // createPath(lefiGeomPath*).// *****************************************************************************voidLefInGeom::createPath(lefiGeomPathIter	*lefPathIter){    lefiGeomPath    lefPath;    oaDouble        x;    oaDouble        y;    lefPath.numPoints = lefPathIter->numPoints;    lefPath.x = lefPathIter->x;    lefPath.y = lefPathIter->y;    for (y = 0; y < lefPathIter->yStart; y++) {        for (x = 0; x < lefPathIter->xStart; x++) {            createPath(&lefPath, x * lefPathIter->xStep,		       y * lefPathIter->yStep);        }    }}    // *****************************************************************************// LefInGeom::createPath()//// This function creates new oaFig for given parser geometry.// The point array created from the lef parser datastructure is// compressed before creating the path to catch duplicate points.//// An oaPath is created (or oaRect if appropriate) from the parser data.// For Pins this figure is directly returned.// For Obstructions, the figure is converted to a polygon (the outline// of the path or rect), and this polygon is used to create an oaBlockage.// *****************************************************************************voidLefInGeom::createPath(lefiGeomPath  *lefPath,		      oaDouble	    offsetX,		      oaDouble	    offsetY){    int		    numPoints = lefPath->numPoints;    oaPointArray    pointArray(numPoints);    for (int i = 0; i < numPoints; i++) {        pointArray[i].x() = lefIn.uuToDBU(lefPath->x[i] + offsetX);        pointArray[i].y() = lefIn.uuToDBU(lefPath->y[i] + offsetY);    }    pointArray.setNumElements(numPoints);    pointArray.compress(false);    createPath(pointArray);}// *****************************************************************************// LefInGeom::createPolygon()//// This function is base class function which applies to pin and obstruction// statements.// It creates polygon of an iter statement while calling // createPolygon(lefiGeomPolygon*).// *****************************************************************************voidLefInGeom::createPolygon(lefiGeomPolygonIter *lefPolygonIter){    lefiGeomPolygon lefPolygon;    oaDouble        x;    oaDouble        y;    lefPolygon.numPoints    = lefPolygonIter->numPoints;    lefPolygon.x	    = lefPolygonIter->x;    lefPolygon.y	    = lefPolygonIter->y;    for (y = 0; y < lefPolygonIter->yStart; y++) {        for (x = 0; x < lefPolygonIter->xStart; x++) {            createPolygon(&lefPolygon, x * lefPolygonIter->xStep,			  y * lefPolygonIter->yStep);        }    }}// *****************************************************************************// LefInGeom::createPolygon()//// This function is base class function which applies to pin and obstruction// statements.// It creates a new oaFig for given parser geometry.// The point array created from the lef parser datastructure is// compressed before creating the path to catch duplicate points.//// For Pins an oaPolygon is created from the point array,// For Obstructions, an oaBlockage is created.// *****************************************************************************voidLefInGeom::createPolygon(lefiGeomPolygon    *lefPolygon,			 oaDouble	    offsetX,			 oaDouble	    offsetY){    oaUInt4         numPoints = lefPolygon->numPoints;    oaPointArray    pointArray(numPoints);    for (oaUInt4 i = 0; i < numPoints; i++) {        pointArray[i].x() = lefIn.uuToDBU(lefPolygon->x[i] + offsetX);        pointArray[i].y() = lefIn.uuToDBU(lefPolygon->y[i] + offsetY);    }    pointArray.setNumElements(numPoints);    pointArray.compress(true);    createPolygon(pointArray);}// *****************************************************************************// LefInGeom::createVia()// // This function is base class function which applies to pin and obstruction// statements. It creates vias of an iter statement while calling // createVia(lefiGeomVia*).// *****************************************************************************voidLefInGeom::createVia(lefiGeomViaIter	*lefViaIter){    lefiGeomVia     lefVia;    oaDouble        x;    oaDouble        y;    lefVia.name = lefViaIter->name;    lefVia.x	= lefViaIter->x;    lefVia.y	= lefViaIter->y;    for (y = 0; y < lefViaIter->yStart; y++) {        for (x = 0; x < lefViaIter->xStart; x++) {            createVia(&lefVia, x * lefViaIter->xStep, y * lefViaIter->yStep);        }    }}// *****************************************************************************// LefInGeom::createVia()//// This function is base class function which applies to pin and obstruction// statements.// It creates a new oaFig for given parser via geometry.//// For Pins, an oaVia is stored. For Obstructions, the function createVia will// create separate oaBlockages for all shapes in the via.// *****************************************************************************voidLefInGeom::createVia(lefiGeomVia    *lefVia,		     oaDouble	    offsetX,		     oaDouble	    offsetY){    oaDouble	x	= lefVia->x;    oaDouble	y	= lefVia->y;    oaPoint	point(lefIn.uuToDBU(x + offsetX), lefIn.uuToDBU(y + offsetY));    oaString	viaName = lefVia->name;    oaViaDef	*viaDef = oaViaDef::find(lefIn.tech(), viaName);    oaVia	*via;    if (viaDef && viaDef->getType() == oacCustomViaDefType) {	via = oaCustomVia::create(lefIn.topBlock(), (oaCustomViaDef*) viaDef,				  oaTransform(point));    } else {    	oaViaParam	viaParam;	viaDef = lefIn.getGenVia(viaName, viaParam);	if (!viaDef) {	    throw LefDefError(cGeomCannotFindVia, (const char*) viaName);	}	 	via = oaStdVia::create(lefIn.topBlock(), (oaStdViaDef*) viaDef,			       oaTransform(point), &viaParam);    }    createVia(via, point);}// *****************************************************************************// LefInGeom::createConstraints()//// This function creates constraints on the given shape, // for any current object based spacing rules.// *****************************************************************************voidLefInGeom::createConstraints(oaFig *fig){    if (currentSpacing) {	oaLayerConstraintDef	*def = oaLayerConstraintDef::get(oacMinSpacing);	oaValue			*value = oaIntValue::create(lefIn.design(),							    currentSpacing);	oaConstraint		*constraint = oaLayerConstraint::create(getLayerNum(),									def, value);	oaConstraintGroupMem::create(fig->getConstraintGroup(), constraint);    }}            // *****************************************************************************// LefInGeom::getLayerNum()//// This function returns the current layer num. If no layer has been set, an// exception is thrown.// *****************************************************************************oaLayerNumLefInGeom::getLayerNum(){    if (!hasLayer) {	throw LefDefError(cGeomNoLayer);    }    return currentLayerNum;}// *****************************************************************************// LefInGeomPin::LefInGeomPin()//

⌨️ 快捷键说明

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