本文整理汇总了C++中cuddBddAndRecur函数的典型用法代码示例。如果您正苦于以下问题:C++ cuddBddAndRecur函数的具体用法?C++ cuddBddAndRecur怎么用?C++ cuddBddAndRecur使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cuddBddAndRecur函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 */
开发者ID:thizanne,项目名称:mlcuddidl,代码行数:71,代码来源:cuddauxMisc.c
示例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 */
开发者ID:Oliii,项目名称:MTBDD,代码行数:67,代码来源:cuddSplit.c
示例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 */
开发者ID:Shubhankar007,项目名称:ECEN-699,代码行数:29,代码来源:cuddBddIte.c
示例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 */
开发者ID:Shubhankar007,项目名称:ECEN-699,代码行数:29,代码来源:cuddBddIte.c
示例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 */
开发者ID:bakhansen,项目名称:service-technology.org,代码行数:30,代码来源:cuddBddIte.c
示例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 */
开发者ID:Shubhankar007,项目名称:ECEN-699,代码行数:34,代码来源:cuddBddIte.c
示例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);
开发者ID:ansonn,项目名称:esl_systemc,代码行数:67,代码来源:cuddZddIsop.c
示例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
//.........这里部分代码省略.........
开发者ID:kyotobay,项目名称:ABC_withFD_check,代码行数:101,代码来源:extraBddAuto.c
示例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;
//.........这里部分代码省略.........
开发者ID:Oliii,项目名称:MTBDD,代码行数:101,代码来源:cuddSplit.c
示例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);
}
//.........这里部分代码省略.........
开发者ID:kyotobay,项目名称:ABC_withFD_check,代码行数:101,代码来源:cuddAndAbs.c
示例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 */
开发者ID:AndrewSmart,项目名称:CS5600,代码行数:101,代码来源:cuddBddAbs.c
示例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);
}
//.........这里部分代码省略.........
开发者ID:AndrewSmart,项目名称:CS5600,代码行数:101,代码来源:cuddBddAbs.c
示例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 */
开发者ID:saidalfaraby,项目名称:DTP4TC,代码行数:101,代码来源:cuddPriority.c
示例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);
//.........这里部分代码省略.........
开发者ID:ansonn,项目名称:esl_systemc,代码行数:101,代码来源:cuddZddIsop.c
示例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 */
开发者ID:systemc,项目名称:scv-1.0p2-sysc2.2,代码行数:101,代码来源:cuddLiteral.c
示例16: cuddauxAddRestrictRecur
/**Function********************************************************************
Synopsis [Performs the recursive step of Cuddaux_addRestrict.]
Description [Performs the recursive step of Cuddaux_addRestrict.
Returns the restricted ADD if successful; otherwise NULL.]
SideEffects [None]
SeeAlso [Cudd_addRestrict]
******************************************************************************/
DdNode *
cuddauxAddRestrictRecur(
DdManager * dd,
DdNode * f,
DdNode * c)
{
DdNode *Fv, *Fnv, *Cv, *Cnv, *t, *e, *res, *one, *zero;
unsigned int topf, topc;
int index;
one = DD_ONE(dd);
zero = Cudd_Not(one);
/* Trivial cases */
if (c == one) return(f);
if (c == zero){
fprintf(stderr,"CuddauxAddRestrictRecur: warning: false careset\n");
return(DD_BACKGROUND(dd));
}
if (Cudd_IsConstant(f)) return(f);
/* Now f and c are non-constant. */
/* Check the cache. */
res = cuddCacheLookup2(dd, Cuddaux_addRestrict, f, c);
if (res != NULL) {
return(res);
}
topf = dd->perm[f->index];
topc = dd->perm[Cudd_Regular(c)->index];
if (topc < topf) { /* abstract top variable from c */
DdNode *d, *s1, *s2;
/* Take the OR by applying DeMorgan. */
/* Find complements of cofactors of c. */
if (Cudd_IsComplement(c)) {
s1 = cuddT(Cudd_Regular(c));
s2 = cuddE(Cudd_Regular(c));
} else {
s1 = Cudd_Not(cuddT(c));
s2 = Cudd_Not(cuddE(c));
}
/* Take the AND and negate */
d = cuddBddAndRecur(dd, s1, s2);
if (d == NULL) return(NULL);
d = Cudd_Not(d);
cuddRef(d);
res = cuddauxAddRestrictRecur(dd, f, d);
if (res == NULL) {
Cudd_IterDerefBdd(dd, d);
return(NULL);
}
cuddRef(res);
Cudd_IterDerefBdd(dd, d);
cuddDeref(res);
cuddCacheInsert2(dd, Cuddaux_addRestrict, f, c, res);
return(res);
}
/* Recursive step. Here topf <= topc. */
index = f->index;
Fv = cuddT(f); Fnv = cuddE(f);
if (topc == topf) {
Cv = Cudd_T(c); Cnv = Cudd_E(c);
if (Cudd_IsComplement(c)) {
Cv = Cudd_Not(Cv); Cnv = Cudd_Not(Cnv);
}
} else {
Cv = Cnv = c;
}
if (!Cudd_IsConstant(Cv)) {
t = cuddauxAddRestrictRecur(dd, Fv, Cv);
if (t == NULL) return(NULL);
}
else if (Cv == one) {
t = Fv;
}
else { /* Cv == zero: return(Fnv @ Cnv) */
if (Cnv == one) {
res = Fnv;
}
else {
res = cuddauxAddRestrictRecur(dd, Fnv, Cnv);
if (res == NULL) return(NULL);
//.........这里部分代码省略.........
开发者ID:thizanne,项目名称:mlcuddidl,代码行数:101,代码来源:cuddauxGenCof.c
示例17: extraBddSpaceFromFunction
/**Function********************************************************************
Synopsis [Performs the recursive steps of Extra_bddSpaceFromFunction.]
Description []
SideEffects []
SeeAlso []
******************************************************************************/
DdNode * extraBddSpaceFromFunction( DdManager * dd, DdNode * bF, DdNode * bG )
{
DdNode * bRes;
DdNode * bFR, * bGR;
bFR = Cudd_Regular( bF );
bGR = Cudd_Regular( bG );
if ( cuddIsConstant(bFR) )
{
if ( bF == bG )
return b1;
else
return b0;
}
if ( cuddIsConstant(bGR) )
return b0;
// both bFunc and bCore are not constants
// the operation is commutative - normalize the problem
if ( (unsigned)(ABC_PTRUINT_T)bF > (unsigned)(ABC_PTRUINT_T)bG )
return extraBddSpaceFromFunction(dd, bG, bF);
if ( (bRes = cuddCacheLookup2(dd, extraBddSpaceFromFunction, bF, bG)) )
return bRes;
else
{
DdNode * bF0, * bF1;
DdNode * bG0, * bG1;
DdNode * bTemp1, * bTemp2;
DdNode * bRes0, * bRes1;
int LevelF, LevelG;
int index;
LevelF = dd->perm[bFR->index];
LevelG = dd->perm[bGR->index];
if ( LevelF <= LevelG )
{
index = dd->invperm[LevelF];
if ( bFR != bF )
{
bF0 = Cudd_Not( cuddE(bFR) );
bF1 = Cudd_Not( cuddT(bFR) );
}
else
{
bF0 = cuddE(bFR);
bF1 = cuddT(bFR);
}
}
else
{
index = dd->invperm[LevelG];
bF0 = bF1 = bF;
}
if ( LevelG <= LevelF )
{
if ( bGR != bG )
{
bG0 = Cudd_Not( cuddE(bGR) );
bG1 = Cudd_Not( cuddT(bGR) );
}
else
{
bG0 = cuddE(bGR);
bG1 = cuddT(bGR);
}
}
else
bG0 = bG1 = bG;
bTemp1 = extraBddSpaceFromFunction( dd, bF0, bG0 );
if ( bTemp1 == NULL )
return NULL;
cuddRef( bTemp1 );
bTemp2 = extraBddSpaceFromFunction( dd, bF1, bG1 );
if ( bTemp2 == NULL )
{
Cudd_RecursiveDeref( dd, bTemp1 );
return NULL;
}
cuddRef( bTemp2 );
bRes0 = cuddBddAndRecur( dd, bTemp1, bTemp2 );
if ( bRes0 == NULL )
{
//.........这里部分代码省略.........
开发者ID:kyotobay,项目名称:ABC_withFD_check,代码行数:101,代码来源:extraBddAuto.c
示例18: BDDs
/**Function********************************************************************
Synopsis [Converts a ZDD cover to a BDD graph.]
Description [Converts a ZDD cover to a BDD graph. If successful, it
returns a BDD node, otherwise it returns NULL. It is a recursive
algorithm as the following. First computes 3 cofactors of a ZDD cover;
f1, f0 and fd. Second, compute BDDs(b1, b0 and bd) of f1, f0 and fd.
Third, compute T=b1+bd and E=b0+bd. Fourth, compute ITE(v,T,E) where v
is the variable which has the index of the top node of the ZDD cover.
In this case, since the index of v can be larger than either one of T or
one of E, cuddUniqueInterIVO is called, here IVO stands for
independent variable ordering.]
SideEffects []
SeeAlso [Cudd_MakeBddFromZddCover]
******************************************************************************/
DdNode *
cuddMakeBddFromZddCover(
DdManager * dd,
DdNode * node)
{
DdNode *neW;
int v;
DdNode *f1, *f0, *fd;
DdNode *b1, *b0, *bd;
DdNode *T, *E;
statLine(dd);
if (node == dd->one)
return(dd->one);
if (node == dd->zero)
return(Cudd_Not(dd->one));
/* Check cache */
neW = cuddCacheLookup1(dd, cuddMakeBddFromZddCover, node);
if (neW)
return(neW);
v = Cudd_Regular(node)->index; /* either yi or zi */
cuddZddGetCofactors3(dd, node, v, &f1, &f0, &fd);
Cudd_Ref(f1);
Cudd_Ref(f0);
Cudd_Ref(fd);
b1 = cuddMakeBddFromZddCover(dd, f1);
if (!b1) {
Cudd_RecursiveDerefZdd(dd, f1);
Cudd_RecursiveDerefZdd(dd, f0);
Cudd_RecursiveDerefZdd(dd, fd);
return(NULL);
}
Cudd_Ref(b1);
b0 = cuddMakeBddFromZddCover(dd, f0);
if (!b1) {
Cudd_RecursiveDerefZdd(dd, f1);
Cudd_RecursiveDerefZdd(dd, f0);
Cudd_RecursiveDerefZdd(dd, fd);
Cudd_RecursiveDeref(dd, b1);
return(NULL);
}
Cudd_Ref(b0);
Cudd_RecursiveDerefZdd(dd, f1);
Cudd_RecursiveDerefZdd(dd, f0);
if (fd != dd->zero) {
bd = cuddMakeBddFromZddCover(dd, fd);
if (!bd) {
Cudd_RecursiveDerefZdd(dd, fd);
Cudd_RecursiveDeref(dd, b1);
Cudd_RecursiveDeref(dd, b0);
return(NULL);
}
Cudd_Ref(bd);
Cudd_RecursiveDerefZdd(dd, fd);
T = cuddBddAndRecur(dd, Cudd_Not(b1), Cudd_Not(bd));
if (!T) {
Cudd_RecursiveDeref(dd, b1);
Cudd_RecursiveDeref(dd, b0);
Cudd_RecursiveDeref(dd, bd);
return(NULL);
}
T = Cudd_NotCond(T, T != NULL);
Cudd_Ref(T);
Cudd_RecursiveDeref(dd, b1);
E = cuddBddAndRecur(dd, Cudd_Not(b0), Cudd_Not(bd));
if (!E) {
Cudd_RecursiveDeref(dd, b0);
Cudd_RecursiveDeref(dd, bd);
Cudd_RecursiveDeref(dd, T);
return(NULL);
}
E = Cudd_NotCond(E, E != NULL);
Cudd_Ref(E);
Cudd_RecursiveDeref(dd, b0);
Cudd_RecursiveDeref(dd, bd);
}
else {
//.........这里部分代码省略.........
开发者ID:ansonn,项目名称:esl_systemc,代码行数:101,代码来源:cuddZddIsop.c
示例19: cuddBddIteRecur
/**Function********************************************************************
Synopsis [Implements the recursive step of Cudd_bddIte.]
Description [Implements the recursive step of Cudd_bddIte. Returns a
pointer to the resulting BDD. NULL if the intermediate result blows
up or if reordering occurs.]
SideEffects [None]
SeeAlso []
******************************************************************************/
DdNode *
cuddBddIteRecur(
DdManager * dd,
DdNode * f,
DdNode * g,
DdNode * h)
{
DdNode *one, *zero, *res;
DdNode *r, *Fv, *Fnv, *Gv, *Gnv, *H, *Hv, *Hnv, *t, *e;
unsigned int topf, topg, toph, v;
int index = -1;
int comple;
statLine(dd);
/* Terminal cases. */
/* One variable cases. */
if (f == (one = DD_ONE(dd))) /* ITE(1,G,H) = G */
return(
|
请发表评论