本文整理汇总了C++中Cudd_RecursiveDerefZdd函数的典型用法代码示例。如果您正苦于以下问题:C++ Cudd_RecursiveDerefZdd函数的具体用法?C++ Cudd_RecursiveDerefZdd怎么用?C++ Cudd_RecursiveDerefZdd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cudd_RecursiveDerefZdd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cuddZddSubset0
/**Function********************************************************************
Synopsis [Computes the negative cofactor of a ZDD w.r.t. a variable.]
Description [Computes the negative cofactor of a ZDD w.r.t. a
variable. In terms of combinations, the result is the set of all
combinations in which the variable is negated. Returns a pointer to
the result if successful; NULL otherwise. cuddZddSubset0 performs
the same function as Cudd_zddSubset0, but does not restart if
reordering has taken place. Therefore it can be called from within a
recursive procedure.]
SideEffects [None]
SeeAlso [cuddZddSubset1 Cudd_zddSubset0]
******************************************************************************/
DdNode *
cuddZddSubset0(
DdManager * dd,
DdNode * P,
int var)
{
DdNode *zvar, *r;
DdNode *base, *empty;
base = DD_ONE(dd);
empty = DD_ZERO(dd);
zvar = cuddUniqueInterZdd(dd, var, base, empty);
if (zvar == NULL) {
return(NULL);
} else {
cuddRef(zvar);
r = zdd_subset0_aux(dd, P, zvar);
if (r == NULL) {
Cudd_RecursiveDerefZdd(dd, zvar);
return(NULL);
}
cuddRef(r);
Cudd_RecursiveDerefZdd(dd, zvar);
}
cuddDeref(r);
return(r);
} /* end of cuddZddSubset0 */
示例2: Extra_SymmPairsCreateFromZdd
/**Function********************************************************************
Synopsis [Creates the symmetry information structure from ZDD.]
Description [ZDD representation of symmetries is the set of cubes, each
of which has two variables in the positive polarity. These variables correspond
to the symmetric variable pair.]
SideEffects []
SeeAlso []
******************************************************************************/
Extra_SymmInfo_t * Extra_SymmPairsCreateFromZdd( DdManager * dd, DdNode * zPairs, DdNode * bSupp )
{
int i;
int nSuppSize;
Extra_SymmInfo_t * p;
int * pMapVars2Nums;
DdNode * bTemp;
DdNode * zSet, * zCube, * zTemp;
int iVar1, iVar2;
nSuppSize = Extra_bddSuppSize( dd, bSupp );
// allocate and clean the storage for symmetry info
p = Extra_SymmPairsAllocate( nSuppSize );
// allocate the storage for the temporary map
pMapVars2Nums = ABC_ALLOC( int, dd->size );
memset( pMapVars2Nums, 0, dd->size * sizeof(int) );
// assign the variables
p->nVarsMax = dd->size;
// p->nNodes = Cudd_DagSize( zPairs );
p->nNodes = 0;
for ( i = 0, bTemp = bSupp; bTemp != b1; bTemp = cuddT(bTemp), i++ )
{
p->pVars[i] = bTemp->index;
pMapVars2Nums[bTemp->index] = i;
}
// write the symmetry info into the structure
zSet = zPairs; Cudd_Ref( zSet );
while ( zSet != z0 )
{
// get the next cube
zCube = Extra_zddSelectOneSubset( dd, zSet ); Cudd_Ref( zCube );
// add these two variables to the data structure
assert( cuddT( cuddT(zCube) ) == z1 );
iVar1 = zCube->index/2;
iVar2 = cuddT(zCube)->index/2;
if ( pMapVars2Nums[iVar1] < pMapVars2Nums[iVar2] )
p->pSymms[ pMapVars2Nums[iVar1] ][ pMapVars2Nums[iVar2] ] = 1;
else
p->pSymms[ pMapVars2Nums[iVar2] ][ pMapVars2Nums[iVar1] ] = 1;
// count the symmetric pairs
p->nSymms ++;
// update the cuver and deref the cube
zSet = Cudd_zddDiff( dd, zTemp = zSet, zCube ); Cudd_Ref( zSet );
Cudd_RecursiveDerefZdd( dd, zTemp );
Cudd_RecursiveDerefZdd( dd, zCube );
} // for each cube
Cudd_RecursiveDerefZdd( dd, zSet );
ABC_FREE( pMapVars2Nums );
return p;
} /* end of Extra_SymmPairsCreateFromZdd */
示例3: cuddZddChangeAux
/**Function********************************************************************
Synopsis [Performs the recursive step of Cudd_zddChange.]
Description []
SideEffects [None]
SeeAlso []
******************************************************************************/
DdNode *
cuddZddChangeAux(
DdManager * zdd,
DdNode * P,
DdNode * zvar)
{
int top_var, level;
DdNode *res, *t, *e;
DdNode *base = DD_ONE(zdd);
DdNode *empty = DD_ZERO(zdd);
statLine(zdd);
if (P == empty)
return(empty);
if (P == base)
return(zvar);
/* Check cache. */
res = cuddCacheLookup2Zdd(zdd, cuddZddChangeAux, P, zvar);
if (res != NULL)
return(res);
top_var = zdd->permZ[P->index];
level = zdd->permZ[zvar->index];
if (top_var > level) {
res = cuddZddGetNode(zdd, zvar->index, P, DD_ZERO(zdd));
if (res == NULL) return(NULL);
} else if (top_var == level) {
res = cuddZddGetNode(zdd, zvar->index, cuddE(P), cuddT(P));
if (res == NULL) return(NULL);
} else {
t = cuddZddChangeAux(zdd, cuddT(P), zvar);
if (t == NULL) return(NULL);
cuddRef(t);
e = cuddZddChangeAux(zdd, cuddE(P), zvar);
if (e == NULL) {
Cudd_RecursiveDerefZdd(zdd, t);
return(NULL);
}
cuddRef(e);
res = cuddZddGetNode(zdd, P->index, t, e);
if (res == NULL) {
Cudd_RecursiveDerefZdd(zdd, t);
Cudd_RecursiveDerefZdd(zdd, e);
return(NULL);
}
cuddDeref(t);
cuddDeref(e);
}
cuddCacheInsert2(zdd, cuddZddChangeAux, P, zvar, res);
return(res);
} /* end of cuddZddChangeAux */
示例4: zdd_subset1_aux
/**Function********************************************************************
Synopsis [Performs the recursive step of Cudd_zddSubset1.]
Description []
SideEffects [None]
SeeAlso []
******************************************************************************/
static DdNode *
zdd_subset1_aux(
DdManager * zdd,
DdNode * P,
DdNode * zvar)
{
int top_var, level;
DdNode *res, *t, *e;
DdNode *empty;
statLine(zdd);
empty = DD_ZERO(zdd);
/* Check cache. */
res = cuddCacheLookup2Zdd(zdd, zdd_subset1_aux, P, zvar);
if (res != NULL)
return(res);
if (cuddIsConstant(P)) {
res = empty;
cuddCacheInsert2(zdd, zdd_subset1_aux, P, zvar, res);
return(res);
}
top_var = zdd->permZ[P->index];
level = zdd->permZ[zvar->index];
if (top_var > level) {
res = empty;
} else if (top_var == level) {
res = cuddT(P);
} else {
t = zdd_subset1_aux(zdd, cuddT(P), zvar);
if (t == NULL) return(NULL);
cuddRef(t);
e = zdd_subset1_aux(zdd, cuddE(P), zvar);
if (e == NULL) {
Cudd_RecursiveDerefZdd(zdd, t);
return(NULL);
}
cuddRef(e);
res = cuddZddGetNode(zdd, P->index, t, e);
if (res == NULL) {
Cudd_RecursiveDerefZdd(zdd, t);
Cudd_RecursiveDerefZdd(zdd, e);
return(NULL);
}
cuddDeref(t);
cuddDeref(e);
}
cuddCacheInsert2(zdd, zdd_subset1_aux, P, zvar, res);
return(res);
} /* end of zdd_subset1_aux */
示例5: Extra_bddSpaceEquations
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
DdNode * Extra_bddSpaceEquations( DdManager * dd, DdNode * bSpace )
{
DdNode * zRes;
DdNode * zEquPos;
DdNode * zEquNeg;
zEquPos = Extra_bddSpaceEquationsPos( dd, bSpace ); Cudd_Ref( zEquPos );
zEquNeg = Extra_bddSpaceEquationsNeg( dd, bSpace ); Cudd_Ref( zEquNeg );
zRes = Cudd_zddUnion( dd, zEquPos, zEquNeg ); Cudd_Ref( zRes );
Cudd_RecursiveDerefZdd( dd, zEquPos );
Cudd_RecursiveDerefZdd( dd, zEquNeg );
Cudd_Deref( zRes );
return zRes;
}
示例6: extraZddGetSingletons
/**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 []
******************************************************************************/
DdNode * extraZddGetSingletons(
DdManager * dd, /* the DD manager */
DdNode * bVars) /* the set of variables */
{
DdNode * zRes;
if ( bVars == b1 )
// if ( bVars == b0 ) // bug fixed by Jin Zhang, Jan 23, 2004
return z1;
if ( (zRes = cuddCacheLookup1Zdd(dd, extraZddGetSingletons, bVars)) )
return zRes;
else
{
DdNode * zTemp, * zPlus;
// solve subproblem
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 );
// add these to the result
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;
}
} /* end of extraZddGetSingletons */
示例7: unreference_dd
static void unreference_dd(shadow_mgr mgr, DdNode *n, dd_type_t dtype) {
if (!mgr->do_cudd)
return;
if (dtype == IS_ZDD) {
Cudd_RecursiveDerefZdd(mgr->bdd_manager, n);
} else {
Cudd_RecursiveDeref(mgr->bdd_manager, n);
}
}
示例8: cuddZddFreeUniv
/**Function********************************************************************
Synopsis [Frees the ZDD universe.]
Description [Frees the ZDD universe.]
SideEffects [None]
SeeAlso [cuddZddInitUniv]
******************************************************************************/
void
cuddZddFreeUniv(
DdManager * zdd)
{
if (zdd->univ) {
Cudd_RecursiveDerefZdd(zdd, zdd->univ[0]);
FREE(zdd->univ);
}
} /* end of cuddZddFreeUniv */
示例9: testZdd
/**
* @brief Basic test of ZDDs.
* @return 0 if successful; -1 otherwise.
*/
static int
testZdd(int verbosity)
{
DdManager *manager;
DdNode *f, *var, *tmp;
int i, ret;
manager = Cudd_Init(0,4,CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS,0);
if (!manager) {
if (verbosity) {
printf("initialization failed\n");
}
return -1;
}
tmp = Cudd_ReadZddOne(manager,0);
Cudd_Ref(tmp);
for (i = 3; i >= 0; i--) {
var = Cudd_zddIthVar(manager,i);
Cudd_Ref(var);
f = Cudd_zddIntersect(manager,var,tmp);
Cudd_Ref(f);
Cudd_RecursiveDerefZdd(manager,tmp);
Cudd_RecursiveDerefZdd(manager,var);
tmp = f;
}
f = Cudd_zddDiff(manager,Cudd_ReadZddOne(manager,0),tmp);
Cudd_Ref(f);
Cudd_RecursiveDerefZdd(manager,tmp);
if (verbosity) {
Cudd_zddPrintMinterm(manager,f);
printf("\n");
}
Cudd_RecursiveDerefZdd(manager,f);
ret = Cudd_CheckZeroRef(manager);
if (ret != 0 && verbosity) {
printf("%d unexpected non-zero references\n", ret);
}
Cudd_Quit(manager);
return 0;
}
示例10: cuddZddChange
/**Function********************************************************************
Synopsis [Substitutes a variable with its complement in a ZDD.]
Description [Substitutes a variable with its complement in a ZDD.
returns a pointer to the result if successful; NULL
otherwise. cuddZddChange performs the same function as
Cudd_zddChange, but does not restart if reordering has taken
place. Therefore it can be called from within a recursive
procedure.]
SideEffects [None]
SeeAlso [Cudd_zddChange]
******************************************************************************/
DdNode *
cuddZddChange(
DdManager * dd,
DdNode * P,
int var)
{
DdNode *zvar, *res;
zvar = cuddUniqueInterZdd(dd, var, DD_ONE(dd), DD_ZERO(dd));
if (zvar == NULL) return(NULL);
cuddRef(zvar);
res = cuddZddChangeAux(dd, P, zvar);
if (res == NULL) {
Cudd_RecursiveDerefZdd(dd,zvar);
return(NULL);
}
cuddRef(res);
Cudd_RecursiveDerefZdd(dd,zvar);
cuddDeref(res);
return(res);
} /* end of cuddZddChange */
示例11: extraZddSelectOneSubset
/**Function********************************************************************
Synopsis [Performs the recursive step of Extra_zddSelectOneSubset.]
Description []
SideEffects [None]
SeeAlso []
******************************************************************************/
DdNode * extraZddSelectOneSubset(
DdManager * dd,
DdNode * zS )
// selects one subset from the ZDD zS
// returns z0 if and only if zS is an empty set of cubes
{
DdNode * zRes;
if ( zS == z0 ) return z0;
if ( zS == z1 ) return z1;
// check cache
if ( (zRes = cuddCacheLookup1Zdd( dd, extraZddSelectOneSubset, zS )) )
return zRes;
else
{
DdNode * zS0, * zS1, * zTemp;
zS0 = cuddE(zS);
zS1 = cuddT(zS);
if ( zS0 != z0 )
{
zRes = extraZddSelectOneSubset( dd, zS0 );
if ( zRes == NULL )
return NULL;
}
else // if ( zS0 == z0 )
{
assert( zS1 != z0 );
zRes = extraZddSelectOneSubset( dd, zS1 );
if ( zRes == NULL )
return NULL;
cuddRef( zRes );
zRes = cuddZddGetNode( dd, zS->index, zTemp = zRes, z0 );
if ( zRes == NULL )
{
Cudd_RecursiveDerefZdd( dd, zTemp );
return NULL;
}
cuddDeref( zTemp );
}
// insert the result into cache
cuddCacheInsert1( dd, extraZddSelectOneSubset, zS, zRes );
return zRes;
}
} /* end of extraZddSelectOneSubset */
示例12: cuddZddInitUniv
/**Function********************************************************************
Synopsis [Initializes the ZDD universe.]
Description [Initializes the ZDD universe. Returns 1 if successful; 0
otherwise.]
SideEffects [None]
SeeAlso [cuddZddFreeUniv]
******************************************************************************/
int
cuddZddInitUniv(
DdManager * zdd)
{
DdNode *p, *res;
int i;
#ifdef __osf__
#pragma pointer_size save
#pragma pointer_size short
#endif
zdd->univ = ALLOC(DdNode *, zdd->sizeZ);
#ifdef __osf__
#pragma pointer_size restore
#endif
if (zdd->univ == NULL) {
zdd->errorCode = CUDD_MEMORY_OUT;
return(0);
}
res = DD_ONE(zdd);
cuddRef(res);
for (i = zdd->sizeZ - 1; i >= 0; i--) {
unsigned int index = zdd->invpermZ[i];
p = res;
res = cuddUniqueInterZdd(zdd, index, p, p);
if (res == NULL) {
Cudd_RecursiveDerefZdd(zdd,p);
FREE(zdd->univ);
return(0);
}
cuddRef(res);
cuddDeref(p);
zdd->univ[i] = res;
}
#ifdef DD_VERBOSE
cuddZddP(zdd, zdd->univ[0]);
#endif
return(1);
} /* end of cuddZddInitUniv */
示例13: cuddZddGetCofactors2
/**Function********************************************************************
Synopsis [Computes the two-way decomposition of f w.r.t. v.]
Description []
SideEffects [The results are returned in f1 and f0.]
SeeAlso [cuddZddGetCofactors3]
******************************************************************************/
int
cuddZddGetCofactors2(
DdManager * dd,
DdNode * f,
int v,
DdNode ** f1,
DdNode ** f0)
{
*f1 = cuddZddSubset1(dd, f, v);
if (*f1 == NULL)
return(1);
*f0 = cuddZddSubset0(dd, f, v);
if (*f0 == NULL) {
Cudd_RecursiveDerefZdd(dd, *f1);
return(1);
}
return(0);
} /* end of cuddZddGetCofactors2 */
示例14: Extra_SymmPairsCompute
ABC_NAMESPACE_IMPL_START
/*---------------------------------------------------------------------------*/
/* Constant declarations */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Stucture declarations */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Type declarations */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Variable declarations */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Macro declarations */
/*---------------------------------------------------------------------------*/
#define DD_GET_SYMM_VARS_TAG 0x0a /* former DD_BDD_XOR_EXIST_ABSTRACT_TAG */
/**AutomaticStart*************************************************************/
/*---------------------------------------------------------------------------*/
/* Static function prototypes */
/*---------------------------------------------------------------------------*/
/**AutomaticEnd***************************************************************/
/*---------------------------------------------------------------------------*/
/* Definition of exported functions */
/*---------------------------------------------------------------------------*/
/**Function********************************************************************
Synopsis [Computes the classical symmetry information for the function.]
Description [Returns the symmetry information in the form of Extra_SymmInfo_t structure.]
SideEffects [If the ZDD variables are not derived from BDD variables with
multiplicity 2, this function may derive them in a wrong way.]
SeeAlso []
******************************************************************************/
Extra_SymmInfo_t * Extra_SymmPairsCompute(
DdManager * dd, /* the manager */
DdNode * bFunc) /* the function whose symmetries are computed */
{
DdNode * bSupp;
DdNode * zRes;
Extra_SymmInfo_t * p;
bSupp = Cudd_Support( dd, bFunc ); Cudd_Ref( bSupp );
zRes = Extra_zddSymmPairsCompute( dd, bFunc, bSupp ); Cudd_Ref( zRes );
p = Extra_SymmPairsCreateFromZdd( dd, zRes, bSupp );
Cudd_RecursiveDeref( dd, bSupp );
Cudd_RecursiveDerefZdd( dd, zRes );
return p;
} /* end of Extra_SymmPairsCompute */
示例15: cuddZddDiff
/**Function********************************************************************
Synopsis [Performs the recursive step of Cudd_zddDiff.]
Description []
SideEffects [None]
SeeAlso []
******************************************************************************/
DdNode *
cuddZddDiff(
DdManager * zdd,
DdNode * P,
DdNode * Q)
{
int p_top, q_top;
DdNode *empty = DD_ZERO(zdd), *t, *e, *res;
DdManager *table = zdd;
statLine(zdd);
if (P == empty)
return(empty);
if (Q == empty)
return(P);
if (P == Q)
return(empty);
/* Check cache. The cache is shared by Cudd_zddDiffConst(). */
res = cuddCacheLookup2Zdd(table, cuddZddDiff, P, Q);
if (res != NULL && res != DD_NON_CONSTANT)
return(res);
if (cuddIsConstant(P))
p_top = P->index;
else
p_top = zdd->permZ[P->index];
if (cuddIsConstant(Q))
q_top = Q->index;
else
q_top = zdd->permZ[Q->index];
if (p_top < q_top) {
e = cuddZddDiff(zdd, cuddE(P), Q);
if (e == NULL) return(NULL);
cuddRef(e);
res = cuddZddGetNode(zdd, P->index, cuddT(P), e);
if (res == NULL) {
Cudd_RecursiveDerefZdd(table, e);
return(NULL);
}
cuddDeref(e);
} else if (p_top > q_top) {
res = cuddZddDiff(zdd, P, cuddE(Q));
if (res == NULL) return(NULL);
} else {
t = cuddZddDiff(zdd, cuddT(P), cuddT(Q));
if (t == NULL) return(NULL);
cuddRef(t);
e = cuddZddDiff(zdd, cuddE(P), cuddE(Q));
if (e == NULL) {
Cudd_RecursiveDerefZdd(table, t);
return(NULL);
}
cuddRef(e);
res = cuddZddGetNode(zdd, P->index, t, e);
if (res == NULL) {
Cudd_RecursiveDerefZdd(table, t);
Cudd_RecursiveDerefZdd(table, e);
return(NULL);
}
cuddDeref(t);
cuddDeref(e);
}
cuddCacheInsert2(table, cuddZddDiff, P, Q, res);
return(res);
} /* end of cuddZddDiff */