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

📄 oadefoutnet.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// *****************************************************************************// *****************************************************************************// DefOutNets.cpp//// Functions to handle DEF SPECIALNETS and NETS 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.88 $//  $Date: 2005/06/16 10:27:21 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefOutNet::DefOutNet()// DefOutNet::~DefOutNet()//// This is the constructor for the DefOutNet class. // *****************************************************************************DefOutNet::DefOutNet(DefOut &translator):   defOut(translator){    translator.defOutNet = this;}DefOutNet::~DefOutNet(){}// *****************************************************************************// DefOutNet::write()//// This function writes a DEF NET construct for the current net.// For a net that appears both in the NETS and the SPECIALNETS section,// common attributes are only written out in the SPECIALNETS section.// *****************************************************************************voidDefOutNet::write(oaBitNet   *netIn,		 oaBoolean  special){    net = netIn;    initDataTypes();    oaString	netName;    net->getName(defOut.getNS(), netName);    defOut.output("- %s", (const char*)netName);    defOut.incIndent();    writePins(special);    if (special || (!special && !geometric)) {	writeSource();	writeOriginal();	writeUse();	writePattern();	writeEstCap();	writeWeight();    }    if (special) {	writeVoltage();        writeFixedBump();	writeSpecialRoutes();	defOut.writeProperties(net, cLefDefSpecialNet);    } else {        writeFrequency();	writeShieldNets();	writeXTalk();	writeNDRule();	writeRoutes();	defOut.writeProperties(net, cLefDefNet);    }    defOut.outNoIndent(" ;\n");    defOut.decIndent();}// *****************************************************************************// DefOutNet::initDataTypes()//// This function checks if the current net has data (instterms// or routes) for the different net types (geometric/symbolic)// Note that terms are only output in the NETs section, so symbolic.// It also checks for attributes that can only appear on special nets.// *****************************************************************************voidDefOutNet::initDataTypes(){    geometric = false;    symbolic = false;    oaIter<oaInstTerm>	instTermIter(net->getInstTerms(oacInstTermIterEquivNets));    oaInstTerm		*instTerm;    while (instTerm = instTermIter.getNext()) {	if (instTerm->getRouteMethod() == oacGeometricRouteMethod) {	    geometric = true;	}	if (instTerm->getRouteMethod() == oacSymbolicRouteMethod) {	    symbolic = true;	}    }    if (net->getRoutes().getCount()) {	symbolic = true;    }    if (net->getShapes(oacShapeIterNetOnly).getCount()	|| net->getVias(oacViaIterNetOnly).getCount()) {	geometric = true;    }    oaIter<oaBitNet>	equivNetIter(net->getEquivalentNets());        while (oaBitNet *equivNet = equivNetIter.getNext()) {	if (equivNet->getRoutes().getCount()) {	    symbolic = true;	}	if (equivNet->getShapes(oacShapeIterNetOnly).getCount()	    || equivNet->getVias(oacViaIterNetOnly).getCount()) {	    geometric = true;	}    }    // attributes that appear only on special nets    oaFloat  voltage(net->getVoltage());    if (voltage != 0.0) {	geometric = true;    }}// *****************************************************************************// DefOutNet::hasData()//// This function checks if the current net has data (terms, instterms// or routes) for the current net type (special/normal)// If there is no data at all, the function will return true for normal nets// *****************************************************************************oaBooleanDefOutNet::hasData(oaBitNet	*n,		   oaBoolean	special){    net = n;    initDataTypes();        if (special && geometric) {	return true;    }    if (!special && symbolic) {	return true;    }    if (!special && !geometric) {	return true;    }    return false;}// *****************************************************************************// DefOutNet::writePins()//// This function writes out all pins for this net.//// Syntax:// [( {compName pinName | PIN pinName} ) ]...// Note: Terminals are NOT listed here again (duplicate of pins section)// *****************************************************************************voidDefOutNet::writePins(oaBoolean    special){    oaIter<oaTerm> termIter(net->getTerms(oacTermIterSingleBit | oacTermIterEquivNets));        while (oaBitTerm *term = (oaBitTerm*) termIter.getNext()) {	oaRouteMethod routeMethod(term->getRouteMethod());	if ((special && routeMethod == oacGeometricRouteMethod)	    || (!special && routeMethod == oacSymbolicRouteMethod)) {	    oaString termName;	    term->getName(defOut.getNS(), termName);	    defOut.outNoIndent("\n");	    defOut.output("( PIN %s )", (const char*) termName);	}    }    oaIter<oaInstTerm>	instTermIter(net->getInstTerms(oacInstTermIterEquivNets));    oaInstTerm		*instTerm;    while (instTerm = instTermIter.getNext()) {	oaRouteMethod	routeMethod(instTerm->getRouteMethod());	if ((special && routeMethod == oacGeometricRouteMethod)	    || (!special && routeMethod == oacSymbolicRouteMethod)) {	    oaString	instName;	    oaString	termName;	    instTerm->getInst()->getName(defOut.getNS(), instName);	    instTerm->getTermName(defOut.getNS(), termName);	    defOut.outNoIndent("\n");	    defOut.output("( %s %s )",			  (const char*)instName, (const char*)termName);	}    }}// *****************************************************************************// DefOutNet::writeShieldNets()//// This function writes the SHIELDNET attribute(s) of the current net.// *****************************************************************************voidDefOutNet::writeShieldNets(){    oaNet	*shieldNet = net->getShieldNet1();    oaString	netName;    if (shieldNet) {	shieldNet->getName(defOut.getNS(), netName);	defOut.outNoIndent("\n");	defOut.output("+ SHIELDNET %s", (const char *) netName);	// We can only have a shielNet2 if there is a shieldNet1	shieldNet = net->getShieldNet2();	if (shieldNet) {	    shieldNet->getName(defOut.getNS(), netName);	    defOut.outNoIndent("\n");	    defOut.output("+ SHIELDNET %s", (const char *) netName);	}    }}// *****************************************************************************// DefOutNet::writeXTalk()//// This function writes the XTALK attribute for the current net.// XTALK attribute is only valid in NETS section.//// Syntax: [+ XTALK class]// *****************************************************************************voidDefOutNet::writeXTalk(){    oaIntProp	*prop = (oaIntProp *) oaProp::find(net, cDefXtalk);    if (prop && prop->getType() == oacIntPropType) {	defOut.outNoIndent("\n");	defOut.output("+ XTALK %d", prop->getValue());    }}// *****************************************************************************// DefOutNet::writeNDRule()//// This function writes the NONDEFAULTRULE attribute for the current net.// NONDEFAULTRULE attribute is only valid in NETS section.//// Syntax:// [+ NONDEFAULTRULE ruleName]// *****************************************************************************voidDefOutNet::writeNDRule(){    oaConstraintGroup	*cg = defOut.getRules(net);        if (cg && cg != defOut.getDefaultRules()) {	oaString name;	cg->getName(name);	defOut.outNoIndent("\n");	defOut.output("+ NONDEFAULTRULE %s", (const char*) name);    }}// *****************************************************************************// DefOutNet::writeRoutes()//// This function writes a wiring construct for the current (normal) net.//// Syntax:// {+ COVER | + FIXED | + ROUTED | + NOSHIELD} //   <regularWire>... //// *****************************************************************************voidDefOutNet::writeRoutes(){    writeRoutes(net);    oaIter<oaBitNet>	equivNetIter(net->getEquivalentNets());    while (oaBitNet *equivNet = equivNetIter.getNext()) {	writeRoutes(equivNet);    }}voidDefOutNet::writeRoutes(oaBitNet	*bNet){    oaBoolean	    first(true);    oaRouteStatus   currentRouteStatus(oacNormalRouteStatus);    oaBoolean	    currentUnShielded(false);    oaIter<oaRoute> routeIter(bNet->getRoutes());    oaRoute	    *route;    while (route = routeIter.getNext()) {	if (first	    || route->getRouteStatus() != currentRouteStatus) {	    currentRouteStatus = route->getRouteStatus();	    first = true;	    defOut.outNoIndent("\n");	    switch (currentRouteStatus) {	      case oacFixedRouteStatus:		defOut.output("+ FIXED");		break;	      case oacLockedRouteStatus:		defOut.output("+ COVER");		break;	      case oacNormalRouteStatus:	      default:		defOut.output("+ ROUTED");	    }	} 	defOut.incIndent();	writeRoute(route, first);	defOut.decIndent();	first = false;    }   }// *****************************************************************************// DefOutNet::writeRoute()// DefOutNet::writeRouteTaper()//// These function outputs the DEF coordinates for this route//    layerName [TAPER | TAPERRULE ruleName] ( x y [value] )//       {( x * [value] ) | ( * y [value] ) | ( * * [value] ) | viaName}...// *****************************************************************************voidDefOutNet::writeRoute(oaRoute	    *route,		      oaBoolean   first){    oaRouteObjectArray	objects;    route->getObjects(objects);        oaPoint		currentPoint;    oaLayerNum		currentLayerNum = oacNullIndex;    oaUInt4		currentStyleNum = oacNullIndex;    // Find the constraint group (NDR) that is applicable to this route.    oaConstraintGroup	*rules = defOut.getRules(route);    if (!rules) {	rules = defOut.getRules(net);	if (!rules) {	    rules = defOut.getDefaultRules();	}    }    // Output all route elements.    for (oaUInt4 i = 0; i < objects.getNumElements(); i++) {	// Start a new line after every n elements.	if ((i & 0x7) == 0x4) {	    defOut.outNoIndent("\n");	    defOut.output("");	}	switch (objects[i]->getType()) {	  case oacPathSegType:	    {		oaPathSeg   *pathSeg = (oaPathSeg*) objects[i];		oaPoint	    beginPoint;		oaPoint	    endPoint;		oaSegStyle  style;		pathSeg->getStyle(style);		pathSeg->getPoints(beginPoint, endPoint);				oaLayerNum  layerNum	 = pathSeg->getLayerNum();		oaUInt4	    layerWidth   = style.getWidth();		oaUInt4	    dir		 = defOut.getDirection(beginPoint, endPoint);		oaUInt4	    styleNum	 = oacNullIndex;		if (defOut.getOptions()->getVersion() > cLefDefVersion55) {		    styleNum = defOut.defOutStyle->findStyle(style, dir);		}		if (!pathSeg->isOrthogonal()) {		    layerWidth = defOut.diagToOrthoDBU(layerWidth);		}

⌨️ 快捷键说明

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