/**Function************************************************************* Synopsis [Derives the local AIG for the cut.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Hop_Obj_t * Nwk_NodeIfToHop( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj_t * pIfObj ) { If_Cut_t * pCut; Hop_Obj_t * gFunc; If_Obj_t * pLeaf; int i; // get the best cut pCut = If_ObjCutBest(pIfObj); assert( pCut->nLeaves > 1 ); // set the leaf variables If_CutForEachLeaf( pIfMan, pCut, pLeaf, i ) If_CutSetData( If_ObjCutBest(pLeaf), Hop_IthVar(pHopMan, i) ); // recursively compute the function while collecting visited cuts Vec_PtrClear( pIfMan->vTemp ); gFunc = Nwk_NodeIfToHop2_rec( pHopMan, pIfMan, pIfObj, pIfMan->vTemp ); if ( gFunc == (void *)1 ) { printf( "Nwk_NodeIfToHop(): Computing local AIG has failed.\n" ); return NULL; } // printf( "%d ", Vec_PtrSize(p->vTemp) ); // clean the cuts If_CutForEachLeaf( pIfMan, pCut, pLeaf, i ) If_CutSetData( If_ObjCutBest(pLeaf), NULL ); Vec_PtrForEachEntry( If_Cut_t *, pIfMan->vTemp, pCut, i ) If_CutSetData( pCut, NULL ); return gFunc; }
int If_ManCutReach( If_Man_t * p, If_Cut_t * pCut, If_Obj_t * pPath, If_Obj_t * pLeaf ) { If_Obj_t * pTemp; int i, RetValue; If_CutForEachLeaf( p, pCut, pTemp, i ) pTemp->fMark = 1; RetValue = If_ManCutReach_rec( pPath, pLeaf ); If_CutForEachLeaf( p, pCut, pTemp, i ) pTemp->fMark = 0; return RetValue; }
/**Function************************************************************* Synopsis [Prints one cut.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut ) { If_Obj_t * pLeaf; unsigned i; Abc_Print( 1, "{" ); If_CutForEachLeaf( p, pCut, pLeaf, i ) Abc_Print( 1, " %d(%.2f/%.2f)", pLeaf->Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->Required ); Abc_Print( 1, " }\n" ); }
/**Function************************************************************* Synopsis [Average number of references of the leaves.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ float If_CutAverageRefs( If_Man_t * p, If_Cut_t * pCut ) { If_Obj_t * pLeaf; int nRefsTotal, i; assert( p->pPars->fSeqMap || pCut->nLeaves > 1 ); nRefsTotal = 0; If_CutForEachLeaf( p, pCut, pLeaf, i ) nRefsTotal += pLeaf->nRefs; return ((float)nRefsTotal)/pCut->nLeaves; }
void If_ObjConePrint( If_Man_t * pIfMan, If_Obj_t * pIfObj ) { If_Cut_t * pCut; If_Obj_t * pLeaf; int i; Vec_PtrClear( pIfMan->vTemp ); If_ObjConePrint_rec( pIfMan, pIfObj, pIfMan->vTemp ); Vec_PtrForEachEntry( If_Cut_t *, pIfMan->vTemp, pCut, i ) If_CutSetDataInt( pCut, 0 ); // print the leaf variables printf( "Cut " ); pCut = If_ObjCutBest(pIfObj); If_CutForEachLeaf( pIfMan, pCut, pLeaf, i ) printf( "%d ", pLeaf->Id ); printf( "\n" ); }