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

📄 oadefout.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	  case oacMXR90 :	    defSiteOrient = "FN";	    siteSpacing = siteHeight + row->getSiteSpacing();	    break;	  case oacMX :	    defSiteOrient = "FW";	    break;	  case oacMYR90 :	    defSiteOrient = "FS";	    siteSpacing = siteHeight + row->getSiteSpacing();	    break;	  case oacR0 :	  default:	    defSiteOrient = "W";	}    }                output("ROW %s %s %i %i %s DO %i BY %i STEP %i %i",	   (const char *) rowName,	   (const char *) siteName,	   rowBBox.left(),	   rowBBox.bottom(),	   (const char *) defSiteOrient,	   (horizontal ? numSites : 1),	   (horizontal ? 1 : numSites),	   (horizontal ? siteSpacing : 0),	   (horizontal ? 0 : siteSpacing));    incIndent();    writeProperties(row, cLefDefRow);    decIndent();    outNoIndent(" ;\n");	}// *****************************************************************************// DefOut::writeTracks()//// This function writes track information for this design.// *****************************************************************************voidDefOut::writeTracks(){    oaIter<oaTrackPattern> trackIter(topBlock()->getTrackPatterns());    while (oaTrackPattern *trackPattern = trackIter.getNext()) {	writeTrack(trackPattern);    }}// *****************************************************************************// DefOut::writeTrack()//// This function writes the DEF TRACK construct for the given trackPattern//// Syntax:// TRACKS//   {X | Y} start//   DO numtracks STEP space//   [ LAYER layerName ...]  ; // *****************************************************************************voidDefOut::writeTrack(oaTrackPattern *trackPattern){    oaString layerName;    if (trackPattern->hasRoutingLayer()) {	oaLayerNum  layerNum(trackPattern->getRoutingLayer());	oaLayer	    *layer = getLayer(layerNum);	layer->getName(layerName);    }        output("TRACKS %s %i DO %i STEP %i",	   (trackPattern->isHorizontal() ? "X" : "Y"),	   trackPattern->getStartCoord(),	   trackPattern->getNumTracks(),	   trackPattern->getTrackSpacing());        if (trackPattern->hasRoutingLayer()) {	outNoIndent(" LAYER %s", (const char*)layerName);    }    outNoIndent(" ;\n");}// *****************************************************************************// DefOut::writeGCellGrid()//// This function writes the GCELLGRID construct for this design//// Syntax:// GCELLGRID//    X start DO numColumns+1 STEP space//    Y start DO numRows+1 STEP space ;} // *****************************************************************************voidDefOut::writeGCellGrid(){    oaIter<oaGCellPattern>  gCellPatternIter(topBlock()->getGCellPatterns());    while (oaGCellPattern   *gCellPattern = gCellPatternIter.getNext()) {	output("GCELLGRID %s %i DO %i STEP %i ;\n",	       gCellPattern->isHorizontal() ? "X" : "Y",	       gCellPattern->getStartCoord(),	       gCellPattern->getCount(),	       gCellPattern->getSpacing());    }}// *****************************************************************************// DefOut::writeVias()//// This function iterates over all viaHeaders in the design,// and calls writeVia to output the vias.// *****************************************************************************voidDefOut::writeVias(){    oaUInt4 num = 0;    oaIter<oaViaHeader> viaHeaderIter(topBlock()->getViaHeaders());    while (oaViaHeader *viaHeader = viaHeaderIter.getNext()) {	if (viaHeader->getVias().getCount()) {	    num++;	}    }    if (num) {	output("VIAS %i ;\n", num);	viaHeaderIter.reset();	while (oaViaHeader *viaHeader = viaHeaderIter.getNext()) {	    if (viaHeader->getVias().getCount()) {		writeVia(viaHeader);	    }	}	output("END VIAS\n\n");    }}// *****************************************************************************// DefOut::writeVia()// This function writes the vias for this design.// [ VIAS statement ]// *****************************************************************************voidDefOut::writeVia(oaViaHeader *viaHeader){    if (!defOutVia) {	new DefOutVia(*this);    }        defOutVia->write(viaHeader);}// *****************************************************************************// DefOut::writeNonDefaultRules()//// This function iterates over all constraintGroups in the design,// and calls writeNonDefaultRule to output the groups.// *****************************************************************************voidDefOut::writeNonDefaultRules(){    oaUInt4 num = 0;    oaIter<oaConstraintGroup>   cgIter(design()->getConstraintGroups());        while (oaConstraintGroup *cg = cgIter.getNext()) {	if (isLefDefRule(cg)) {	    num++;	}    }    if (num) {	output("NONDEFAULTRULES %i ;\n", num);	cgIter.reset();	while (oaConstraintGroup *cg = cgIter.getNext()) {	    if (isLefDefRule(cg)) {		writeNonDefaultRule(cg);	    }	}	output("END NONDEFAULTRULES\n\n");    }}// *****************************************************************************// DefOut::writeNonDefaultRule()// This function writes the constraintGroups for this design.// [ NONDEFAULTRULES statement ]// *****************************************************************************voidDefOut::writeNonDefaultRule(oaConstraintGroup	*ndr){    if (!defOutNDR) {	new DefOutNDR(*this);    }        defOutNDR->write(ndr);}// *****************************************************************************// DefOut::writeRegions()//// This function writes the DEF REGIONS section.// Note: We only write regions that are not "anonymous".// *****************************************************************************voidDefOut::writeRegions(){    oaUInt4 numRegions(0);    oaIter<oaCluster> clusterIter(topBlock()->getClusters());    while (oaCluster *cluster = clusterIter.getNext()) {	if (cluster->getBoundaries().getCount()) {	    oaString regionName;	    cluster->getName(regionName);	    if (regionName.substr("anonymous") == regionName.getLength()) {		numRegions++;	    }	}    }        if (numRegions) {	output("REGIONS %i ;\n", numRegions);		clusterIter.reset();	while (oaCluster *cluster = clusterIter.getNext()) {	    if (cluster->getBoundaries().getCount()) {		oaString regionName;		cluster->getName(regionName);		if (regionName.substr("anonymous") == regionName.getLength()) {		    writeRegion(cluster);		}	    }	}	output("END REGIONS\n\n");    }}// *****************************************************************************// DefOut::writeRegion()//// This function writes the def regions for this design.// Note: Clusters representing a region have at least 1 clusterBoundary//// Syntax:// REGIONS numRegions;//       [- regionName pt pt [pt pt]...//       [+ TYPE {FENCE|GUIDE}] (5.5 only)//       [+ PROPERTY {propName propVal}...]...;]...// END REGIONS  // *****************************************************************************voidDefOut::writeRegion(oaCluster *cluster){    oaString regionName;    cluster->getName(regionName);    output("- %s", (const char*)regionName);    incIndent();    oaIter<oaClusterBoundary> cbIter(cluster->getBoundaries());    while (oaClusterBoundary *clusterBoundary = cbIter.getNext()) {	oaBox bbox;	clusterBoundary->getBBox(bbox);	outNoIndent(" ( %i %i ) ( %i %i )",		    bbox.left(), bbox.bottom(),		    bbox.right(), bbox.top());    }    if (getOptions()->getVersion() > cLefDefVersion54) {	switch(cluster->getClusterType()) {          case oacClusterTypeExclusive:            outNoIndent("\n");            output("+ TYPE FENCE");            break;          case oacClusterTypeSuggested:            outNoIndent("\n");            output("+ TYPE GUIDE");            break;          default:            break;        }    }    writeProperties(cluster, cLefDefRegion);		        outNoIndent(" ;\n");    decIndent();}// *****************************************************************************// DefOut::writeComponents()// // This function writes a DEF COMPONENTS section// *****************************************************************************voidDefOut::writeComponents(){    oaUInt4 numInsts = topBlock()->getInsts(oacInstIterSingleBit).getCount();        if (numInsts) {	output("COMPONENTS %i ;\n", numInsts);	oaIter<oaInst> instIter(topBlock()->getInsts(oacInstIterSingleBit));	while (oaInst *inst = instIter.getNext()) {	    writeComponent(inst);	}	output("END COMPONENTS\n\n");    }}// *****************************************************************************// DefOut::writeComponents()// // This function writes a DEF COMPONENT using the DefOutComponent class.// *****************************************************************************voidDefOut::writeComponent(oaInst *inst){    if (!defOutComponent) {	new DefOutComponent(*this);    }        defOutComponent->write(inst);}// *****************************************************************************// DefOut::writePins()// // This function writes a DEF PINS section// *****************************************************************************voidDefOut::writePins(){    oaCollection<oaTerm, oaBlock>   termColl = topBlock()->getTerms(oacTermIterSingleBit);    oaUInt4			    numPins = termColl.getCount();    if (numPins) {	output("PINS %i ;\n", numPins);		oaIter<oaTerm> termIter(termColl);	while (oaBitTerm *term = (oaBitTerm*) termIter.getNext()) {	    writePin(term);	}	output("END PINS\n\n");    }}// *****************************************************************************// DefOut::writePin()// // This function writes a DEF PIN using the DefOutPin class// *****************************************************************************voidDefOut::writePin(oaBitTerm  *term){    if (!defOutPin) {	new DefOutPin(*this);    }        defOutPin->write(term);}// *****************************************************************************// DefOut::writePinProps()// // This function writes a DEF PINPROPERTIES section.// Note: Pin properties can be on oaTerms or oaInstTerms.//// Syntax:// PINPROPERTIES num;//       [- {compName | PIN} pinName//             [+ PROPERTY {propName propVal}...]...;]...// END PINPROPERTIES  // *****************************************************************************voidDefOut::writePinProps(){     oaUInt4  numPins(0);    if (!hasProp(cLefDefComponentPin)) {	return;    }    oaIter<oaTerm>  termIter(topBlock()->getTerms(oacTermIterSingleBit						  | oacTermIterEquivNets));    oaBitTerm	    *term;    while (term = (oaBitTerm*) termIter.getNext()) {	oaIter<oaProp> termPropIter(term->getProps());	if(termPropIter.getNext()) {	    numPins++;	}    }        oaIter<oaInst> instIter(topBlock()->getInsts());    oaInst *inst;    while (inst = instIter.getNext()) {	oaIter<oaInstTerm> instTermIter(inst->getInstTerms(oacInstTermIterSingleBit | oacInstTermIterEquivNets));	oaInstTerm *instTerm;	while (instTerm = instTermIter.getNext()) {	    oaIter<oaProp> instTermPropIter(instTerm->getProps());	    if(instTermPropIter.getNext()) {		numPins++;	    }	}    }    if (!numPins) {	return;    }        output("PINPROPERTIES %i ;\n", numPins);        termIter.reset();    while (term = (oaBitTerm*) termIter.getNext()) {	writePinPropsTerm(term);    }        instIter.reset();    while (inst = instIter.getNext()) {	oaIter<oaInstTerm> instTermIter(inst->getInstTerms(oacInstTermIterSingleBit | oacInstTermIterEquivNets));	oaInstTerm *instTerm;	while (instTerm = instTermIter.getNext()) {	    writePinPropsInstTerm(instTerm);	}    }        output("END PINPROPERTIES\n\n");}// *****************************************************************************// DefOut::writePinPropTerm()// // This function writes a DEF PINPROPERTIES section, syntax:// PINPROPERTIES num;

⌨️ 快捷键说明

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