150 static char rcsid[]
DD_UNUSED =
"$Id: cuddEssent.c,v 1.24 2009/02/21 18:24:10 fabio Exp $";
293 if (table == NULL)
return(NULL);
367 if (tlc == NULL)
return(0);
368 if (tlc->
vars == NULL || tlc->
phases == NULL)
return(0);
369 if (i < 0 || (
unsigned) i >= tlc->
cnt)
return(0);
370 *var1 = tlc->
vars[2*i];
371 *var2 = tlc->
vars[2*i+1];
403 FILE *ifp = fp == NULL ? dd->
out : fp;
405 if (res == NULL)
return(0);
408 for (i = 0; !
sentinelp(vars[i], vars[i+1]); i += 2) {
411 (void) fprintf(ifp,
"%s%s\n",
415 (void) fprintf(ifp,
"%s%s | %s%s\n",
423 (void) fprintf(ifp,
"%s%d\n",
427 (void) fprintf(ifp,
"%s%d | %s%d\n",
491 DdNode *essT, *essE, *res;
521 if (E == lzero || E == azero) {
522 res = dd->
vars[index];
526 }
else if (T == lzero || T == azero) {
547 if (E == lzero || E == azero) {
636 if (
st__lookup(table, (
const char *)f, (
char **)&res)) {
658 if (E == lzero || E == azero) {
661 if (res == NULL)
return(NULL);
663 if (res->
vars == NULL) {
668 if (res->
phases == NULL) {
673 res->
vars[0] = index;
685 if (Tres == NULL)
return(NULL);
694 }
else if (T == lzero || T == azero) {
702 if (res == NULL)
return(NULL);
704 if (res->
vars == NULL) {
709 if (res->
phases == NULL) {
714 res->
vars[0] = index;
722 if (Eres == NULL)
return(NULL);
727 if (Tres == NULL)
return(NULL);
729 if (E == lzero || E == azero) {
733 if (Eres == NULL)
return(NULL);
739 if (Eres == NULL)
return(NULL);
803 if (res == NULL)
goto cleanup;
821 if (newclause == NULL)
goto cleanup;
822 newclause->
v1 = Tcv[pt];
823 newclause->
v2 = Tcv[pt+1];
826 newclause->
next = iclauses;
827 iclauses = newclause;
828 pt += 2; pe += 2; cv++;
836 if (newclause == NULL)
goto cleanup;
837 newclause->
v1 = Tcv[pt];
841 newclause->
next = tclauses;
842 tclauses = newclause;
851 if (newclause == NULL)
goto cleanup;
852 newclause->
v1 = Tcv[pt];
853 newclause->
v2 = Tcv[pt+1];
856 newclause->
next = iclauses;
857 iclauses = newclause;
866 if (newclause == NULL)
goto cleanup;
867 newclause->
v1 = Ecv[pe];
871 newclause->
next = eclauses;
872 eclauses = newclause;
881 if (newclause == NULL)
goto cleanup;
882 newclause->
v1 = Ecv[pe];
883 newclause->
v2 = Ecv[pe+1];
886 newclause->
next = iclauses;
887 iclauses = newclause;
898 if (newclause == NULL)
goto cleanup;
899 newclause->
v1 = label;
903 newclause->
next = tclauses;
904 tclauses = newclause;
906 if (newclause == NULL)
goto cleanup;
907 newclause->
v1 = label;
911 newclause->
next = eclauses;
912 eclauses = newclause;
917 while (tclauses != NULL && eclauses != NULL) {
919 tclauses->
v1, tclauses->
p1, tclauses->
v2, tclauses->
p2)) {
922 while (otherclauses != NULL) {
923 if (tclauses->
v1 != otherclauses->
v1) {
925 if (newclause == NULL)
goto cleanup;
926 newclause->
v1 = tclauses->
v1;
927 newclause->
v2 = otherclauses->
v1;
928 newclause->
p1 = tclauses->
p1;
929 newclause->
p2 = otherclauses->
p1;
930 newclause->
next = NULL;
931 if (nclauses == NULL) {
932 nclauses = newclause;
933 lnclause = newclause;
935 lnclause->
next = newclause;
936 lnclause = newclause;
940 otherclauses = otherclauses->
next;
943 tclauses = nextclause;
947 while (otherclauses != NULL) {
948 if (eclauses->
v1 != otherclauses->
v1) {
950 if (newclause == NULL)
goto cleanup;
951 newclause->
v1 = eclauses->
v1;
952 newclause->
v2 = otherclauses->
v1;
953 newclause->
p1 = eclauses->
p1;
954 newclause->
p2 = otherclauses->
p1;
955 newclause->
next = NULL;
956 if (nclauses == NULL) {
957 nclauses = newclause;
958 lnclause = newclause;
960 lnclause->
next = newclause;
961 lnclause = newclause;
965 otherclauses = otherclauses->
next;
968 eclauses = nextclause;
971 while (tclauses != NULL) {
974 tclauses = nextclause;
976 while (eclauses != NULL) {
979 eclauses = nextclause;
986 if (Vcv == NULL)
goto cleanup;
989 if (Vcp == NULL)
goto cleanup;
998 while (iclauses != NULL || nclauses != NULL) {
1001 if (nclauses == NULL || (iclauses != NULL &&
1003 iclauses->
v1, iclauses->
p1, iclauses->
v2, iclauses->
p2))) {
1004 Vcv[2*cv] = iclauses->
v1;
1005 Vcv[2*cv+1] = iclauses->
v2;
1008 nextclause = iclauses->
next;
1010 iclauses = nextclause;
1012 Vcv[2*cv] = nclauses->
v1;
1013 Vcv[2*cv+1] = nclauses->
v2;
1016 nextclause = nclauses->
next;
1018 nclauses = nextclause;
1027 while (iclauses != NULL) {
1030 iclauses = nextclause;
1032 while (nclauses != NULL) {
1035 nclauses = nextclause;
1037 while (tclauses != NULL) {
1040 tclauses = nextclause;
1042 while (eclauses != NULL) {
1045 eclauses = nextclause;
1082 if (res == NULL)
goto cleanup;
1084 for (i = 0; !
sentinelp(Ccv[i], Ccv[i+1]); i += 2);
1089 if (Vcv == NULL)
goto cleanup;
1091 if (Vcp == NULL)
goto cleanup;
1095 for (i = 0; !
sentinelp(Ccv[i], Ccv[i+1]); i += 2) {
1097 Vcv[i+1] = Ccv[i+1];
1145 if (eset == NULL)
return(NULL);
1147 if (eset->
vars == NULL) {
1178 return(var1 == 0 && var2 == 0);
1207 return(var1a == var2a && phase1a == phase2a &&
1208 var1b == var2b && phase1b == phase2b);
1243 return(var1a > var2a || (var1a == var2a &&
1244 (phase1a < phase2a || (phase1a == phase2a &&
1245 (var1b > var2b || (var1b == var2b && phase1b < phase2b))))));
1329 allocSize = ((size - 1) / (
sizeof(
BitVector) * 8)) + 1;
1331 if (vector == NULL)
return(NULL);
1363 allocSize = ((size - 1) / (
sizeof(
BitVector) * 8)) + 1;
1411 if (vector == NULL)
return((
short) 0);
1414 bit = i & (
BPL - 1);
1415 result = (short) ((vector[word] >> bit) & 1L);
1442 bit = i & (
BPL - 1);
1443 vector[
word] &= ~(1L << bit);
1444 vector[
word] |= (((long) val) << bit);
1465 if (res == NULL)
return(NULL);
static DdTlcInfo * computeClausesWithUniverse(DdTlcInfo *Cres, DdHalfWord label, short phase)
void st__free_table(st__table *table)
unsigned short DdHalfWord
int Cudd_bddIsVarEssential(DdManager *manager, DdNode *f, int id, int phase)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
#define Cudd_IsConstant(node)
static DD_INLINE void bitVectorSet(BitVector *vector, int i, short val)
#define Cudd_Regular(node)
static char rcsid[] DD_UNUSED
int st__ptrcmp(const char *, const char *)
#define ABC_ALLOC(type, num)
static DdTlcInfo * tlcInfoAlloc(void)
static int impliedp(DdHalfWord var1, short phase1, DdHalfWord var2, short phase2, BitVector *olv, BitVector *olp)
DdTlcInfo * Cudd_FindTwoLiteralClauses(DdManager *dd, DdNode *f)
int Cudd_ReadIthClause(DdTlcInfo *tlc, int i, DdHalfWord *var1, DdHalfWord *var2, int *phase1, int *phase2)
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
static DdNode * ddFindEssentialRecur(DdManager *dd, DdNode *f)
#define Cudd_IsComplement(node)
DdNode * cuddBddLiteralSetIntersectionRecur(DdManager *dd, DdNode *f, DdNode *g)
DdNode * cuddCacheLookup1(DdManager *table, DD_CTFP1 op, DdNode *f)
static DdTlcInfo * emptyClauseSet(void)
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
#define cuddIsConstant(node)
static int beforep(DdHalfWord var1a, short phase1a, DdHalfWord var1b, short phase1b, DdHalfWord var2a, short phase2a, DdHalfWord var2b, short phase2b)
static DdTlcInfo * ddFindTwoLiteralClausesRecur(DdManager *dd, DdNode *f, st__table *table)
void Cudd_tlcInfoFree(DdTlcInfo *t)
#define ABC_NAMESPACE_IMPL_START
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
int st__lookup(st__table *table, const char *key, char **value)
static void bitVectorFree(BitVector *vector)
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
static int sentinelp(DdHalfWord var1, DdHalfWord var2)
static DD_INLINE void bitVectorClear(BitVector *vector, int size)
int st__add_direct(st__table *table, char *key, char *value)
#define Cudd_NotCond(node, c)
#define st__foreach_item(table, gen, key, value)
DdNode * Cudd_FindEssential(DdManager *dd, DdNode *f)
static int equalp(DdHalfWord var1a, short phase1a, DdHalfWord var1b, short phase1b, DdHalfWord var2a, short phase2a, DdHalfWord var2b, short phase2b)
static DD_INLINE short bitVectorRead(BitVector *vector, int i)
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
static DdTlcInfo * computeClauses(DdTlcInfo *Tres, DdTlcInfo *Eres, DdHalfWord label, int size)
static BitVector * bitVectorAlloc(int size)
int st__ptrhash(const char *, int)
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
int Cudd_PrintTwoLiteralClauses(DdManager *dd, DdNode *f, char **names, FILE *fp)
void cuddCacheInsert1(DdManager *table, DD_CTFP1 op, DdNode *f, DdNode *data)
static int oneliteralp(DdHalfWord var)