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

📄 oadefoutcomponent.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// DefOutComponent.cpp//// Functions to handle DEF components 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.37 $//  $Date: 2005/06/14 10:42:53 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefOutComponent::DefOutComponent()// DefOutComponent::~DefOutComponent()//// This is the constructor for the DefOutComponent class. // *****************************************************************************DefOutComponent::DefOutComponent(DefOut	&translator):   defOut(translator){    translator.defOutComponent = this;}DefOutComponent::~DefOutComponent(){}// *****************************************************************************// DefOutComponent::write()//// This function writes the COMPONENT construct for this instance.//// Syntax:// - compName modelName // *****************************************************************************voidDefOutComponent::write(oaInst	*instIn){    inst = instIn;    oaString	instName;    oaString	cellName;    inst->getName(defOut.getNS(), instName);    inst->getCellName(defOut.getNS(), cellName);    master = inst->getMaster();    defOut.output("- %s %s", (const char*) instName, (const char*) cellName);    defOut.incIndent();    writePlacement();    writeEEQMaster();    writeSource();    writeWeight();    writeRegion();    if (defOut.getOptions()->getVersion() > cLefDefVersion55) {	writeHalo();    }    defOut.writeProperties(inst, cLefDefComponent);    defOut.outNoIndent(" ;\n");    defOut.decIndent();}// *****************************************************************************// DefOutComponent::writeEEQMaster()//// This function writes the cellName electrically equivalent.//// Syntax:// [+ EEQMASTER macroName]// *****************************************************************************voidDefOutComponent::writeEEQMaster(){    if (master && master->getTopBlock()) {	oaString    EEQMaster;	master->getTopBlock()->getEEQMaster(EEQMaster);	if (!EEQMaster.isEmpty()) {	    defOut.outNoIndent("\n");	    defOut.output("+ EEQMASTER %s", (const char *) EEQMaster);	}    }}// *****************************************************************************// DefOutComponent::writeSource()//// This function writes the instance source.//// Syntax:// [+ SOURCE {NETLIST | DIST | USER | TIMING}]// *****************************************************************************voidDefOutComponent::writeSource(){    oaString	source;    switch (inst->getSource()) {      case oacTimingSource :	source = "TIMING";	break;      case oacDistSource :	source = "DIST";	break;      case oacUserSource :	source = "USER";	break;      default:	return;    }    defOut.outNoIndent("\n");    defOut.output("+ SOURCE %s", (const char*) source);}// *****************************************************************************// DefOutComponent::writePlacement()//// This function writes the instance placement status, location and orientation//// Syntax:// [+ { FIXED pt orient | COVER pt orient | PLACED pt orient //    | UNPLACED } ]// *****************************************************************************voidDefOutComponent::writePlacement(){    switch (inst->getPlacementStatus()) {      case oacPlacedPlacementStatus:	defOut.outNoIndent(" + PLACED");	break;      case oacFixedPlacementStatus:	defOut.outNoIndent(" + FIXED");	break;      case oacLockedPlacementStatus:	defOut.outNoIndent(" + COVER");	break;      case oacUnplacedPlacementStatus:	defOut.outNoIndent(" + UNPLACED");      default:	return; // no coordinates to output if UNPLACED    }    oaPoint	origin;    oaBox	bBox;    oaTransform tr(0, 0);    oaString	os;    inst->getOrigin(origin);    getMasterBoundary(bBox);    switch (inst->getOrient()) {      case oacR0:	tr = oaTransform(bBox.left(), bBox.bottom());	os = "N";	break;      case oacR90:	tr = oaTransform(-bBox.bottom() - bBox.getHeight(),			 bBox.left());	os =  "W";	break;      case oacR180:	tr = oaTransform(-bBox.left() - bBox.getWidth(),			 -bBox.bottom() - bBox.getHeight());	os = "S";	break;      case oacR270:	tr = oaTransform(bBox.bottom(),			 -bBox.left() - bBox.getWidth());	os = "E";	break;      case oacMY:	tr = oaTransform(-bBox.left() - bBox.getWidth(),			 bBox.bottom());	os = "FN";	break;      case oacMYR90:	tr = oaTransform(-bBox.bottom() - bBox.getHeight(),			 -bBox.left() - bBox.getWidth());	os = "FE";	break;      case oacMX:	tr = oaTransform(bBox.left(),			 -bBox.bottom() - bBox.getHeight());	os = "FS";	break;      case oacMXR90:	tr = oaTransform(bBox.bottom(),			 bBox.left());	os = "FW";    }    origin.transform(tr);    defOut.outNoIndent(" ( %i %i ) %s", origin.x(), origin.y(),		       (const char*) os);}// *****************************************************************************// DefOutComponent::writeWeight()//// This function writes the WEIGHT construct for this instance.// The DEF instance weight is equivalent to the oaInst priority.//// Syntax:// [+ WEIGHT weight] // *****************************************************************************voidDefOutComponent::writeWeight(){    oaInt4 weight = inst->getPriority();    if (weight) {	defOut.outNoIndent("\n");	defOut.output("+ WEIGHT %i", weight);    }}// *****************************************************************************// DefOutComponent::writeRegion()//// This function writes the REGION attribute for the current instance.// Note: for anonymous regions we only write the coordinates.// (Currently, for anonymous regions, the name starts with anonymous)//// Syntax:// [+ REGION { pt pt | regionName }]// *****************************************************************************voidDefOutComponent::writeRegion(){      oaCluster   *cluster = inst->getCluster();    if (!cluster || !cluster->getBoundaries().getCount()) {	return;    }    oaString	regionName;    cluster->getName(regionName);    defOut.outNoIndent("\n");    defOut.output("+ REGION ");    if (regionName.substr("anonymous") == regionName.getLength()) {	defOut.outNoIndent("%s", (const char *) regionName);	return;    }            oaIter<oaClusterBoundary> cbIter(cluster->getBoundaries());    oaClusterBoundary	      *clusterBoundary;    while (clusterBoundary = cbIter.getNext()) {	oaBox bbox;	clusterBoundary->getBBox(bbox);	defOut.outNoIndent(" ( %i %i ) ( %i %i )",			   bbox.left(), bbox.bottom(),			   bbox.right(), bbox.top());    }}// *****************************************************************************// DefOutComponent::writeHalo()//// This function writes the HALO attribute for the current instance.//// Syntax:// [+ HALO left bottom right top]// *****************************************************************************voidDefOutComponent::writeHalo(){      oaAreaHalo *halo = oaAreaHalo::find(inst);    if (halo) {	oaUInt4	left;	oaUInt4	bottom;	oaUInt4	right;	oaUInt4 top;	halo->getOffsets(left, bottom, right, top);	defOut.outNoIndent("\n");	defOut.output("+ HALO %i %i %i %i", left, bottom, right, top);    }}// *****************************************************************************// DefOutComponent::getMasterBoundary()// // Gets the bbox of the snapBoundary in the master design for this instance.// If snapBoundary does not exist, prBoundary or design bbox are used.// *****************************************************************************voidDefOutComponent::getMasterBoundary(oaBox &bbox){    if (master) {	oaBlock	*blk = master->getTopBlock();	if (blk) {	    oaSnapBoundary  *snapBoundary = oaSnapBoundary::find(blk);	    if (snapBoundary) {		snapBoundary->getBBox(bbox);		return;	    }	    oaPRBoundary    *prBoundary = oaPRBoundary::find(blk);	    if (prBoundary) {		prBoundary->getBBox(bbox);		return;	    }	    blk->getBBox(bbox);	    return;	}    }    oaString	cellName;    inst->getCellName(defOut.getNS(), cellName);    inst->getHeader()->getBBox(bbox);    defOut.warn(cInstMasterNotFound, (const char*) cellName);}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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