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

📄 oalefinndr.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// LefInNDR.cpp//// Functions to handle LEF NONDEFAULTRULE constructs for the 'lef2oa' 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/04/27 09:47:09 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefInNDR::LefInNDR()// LefInNDR::~LefInNDR()//// This is the constructor for the LefInNDR class. // *****************************************************************************LefInNDR::LefInNDR(LefIn    &translator):   lefIn(translator),    ndr(NULL){    translator.lefInNDR = this;}LefInNDR::~LefInNDR(){}// *****************************************************************************// LefInNDR::parse()//// This function handles a LEF NONDEFAULTRULE construct.// It creates an OA constraints object in the technology database.// *****************************************************************************voidLefInNDR::parse(lefiNonDefault	*data){    layerArray.setNumElements(0);    viaDefArray.setNumElements(0);    lefNDR = data;    ndr = oaConstraintGroup::find(lefIn.tech(), lefNDR->name());        if (!ndr) {	ndr = oaConstraintGroup::create(lefIn.tech(), lefNDR->name());    }    // Get existing constraints for update mode    oaValue *v;        if (!lefIn.getOptions()->overwriteMode()) {	v = lefIn.getConstraint(ndr, oacValidRoutingLayers);		if (v && v->getType() == oacLayerArrayValueType) {	    ((oaLayerArrayValue*) v)->get(layerArray);	}	v = lefIn.getConstraint(ndr, oacValidRoutingVias);	if (v && v->getType() == oacViaDefArrayValueType) {	    ((oaViaDefArrayValue*) v)->get(viaDefArray);	}    }    // Parse the layer and via definitions    parseLayers();    parseVias();    parseUseVias();    parseUseViaRules();    parseMinCuts();    // Create the new constraints    v = oaLayerArrayValue::create(lefIn.tech(), layerArray);    lefIn.setConstraint(ndr, oacValidRoutingLayers, v);    if (viaDefArray.getNumElements() == 0) {	viaDefArray.append(lefIn.viaDefArray);    }        v = oaViaDefArrayValue::create(lefIn.tech(), viaDefArray);    lefIn.setConstraint(ndr, oacValidRoutingVias, v);    parseProperties();}// *****************************************************************************// LefInNDR::parseVias()//// This function handles the VIA section in the current LEF NONDEFAULTRULE// construct.// *****************************************************************************voidLefInNDR::parseVias(){    for (int i = 0; i < lefNDR->numVias(); i++) {	lefIn.getLefInVia()->parse(lefNDR->viaRule(i), true);	if (viaDefArray.find(lefIn.getLefInVia()->getVia()) == oacNullIndex) {	    viaDefArray.append(lefIn.getLefInVia()->getVia());	}    }}// *****************************************************************************// LefInNDR::parseUseVias()//// This function handles the VIA section in the current LEF NONDEFAULTRULE// construct.// *****************************************************************************voidLefInNDR::parseUseVias(){    for (int i = 0; i < lefNDR->numUseVia(); i++) {	oaViaDef    *viaDef = oaCustomViaDef::find(lefIn.tech(), 						   lefNDR->viaName(i));	if (!viaDef) {	    throw LefDefError(cNDRCannotFindVia, lefNDR->name(), 			      lefNDR->viaName(i));	}	if (viaDefArray.find(viaDef) == oacNullIndex) {	    viaDefArray.append(viaDef);	}    }}// *****************************************************************************// LefInNDR::parseUseViaRules()//// This function handles the VIA section in the current LEF NONDEFAULTRULE// construct.// *****************************************************************************voidLefInNDR::parseUseViaRules(){    for (int i = 0; i < lefNDR->numUseViaRule(); i++) {	oaViaDef    *viaDef = oaStdViaDef::find(lefIn.tech(),						lefNDR->viaRuleName(i));	if (!viaDef) {	    throw LefDefError(cNDRCannotFindVia, lefNDR->name(), 			      lefNDR->viaRuleName(i));	}	if (viaDefArray.find(viaDef) == oacNullIndex) {	    viaDefArray.append(viaDef);	}    }}// *****************************************************************************// LefInNDR::parseLayers()//// This function handles the LAYER section in the current LEF NONDEFAULTRULE// construct.// *****************************************************************************voidLefInNDR::parseLayers(){    oaString		layerName;    oaPhysicalLayer	*layer;    for (int i = 0; i < lefNDR->numLayers(); i++) {	layer = lefIn.getLayer(lefNDR->layerName(i));	if (layer->getMaterial() != oacMetalMaterial) {	    throw LefDefError(cNDRNotRoutingLayer, lefNDR->name(),                  lefNDR->layerName(i));	}	parseLayerWidth(i, layer);	parseLayerDiagWidth(i, layer);	parseLayerSpacing(i, layer);	parseLayerExt(i, layer);		if (layerArray.find(layer->getNumber()) == oacNullIndex) {	    layerArray.append(layer->getNumber());	}    }}// *****************************************************************************// LefInNDR::parseLayerWidth()//// This function handles the LAYER WIDTH attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidLefInNDR::parseLayerWidth(oaUInt4	    num,			  oaPhysicalLayer   *layer){    oaValue *v = oaIntValue::create(lefIn.tech(),				    lefIn.uuToDBU(lefNDR->layerWidth(num)));    lefIn.setConstraint(ndr, oacMinWidth, layer->getNumber(), v);}    // *****************************************************************************// LefInNDR::parseLayerDiagWidth()//// This function handles the LAYER DIAGWIDTH attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidLefInNDR::parseLayerDiagWidth(oaUInt4		num,			      oaPhysicalLayer	*layer){    if (lefNDR->hasLayerDiagWidth(num)) {	oaValue	*v = oaIntValue::create(lefIn.tech(),					lefIn.uuToDBU(lefNDR->layerWidth(num)));	lefIn.setConstraint(ndr, oacMinDiagonalWidth, layer->getNumber(), v);    }}    // *****************************************************************************// LefInNDR::parseLayerSpacing()//// This function handles the LAYER SPACING attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidLefInNDR::parseLayerSpacing(oaUInt4	    num,			    oaPhysicalLayer *layer){    oaValue *v = oaIntValue::create(lefIn.tech(),				    lefIn.uuToDBU(lefNDR->layerSpacing(num)));    lefIn.setConstraint(ndr, oacMinSpacing, layer->getNumber(), v,			lefNDR->hasHardspacing());}    // *****************************************************************************// LefInNDR::parseLayerExt()//// This function handles the LAYER WIREXT attribute in the current LEF// NONDEFAULTRULE construct, for the given layer// *****************************************************************************voidLefInNDR::parseLayerExt(oaUInt4		num,			oaPhysicalLayer	*layer){    if (lefNDR->hasLayerWireExtension(num)) {	oaValue *v = oaIntValue::create(lefIn.tech(),					lefIn.uuToDBU(lefNDR->layerWireExtension(num)));	lefIn.setConstraint(ndr, oacMinWireExtension, layer->getNumber(), v);    }}    // *****************************************************************************// LefInNDR::parseMinCuts()//// This function handles the MINCUTS attribute for the non-default-rule// *****************************************************************************voidLefInNDR::parseMinCuts(){    for(int i = 0; i < lefNDR->numMinCuts(); i++) {	oaPhysicalLayer *layer = lefIn.getLayer(lefNDR->cutLayerName(i));	oa1DLookupTbl<oaInt4, oaInt4>	table(1, "minNumCut", 1);    	table.setHeader(0, lefIn.uuToDBU(lefNDR->layerWidth(i)));	table.setValue(0, lefNDR->numCuts(i));	table.setNumItems(1);		oaValue	*v = oaInt1DTblValue::create(lefIn.tech(), table);	lefIn.setConstraint(ndr, oacMinNumCut, layer->getNumber(), v);    }}// *****************************************************************************// LefInNDR::parseProperties()//// This function handles the properties for the non-default-rule// *****************************************************************************voidLefInNDR::parseProperties(){    LefDefProp *propDef;    for (int i = 0; i < lefNDR->numProps(); i++) {	propDef = lefIn.getProp(lefNDR->propName(i), cLefDefNonDefaultRule);	lefIn.createProp(propDef, ndr, lefNDR->propValue(i));    }}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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