abc/src/bdd/cudd/cuddBddAbs.c
/**Function********************************************************************

  Synopsis    [Performs the recursive steps of Cudd_bddBoleanDiff.]

  Description [Performs the recursive steps of Cudd_bddBoleanDiff.
  Returns the BDD obtained by XORing the cofactors of f with respect to
  var if successful; NULL otherwise. Exploits the fact that dF/dx =
  dF'/dx.]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Performs the recursive steps of Cudd_bddBoleanDiff.]

Description [Performs the recursive steps of Cudd_bddBoleanDiff.
Returns the BDD obtained by XORing the cofactors of f with respect to
var if successful; NULL otherwise. Exploits the fact that dF/dx
dF'/dx.]




Function Synopsis [ Performs the recursive steps of Cudd_bddBoleanDiff . ] Description [ Performs the recursive steps of Cudd_bddBoleanDiff . Returns the BDD obtained by XORing the cofactors of f with respect to var if successful ; NULL otherwise . Exploits the fact that dF / dx dF ' / dx . ]
DdNode *
cuddBddBooleanDiffRecur(
  DdManager * manager,
  DdNode * f,
  DdNode * var)
{
    DdNode *T, *E, *res, *res1, *res2;
    statLine(manager);
    if (cuddI(manager,f->index) > manager->perm[var->index]) {
        return(Cudd_Not(DD_ONE(manager)));
    }
    if (f->index == var->index) {
        res = cuddBddXorRecur(manager, cuddT(f), cuddE(f));
        return(res);
    }
    res = cuddCacheLookup2(manager, cuddBddBooleanDiffRecur, f, var);
    if (res != NULL) {
        return(res);
    }
    T = cuddT(f); E = cuddE(f);
    res1 = cuddBddBooleanDiffRecur(manager, T, var);
    if (res1 == NULL) return(NULL);
    cuddRef(res1);
    res2 = cuddBddBooleanDiffRecur(manager, Cudd_Regular(E), var);
    if (res2 == NULL) {
        Cudd_IterDerefBdd(manager, res1);
        return(NULL);
    }
    cuddRef(res2);
    res = cuddBddIteRecur(manager, manager->vars[f->index], res1, res2);
    if (res == NULL) {
        Cudd_IterDerefBdd(manager, res1);
        Cudd_IterDerefBdd(manager, res2);
        return(NULL);
    }
    cuddDeref(res1);
    cuddDeref(res2);
    cuddCacheInsert2(manager, cuddBddBooleanDiffRecur, f, var, res);
    return(res);
}
DdNode * cuddBddBooleanDiffRecur ( DdManager * manager , DdNode * f , DdNode * var ) { DdNode * T , * E , * res , * res1 , * res2 ; statLine ( manager ) ; if ( cuddI ( manager , f -> index ) > manager -> perm [ var -> index ] ) { return ( Cudd_Not ( DD_ONE ( manager ) ) ) ; } if ( f -> index == var -> index ) { res = cuddBddXorRecur ( manager , cuddT ( f ) , cuddE ( f ) ) ; return ( res ) ; } res = cuddCacheLookup2 ( manager , cuddBddBooleanDiffRecur , f , var ) ; if ( res != NULL ) { return ( res ) ; } T = cuddT ( f ) ; E = cuddE ( f ) ; res1 = cuddBddBooleanDiffRecur ( manager , T , var ) ; if ( res1 == NULL ) return ( NULL ) ; cuddRef ( res1 ) ; res2 = cuddBddBooleanDiffRecur ( manager , Cudd_Regular ( E ) , var ) ; if ( res2 == NULL ) { Cudd_IterDerefBdd ( manager , res1 ) ; return ( NULL ) ; } cuddRef ( res2 ) ; res = cuddBddIteRecur ( manager , manager -> vars [ f -> index ] , res1 , res2 ) ; if ( res == NULL ) { Cudd_IterDerefBdd ( manager , res1 ) ; Cudd_IterDerefBdd ( manager , res2 ) ; return ( NULL ) ; } cuddDeref ( res1 ) ; cuddDeref ( res2 ) ; cuddCacheInsert2 ( manager , cuddBddBooleanDiffRecur , f , var , res ) ; return ( res ) ; }
Function
Synopsis    [Performs the recursive steps of Cudd_bddBoleanDiff.]
Function Synopsis [ Performs the recursive steps of Cudd_bddBoleanDiff . ]
/* f does not depend on var. */ /* From now on, f is non-constant. */ /* If the two indices are the same, so are their levels. */ /* From now on, cuddI(manager,f->index) < cuddI(manager,cube->index). */ /* Check the cache. */ /* Compute the cofactors of f. */ /* ITE takes care of possible complementation of res1 and of the
    ** case in which res1 == res2. */