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

📄 oadefinregion.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// DefInRegion.cpp//// Functions to handle DEF REGIONS constructs for the 'def2oa' translator.//// *****************************************************************************// 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: sailajad $//  $Revision: 1.28 $//  $Date: 2005/07/17 01:55:02 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefInRegion::DefInRegion()// DefInRegion::~DefInRegion()//// This is the constructor for the DefInRegion class.// *****************************************************************************DefInRegion::DefInRegion(DefIn	&translator):   defIn(translator),    nbAnonymousRegions(0){    translator.defInRegion = this;}DefInRegion::~DefInRegion(){}// *****************************************************************************// DefInRegion::init()//// This function initializes the DefInRegion class. Any persistent data// will be reset.// *****************************************************************************voidDefInRegion::init(){    nbAnonymousRegions = 0;}// *****************************************************************************// DefInRegion::parse()//// This function is called for each region found in the "REGIONS" DEF construct.// In OA, a DEF region is modeled by a cluster object associated to one to// several cluster boundaries objects, each cluster boundary representing an// area (pair of points) of the region.// *****************************************************************************voidDefInRegion::parse(defiRegion	*data){    defRegion = data;    oaCluster	*region = create(defRegion->name(), NULL, NULL, true, false);     // TYPE attribute (5.5 attribute)    if (defRegion->hasType()) {	oaString    regionType = defRegion->type();	if (regionType == "FENCE") {	    region->setClusterType(oacClusterTypeExclusive);	} else if (regionType == "GUIDE") {	    region->setClusterType(oacClusterTypeSuggested);	}    }    // User properties    LefDefProp	    *propDef;    for (int i = 0; i < defRegion->numProps(); i++) {	propDef = defIn.getProp(defRegion->propName(i), cLefDefRegion);	defIn.createProp(propDef, region, oaString(defRegion->propValue(i)));    }}// *****************************************************************************// DefInRegion::find()//// This function searches a region with specified name in the DEF design.// It returns a pointer on it if succeeds, NULL otherwise.// A cluster object represents a region if it has at least one boundary.// *****************************************************************************oaCluster *DefInRegion::find(const oaString    &regionName){    oaCluster   *region = NULL;    region = oaCluster::find(defIn.design()->getTopBlock(), regionName);    if (region &&  (region->getBoundaries().getCount() > 0)) {	return region;    }    return NULL;}// *****************************************************************************// DefInRegion::create()//// This function creates a region in the DEF design : a cluster object// associated to one to several cluster boundaries objects, each cluster// boundary representing an area (pair of points) of the region.// It returns the created region or NULL.// This function is used when handling REGIONS, GROUPS and COMPONENTS.//// Prerequisite : a region with the specified name does not already exist in//                the DEF design.// *****************************************************************************oaCluster *DefInRegion::create(const oaString  &regionNameIn,		    defiGroup	    *groupData,		    defiComponent   *componentData,		    oaBoolean	    fromRegion,		    oaBoolean	    fromComponent){    oaCluster   *regionCluster = NULL;    oaString    regionName;    if (regionNameIn.isEmpty()) {	regionName.format(100, "anonymousRegion_%d", nbAnonymousRegions);	nbAnonymousRegions++;    } else {	regionName = regionNameIn;    }    regionCluster = oaCluster::create(defIn.design()->getTopBlock(), regionName,				      oacClusterTypeInclusive);    if (fromRegion) {	for (int i = 0; i < defRegion->numRectangles(); i++) {	    // Create a clusterBoundary for each pair of points	    oaPointArray    bBox(4);	    int xl = defIn.scaleToDBU(defRegion->xl(i));	    int yl = defIn.scaleToDBU(defRegion->yl(i));	    int xh = defIn.scaleToDBU(defRegion->xh(i));	    int yh = defIn.scaleToDBU(defRegion->yh(i));	    bBox.append(oaPoint(xl, yl));	    bBox.append(oaPoint(xl, yh));	    bBox.append(oaPoint(xh, yh));	    bBox.append(oaPoint(xh, yl));	    oaString	clusterBoundaryName(100);	    	    clusterBoundaryName.format("%s_%d", (const char *) regionName, i);	    oaClusterBoundary::create(regionCluster,		clusterBoundaryName,		bBox);	}    } else {	// from group or components construct, create the anonymous region	int size;	int *gxl;	int *gyl;	int *gxh;	int *gyh;	if (!fromComponent) {	    groupData->regionRects(&size, &gxl, &gyl, &gxh, &gyh);	} else {	    componentData->regionBounds(&size, &gxl, &gyl, &gxh, &gyh);	}	// Normally from syntax only 1 rect ...	int xl = defIn.scaleToDBU(gxl[0]);	int yl = defIn.scaleToDBU(gyl[0]);	int xh = defIn.scaleToDBU(gxh[0]);	int yh = defIn.scaleToDBU(gyh[0]);	oaPointArray    bBox(4);	bBox.append(oaPoint(xl, yl));	bBox.append(oaPoint(xl, yh));	bBox.append(oaPoint(xh, yh));	bBox.append(oaPoint(xh, yl));	oaString    clusterBoundaryName(100);	clusterBoundaryName.format("%s_%d", (const char *) regionName, 0);	oaClusterBoundary::create(regionCluster, clusterBoundaryName, bBox);    }    return regionCluster;}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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