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

📄 oadefinscanchain.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// DefInScanChain.cpp//// Functions to handle DEF SCANCHAINS 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: nitters $//  $Revision: 1.35 $//  $Date: 2005/04/11 12:01:43 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefInScanChain::DefInScanChain()// DefInScanChain::~DefInScanChain()//// This is the constructor for the DefInScanChain class.// *****************************************************************************DefInScanChain::DefInScanChain(DefIn	&translator):   defIn(translator){    translator.defInScanChain = this;}DefInScanChain::~DefInScanChain(){}// *****************************************************************************// DefInScanChain::parse()//// This function is called for each scanChain found in the "SCANCHAINS" DEF// construct.// // Note: COMMONSCANPINS are not stored in the database instead we resolve// unspecified pin names in the translator// *****************************************************************************voidDefInScanChain::parse(defiScanchain *data){    defScanChain = data;    scanChain = oaScanChain::create(defIn.topBlock(), defScanChain->name());    parsePartition();    parseStart();    parseFloating();    parseOrdered();    parseStop();}// *****************************************************************************// DefInScanChain::parsePartition()//// This function handles the following section for a scanChain of the// "SCANCHAINS" DEF construct ://// [ + PARTITION partitionName [ MAXBITS maxBits ] ]//// *****************************************************************************voidDefInScanChain::parsePartition(){    if (defScanChain->hasPartition()) {	scanChain->setPartitionName(defScanChain->partitionName());		if (defScanChain->hasPartitionMaxBits()) {	    scanChain->setMaxBits(defScanChain->partitionMaxBits());	}    }}// *****************************************************************************// DefInScanChain::parseStart()//// This function handles the following section for a scanChain of the// "SCANCHAINS" DEF construct ://// [ + START { <fixedInComp> | PIN } [ <outPin> ] ]//// *****************************************************************************voidDefInScanChain::parseStart(){    if (defScanChain->hasStart()) {	char    *instName;	char    *pinName;	defScanChain->start(&instName, &pinName);	if (strlen(pinName) == 0) {	    if (!defScanChain->hasCommonOutPin()) {		throw LefDefError(cScanChainNoOutputPin, defScanChain->name());	    }	    pinName = const_cast<char*>(defScanChain->commonOutPin());	}	if (!strcmp(instName, "PIN")) {	    // Start object is a terminal in the DEF design	    defIn.getSimpleName(pinName, simplePinName);	    oaTerm  *term = defIn.getTerm(simplePinName);	    scanChain->setStartObject(term);	} else {	    // Start object is an instTerm	    defIn.getSimpleName(instName, simpleInstName);	    defIn.getSimpleName(pinName, simplePinName);	    oaInst	*inst     = defIn.getInst(simpleInstName);	    oaInstTerm  *instTerm = defIn.getInstTerm(inst, simplePinName);	    scanChain->setStartObject(instTerm);	}    }}// *****************************************************************************// DefInScanChain::parseOrdered()//// This function handles the following DEF syntax for a scanChain :// [ + ORDERED//   { <fixedComp> [(IN <pin>)] [(OUT <pin>)]//     <fixedComp> [(IN <pin>)] [(OUT <pin>)] }//   [ <fixedComp> [(IN <pin>)] [(OUT <pin>)] ] ... ]// *****************************************************************************voidDefInScanChain::parseOrdered(){    if (defScanChain->hasOrdered()) {	int	size;	int     i;	char    **insts;	char    **inPins;	char    **outPins;	int     *bits;	int     numLists = defScanChain->numOrderedLists();	for (int n = 0; n < numLists; n++) {	    oaScanChainSet  *scanChainSet		= oaScanChainSet::create(scanChain, oacOrderedScanChainSetType);	    defScanChain->ordered(n, &size, &insts, &inPins, &outPins, &bits);	    for(i = 0; i < size; i++) {		createInst(insts[i], inPins[i], outPins[i], bits[i],			   scanChainSet);	    }	}    }}// *****************************************************************************// DefInScanChain:parseFloating()//// This function handles the following DEF syntax for a scanChain :// { + FLOATING { <floatingComp> [(IN <pin>)] [(OUT <pin>)] } ... }// *****************************************************************************voidDefInScanChain::parseFloating(){    if (defScanChain->hasFloating()) {	oaScanChainSet  *scanChainSet	    = oaScanChainSet::create(scanChain, oacUnorderedScanChainSetType);	int     size,i;	char    **insts;	char    **inpins;	char    **outpins;	int     *bits;	defScanChain->floating(&size, &insts, &inpins, &outpins, &bits);	for (i = 0; i < size; i++) {	    createInst(insts[i], inpins[i], outpins[i], bits[i], scanChainSet);	}    }}// *****************************************************************************// DefInScanChain:parseStop()//// This function handles the following DEF syntax for a scanChain :// [ + STOP { <fixedOutComp | PIN } [<inPin>] ; ] ...// *****************************************************************************voidDefInScanChain::parseStop(){    if (defScanChain->hasStop()) {	char    *instName;	char    *pinName;	defScanChain->stop(&instName, &pinName);	if (strlen(pinName) == 0) {	    if (!defScanChain->hasCommonInPin()) {		throw LefDefError(cScanChainNoInputPin, defScanChain->name());	    }	    pinName = const_cast<char*>(defScanChain->commonInPin());	}	if (!strcmp(instName, "PIN")) {	    // Start object is a terminal in the DEF design	    defIn.getSimpleName(pinName, simplePinName);	    oaTerm  *term = defIn.getTerm(simplePinName);	    scanChain->setStopObject(term);	} else {	    // Start object is an instTerm	    defIn.getSimpleName(pinName, simplePinName);	    defIn.getSimpleName(instName, simpleInstName);	    oaInst	*inst     = defIn.getInst(simpleInstName);	    oaInstTerm  *instTerm = defIn.getInstTerm(inst, simplePinName);	    scanChain->setStopObject(instTerm);	}    }}// *****************************************************************************// DefInScanChain::createInst()//// This function creates an oaScanChainInst from the instance and pin names;// it resolves pin names from COMMONSCANPINS if they are not specified.// *****************************************************************************voidDefInScanChain::createInst(const oaString   &instName,			   const oaString   &inPinName,			   const oaString   &outPinName,			   oaInt4	    numBits,			   oaScanChainSet   *scanChainSet){    // Find the instance.    defIn.getSimpleName(instName, simpleInstName);    oaInst  *inst = defIn.getInst(simpleInstName);    // Find input instTerm    if (inPinName.isEmpty()) {	if (!defScanChain->hasCommonInPin()) {	    throw LefDefError(cScanChainNoInputPin, defScanChain->name());	}		defIn.getSimpleName(defScanChain->commonInPin(), simplePinName);    } else {	defIn.getSimpleName(inPinName, simplePinName);    }        oaInstTerm	*inInstTerm = defIn.getInstTerm(inst, simplePinName);    // Find output instTerm    if (outPinName.isEmpty()) {	if (!defScanChain->hasCommonOutPin()) {	    throw LefDefError(cScanChainNoOutputPin, defScanChain->name());	}		defIn.getSimpleName(defScanChain->commonOutPin(), simplePinName);    } else {	defIn.getSimpleName(outPinName, simplePinName);    }             oaInstTerm	*outInstTerm = defIn.getInstTerm(inst, simplePinName);    // Create the scanchain instance    oaScanChainInst *scanChainInst	= oaScanChainInst::create(scanChainSet, inInstTerm, outInstTerm);        if (numBits > 1) {	scanChainInst->setSeqBitLength(numBits);    }}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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