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

📄 oadefincomponent.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    oaBlockDomainVisibility visibility = oacInheritFromTopBlock;        if (isPhysicalOnly()) {	visibility = oacExcludeFromModuleDomain;    }    if (defIn.isUpdate() && visibility != oacExcludeFromModuleDomain) {	throw LefDefError(cInstUpdateNotFound, defComponent->id());    }        if (simpleInstName.getType() == oacScalarNameType) {	if (simpleInstName.getNumMembers() == 1) {	    oaTransform xForm(0, 0);	    inst = oaScalarInst::create(defIn.topBlock(),					master.libName,					master.cellName,					master.viewName,					*simpleInstName.getScalar(),					xForm, 0, visibility);	    return;	}	defIn.getDefInModHier()->getScalarInst(*simpleInstName.getScalar(),					       master.libName,					       master.cellName,					       master.viewName);    } else {      oaScalarName  baseName;      oaUInt4	    bit = simpleInstName.getVectorBit()->getIndex();      simpleInstName.getVectorBit()->getBaseName(baseName);      if (simpleInstName.getNumMembers() == 1) {	  oaTransform	xForm(0, 0);	  inst = oaVectorInstBit::create(defIn.topBlock(),					 master.libName,					 master.cellName,					 master.viewName,					 baseName, bit,					 xForm, 0, visibility);	  return;      }      defIn.getDefInModHier()->getVectorInstBit(*simpleInstName.getVectorBit(),						master.libName,						master.cellName,						master.viewName);    }    inst = oaInst::find(defIn.topBlock(), simpleInstName);}// *****************************************************************************// DefInComponent::getMaster()// DefInComponent::getMasterLibView()// // These functions try to find a lirary and view name for the current master.// // The search order is the following :// o in the hash table of open designs// o in the libraries specified in the masterLib option.// In all cases the first matching design is returned...// *****************************************************************************voidDefInComponent::getMaster(){    // search in masterTbl;    if (masterTbl.find(defComponent->name(), master)) {	return;    }    getMasterLibView();    if (oaDesign::exists(master.libName, master.cellName, master.viewName)) {	master.design = oaDesign::open(master.libName, master.cellName,				       master.viewName, 'r');	if (master.design == defIn.design()) {	    master.design->close();	    throw LefDefError(cInstMasterRecursive, defComponent->id());	}	getMasterBoundary();	getMasterPhysicalOnly();    } else {	master.bBox = oaBox(0, 0, 0, 0);	master.physicalOnly = false;	master.design = NULL;    }    masterTbl.insert(defComponent->name(), master);}voidDefInComponent::getMasterLibView(){    // Search libraries    master.cellName.init(defIn.getNS(), defComponent->name());    for (oaUInt4 j = 0; j < defIn.getOptions()->getNumMasterLibNames(); j++) {	oaLib	*lib = oaLib::find(defIn.getOptions()->getMasterLibName(j));		if (!lib) {	    oaString	libName;	    defIn.getOptions()->getMasterLibName(j).get(libName);	    defIn.error(cLibNotFound, (const char*) libName);	    continue;	}	lib->getAccess(oacReadLibAccess);		oaCell	*cell = oaCell::find(lib, master.cellName);	if (cell) {	    for (oaUInt4 i = 0; i < defIn.getOptions()->getNumMasterViewNames(); i++) {		oaView  *view = oaView::find(lib,					     defIn.getOptions()->getMasterViewName(i), 					     oaViewType::get(oacMaskLayout));		if (view) {		    oaCellView	*cv = oaCellView::find(cell, view);		    if (cv) {			master.libName = defIn.getOptions()->getMasterLibName(j);			master.viewName = defIn.getOptions()->getMasterViewName(i);			lib->releaseAccess();			return;		    }		}	    }	}	lib->releaseAccess();    }    // Not found, assume same library and view names.    master.libName = defIn.getOptions()->getLibName();    master.viewName = defIn.getOptions()->getViewName();}// *****************************************************************************// DefInComponent:getMasterBoundary()// // This function gets the bbox of the snapBoundary otherwise of the prBoundary// otherwise of the design itself for the specified design; the result is// stored in 'bbox'.// *****************************************************************************voidDefInComponent::getMasterBoundary(){    oaSnapBoundary  *snapBoundary;    oaPRBoundary    *prBoundary;    oaBlock	    *blk = master.design->getTopBlock();    if (snapBoundary = oaSnapBoundary::find(blk)) {	snapBoundary->getBBox(master.bBox);    } else if (prBoundary = oaPRBoundary::find(blk)) {	prBoundary->getBBox(master.bBox);    } else {	blk->getBBox(master.bBox);	master.bBox.makeInvertedZero();    }}// *****************************************************************************// DefInComponent:getMasterPhysicalOnly()// // This function checks if the master is a "physical only" design.// *****************************************************************************voidDefInComponent::getMasterPhysicalOnly(){    master.physicalOnly = false;        switch(master.design->getCellType()) {      case oacCoverCellType:      case oacCoverBumpCellType:      case oacPadCellType:      case oacPadSpacerCellType:      case oacPadAreaIOCellType:	{	    master.physicalOnly = true;	    oaIter<oaTerm>  termIter(master.design->getTopBlock()->getTerms(oacTermIterSingleBit | oacTermIterEquivNets));	    	    while (oaTerm *term = termIter.getNext()) {		oaSigType   sigType = term->getNet()->getSigType();		if (sigType != oacPowerSigType && sigType != oacGroundSigType) {		    master.physicalOnly = false;		    return;		}	    }	}    }}// *****************************************************************************// DefInComponent:resolveMasters()// // This function iterates through the masterTbl and checks for unresolved// masters. If the master design still cannot be found, an exception is thrown.// If the master design is found, it will update the placement coordinates,// and terminal names in all designs that are in the oaDefIn::designNames list.// *****************************************************************************voidDefInComponent::resolveMasters(){    oaUtil::HashTableIter<oaString, DefInMaster>    it(&masterTbl);    oaString					    name;    while (it.getNext(name, master)) {	if (!master.design) {	    if (!oaDesign::exists(master.libName, master.cellName, master.viewName)) {		oaString cellStr;		master.cellName.get(defIn.getNS(), cellStr);		defIn.error(cInstMasterNotFound, (const char*) name, (const char*) cellStr);		continue;	    }	    master.design = oaDesign::open(master.libName, master.cellName,					   master.viewName, 'r');	    getMasterBoundary();	    resolveDesigns();	}	master.design->close();    }    masterTbl.clear();}// *****************************************************************************// DefInComponent::resolveDesigns()//// This function updates all processed designs for the current master.// *****************************************************************************voidDefInComponent::resolveDesigns(){    for (oaUInt4 i = 0; i < defIn.designs.getNumElements(); i++) {	oaInstHeader	*ih = oaInstHeader::find(defIn.designs[i]->getTopBlock(),						 master.libName,						 master.cellName,						 master.viewName);	if (ih) {	    oaIter<oaInst>  iter(ih->getInsts());	    while (oaInst   *inst = iter.getNext()) {		// Update placement. See parsePlacement() for description.		oaPlacementStatus   status = inst->getPlacementStatus();				if (status != oacNonePlacementStatus		    && status != oacUnplacedPlacementStatus) {		    oaOrient	orient = inst->getOrient();		    oaPoint	origin;		    oaBox	bbox;		    inst->getOrigin(origin);		    master.bBox.transform(oaTransform(orient), bbox);		    oaPoint newOrigin(origin.x() - bbox.left(),				      origin.y() - bbox.bottom());		    inst->setOrigin(newOrigin);		}		// Verify all terminals are bound.		oaIter<oaInstTerm>  itIter(inst->getInstTerms(oacInstTermIterSingleBit | oacInstTermIterEquivNets));		while (oaInstTerm *instTerm = itIter.getNext()) {		    if (!instTerm->getTerm()) {			instTerm->destroy();		    }		}	    }	}    }}END_LEFDEF_NAMESPACE

⌨️ 快捷键说明

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