abc/src/bdd/extrab/extraBddSymm.c
/**Function********************************************************************

  Synopsis    [Performs a recursive step of Extra_zddGetSingletons.]

  Description [Returns the set of ZDD singletons, containing those positive 
  polarity ZDD variables that correspond to the BDD variables in bVars.]

  SideEffects []

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Performs a recursive step of Extra_zddGetSingletons.]

Description [Returns the set of ZDD singletons, containing those positive
polarity ZDD variables that correspond to the BDD variables in bVars.]




Function Synopsis [ Performs a recursive step of Extra_zddGetSingletons . ] Description [ Returns the set of ZDD singletons containing those positive polarity ZDD variables that correspond to the BDD variables in bVars . ]
DdNode * extraZddGetSingletons( 
  DdManager * dd,    
  DdNode * bVars)    
{
    DdNode * zRes;
    if ( bVars == b1 )
        return z1;
    if ( (zRes = cuddCacheLookup1Zdd(dd, extraZddGetSingletons, bVars)) )
        return zRes;
    else
    {
        DdNode * zTemp, * zPlus;          
        zRes = extraZddGetSingletons( dd, cuddT(bVars) );
        if ( zRes == NULL ) 
            return NULL;
        cuddRef( zRes );
        zPlus = cuddZddGetNode( dd, 2*bVars->index, z1, z0 );
        if ( zPlus == NULL ) 
        {
            Cudd_RecursiveDerefZdd( dd, zRes );
            return NULL;
        }
        cuddRef( zPlus );
        zRes = cuddZddUnion( dd, zTemp = zRes, zPlus );
        if ( zRes == NULL )
        {
            Cudd_RecursiveDerefZdd( dd, zTemp );
            Cudd_RecursiveDerefZdd( dd, zPlus );
            return NULL;
        }
        cuddRef( zRes );
        Cudd_RecursiveDerefZdd( dd, zTemp );
        Cudd_RecursiveDerefZdd( dd, zPlus );
        cuddDeref( zRes );
        cuddCacheInsert1( dd, extraZddGetSingletons, bVars, zRes );
        return zRes;
    }
}
DdNode * extraZddGetSingletons ( DdManager * dd , DdNode * bVars ) { DdNode * zRes ; if ( bVars == b1 ) return z1 ; if ( ( zRes = cuddCacheLookup1Zdd ( dd , extraZddGetSingletons , bVars ) ) ) return zRes ; else { DdNode * zTemp , * zPlus ; zRes = extraZddGetSingletons ( dd , cuddT ( bVars ) ) ; if ( zRes == NULL ) return NULL ; cuddRef ( zRes ) ; zPlus = cuddZddGetNode ( dd , 2 * bVars -> index , z1 , z0 ) ; if ( zPlus == NULL ) { Cudd_RecursiveDerefZdd ( dd , zRes ) ; return NULL ; } cuddRef ( zPlus ) ; zRes = cuddZddUnion ( dd , zTemp = zRes , zPlus ) ; if ( zRes == NULL ) { Cudd_RecursiveDerefZdd ( dd , zTemp ) ; Cudd_RecursiveDerefZdd ( dd , zPlus ) ; return NULL ; } cuddRef ( zRes ) ; Cudd_RecursiveDerefZdd ( dd , zTemp ) ; Cudd_RecursiveDerefZdd ( dd , zPlus ) ; cuddDeref ( zRes ) ; cuddCacheInsert1 ( dd , extraZddGetSingletons , bVars , zRes ) ; return zRes ; } }
Function
Synopsis    [Performs a recursive step of Extra_zddGetSingletons.]
Function Synopsis [ Performs a recursive step of Extra_zddGetSingletons . ]
/* the DD manager */ /* the set of variables */ //    if ( bVars == b0 )  // bug fixed by Jin Zhang, Jan 23, 2004 // solve subproblem // add these to the result