/**Function************************************************************* Synopsis [Computes the cost of MV-SOP of the cut function.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_NtkRenodeEvalMv( If_Man_t * p, If_Cut_t * pCut ) { char * pPerm = If_CutPerm( pCut ); int i, RetValue; // set internal mapper parameters for ( i = 0; i < If_CutLeaveNum(pCut); i++ ) pPerm[i] = 1; // compute ISOP for the positive phase RetValue = Kit_TruthIsop( If_CutTruth(p, pCut), If_CutLeaveNum(pCut), s_vMemory, 0 ); if ( RetValue == -1 ) return IF_COST_MAX; assert( RetValue == 0 || RetValue == 1 ); // compute ISOP for the negative phase Kit_TruthNot( If_CutTruth(p, pCut), If_CutTruth(p, pCut), If_CutLeaveNum(pCut) ); RetValue = Kit_TruthIsop( If_CutTruth(p, pCut), If_CutLeaveNum(pCut), s_vMemory2, 0 ); Kit_TruthNot( If_CutTruth(p, pCut), If_CutTruth(p, pCut), If_CutLeaveNum(pCut) ); if ( RetValue == -1 ) return IF_COST_MAX; assert( RetValue == 0 || RetValue == 1 ); // return the cost of the cut RetValue = Abc_NodeEvalMvCost( If_CutLeaveNum(pCut), s_vMemory, s_vMemory2 ); if ( RetValue >= IF_COST_MAX ) return IF_COST_MAX; return RetValue; }
/**Function************************************************************* Synopsis [Computes the cost based on two ISOPs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_NtkRenodeEvalCnf( If_Cut_t * pCut ) { int i, RetValue, nClauses; // set internal mapper parameters for ( i = 0; i < If_CutLeaveNum(pCut); i++ ) pCut->pPerm[i] = 1; // compute ISOP for the positive phase RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 0 ); if ( RetValue == -1 ) return IF_COST_MAX; assert( RetValue == 0 || RetValue == 1 ); nClauses = Vec_IntSize( s_vMemory ); // compute ISOP for the negative phase Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) ); RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 0 ); Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) ); if ( RetValue == -1 ) return IF_COST_MAX; assert( RetValue == 0 || RetValue == 1 ); nClauses += Vec_IntSize( s_vMemory ); return nClauses; }
/**Function************************************************************* Synopsis [Performs one step of bi-decomposition.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Bdc_Fun_t * Bdc_ManDecompose_rec( Bdc_Man_t * p, Bdc_Isf_t * pIsf ) { Bdc_Fun_t * pFunc; Bdc_Isf_t IsfL, * pIsfL = &IsfL; Bdc_Isf_t IsfB, * pIsfR = &IsfB; // check computed results if ( pFunc = Bdc_TableLookup( p, pIsf ) ) return pFunc; // decide on the decomposition type pFunc = Bdc_FunNew( p ); if ( pFunc == NULL ) return NULL; pFunc->Type = Bdc_DecomposeStep( p, pIsf, pIsfL, pIsfR ); // decompose the left branch pFunc->pFan0 = Bdc_ManDecompose_rec( p, pIsfL ); if ( pFunc->pFan0 == NULL ) return NULL; // decompose the right branch if ( Bdc_DecomposeUpdateRight( p, pIsf, pIsfL, pIsfR, pFunc->pFan0->puFunc, pFunc->Type ) ) { p->nNodes--; return pFunc->pFan0; } pFunc->pFan1 = Bdc_ManDecompose_rec( p, pIsfL ); if ( pFunc->pFan1 == NULL ) return NULL; // compute the function of node pFunc->puFunc = (unsigned *)Vec_IntFetch(p->vMemory, p->nWords); if ( pFunc->Type == BDC_TYPE_AND ) Kit_TruthAnd( pFunc->puFunc, pFunc->pFan0->puFunc, pFunc->pFan1->puFunc, p->nVars ); else if ( pFunc->Type == BDC_TYPE_OR ) Kit_TruthOr( pFunc->puFunc, pFunc->pFan0->puFunc, pFunc->pFan1->puFunc, p->nVars ); else assert( 0 ); // verify correctness assert( Bdc_TableCheckContainment(p, pIsf, pFunc->puFunc) ); // convert from OR to AND if ( pFunc->Type == BDC_TYPE_OR ) { pFunc->Type = BDC_TYPE_AND; pFunc->pFan0 = Bdc_Not(pFunc->pFan0); pFunc->pFan1 = Bdc_Not(pFunc->pFan1); Kit_TruthNot( pFunc->puFunc, pFunc->puFunc, p->nVars ); pFunc = Bdc_Not(pFunc); } Bdc_TableAdd( p, Bdc_Regular(pFunc) ); return pFunc; }