/**Function************************************************************* Synopsis [Reorders the DD using REO and CUDD.] Description [This function can be used to test the performance of the reordering package.] SideEffects [] SeeAlso [] ***********************************************************************/ void Extra_ReorderTestArray( DdManager * dd, DdNode * Funcs[], int nFuncs ) { reo_man * pReo; DdNode * FuncsRes[1000]; int pOrder[1000]; int i; pReo = Extra_ReorderInit( 100, 100 ); Extra_ReorderArray( pReo, dd, Funcs, FuncsRes, nFuncs, pOrder ); Extra_ReorderQuit( pReo ); printf( "Initial = %d. Final = %d.\n", Cudd_SharingSize(Funcs,nFuncs), Cudd_SharingSize(FuncsRes,nFuncs) ); for ( i = 0; i < nFuncs; i++ ) Cudd_RecursiveDeref( dd, FuncsRes[i] ); }
/**Function************************************************************* Synopsis [Reorders the DD using REO and CUDD.] Description [This function can be used to test the performance of the reordering package.] SideEffects [] SeeAlso [] ***********************************************************************/ void Extra_ReorderTest( DdManager * dd, DdNode * Func ) { reo_man * pReo; DdNode * Temp, * Temp1; int pOrder[1000]; pReo = Extra_ReorderInit( 100, 100 ); //Extra_DumpDot( dd, &Func, 1, "beforReo.dot", 0 ); Temp = Extra_Reorder( pReo, dd, Func, pOrder ); Cudd_Ref( Temp ); //Extra_DumpDot( dd, &Temp, 1, "afterReo.dot", 0 ); Temp1 = Extra_ReorderCudd(dd, Func, NULL ); Cudd_Ref( Temp1 ); printf( "Initial = %d. Final = %d. Cudd = %d.\n", Cudd_DagSize(Func), Cudd_DagSize(Temp), Cudd_DagSize(Temp1) ); Cudd_RecursiveDeref( dd, Temp1 ); Cudd_RecursiveDeref( dd, Temp ); Extra_ReorderQuit( pReo ); }
/**Function************************************************************* Synopsis [Reorders BDDs of the local functions.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose ) { reo_man * p; Abc_Obj_t * pNode; int i; Abc_NtkRemoveDupFanins( pNtk ); Abc_NtkMinimumBase( pNtk ); p = Extra_ReorderInit( Abc_NtkGetFaninMax(pNtk), 100 ); Abc_NtkForEachNode( pNtk, pNode, i ) { if ( Abc_ObjFaninNum(pNode) < 3 ) continue; if ( fVerbose ) fprintf( stdout, "%10s: ", Abc_ObjName(pNode) ); if ( fVerbose ) fprintf( stdout, "Before = %5d BDD nodes. ", Cudd_DagSize((DdNode *)pNode->pData) ); Abc_NodeBddReorder( p, pNode ); if ( fVerbose ) fprintf( stdout, "After = %5d BDD nodes.\n", Cudd_DagSize((DdNode *)pNode->pData) ); } Extra_ReorderQuit( p ); }
/**Function************************************************************* Synopsis [Performs renoding as technology mapping.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nFaninMax, int nCubeMax, int nFlowIters, int nAreaIters, int fArea, int fUseBdds, int fUseSops, int fUseCnfs, int fUseMv, int fVerbose ) { extern Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars ); If_Par_t Pars, * pPars = &Pars; Abc_Ntk_t * pNtkNew; if ( Abc_NtkGetChoiceNum( pNtk ) ) printf( "Performing renoding with choices.\n" ); nDsdCounter = 0; // set defaults memset( pPars, 0, sizeof(If_Par_t) ); // user-controlable paramters pPars->nLutSize = nFaninMax; pPars->nCutsMax = nCubeMax; pPars->nFlowIters = nFlowIters; pPars->nAreaIters = nAreaIters; pPars->DelayTarget = -1; pPars->Epsilon = (float)0.005; pPars->fPreprocess = 1; pPars->fArea = fArea; pPars->fFancy = 0; pPars->fExpRed = 0; // pPars->fLatchPaths = 0; pPars->fVerbose = fVerbose; // internal parameters pPars->fTruth = 1; pPars->fUsePerm = 1; pPars->nLatchesCi = 0; pPars->nLatchesCo = 0; pPars->pLutLib = NULL; // Abc_FrameReadLibLut(); pPars->pTimesArr = NULL; pPars->pTimesArr = NULL; pPars->fUseBdds = fUseBdds; pPars->fUseSops = fUseSops; pPars->fUseCnfs = fUseCnfs; pPars->fUseMv = fUseMv; if ( fUseBdds ) pPars->pFuncCost = Abc_NtkRenodeEvalBdd; else if ( fUseSops ) pPars->pFuncCost = Abc_NtkRenodeEvalSop; else if ( fUseCnfs ) { pPars->fArea = 1; pPars->pFuncCost = Abc_NtkRenodeEvalCnf; } else if ( fUseMv ) pPars->pFuncCost = Abc_NtkRenodeEvalMv; else pPars->pFuncCost = Abc_NtkRenodeEvalAig; // start the manager if ( fUseBdds ) { assert( s_pReo == NULL ); s_pDd = Cudd_Init( nFaninMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); s_pReo = Extra_ReorderInit( nFaninMax, 100 ); pPars->pReoMan = s_pReo; } else { assert( s_vMemory == NULL ); s_vMemory = Vec_IntAlloc( 1 << 16 ); s_vMemory2 = Vec_IntAlloc( 1 << 16 ); } // perform mapping/renoding pNtkNew = Abc_NtkIf( pNtk, pPars ); // start the manager if ( fUseBdds ) { Extra_StopManager( s_pDd ); Extra_ReorderQuit( s_pReo ); s_pReo = NULL; s_pDd = NULL; } else { Vec_IntFree( s_vMemory ); Vec_IntFree( s_vMemory2 ); s_vMemory = NULL; s_vMemory2 = NULL; } // printf( "Decomposed %d functions.\n", nDsdCounter ); return pNtkNew; }