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

📄 oaverilogcallbacksin.cpp

📁 openaccess与verilog互相转化时所用的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		nameOut.append(*eltNameOut.getScalar());		break;	      case oacVectorNameType:		nameOut.append(*eltNameOut.getVector());		break;	      case oacVectorBitNameType:		nameOut.append(*eltNameOut.getVectorBit());		break;	    }	} else {	    nameOut.append(eltNameIn);	}    }	    }// *****************************************************************************// CallbacksIn::expandTermScalarName()//// If the input terminal name (nameIn) represents a scalar terminal, then this// method returns the terminal name.  If the input name is the base name of a// bus then the output name is the full range of the bus.// *****************************************************************************voidCallbacksIn::expandTermScalarName(const oaScalarName	&nameIn,				  oaName		&nameOut){    oaModBusTermDef *btDef = oaModBusTermDef::find(currentModule, nameIn);    if (btDef) {	oaScalarName	defName;	oaUInt4		start;	oaUInt4		stop;	oaInt4		step;	getStartStopStep(*btDef, start, stop, step);	btDef->getName(defName);	if (start == stop) {	    oaModBusTermBit  *bit = oaModBusTermBit::find(currentModule,						          defName, start);	    bit->getName(nameOut);	} else {	    oaModBusTerm    *bus = oaModBusTerm::find(currentModule, defName,						      start, stop, 1);	    bus->getName(nameOut);	}    } else {	nameOut = nameIn;    }}// *****************************************************************************// CallbacksIn::findInst()//// This function finds the instance with the given name in the current module.// *****************************************************************************oaModInst*CallbacksIn::findInst(const oaName   &instName){    oaModInst	*inst = NULL;    switch (instName.getType())	{      case oacScalarNameType:	inst = oaModInst::find(currentModule, *instName.getScalar());	break;      case oacVectorBitNameType:	inst = oaModInst::find(currentModule, *instName.getVectorBit());	break;      case oacVectorNameType:	inst = oaModInst::find(currentModule, *instName.getVector());	break;    }    if (!inst) {	oaString    instNameStr;	instName.get(vns, instNameStr);	throw Error(NoDesignInst, fileAndLine, (const char*) instNameStr);    }    return inst;}// *****************************************************************************// CallbacksIn::fixStubRefs()//// This function replaces the masters of instances whose cellName matches the// current module name, with the current design.// *****************************************************************************voidCallbacksIn::fixStubRefs(){       oaIter<oaDesign>	designIter(oaDesign::getOpenDesigns());    while (oaDesign *design = designIter.getNext()) {	oaModInstHeader	*hdr = oaModInstHeader::find(design,						     options.getLibName(),						     currentModuleName,						     options.getFirstLeafView());		if (hdr) {	    oaIter<oaModDesignInst> instIter(hdr->getInsts());	    while (oaModDesignInst *inst = instIter.getNext()) {		inst->setMaster(currentDesign);		if (!inst->usesTermPositions()) {		    fixInstTerms(inst); 		}	    }	    design->save();	}    }}// *****************************************************************************// CallbacksIn::fixInstTerms()//// This function fixes the instTerms after the instance master has been // switched. Fixing consists of correcting the widths of named connections.// *****************************************************************************voidCallbacksIn::fixInstTerms(oaModInst  *inst){    oaIter<oaModInstTerm>   itermIter(inst->getInstTerms());    oaName		    termName;    oaScalarName	    baseName;    while (oaModInstTerm *iterm = itermIter.getNext()) {	if (!iterm->isBound()) {	    iterm->getTermName(termName);	    if (termName.getType() == oacVectorNameType) {		termName.getVector()->getBaseName(baseName);		oaModule	*master = inst->getMasterModule();		oaModBusTermDef	*def = oaModBusTermDef::find(master, baseName);		if (def) {		    oaUInt4 start;		    oaUInt4 stop;		    oaInt4  step;		    getStartStopStep(*def, start, stop, step);		    termName.getVector()->setStart(start);		    termName.getVector()->setStop(stop);		    oaModNet	*net = iterm->getNet();		    iterm->destroy();		    createInstTerm(net, inst, termName);		}	    }	}    }}// *****************************************************************************// CallbacksIn::functionCall()//// This function evaluates the function "fname" called with the given args and// store the result in "result"// *****************************************************************************voidCallbacksIn::functionCall(const	oaName	    &fname,			  const	ValueList   &args,			  Value		    &result){    notImplemented(FuncCallImpl);    result = 0;}// *****************************************************************************// CallbacksIn::functionDeclaration()//// This function handles function declarations.// *****************************************************************************voidCallbacksIn::functionDeclaration(){    notImplemented(FuncDeclImpl);}// *****************************************************************************// CallbacksIn::generalFuncCall()//// This function evaluate the function "fname" called with the given args and// store the result in "result".// *****************************************************************************voidCallbacksIn::generalFuncCall(const oaName	&fname,			     const ValueList	&args,			     Value		&rslt){    notImplemented(FuncCallImpl);    rslt = 0;}// *****************************************************************************// CallbacksIn::genvarDeclaration()//// This function handles genvar declarations.// *****************************************************************************voidCallbacksIn::genvarDeclaration(){    notImplemented(GenvarDeclImpl);}// *****************************************************************************// CallbacksIn::genTermType()//// In the case of mulit-bit terminals, the term type of each bit must be // consistent with every other bit of the multi-bit terminal. Given a terminal// name and a net, this function returns a term type that is consistent with// the other bits of the terminal or with the other terminals on the given// bundle net. If the term type is "unused" and there are other terminals// on the same net, then the term type returned will be the same as the term// type of the first terminal on the net.// *****************************************************************************oaTermTypeCallbacksIn::genTermType(const oaName	    &termName,			 const oaTermType   requestedType,			 const oaModNet	    *net){    return getTermType(net);}// *****************************************************************************// CallbacksIn::getExplicitBit()//// This function gets the explicit bit of the given net. It creates an explicit// bit at the given index if no explicit bit already exists. // *****************************************************************************oaModBitNet*CallbacksIn::getExplicitBit(oaModNet	*net, 			    oaUInt4	index){    oaModule    *module  = net->getModule();    oaModBitNet	*implBit = net->getBit(index);    oaName	bitName;    implBit->getName(bitName);    oaModBitNet	*bit = (oaModBitNet*) oaModNet::find(module, bitName);    if (!bit || bit->isImplicit()) {	switch (bitName.getType()) {	  case oacScalarNameType:	    bit = oaModScalarNet::create(module, *bitName.getScalar(),					 net->getSigType(), net->isGlobal());	    break;	  case oacVectorBitNameType:	    bit = oaModBusNetBit::create(module, *bitName.getVectorBit(),					 net->getSigType(), net->isGlobal());	    break;	}    }    return bit;}// *****************************************************************************// CallbacksIn::getExplicitBit()//// This function gets the explicit bit of the given terminal.// *****************************************************************************oaModTerm*CallbacksIn::getExplicitBit(oaModTerm	*term, 			    oaUInt4	index){    oaModTerm   *implBit = term->getBit(index);    oaName	bitName;    implBit->getName(bitName);    oaModTerm	*explBit = oaModTerm::find(currentModule, bitName);    if (!explBit || explBit->isImplicit()) {	oaModBitNet *netBit = getExplicitBit(term->getNet(), 0);	switch (bitName.getType()) {	  case oacVectorBitNameType:	    explBit = oaModBusTermBit::create((oaModBitNet*) netBit,					      *bitName.getVectorBit(),					      term->getTermType());	    termCreatedBy->set(explBit, true);	    break;	  case oacScalarNameType:	    explBit = oaModScalarTerm::create(netBit, *bitName.getScalar(),					      term->getTermType());	    termCreatedBy->set(explBit, true);	    break;	}    }    return explBit;}// *****************************************************************************// CallbacksIn::getInst()//// This function finds or creates the given instance identified by instName. The// parameter list is ignored in the base callback implementation, but it may// be used by a method in a derived callback class to modify the instance// creation.// *****************************************************************************oaModInst*CallbacksIn::getInst(const oaString	&instMasterN,		     const ParamList	&parameterL,		     const oaName	&instName){    oaScalarName    cellName(vns, instMasterN);    oaDesign	    *design = leafMgr.findLeaf(cellName);    if (!design) {	design = oaDesign::find(options.getLibName(), cellName,			        options.getViewName());	if (!design) {	    if (oaDesign::exists(options.getLibName(), cellName, 	                         options.getViewName())) {		design = openDesign(options.getLibName(), cellName,				    options.getViewName(), 'r');	    } 	}    }    oaScalarName    libName;    oaScalarName    viewName;    if (design) {	design->getLibName(libName);	design->getViewName(viewName);    } else {	libName = options.getLibName();	viewName = options.getFirstLeafView();    }    switch (instName.getType())	{      case oacScalarNameType:	return getInst(libName, cellName, viewName, *instName.getScalar());	break;      case oacVectorNameType:	return getInst(libName, cellName, viewName, *instName.getVector());	break;      case oacVectorBitNameType: 	return getInst(libName, cellName, viewName, *instName.getVectorBit());	break;    }    return NULL;}// *****************************************************************************// CallbacksIn::getInst()//// This function finds or creates a scalar inst from a given scalar name.// *****************************************************************************oaModScalarInst*CallbacksIn::getInst(const oaScalarName	&libName,		     const oaScalarName	&cellName,		     const oaScalarName	&viewName,		     const oaScalarName	&instName){    oaModScalarInst *inst = oaModScalarInst::find(currentModule, instName);    if (!inst) {	inst = oaModScalarInst::create(currentModule, libName, cellName, 				       viewName, instName);    }    return inst;}// *****************************************************************************// CallbacksIn::getInst()//// This function finds or creates a vector inst from a given vector name. // *****************************************************************************oaModVectorInst*CallbacksIn::getInst(const oaScalarName	&libName,		     const oaScalarName	&cellName,		     const oaScalarName	&viewName,		     const oaVectorName	&instName){    oaScalarName    baseName;    oaUInt4	    start;    oaUInt4	    stop;    oaInt4	    step;    instName.getBaseName(baseName);    getStartStopStep(instName, start, stop, step);    oaModVectorInst	*inst;    oaModVectorInstDef  *instDef = oaModVectorInstDef::find(currentModule,							    baseName);    if (!instDef) {	instDef = oaModVectorInstDef::create(currentModule, baseName,					     oacDescendingBitOrder);	if (start < stop) {	    instDef->setBitOrder(oacAscendingBitOrder);	}    }    inst = oaModVectorInst::find(currentModule, baseName, start, stop);    if (!inst) {	inst = oaModVectorInst::create(currentModule, libName, cellName, 				       viewName, baseName, start, stop);    }    return inst;}

⌨️ 快捷键说明

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