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

📄 oadefinndr.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// DefInNDR.cpp//// Functions to handle DEF NONDEFAULTRULE 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: mhahn $//  $Revision: 1.12 $//  $Date: 2005/01/04 03:26:11 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefInNDR::DefInNDR()// DefInNDR::~DefInNDR()//// This is the constructor for the DefInNDR class. // *****************************************************************************DefInNDR::DefInNDR(DefIn    &translator):   defIn(translator){    translator.defInNDR = this;}DefInNDR::~DefInNDR(){}// *****************************************************************************// DefInNDR::parse()//// This function handles a DEF NONDEFAULTRULE construct.// It creates an OA ndr object in the technology database.// *****************************************************************************voidDefInNDR::parse(defiNonDefault	*data){    defNDR = data;    ndr = oaConstraintGroup::find(defIn.design(), defNDR->name());    if (!ndr) {	ndr = oaConstraintGroup::create(defIn.design(), defNDR->name());    }    // Parse the layer and via definitions    oaLayerArray    layerArray;    oaViaDefArray   viaDefArray;        parseLayers(layerArray);    parseVias(viaDefArray);    parseViaRules(viaDefArray);    // Create the new ndr    oaValue *v = oaLayerArrayValue::create(defIn.design(), layerArray);    defIn.setConstraint(ndr, oacValidRoutingLayers, v);        v = oaViaDefArrayValue::create(defIn.design(), viaDefArray);    defIn.setConstraint(ndr, oacValidRoutingVias, v);    parseMinCuts();    parseProperties();}// *****************************************************************************// DefInNDR::parseVias()//// This function handles the VIA section in the current DEF NONDEFAULTRULE// construct.// *****************************************************************************voidDefInNDR::parseVias(oaViaDefArray &viaDefArray){    for (int i = 0; i < defNDR->numVias(); i++) {	oaViaDef    *viaDef = oaCustomViaDef::find(defIn.tech(),						   defNDR->viaName(i));		if (!viaDef) {	    throw LefDefError(cNDRCannotFindVia, defNDR->name(), 			      defNDR->viaName(i));	}	viaDefArray.append(viaDef);    }}// *****************************************************************************// DefInNDR::parseViaRules()//// This function handles the VIARULE section in the current DEF NONDEFAULTRULE// construct.// *****************************************************************************voidDefInNDR::parseViaRules(oaViaDefArray	&viaDefArray){    for (int i = 0; i < defNDR->numViaRules(); i++) {	oaViaDef    *viaDef = oaStdViaDef::find(defIn.tech(), 						defNDR->viaRuleName(i));		if (!viaDef) {	    throw LefDefError(cNDRCannotFindViaRule, defNDR->name(),			      defNDR->viaRuleName(i));	}	viaDefArray.append(viaDef);    }}// *****************************************************************************// DefInNDR::parseLayers()//// This function handles the LAYER section in the current LEF NONDEFAULTRULE// construct.// *****************************************************************************voidDefInNDR::parseLayers(oaLayerArray  &layerArray){    oaString		layerName;    oaPhysicalLayer	*layer;    for (int i = 0; i < defNDR->numLayers(); i++) {	layer = defIn.getLayer(defNDR->layerName(i));	if (layer->getMaterial() != oacMetalMaterial) {	    throw LefDefError(cNDRNotRoutingLayer, defNDR->name(),                  defNDR->layerName(i));	}	oaLayerNum  layerNum = layer->getNumber();	parseLayerWidth(i, layerNum);	parseLayerDiagWidth(i, layerNum);	parseLayerSpacing(i, layerNum);	parseLayerExt(i, layerNum);		layerArray.append(layerNum);    }}// *****************************************************************************// DefInNDR::parseLayerWidth()//// This function handles the LAYER WIDTH attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidDefInNDR::parseLayerWidth(oaUInt4	num,			  oaLayerNum	layerNum){    oaUInt4 width = defIn.scaleToDBU(defNDR->layerWidth(num));    oaValue *v	  = oaIntValue::create(defIn.design(), width);    defIn.setConstraint(ndr, oacMinWidth, layerNum, v);}    // *****************************************************************************// DefInNDR::parseLayerDiagWidth()//// This function handles the LAYER DIAGWIDTH attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidDefInNDR::parseLayerDiagWidth(oaUInt4	    num,			      oaLayerNum    layerNum){    if (defNDR->hasLayerDiagWidth(num)) {	oaUInt4	width = defIn.scaleToDBU(defNDR->layerWidth(num));	oaValue	*v = oaIntValue::create(defIn.design(), width);	defIn.setConstraint(ndr, oacMinDiagonalWidth, layerNum, v);    }}    // *****************************************************************************// DefInNDR::parseLayerSpacing()//// This function handles the LAYER SPACING attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidDefInNDR::parseLayerSpacing(oaUInt4	num,			    oaLayerNum	layerNum){    oaUInt4 spacing = defIn.scaleToDBU(defNDR->layerSpacing(num));    oaValue *v	    = oaIntValue::create(defIn.design(), spacing);    defIn.setConstraint(ndr, oacMinSpacing, layerNum, v);}    // *****************************************************************************// DefInNDR::parseLayerExt()//// This function handles the LAYER WIREXT attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidDefInNDR::parseLayerExt(oaUInt4	    num,			oaLayerNum  layerNum){    if (defNDR->hasLayerWireExt(num)) {	oaUInt4	ext = defIn.scaleToDBU(defNDR->layerWireExt(num));	oaValue *v = oaIntValue::create(defIn.design(), ext);	defIn.setConstraint(ndr, oacMinWireExtension, layerNum, v);    }}    // *****************************************************************************// DefInNDR::parseMinCuts()//// This function handles the MINCUTS attribute for the non-default-rule// *****************************************************************************voidDefInNDR::parseMinCuts(){    for(int i = 0; i < defNDR->numMinCuts(); i++) {	oaPhysicalLayer *layer = defIn.getLayer(defNDR->cutLayerName(i));	oa1DLookupTbl<oaInt4, oaInt4>	table(1, "minNumCut", 1);    	table.setHeader(0, defIn.scaleToDBU(defNDR->layerWidth(i)));	table.setValue(0, defNDR->numCuts(i));	table.setNumItems(1);		oaValue	*v = oaInt1DTblValue::create(defIn.design(), table);	defIn.setConstraint(ndr, oacMinNumCut, layer->getNumber(), v);    }}// *****************************************************************************// DefInNDR::parseProperties()//// This function handles the properties for the non-default-rule// *****************************************************************************voidDefInNDR::parseProperties(){    LefDefProp *propDef;    for (int i = 0; i < defNDR->numProps(); i++) {	propDef = defIn.getProp(defNDR->propName(i), cLefDefNonDefaultRule);	defIn.createProp(propDef, ndr, defNDR->propValue(i));    }}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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