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

📄 oalefoutmacro.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// *****************************************************************************// *****************************************************************************// LefOutMacro.cpp//// This file contains the member functions for the LefOutMacro class.//// *****************************************************************************// 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.65 $//  $Date: 2005/07/29 13:42:24 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefOutMacro::LefOutMacro()// LefOutMacro::~LefOutMacro()//// This is the default constructor for the LefOutMacro class. // *****************************************************************************LefOutMacro::LefOutMacro(LefOut	    &lefOutIn):   lefOut(lefOutIn){    lefOutIn.lefOutMacro = this;}LefOutMacro::~LefOutMacro(){}// *****************************************************************************// LefOutMacro::write()//// This function outputs the MACRO definition for this design. It first outputs// any new stdVias that are used in this design.// *****************************************************************************voidLefOutMacro::write(oaDesign *designIn){    design = designIn;    block = designIn->getTopBlock();            // Determine the bBox of the design.    oaBoundary  *boundary = oaSnapBoundary::find(block);    if (!boundary) {	boundary = oaPRBoundary::find(block);    }    if (boundary) {	boundary->getBBox(bBox);    } else {	block->getBBox(bBox);    }        // Write any stdVias used in this design.    if (lefOut.getOptions()->getVersion() > cLefDefVersion55) {	writeStdVias();    }    oaString	macroName;    design->getCellName(lefOut.getNS(), macroName);    lefOut.output("MACRO %s\n", (const char*) macroName);    lefOut.incIndent();    writeClass();    writeOrigin();    writeForeign();    writeEEQ();    writeSize();    writeSymmetry();    writeSite();    writePins();    writeObs();    writeDensity();    lefOut.writeProperties(design, cLefDefMacro);    lefOut.decIndent();    lefOut.output("END %s\n\n", (const char*) macroName);}// *****************************************************************************// LefOutMacro::writeStdVias()// LefOutMacro::writeStdVia()//// These functions output the oaStdVias used in this design.// *****************************************************************************voidLefOutMacro::writeStdVias(){    lefOut.clearGenVias(true);    oaIter<oaViaHeader> vhIter(block->getViaHeaders());    while (oaViaHeader	*vh = vhIter.getNext()) {	if (vh->getType() == oacStdViaHeaderType) {	    writeStdVia((oaStdViaHeader*) vh);	}    }}voidLefOutMacro::writeStdVia(oaStdViaHeader	*viaHeader){    oaString	viaRuleName;    viaHeader->getViaDefName(viaRuleName);    // Add a unique number to the end of the name    oaUInt4	num = lefOut.addGenVia((oaStdViaHeader *) viaHeader);    oaString	name(256);    name.format("%s_%d", (const char*) viaRuleName, num);    lefOut.output("VIA %s\n", (const char*) name);    lefOut.incIndent();    lefOut.output("VIARULE %s ;\n", (const char*) viaRuleName);    oaViaParam	params;    viaHeader->getParams(params);    lefOut.output("CUTSIZE %.11g %.11g ;\n", 		  lefOut.dbuToUU(params.getCutWidth()), 		  lefOut.dbuToUU(params.getCutHeight()));    oaViaDef	*viaDef = viaHeader->getViaDef();    oaString	botLayer;    oaString	cutLayer;    oaString	topLayer;    viaDef->getLayer1()->getName(botLayer);    lefOut.getLayer(params.getCutLayer())->getName(cutLayer);    viaDef->getLayer2()->getName(topLayer);    lefOut.output("LAYERS %s %s %s ;\n", (const char*) botLayer, 		  (const char*) cutLayer, (const char*) topLayer);    lefOut.output("CUTSPACING %.11g %.11g ;\n", 		  lefOut.dbuToUU(params.getCutSpacing().x()), 		  lefOut.dbuToUU(params.getCutSpacing().y()));    lefOut.output("ENCLOSURE %.11g %.11g %.11g %.11g ;\n", 		  lefOut.dbuToUU(params.getLayer1Enc().x()), 		  lefOut.dbuToUU(params.getLayer1Enc().y()), 		  lefOut.dbuToUU(params.getLayer2Enc().x()), 		  lefOut.dbuToUU(params.getLayer2Enc().y()));    lefOut.output("ROWCOL %d %d ;\n", params.getCutRows(), params.getCutColumns());        if (params.getOriginOffset() != oaVector(0, 0)) {	lefOut.output("ORIGIN %.11g %.11g ;\n", 		      lefOut.dbuToUU(params.getOriginOffset().x()), 		      lefOut.dbuToUU(params.getOriginOffset().y()));    }    if (params.getLayer1Offset() != oaVector(0, 0)	|| params.getLayer2Offset() != oaVector(0, 0)) {	lefOut.output("OFFSET %.11g %.11g %.11g %.11g ;\n", 		      lefOut.dbuToUU(params.getLayer1Offset().x()), 		      lefOut.dbuToUU(params.getLayer1Offset().y()), 		      lefOut.dbuToUU(params.getLayer2Offset().x()), 		      lefOut.dbuToUU(params.getLayer2Offset().y()));    }    if (!params.hasDefaultCutPattern()) {	lefOut.output("PATTERN ");	lefOut.writeCutPattern(params);	lefOut.outNoIndent(" ;\n");    }    lefOut.decIndent();    lefOut.output("END %s\n\n", (const char*) name);}// *****************************************************************************// LefOutMacro::writeClass()//// This function outputs the macro class. This is taken from// oaDesign->getCellClass and getCellType. Use the following syntax:// [CLASS //   {COVER | RING | BLOCK //    | PAD [INPUT | OUTPUT |INOUT | POWER | SPACER]//    | CORE [FEEDTHRU | TIEHIGH | TIELOW | SPACER | ANTENNACELL]//    | ENDCAP {PRE | POST | TOPLEFT | TOPRIGHT | BOTTOMLEFT //             | BOTTOMRIGHT} } ;]// *****************************************************************************voidLefOutMacro::writeClass(){    oaString	    classStr;    switch (design->getCellType()) {      case oacBlockCellType:	classStr = "BLOCK";	break;      case oacBlockBlackBoxCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion55) {            classStr = "BLOCK";            break;        }	classStr = "BLOCK BLACKBOX";	break;      case oacSoftMacroCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion56) {            classStr = "BLOCK";            break;        }	classStr = "BLOCK SOFT";	break;      case oacBlockRingCellType:	classStr = "RING";	break;      case oacCoverCellType:	classStr = "COVER";	break;      case oacCoverBumpCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion55) {            classStr = "COVER";            break;        }	classStr = "COVER BUMP";	break;      case oacPadCellType:	classStr = "PAD";	break;      case oacPadSpacerCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion54) {            classStr = "PAD";            break;        }	classStr = "PAD SPACER";	break;      case oacPadAreaIOCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion55) {            classStr = "PAD";            break;        }	classStr = "PAD AREAIO";	break;      case oacCoreCellType:	classStr = "CORE";	break;      case oacCoreSpacerCellType:        if (lefOut.getOptions()->getVersion() < cLefDefVersion54) {            classStr = "CORE";            break;        }	classStr = "CORE SPACER";	break;      case oacCoreAntennaCellType:	classStr = "CORE ANTENNACELL";	break;      case oacCoreWellTapCellType:	if (lefOut.getOptions()->getVersion() > cLefDefVersion55) {	    classStr = "CORE WELLTAP";	    break;	}      case oacCornerCellType:	{          classStr = "ENDCAP";	  oaStringProp *corner              = (oaStringProp *) oaProp::find(design, cLefCorner);          if (corner && corner->getType() == oacStringPropType) {              oaString val;              corner->getValue(val);              classStr += " ";              classStr += val;	  }        }	break;      default:	return;    }    lefOut.output("CLASS %s ;\n", (const char*) classStr);}// *****************************************************************************// LefOutMacro::writeForeign()//// This function outputs the foreign information for this MACRO.// Foreign information is derived from the container layout view,// if the cellview has a "ForeignView" property.// [FOREIGN foreioaCellName [pt [orient]] ;]... // *****************************************************************************voidLefOutMacro::writeForeign(){    oaBooleanProp *foreignProp	= (oaBooleanProp *) oaProp::find(design, cLefForeignView);    if (foreignProp && foreignProp->getValue()) {	oaScalarName	libName;	oaScalarName    cellName;	oaScalarName    viewName(lefOut.getNS(), cLefLayoutName);	design->getLibName(libName);	design->getCellName(cellName);	oaDesign    *foreignView;	try {

⌨️ 快捷键说明

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