本文整理汇总了C++中cuddBddAndRecur函数的典型用法代码示例。如果您正苦于以下问题:C++ cuddBddAndRecur函数的具体用法?C++ cuddBddAndRecur怎么用?C++ cuddBddAndRecur使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cuddBddAndRecur函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cuddauxSupportRecur
/**Function********************************************************************
Synopsis [Performs the recursive step of Cuddaux_Support.]
Description [Performs the recursive step of Cuddaux_Support.]
SideEffects [None]
SeeAlso []
******************************************************************************/
DdNode*
cuddauxSupportRecur(DdManager* dd,
DdNode * f)
{
DdNode *one, *fv, *fvn, *T,*E, *res, *res1;
one = DD_ONE(dd);
if (cuddIsConstant(f)) {
return one;
}
fv = cuddT(f);
fvn = Cudd_Regular(cuddE(f));
if (cuddIsConstant(fv) && cuddIsConstant(fvn)){
return dd->vars[f->index];
}
/* Look in the cache */
res = cuddCacheLookup1(dd,Cuddaux_Support,f);
if (res != NULL)
return(res);
T = cuddIsConstant(fv) ? one : cuddauxSupportRecur(dd,fv);
if (T == NULL)
return(NULL);
cuddRef(T);
E = cuddIsConstant(fvn) ? one : cuddauxSupportRecur(dd,fvn);
if (E == NULL){
Cudd_IterDerefBdd(dd,T);
return(NULL);
}
if (T==E){
res = cuddUniqueInter(dd,f->index,T,Cudd_Not(one));
if (res == NULL){
Cudd_IterDerefBdd(dd,T);
return NULL;
}
cuddDeref(T);
}
else {
cuddRef(E);
res1 = cuddBddAndRecur(dd,T,E);
if (res1 == NULL){
Cudd_IterDerefBdd(dd,T);
Cudd_IterDerefBdd(dd,E);
return(NULL);
}
cuddRef(res1);
Cudd_IterDerefBdd(dd,T);
Cudd_IterDerefBdd(dd,E);
res = cuddUniqueInter(dd,f->index,res1,Cudd_Not(one));
if (res == NULL){
Cudd_IterDerefBdd(dd,T);
Cudd_IterDerefBdd(dd,E);
Cudd_IterDerefBdd(dd,res1);
return(NULL);
}
cuddDeref(res1);
}
cuddCacheInsert1(dd,Cuddaux_Support,f,res);
return(res);
} /* end of cuddauxSupportRecur */
示例2: mintermsFromUniverse
/**Function********************************************************************
Synopsis [Recursive procedure to extract n mintems from constant 1.]
Description [Recursive procedure to extract n mintems from constant 1.]
SideEffects [None]
******************************************************************************/
static DdNode *
mintermsFromUniverse(
DdManager * manager,
DdNode ** vars,
int numVars,
double n,
int index)
{
DdNode *one, *zero;
DdNode *q, *result;
double max, max2;
statLine(manager);
one = DD_ONE(manager);
zero = Cudd_Not(one);
max = pow(2.0, (double)numVars);
max2 = max / 2.0;
if (n == max)
return(one);
if (n == 0.0)
return(zero);
/* if n == 2^(numVars-1), return a single variable */
if (n == max2)
return vars[index];
else if (n > max2) {
/* When n > 2^(numVars-1), a single variable vars[index]
** contains 2^(numVars-1) minterms. The rest are extracted
** from a constant with 1 less variable.
*/
q = mintermsFromUniverse(manager,vars,numVars-1,(n-max2),index+1);
if (q == NULL)
return(NULL);
cuddRef(q);
result = cuddBddIteRecur(manager,vars[index],one,q);
} else {
/* When n < 2^(numVars-1), a literal of variable vars[index]
** is selected. The required n minterms are extracted from a
** constant with 1 less variable.
*/
q = mintermsFromUniverse(manager,vars,numVars-1,n,index+1);
if (q == NULL)
return(NULL);
cuddRef(q);
result = cuddBddAndRecur(manager,vars[index],q);
}
if (result == NULL) {
Cudd_RecursiveDeref(manager,q);
return(NULL);
}
cuddRef(result);
Cudd_RecursiveDeref(manager,q);
cuddDeref(result);
return(result);
} /* end of mintermsFromUniverse */
示例3: Cudd_bddNor
/**Function********************************************************************
Synopsis [Computes the NOR of two BDDs f and g.]
Description [Computes the NOR of two BDDs f and g. Returns a
pointer to the resulting BDD if successful; NULL if the intermediate
result blows up.]
SideEffects [None]
SeeAlso [Cudd_bddIte Cudd_addApply Cudd_bddAnd Cudd_bddOr Cudd_bddNand
Cudd_bddXor Cudd_bddXnor]
******************************************************************************/
DdNode *
Cudd_bddNor(
DdManager * dd,
DdNode * f,
DdNode * g)
{
DdNode *res;
do {
dd->reordered = 0;
res = cuddBddAndRecur(dd,Cudd_Not(f),Cudd_Not(g));
} while (dd->reordered == 1);
return(res);
} /* end of Cudd_bddNor */
示例4: Cudd_bddAnd
/**Function********************************************************************
Synopsis [Computes the conjunction of two BDDs f and g.]
Description [Computes the conjunction of two BDDs f and g. Returns a
pointer to the resulting BDD if successful; NULL if the intermediate
result blows up.]
SideEffects [None]
SeeAlso [Cudd_bddIte Cudd_addApply Cudd_bddAndAbstract Cudd_bddIntersect
Cudd_bddOr Cudd_bddNand Cudd_bddNor Cudd_bddXor Cudd_bddXnor]
******************************************************************************/
DdNode *
Cudd_bddAnd(
DdManager * dd,
DdNode * f,
DdNode * g)
{
DdNode *res;
do {
dd->reordered = 0;
res = cuddBddAndRecur(dd,f,g);
} while (dd->reordered == 1);
return(res);
} /* end of Cudd_bddAnd */
示例5: Cudd_bddNand
/**Function********************************************************************
Synopsis [Computes the NAND of two BDDs f and g.]
Description [Computes the NAND of two BDDs f and g. Returns a
pointer to the resulting BDD if successful; (uintptr_t) 0 if the intermediate
result blows up.]
SideEffects [None]
SeeAlso [Cudd_bddIte Cudd_addApply Cudd_bddAnd Cudd_bddOr Cudd_bddNor
Cudd_bddXor Cudd_bddXnor]
******************************************************************************/
DdNode *
Cudd_bddNand(
DdManager * dd,
DdNode * f,
DdNode * g)
{
DdNode *res;
do {
dd->reordered = 0;
res = cuddBddAndRecur(dd,f,g);
} while (dd->reordered == 1);
res = Cudd_NotCond(res,res != (uintptr_t) 0);
return(res);
} /* end of Cudd_bddNand */
示例6: Cudd_bddAndLimit
/**Function********************************************************************
Synopsis [Computes the conjunction of two BDDs f and g. Returns
NULL if too many nodes are required.]
Description [Computes the conjunction of two BDDs f and g. Returns a
pointer to the resulting BDD if successful; NULL if the intermediate
result blows up or more new nodes than <code>limit</code> are
required.]
SideEffects [None]
SeeAlso [Cudd_bddAnd]
******************************************************************************/
DdNode *
Cudd_bddAndLimit(
DdManager * dd,
DdNode * f,
DdNode * g,
unsigned int limit)
{
DdNode *res;
unsigned int saveLimit = dd->maxLive;
dd->maxLive = (dd->keys - dd->dead) + (dd->keysZ - dd->deadZ) + limit;
do {
dd->reordered = 0;
res = cuddBddAndRecur(dd,f,g);
} while (dd->reordered == 1);
dd->maxLive = saveLimit;
return(res);
} /* end of Cudd_bddAndLimit */
示例7: cuddZddIsop
//.........这里部分代码省略.........
}
top_l = dd->perm[Cudd_Regular(L)->index];
top_u = dd->perm[Cudd_Regular(U)->index];
v = ddMin(top_l, top_u);
/* Compute cofactors. */
if (top_l == v) {
index = Cudd_Regular(L)->index;
Lv = Cudd_T(L);
Lnv = Cudd_E(L);
if (Cudd_IsComplement(L)) {
Lv = Cudd_Not(Lv);
Lnv = Cudd_Not(Lnv);
}
}
else {
index = Cudd_Regular(U)->index;
Lv = Lnv = L;
}
if (top_u == v) {
Uv = Cudd_T(U);
Unv = Cudd_E(U);
if (Cudd_IsComplement(U)) {
Uv = Cudd_Not(Uv);
Unv = Cudd_Not(Unv);
}
}
else {
Uv = Unv = U;
}
Lsub0 = cuddBddAndRecur(dd, Lnv, Cudd_Not(Uv));
if (Lsub0 == NULL)
return(NULL);
Cudd_Ref(Lsub0);
Usub0 = Unv;
Lsub1 = cuddBddAndRecur(dd, Lv, Cudd_Not(Unv));
if (Lsub1 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
return(NULL);
}
Cudd_Ref(Lsub1);
Usub1 = Uv;
Isub0 = cuddZddIsop(dd, Lsub0, Usub0, &zdd_Isub0);
if (Isub0 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
Cudd_RecursiveDeref(dd, Lsub1);
return(NULL);
}
/*
if ((!cuddIsConstant(Cudd_Regular(Isub0))) &&
(Cudd_Regular(Isub0)->index != zdd_Isub0->index / 2 ||
dd->permZ[index * 2] > dd->permZ[zdd_Isub0->index])) {
printf("*** ERROR : illegal permutation in ZDD. ***\n");
}
*/
Cudd_Ref(Isub0);
Cudd_Ref(zdd_Isub0);
Isub1 = cuddZddIsop(dd, Lsub1, Usub1, &zdd_Isub1);
if (Isub1 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
Cudd_RecursiveDeref(dd, Lsub1);
Cudd_RecursiveDeref(dd, Isub0);
示例8: Extra_bddSpaceFromFunctionPos
/**Function*************************************************************
Synopsis [Performs the recursive step of Extra_bddSpaceFromFunctionPos().]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
DdNode * extraBddSpaceFromMatrixNeg( DdManager * dd, DdNode * zA )
{
DdNode * bRes;
statLine( dd );
if ( zA == z0 )
return b1;
if ( zA == z1 )
return b0;
if ( (bRes = cuddCacheLookup1(dd, extraBddSpaceFromMatrixNeg, zA)) )
return bRes;
else
{
DdNode * bP0, * bP1;
DdNode * bN0, * bN1;
DdNode * bRes0, * bRes1;
bP0 = extraBddSpaceFromMatrixNeg( dd, cuddE(zA) );
if ( bP0 == NULL )
return NULL;
cuddRef( bP0 );
bP1 = extraBddSpaceFromMatrixNeg( dd, cuddT(zA) );
if ( bP1 == NULL )
{
Cudd_RecursiveDeref( dd, bP0 );
return NULL;
}
cuddRef( bP1 );
bRes0 = cuddBddAndRecur( dd, bP0, bP1 );
if ( bRes0 == NULL )
{
Cudd_RecursiveDeref( dd, bP0 );
Cudd_RecursiveDeref( dd, bP1 );
return NULL;
}
cuddRef( bRes0 );
Cudd_RecursiveDeref( dd, bP0 );
Cudd_RecursiveDeref( dd, bP1 );
bN0 = extraBddSpaceFromMatrixNeg( dd, cuddE(zA) );
if ( bN0 == NULL )
{
Cudd_RecursiveDeref( dd, bRes0 );
return NULL;
}
cuddRef( bN0 );
bN1 = extraBddSpaceFromMatrixPos( dd, cuddT(zA) );
if ( bN1 == NULL )
{
Cudd_RecursiveDeref( dd, bRes0 );
Cudd_RecursiveDeref( dd, bN0 );
return NULL;
}
cuddRef( bN1 );
bRes1 = cuddBddAndRecur( dd, bN0, bN1 );
if ( bRes1 == NULL )
{
Cudd_RecursiveDeref( dd, bRes0 );
Cudd_RecursiveDeref( dd, bN0 );
Cudd_RecursiveDeref( dd, bN1 );
return NULL;
}
cuddRef( bRes1 );
Cudd_RecursiveDeref( dd, bN0 );
Cudd_RecursiveDeref( dd, bN1 );
// consider the case when Res0 and Res1 are the same node
if ( bRes0 == bRes1 )
bRes = bRes1;
// consider the case when Res1 is complemented
else if ( Cudd_IsComplement(bRes1) )
{
bRes = cuddUniqueInter( dd, zA->index/2, Cudd_Not(bRes1), Cudd_Not(bRes0) );
if ( bRes == NULL )
{
Cudd_RecursiveDeref(dd,bRes0);
Cudd_RecursiveDeref(dd,bRes1);
return NULL;
}
bRes = Cudd_Not(bRes);
}
else
//.........这里部分代码省略.........
示例9: log
/**Function********************************************************************
Synopsis [Implements the recursive step of Cudd_SplitSet.]
Description [Implements the recursive step of Cudd_SplitSet. The
procedure recursively traverses the BDD and checks to see if any
node satisfies the minterm requirements as specified by 'n'. At any
node X, n is compared to the number of minterms in the onset of X's
children. If either of the child nodes have exactly n minterms, then
that node is returned; else, if n is greater than the onset of one
of the child nodes, that node is retained and the difference in the
number of minterms is extracted from the other child. In case n
minterms can be extracted from constant 1, the algorithm returns the
result with at most log(n) nodes.]
SideEffects [The array 'varSeen' is updated at every recursive call
to set the variables traversed by the procedure.]
SeeAlso []
******************************************************************************/
DdNode*
cuddSplitSetRecur(
DdManager * manager,
st_table * mtable,
int * varSeen,
DdNode * p,
double n,
double max,
int index)
{
DdNode *one, *zero, *N, *Nv;
DdNode *Nnv, *q, *r, *v;
DdNode *result;
double *dummy, numT, numE;
int variable, positive;
statLine(manager);
one = DD_ONE(manager);
zero = Cudd_Not(one);
/* If p is constant, extract n minterms from constant 1. The procedure by
** construction guarantees that minterms will not be extracted from
** constant 0.
*/
if (Cudd_IsConstant(p)) {
q = selectMintermsFromUniverse(manager,varSeen,n);
return(q);
}
N = Cudd_Regular(p);
/* Set variable as seen. */
variable = N->index;
varSeen[manager->invperm[variable]] = -1;
Nv = cuddT(N);
Nnv = cuddE(N);
if (Cudd_IsComplement(p)) {
Nv = Cudd_Not(Nv);
Nnv = Cudd_Not(Nnv);
}
/* If both the children of 'p' are constants, extract n minterms from a
** constant node.
*/
if (Cudd_IsConstant(Nv) && Cudd_IsConstant(Nnv)) {
q = selectMintermsFromUniverse(manager,varSeen,n);
if (q == NULL) {
return(NULL);
}
cuddRef(q);
r = cuddBddAndRecur(manager,p,q);
if (r == NULL) {
Cudd_RecursiveDeref(manager,q);
return(NULL);
}
cuddRef(r);
Cudd_RecursiveDeref(manager,q);
cuddDeref(r);
return(r);
}
/* Lookup the # of minterms in the onset of the node from the table. */
if (!Cudd_IsConstant(Nv)) {
if (!st_lookup(mtable, Nv, &dummy)) return(NULL);
numT = *dummy/(2*(1<<index));
} else if (Nv == one) {
numT = max/(2*(1<<index));
} else {
numT = 0;
}
if (!Cudd_IsConstant(Nnv)) {
if (!st_lookup(mtable, Nnv, &dummy)) return(NULL);
numE = *dummy/(2*(1<<index));
} else if (Nnv == one) {
numE = max/(2*(1<<index));
} else {
numE = 0;
//.........这里部分代码省略.........
示例10: cuddBddAndAbstractRecur
/**Function********************************************************************
Synopsis [Takes the AND of two BDDs and simultaneously abstracts the
variables in cube.]
Description [Takes the AND of two BDDs and simultaneously abstracts
the variables in cube. The variables are existentially abstracted.
Returns a pointer to the result is successful; NULL otherwise.]
SideEffects [None]
SeeAlso [Cudd_bddAndAbstract]
******************************************************************************/
DdNode *
cuddBddAndAbstractRecur(
DdManager * manager,
DdNode * f,
DdNode * g,
DdNode * cube)
{
DdNode *F, *ft, *fe, *G, *gt, *ge;
DdNode *one, *zero, *r, *t, *e;
unsigned int topf, topg, topcube, top, index;
statLine(manager);
one = DD_ONE(manager);
zero = Cudd_Not(one);
/* Terminal cases. */
if (f == zero || g == zero || f == Cudd_Not(g)) return(zero);
if (f == one && g == one) return(one);
if (cube == one) {
return(cuddBddAndRecur(manager, f, g));
}
if (f == one || f == g) {
return(cuddBddExistAbstractRecur(manager, g, cube));
}
if (g == one) {
return(cuddBddExistAbstractRecur(manager, f, cube));
}
/* At this point f, g, and cube are not constant. */
if (f > g) { /* Try to increase cache efficiency. */
DdNode *tmp = f;
f = g;
g = tmp;
}
/* Here we can skip the use of cuddI, because the operands are known
** to be non-constant.
*/
F = Cudd_Regular(f);
G = Cudd_Regular(g);
topf = manager->perm[F->index];
topg = manager->perm[G->index];
top = ddMin(topf, topg);
topcube = manager->perm[cube->index];
while (topcube < top) {
cube = cuddT(cube);
if (cube == one) {
return(cuddBddAndRecur(manager, f, g));
}
topcube = manager->perm[cube->index];
}
/* Now, topcube >= top. */
/* Check cache. */
if (F->ref != 1 || G->ref != 1) {
r = cuddCacheLookup(manager, DD_BDD_AND_ABSTRACT_TAG, f, g, cube);
if (r != NULL) {
return(r);
}
}
if ( manager->TimeStop && manager->TimeStop < clock() )
return NULL;
if (topf == top) {
index = F->index;
ft = cuddT(F);
fe = cuddE(F);
if (Cudd_IsComplement(f)) {
ft = Cudd_Not(ft);
fe = Cudd_Not(fe);
}
} else {
index = G->index;
ft = fe = f;
}
if (topg == top) {
gt = cuddT(G);
ge = cuddE(G);
if (Cudd_IsComplement(g)) {
gt = Cudd_Not(gt);
ge = Cudd_Not(ge);
}
//.........这里部分代码省略.........
示例11: cuddBddXorExistAbstractRecur
//.........这里部分代码省略.........
topf = manager->perm[F->index];
G = Cudd_Regular(g);
topg = manager->perm[G->index];
top = ddMin(topf, topg);
topcube = manager->perm[cube->index];
if (topcube < top) {
return(cuddBddXorExistAbstractRecur(manager, f, g, cuddT(cube)));
}
/* Now, topcube >= top. */
if (topf == top) {
index = F->index;
fv = cuddT(F);
fnv = cuddE(F);
if (Cudd_IsComplement(f)) {
fv = Cudd_Not(fv);
fnv = Cudd_Not(fnv);
}
} else {
index = G->index;
fv = fnv = f;
}
if (topg == top) {
gv = cuddT(G);
gnv = cuddE(G);
if (Cudd_IsComplement(g)) {
gv = Cudd_Not(gv);
gnv = Cudd_Not(gnv);
}
} else {
gv = gnv = g;
}
if (topcube == top) {
Cube = cuddT(cube);
} else {
Cube = cube;
}
t = cuddBddXorExistAbstractRecur(manager, fv, gv, Cube);
if (t == NULL) return(NULL);
/* Special case: 1 OR anything = 1. Hence, no need to compute
** the else branch if t is 1.
*/
if (t == one && topcube == top) {
cuddCacheInsert(manager, DD_BDD_XOR_EXIST_ABSTRACT_TAG, f, g, cube, one);
return(one);
}
cuddRef(t);
e = cuddBddXorExistAbstractRecur(manager, fnv, gnv, Cube);
if (e == NULL) {
Cudd_IterDerefBdd(manager, t);
return(NULL);
}
cuddRef(e);
if (topcube == top) { /* abstract */
r = cuddBddAndRecur(manager, Cudd_Not(t), Cudd_Not(e));
if (r == NULL) {
Cudd_IterDerefBdd(manager, t);
Cudd_IterDerefBdd(manager, e);
return(NULL);
}
r = Cudd_Not(r);
cuddRef(r);
Cudd_IterDerefBdd(manager, t);
Cudd_IterDerefBdd(manager, e);
cuddDeref(r);
} else if (t == e) {
r = t;
cuddDeref(t);
cuddDeref(e);
} else {
if (Cudd_IsComplement(t)) {
r = cuddUniqueInter(manager,(int)index,Cudd_Not(t),Cudd_Not(e));
if (r == NULL) {
Cudd_IterDerefBdd(manager, t);
Cudd_IterDerefBdd(manager, e);
return(NULL);
}
r = Cudd_Not(r);
} else {
r = cuddUniqueInter(manager,(int)index,t,e);
if (r == NULL) {
Cudd_IterDerefBdd(manager, t);
Cudd_IterDerefBdd(manager, e);
return(NULL);
}
}
cuddDeref(e);
cuddDeref(t);
}
cuddCacheInsert(manager, DD_BDD_XOR_EXIST_ABSTRACT_TAG, f, g, cube, r);
return (r);
} /* end of cuddBddXorExistAbstractRecur */
示例12: cuddBddExistAbstractRecur
/**Function********************************************************************
Synopsis [Performs the recursive steps of Cudd_bddExistAbstract.]
Description [Performs the recursive steps of Cudd_bddExistAbstract.
Returns the BDD obtained by abstracting the variables
of cube from f if successful; NULL otherwise. It is also used by
Cudd_bddUnivAbstract.]
SideEffects [None]
SeeAlso [Cudd_bddExistAbstract Cudd_bddUnivAbstract]
******************************************************************************/
DdNode *
cuddBddExistAbstractRecur(
DdManager * manager,
DdNode * f,
DdNode * cube)
{
DdNode *F, *T, *E, *res, *res1, *res2, *one;
statLine(manager);
one = DD_ONE(manager);
F = Cudd_Regular(f);
/* Cube is guaranteed to be a cube at this point. */
if (cube == one || F == one) {
return(f);
}
/* From now on, f and cube are non-constant. */
/* Abstract a variable that does not appear in f. */
while (manager->perm[F->index] > manager->perm[cube->index]) {
cube = cuddT(cube);
if (cube == one) return(f);
}
/* Check the cache. */
if (F->ref != 1 && (res = cuddCacheLookup2(manager, Cudd_bddExistAbstract, f, cube)) != NULL) {
return(res);
}
/* Compute the cofactors of f. */
T = cuddT(F); E = cuddE(F);
if (f != F) {
T = Cudd_Not(T); E = Cudd_Not(E);
}
/* If the two indices are the same, so are their levels. */
if (F->index == cube->index) {
if (T == one || E == one || T == Cudd_Not(E)) {
return(one);
}
res1 = cuddBddExistAbstractRecur(manager, T, cuddT(cube));
if (res1 == NULL) return(NULL);
if (res1 == one) {
if (F->ref != 1)
cuddCacheInsert2(manager, Cudd_bddExistAbstract, f, cube, one);
return(one);
}
cuddRef(res1);
res2 = cuddBddExistAbstractRecur(manager, E, cuddT(cube));
if (res2 == NULL) {
Cudd_IterDerefBdd(manager,res1);
return(NULL);
}
cuddRef(res2);
res = cuddBddAndRecur(manager, Cudd_Not(res1), Cudd_Not(res2));
if (res == NULL) {
Cudd_IterDerefBdd(manager, res1);
Cudd_IterDerefBdd(manager, res2);
return(NULL);
}
res = Cudd_Not(res);
cuddRef(res);
Cudd_IterDerefBdd(manager, res1);
Cudd_IterDerefBdd(manager, res2);
if (F->ref != 1)
cuddCacheInsert2(manager, Cudd_bddExistAbstract, f, cube, res);
cuddDeref(res);
return(res);
} else { /* if (cuddI(manager,F->index) < cuddI(manager,cube->index)) */
res1 = cuddBddExistAbstractRecur(manager, T, cube);
if (res1 == NULL) return(NULL);
cuddRef(res1);
res2 = cuddBddExistAbstractRecur(manager, E, cube);
if (res2 == NULL) {
Cudd_IterDerefBdd(manager, res1);
return(NULL);
}
cuddRef(res2);
/* ITE takes care of possible complementation of res1 and of the
** case in which res1 == res2. */
res = cuddBddIteRecur(manager, manager->vars[F->index], res1, res2);
if (res == NULL) {
Cudd_IterDerefBdd(manager, res1);
Cudd_IterDerefBdd(manager, res2);
return(NULL);
}
//.........这里部分代码省略.........
示例13: cuddCProjectionRecur
//.........这里部分代码省略.........
res1 = cuddCProjectionRecur(dd,RT,Y,Ysupp);
if (res1 == NULL) return(NULL);
cuddRef(res1);
res2 = cuddCProjectionRecur(dd,RE,Y,Ysupp);
if (res2 == NULL) {
Cudd_RecursiveDeref(dd,res1);
return(NULL);
}
cuddRef(res2);
res = cuddBddIteRecur(dd, dd->vars[index], res1, res2);
if (res == NULL) {
Cudd_RecursiveDeref(dd,res1);
Cudd_RecursiveDeref(dd,res2);
return(NULL);
}
/* If we have reached this point, res1 and res2 are now
** incorporated in res. cuddDeref is therefore sufficient.
*/
cuddDeref(res1);
cuddDeref(res2);
} else {
/* Compute the cofactors of Y */
index = y->index;
YT = cuddT(y);
YE = cuddE(y);
if (y != Y) {
YT = Cudd_Not(YT); YE = Cudd_Not(YE);
}
if (YT == Cudd_Not(one)) {
Alpha = Cudd_Not(dd->vars[index]);
Yrest = YE;
Ra = RE;
Ran = RT;
} else {
Alpha = dd->vars[index];
Yrest = YT;
Ra = RT;
Ran = RE;
}
Gamma = cuddBddExistAbstractRecur(dd,Ra,cuddT(Ysupp));
if (Gamma == NULL) return(NULL);
if (Gamma == one) {
res1 = cuddCProjectionRecur(dd,Ra,Yrest,cuddT(Ysupp));
if (res1 == NULL) return(NULL);
cuddRef(res1);
res = cuddBddAndRecur(dd, Alpha, res1);
if (res == NULL) {
Cudd_RecursiveDeref(dd,res1);
return(NULL);
}
cuddDeref(res1);
} else if (Gamma == Cudd_Not(one)) {
res1 = cuddCProjectionRecur(dd,Ran,Yrest,cuddT(Ysupp));
if (res1 == NULL) return(NULL);
cuddRef(res1);
res = cuddBddAndRecur(dd, Cudd_Not(Alpha), res1);
if (res == NULL) {
Cudd_RecursiveDeref(dd,res1);
return(NULL);
}
cuddDeref(res1);
} else {
cuddRef(Gamma);
resA = cuddCProjectionRecur(dd,Ran,Yrest,cuddT(Ysupp));
if (resA == NULL) {
Cudd_RecursiveDeref(dd,Gamma);
return(NULL);
}
cuddRef(resA);
res2 = cuddBddAndRecur(dd, Cudd_Not(Gamma), resA);
if (res2 == NULL) {
Cudd_RecursiveDeref(dd,Gamma);
Cudd_RecursiveDeref(dd,resA);
return(NULL);
}
cuddRef(res2);
Cudd_RecursiveDeref(dd,Gamma);
Cudd_RecursiveDeref(dd,resA);
res1 = cuddCProjectionRecur(dd,Ra,Yrest,cuddT(Ysupp));
if (res1 == NULL) {
Cudd_RecursiveDeref(dd,res2);
return(NULL);
}
cuddRef(res1);
res = cuddBddIteRecur(dd, Alpha, res1, res2);
if (res == NULL) {
Cudd_RecursiveDeref(dd,res1);
Cudd_RecursiveDeref(dd,res2);
return(NULL);
}
cuddDeref(res1);
cuddDeref(res2);
}
}
cuddCacheInsert2(dd,Cudd_CProjection,R,Y,res);
return(res);
} /* end of cuddCProjectionRecur */
示例14: cuddBddIsop
/**Function********************************************************************
Synopsis [Performs the recursive step of Cudd_bddIsop.]
Description []
SideEffects [None]
SeeAlso [Cudd_bddIsop]
******************************************************************************/
DdNode *
cuddBddIsop(
DdManager * dd,
DdNode * L,
DdNode * U)
{
DdNode *one = DD_ONE(dd);
DdNode *zero = Cudd_Not(one);
int v, top_l, top_u;
DdNode *Lsub0, *Usub0, *Lsub1, *Usub1, *Ld, *Ud;
DdNode *Lsuper0, *Usuper0, *Lsuper1, *Usuper1;
DdNode *Isub0, *Isub1, *Id;
DdNode *x;
DdNode *term0, *term1, *sum;
DdNode *Lv, *Uv, *Lnv, *Unv;
DdNode *r;
int index;
statLine(dd);
if (L == zero)
return(zero);
if (U == one)
return(one);
/* Check cache */
r = cuddCacheLookup2(dd, cuddBddIsop, L, U);
if (r)
return(r);
top_l = dd->perm[Cudd_Regular(L)->index];
top_u = dd->perm[Cudd_Regular(U)->index];
v = ddMin(top_l, top_u);
/* Compute cofactors */
if (top_l == v) {
index = Cudd_Regular(L)->index;
Lv = Cudd_T(L);
Lnv = Cudd_E(L);
if (Cudd_IsComplement(L)) {
Lv = Cudd_Not(Lv);
Lnv = Cudd_Not(Lnv);
}
}
else {
index = Cudd_Regular(U)->index;
Lv = Lnv = L;
}
if (top_u == v) {
Uv = Cudd_T(U);
Unv = Cudd_E(U);
if (Cudd_IsComplement(U)) {
Uv = Cudd_Not(Uv);
Unv = Cudd_Not(Unv);
}
}
else {
Uv = Unv = U;
}
Lsub0 = cuddBddAndRecur(dd, Lnv, Cudd_Not(Uv));
if (Lsub0 == NULL)
return(NULL);
Cudd_Ref(Lsub0);
Usub0 = Unv;
Lsub1 = cuddBddAndRecur(dd, Lv, Cudd_Not(Unv));
if (Lsub1 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
return(NULL);
}
Cudd_Ref(Lsub1);
Usub1 = Uv;
Isub0 = cuddBddIsop(dd, Lsub0, Usub0);
if (Isub0 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
Cudd_RecursiveDeref(dd, Lsub1);
return(NULL);
}
Cudd_Ref(Isub0);
Isub1 = cuddBddIsop(dd, Lsub1, Usub1);
if (Isub1 == NULL) {
Cudd_RecursiveDeref(dd, Lsub0);
Cudd_RecursiveDeref(dd, Lsub1);
Cudd_RecursiveDeref(dd, Isub0);
return(NULL);
}
Cudd_Ref(Isub1);
Cudd_RecursiveDeref(dd, Lsub0);
//.........这里部分代码省略.........
示例15: cuddBddLiteralSetIntersectionRecur
//.........这里部分代码省略.........
unsigned int topf, topg, comple;
int phasef, phaseg;
statLine(dd);
if (f == g) return(f);
F = Cudd_Regular(f);
G = Cudd_Regular(g);
one = DD_ONE(dd);
/* Here f != g. If F == G, then f and g are complementary.
** Since they are two cubes, this case only occurs when f == v,
** g == v', and v is a variable or its complement.
*/
if (F == G) return(one);
zero = Cudd_Not(one);
topf = cuddI(dd,F->index);
topg = cuddI(dd,G->index);
/* Look for a variable common to both cubes. If there are none, this
** loop will stop when the constant node is reached in both cubes.
*/
while (topf != topg) {
if (topf < topg) { /* move down on f */
comple = f != F;
f = cuddT(F);
if (comple) f = Cudd_Not(f);
if (f == zero) {
f = cuddE(F);
if (comple) f = Cudd_Not(f);
}
F = Cudd_Regular(f);
topf = cuddI(dd,F->index);
} else if (topg < topf) {
comple = g != G;
g = cuddT(G);
if (comple) g = Cudd_Not(g);
if (g == zero) {
g = cuddE(G);
if (comple) g = Cudd_Not(g);
}
G = Cudd_Regular(g);
topg = cuddI(dd,G->index);
}
}
/* At this point, f == one <=> g == 1. It suffices to test one of them. */
if (f == one) return(one);
res = cuddCacheLookup2(dd,Cudd_bddLiteralSetIntersection,f,g);
if (res != NULL) {
return(res);
}
/* Here f and g are both non constant and have the same top variable. */
comple = f != F;
fc = cuddT(F);
phasef = 1;
if (comple) fc = Cudd_Not(fc);
if (fc == zero) {
fc = cuddE(F);
phasef = 0;
if (comple) fc = Cudd_Not(fc);
}
comple = g != G;
gc = cuddT(G);
phaseg = 1;
if (comple) gc = Cudd_Not(gc);
if (gc == zero) {
gc = cuddE(G);
phaseg = 0;
if (comple) gc = Cudd_Not(gc);
}
tmp = cuddBddLiteralSetIntersectionRecur(dd,fc,gc);
if (tmp == NULL) {
return(NULL);
}
if (phasef != phaseg) {
res = tmp;
} else {
cuddRef(tmp);
if (phasef == 0) {
res = cuddBddAndRecur(dd,Cudd_Not(dd->vars[F->index]),tmp);
} else {
res = cuddBddAndRecur(dd,dd->vars[F->index],tmp);
}
if (res == NULL) {
Cudd_RecursiveDeref(dd,tmp);
return(NULL);
}
cuddDeref(tmp); /* Just cuddDeref, because it is included in result */
}
cuddCacheInsert2(dd,Cudd_bddLiteralSetIntersection,f,g,res);
return(res);
} /* end of cuddBddLiteralSetIntersectionRecur */