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

📄 oadefoutstyle.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// DefOutStyles.cpp//// Functions to handle DEF VIA constructs for the 'DefOut' 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: nitters $//  $Revision: 1.11 $//  $Date: 2005/05/30 06:27:54 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefOutStyle::DefOutStyle()// DefOutStyle::~DefOutStyle()//// This is the constructor for the DefOutStyle class. // *****************************************************************************DefOutStyle::DefOutStyle(DefOut	    &translator):   defOut(translator){    translator.defOutStyle = this;}DefOutStyle::~DefOutStyle(){}// *****************************************************************************// DefOutStyle::init()//// This function initializes the table of styles for the current design.// *****************************************************************************voidDefOutStyle::init(){    oaSegStyle	    style;    oaIter<oaShape> shapeIter(defOut.topBlock()->getShapes());        while (oaShape  *shape = shapeIter.getNext()) {    	if (shape->getType() != oacPathSegType) {	    continue;	}	oaPathSeg   *seg = (oaPathSeg*) shape;	seg->getStyle(style);		if (style.getBeginStyle() == oacCustomEndStyle	    || style.getEndStyle() == oacCustomEndStyle) {	    oaPoint start;	    oaPoint end;	    seg->getPoints(start, end);	    oaUInt4 dir = defOut.getDirection(start, end);	    if (!isDefaultStyle(style, dir)) {		addStyle(style, dir);	    }	}    }}// *****************************************************************************// DefOutStyle::write()//// This function writes the style construct for the given style number// *****************************************************************************voidDefOutStyle::write(oaUInt4  num){    const oaSegStyle	&style = styles[num];    oaUInt4		dist[8];    style.getBeginExt(dist[0], dist[1], dist[7], dist[6]);    style.getEndExt(dist[4], dist[5], dist[3], dist[2]);    oaPointArray    points(8);        points[0].x() = - oaInt4(dist[2]);    points[0].y() = dist[2] - dist[3];    points[1].x() = dist[4] - dist[3];    points[1].y() = - oaInt4(dist[4]);    points[2].x() = dist[5] - dist[4];    points[2].y() = - oaInt4(dist[4]);    points[3].x() = dist[6];    points[3].y() = dist[6] - dist[5];    points[4].x() = dist[6];    points[4].y() = dist[7] - dist[6];    points[5].x() = dist[7] - dist[0];    points[5].y() = dist[0];    points[6].x() = dist[0] - dist[1];    points[6].y() = dist[0];    points[7].x() = - oaInt4(dist[2]);    points[7].y() = dist[1] - dist[2];    points.setNumElements(8);    points.compress();    defOut.output("- STYLE %i", num);    for (oaUInt4 i = 0; i < points.getNumElements(); i++) {	defOut.outNoIndent(" ( %i %i )", points[i].x(), points[i].y());    }    defOut.outNoIndent(" ;\n");}// *****************************************************************************// DefOutStyle::addStyle()// DefOutStyle::findStyle()//// These functions keep track of a list of oaSegStyles// *****************************************************************************voidDefOutStyle::addStyle(const oaSegStyle	&style,		      oaUInt4		dir){    oaUInt4 dist[8];    style.getBeginExt(dist[(dir + 4) % 8], dist[(dir + 5) % 8], 	dist[(dir + 3) % 8], dist[(dir + 2) % 8]);    style.getEndExt(dist[(dir + 0) % 8], dist[(dir + 1) % 8], 	dist[(dir + 7) % 8], dist[(dir + 6) % 8]);    oaSegStyle  tmpStyle(oacCustomEndStyle, dist[0], dist[1], dist[7], dist[6],			 oacCustomEndStyle, dist[4], dist[5], dist[3], dist[2]);    // add the new style	    if (styles.find(tmpStyle) == oacNullIndex) {	styles.append(tmpStyle);    }}// *****************************************************************************// DefOutStyle::findStyle()//// This function searches for a segStyle with the given direction. It will also// search for equivalent segStyles in the other directions.// *****************************************************************************oaUInt4DefOutStyle::findStyle(const oaSegStyle	&style,		       oaUInt4		dir){    if (!isDefaultStyle(style, dir)) {	oaUInt4 dist[8];	style.getBeginExt(dist[(dir + 4) % 8], dist[(dir + 5) % 8], 	    dist[(dir + 3) % 8], dist[(dir + 2) % 8]);	style.getEndExt(dist[(dir + 0) % 8], dist[(dir + 1) % 8], 	    dist[(dir + 7) % 8], dist[(dir + 6) % 8]);	oaSegStyle  tmpStyle(oacCustomEndStyle, dist[0], dist[1], dist[7], dist[6],			     oacCustomEndStyle, dist[4], dist[5], dist[3], dist[2]);	return styles.find(tmpStyle);    }    return oacNullIndex;}// *****************************************************************************// DefOutStyle::isDefaultStyle()//// This function returns true if the given style corresponds to the DEF default// style for the given direction. Note: DEF default styles do not exist for// orthogonal segments so for those the function returns false.// *****************************************************************************oaBooleanDefOutStyle::isDefaultStyle(const oaSegStyle	&style,			    oaUInt4		dir) const{    // Orthogonal segments with extend or variable style.    if ((dir & 1) == 0	&& (style.getBeginStyle() == oacExtendEndStyle	    || style.getBeginStyle() == oacVariableEndStyle	    || style.getBeginStyle() == oacTruncateEndStyle)	    && (style.getEndStyle() == oacExtendEndStyle	    || style.getEndStyle() == oacVariableEndStyle	    || style.getEndStyle() == oacTruncateEndStyle)) {	return true;    }	    // Diagonal segments with custom style matching DEF default octagon.    if ((dir & 1) > 0) {	double  width = style.getWidth();	oaUInt4 halfWidth = (oaUInt4) ceil(double(defOut.diagToOrthoDBU(width)) / 2);	oaUInt4 diagHalfWidth = (oaUInt4) ceil(double(width) / 2);	oaUInt4 beginExt;	oaUInt4 beginLeftDiagExt;	oaUInt4 beginRightDiagExt;	oaUInt4 beginRightHalfWidth;	oaUInt4 endExt;	oaUInt4 endLeftDiagExt;	oaUInt4 endRightDiagExt;	oaUInt4 endRightHalfWidth;	style.getBeginExt(beginExt, beginLeftDiagExt, beginRightDiagExt, beginRightHalfWidth);	style.getEndExt(endExt, endLeftDiagExt, endRightDiagExt, endRightHalfWidth);	return beginExt == diagHalfWidth	    && beginLeftDiagExt == halfWidth	    && beginRightDiagExt ==  halfWidth	    && beginRightHalfWidth == diagHalfWidth	    && endExt == diagHalfWidth	    && endLeftDiagExt == halfWidth	    && endRightDiagExt ==  halfWidth	    && endRightHalfWidth == diagHalfWidth;    }        return false;}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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