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

📄 oadefinpin.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// *****************************************************************************// *****************************************************************************// DefInPin.cpp//// Functions to handle DEF PINS 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: nitters $//  $Revision: 1.83 $//  $Date: 2005/04/26 11:39:15 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefInPin::DefInPin()// DefInPin::~DefInPin()//// This is the constructor for the DefInPin class.// *****************************************************************************DefInPin::DefInPin(DefIn    &translator):   termType(oacInputOutputTermType),    sigType(oacSignalSigType),    visibility(oacInheritFromTopBlock),    placementStatus(oacUnplacedPlacementStatus),    defIn(translator){    translator.defInPin = this;}DefInPin::~DefInPin(){}// *****************************************************************************// DefInPin::parse()//// This function is called for each pin found in the "PINS" DEF construct.// For each DEF pin, a net and a terminal are created.// If it represents a physical pin (layer attribute and optionnally placement// information), a physical pin object is created attached to the terminal.// *****************************************************************************voidDefInPin::parse(defiPin  *data){    defPin = data;    // Remove any ".extra" suffixes from the pin name.    oaString	pinName = data->pinName();    oaUInt4	nameEnd = pinName.substr(".extra");    if (nameEnd != pinName.getLength()) {	oaChar	    busChar = defIn.getNS().getOpenBusChar();	oaString    busOpen(&busChar, 1);	oaUInt4	    busStart = pinName.substr(busOpen, nameEnd);	oaString    postFix;		if (busStart != pinName.getLength()) {	    postFix = &pinName[busStart];	}	pinName[nameEnd] = 0;	pinName += postFix;    }    // Determine domain visibility.    parseDirection();    parseUse();    visibility = oacInheritFromTopBlock;    if (isPhysicalOnly()) {	visibility = oacExcludeFromModuleDomain;    }        // Find or create the terminal.    defIn.getSimpleName(pinName, simplePinName);    defIn.getSimpleName(defPin->netName(), simpleNetName);    if (defIn.isUpdate() && visibility != oacExcludeFromModuleDomain) {	term = (oaBitTerm*) oaTerm::find(defIn.topBlock(), simplePinName);	if (!term) {	    throw LefDefError(cPinUpdateNotFound, defPin->pinName());	}	// Terminal already exists; checks its net.	oaNet	*net = oaNet::find(defIn.topBlock(), simpleNetName);	if (term->getNet() != net) {	    throw LefDefError(cPinDifferentNet, defPin->pinName());	}    } else {	term = defIn.getTerm(simplePinName, simpleNetName,			     termType, sigType, visibility);    }    // Parse any terminal attributes.    parseSpecial();    parsePlacement();    parseLayers();    parsePolygons();    parseAntenna();    parseSensitivity();    parseNetExpr();}// *****************************************************************************// DefInPin::parseDirection()//// This function sets the termType corresponding to the specified DEF pin// direction. Illegal values should be handled by the parser.// *****************************************************************************voidDefInPin::parseDirection(){        termType = oacInputOutputTermType;    if (defPin->hasDirection()) {	oaString    direction = defPin->direction();	if (direction == "INPUT") {	    termType = oacInputTermType;	} else if (direction == "OUTPUT") {	    termType = oacOutputTermType;	} else if (direction == "INOUT") {	    termType = oacInputOutputTermType;	} else if (direction == "FEEDTHRU") {	    termType = oacJumperTermType;	}    }}// *****************************************************************************// DefInPin::parseUse()//// This function determines the signal type of the pin.// *****************************************************************************voidDefInPin::parseUse(){    sigType = oacSignalSigType;        if (defPin->hasUse()) {	sigType = defIn.getSigType(defPin->use());    }}// *****************************************************************************// DefInPin::parseSpecial()//// This function determines the oaRouteMethod from the DEF SPECIAL attribute.// *****************************************************************************voidDefInPin::parseSpecial(){    oaRouteMethod   routeMethod = defPin->hasSpecial()	? oacGeometricRouteMethod : oacSymbolicRouteMethod;    term->setRouteMethod(routeMethod);}// *****************************************************************************// DefInPin::parsePlacement()//// This function determines placement status, location and orientation.// *****************************************************************************voidDefInPin::parsePlacement(){    xform.init();    placementStatus = oacUnplacedPlacementStatus;    if (defPin->hasPlacement()) {	if (defPin->isFixed() || defPin->isCover()) {	    placementStatus = oacLockedPlacementStatus;	} else if (defPin->isPlaced()) {	    placementStatus = oacPlacedPlacementStatus;	}	// Get the transform	xform.offset().x() = defIn.scaleToDBU(defPin->placementX());	xform.offset().y() = defIn.scaleToDBU(defPin->placementY());	xform.orient() = defIn.getOrient(defPin->orient());    }}// *****************************************************************************// DefInPin::parseLayers()// DefInPin::parseLayer()//// These functions parse the rectangles for the DEF pin.// *****************************************************************************voidDefInPin::parseLayers(){    for (int i = 0; i < defPin->numLayer(); i++) {	parseLayer(i);    }}voidDefInPin::parseLayer(oaUInt4	i){    oaLayerNum	layerNum = defIn.getLayerNum(defPin->layer(i));     // Get the bbox of the geometry    int	 xl;    int	 yl;    int	 xh;    int	 yh;    defPin->bounds(i, &xl, &yl, &xh, &yh);        oaPoint p1(defIn.scaleToDBU(xl), defIn.scaleToDBU(yl));    oaPoint p2(defIn.scaleToDBU(xh), defIn.scaleToDBU(yh));        // transform to placement location    p1.transform(xform);    p2.transform(xform);	    // Create the rectangle    oaRect  *rect = NULL;    oaBox   bBox(oaMin(p1.x(), p2.x()), oaMin(p1.y(), p2.y()),		 oaMax(p1.x(), p2.x()), oaMax(p1.y(), p2.y()));        rect = oaRect::create(defIn.topBlock(), layerNum,			  oavPurposeNumberDrawing, bBox);    // Create the pin    oaPin   *pin = oaPin::create(term);        pin->setPlacementStatus(placementStatus);    rect->addToPin(pin);}// *****************************************************************************// DefInPin::parsePolygons()// DefInPin::parsePolygon)//// These functions parse the polygons for the DEF pin.// *****************************************************************************voidDefInPin::parsePolygons(){    for (int i = 0; i < defPin->numPolygons(); i++) {	parsePolygon(i);    }}voidDefInPin::parsePolygon(oaUInt4    i){    oaLayerNum	    layerNum   = defIn.getLayerNum(defPin->polygonName(i));    // Get the points of the geometry    oaUInt4	    numPoints = defPin->getPolygon(i).numPoints;    oaPointArray    points(numPoints);    for (oaUInt4 j = 0; j < numPoints; j++) {	points[j] = oaPoint(defIn.scaleToDBU(defPin->getPolygon(i).x[j]),			    defIn.scaleToDBU(defPin->getPolygon(i).y[j]));    }    points.setNumElements(numPoints);    // transform to placement location    points.transform(xform);    points.compress();	    // Create the shape    oaPolygon	*polygon = oaPolygon::create(defIn.topBlock(), layerNum,					     oavPurposeNumberDrawing, points);    // Create the pin    oaPin   *pin = oaPin::create(term);

⌨️ 快捷键说明

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