SVF
Classes | Macros | Typedefs | Enumerations | Functions
cudd.h File Reference
#include "mtr.h"
#include "epd.h"

Go to the source code of this file.

Classes

struct  DdChildren
 
struct  DdNode
 

Macros

#define CUDD_VERSION   "2.5.0"
 
#define SIZEOF_LONG   4
 
#define CUDD_TRUE   1
 
#define CUDD_FALSE   0
 
#define CUDD_VALUE_TYPE   double
 
#define CUDD_OUT_OF_MEM   -1
 
#define CUDD_UNIQUE_SLOTS   256 /* initial size of subtables */
 
#define CUDD_CACHE_SLOTS   262144 /* default size of the cache */
 
#define CUDD_RESIDUE_DEFAULT   0
 
#define CUDD_RESIDUE_MSB   1
 
#define CUDD_RESIDUE_TC   2
 
#define CUDD_MAXINDEX   ((DdHalfWord) ~0)
 
#define CUDD_CONST_INDEX   CUDD_MAXINDEX
 
#define DD_APA_BITS   16
 
#define DD_APA_BASE   (1 << DD_APA_BITS)
 
#define DD_APA_HEXPRINT   "%04x"
 
#define DD_APA_MASK   (DD_APA_BASE - 1)
 
#define Cudd_IsConstant(node)   ((Cudd_Regular(node))->index == CUDD_CONST_INDEX)
 
#define Cudd_Not(node)   ((DdNode *)((long)(node) ^ 01))
 
#define Cudd_NotCond(node, c)   ((DdNode *)((long)(node) ^ (c)))
 
#define Cudd_Regular(node)   ((DdNode *)((unsigned long)(node) & ~01))
 
#define Cudd_Complement(node)   ((DdNode *)((unsigned long)(node) | 01))
 
#define Cudd_IsComplement(node)   ((int) ((long) (node) & 01))
 
#define Cudd_T(node)   ((Cudd_Regular(node))->type.kids.T)
 
#define Cudd_E(node)   ((Cudd_Regular(node))->type.kids.E)
 
#define Cudd_V(node)   ((Cudd_Regular(node))->type.value)
 
#define Cudd_ReadIndex(dd, index)   (Cudd_ReadPerm(dd,index))
 
#define Cudd_ForeachCube(manager, f, gen, cube, value)
 
#define Cudd_ForeachPrime(manager, l, u, gen, cube)
 
#define Cudd_ForeachNode(manager, f, gen, node)
 
#define Cudd_zddForeachPath(manager, f, gen, path)
 

Typedefs

typedef unsigned short DdHalfWord
 
typedef struct DdNode DdNode
 
typedef struct DdChildren DdChildren
 
typedef struct DdManager DdManager
 
typedef struct DdGen DdGen
 
typedef unsigned short int DdApaDigit
 
typedef unsigned int DdApaDoubleDigit
 
typedef DdApaDigitDdApaNumber
 
typedef struct DdTlcInfo DdTlcInfo
 
typedef int(* DD_HFP) (DdManager *, const char *, void *)
 
typedef DdNode *(* DD_PRFP) (DdManager *, int, DdNode **, DdNode **, DdNode **)
 
typedef DdNode *(* DD_AOP) (DdManager *, DdNode **, DdNode **)
 
typedef DdNode *(* DD_MAOP) (DdManager *, DdNode *)
 
typedef DdNode *(* DD_CTFP) (DdManager *, DdNode *, DdNode *)
 
typedef DdNode *(* DD_CTFP1) (DdManager *, DdNode *)
 
typedef void(* DD_OOMFP) (long)
 
typedef int(* DD_QSFP) (const void *, const void *)
 

Enumerations

enum  Cudd_ReorderingType {
  CUDD_REORDER_SAME, CUDD_REORDER_NONE, CUDD_REORDER_RANDOM, CUDD_REORDER_RANDOM_PIVOT,
  CUDD_REORDER_SIFT, CUDD_REORDER_SIFT_CONVERGE, CUDD_REORDER_SYMM_SIFT, CUDD_REORDER_SYMM_SIFT_CONV,
  CUDD_REORDER_WINDOW2, CUDD_REORDER_WINDOW3, CUDD_REORDER_WINDOW4, CUDD_REORDER_WINDOW2_CONV,
  CUDD_REORDER_WINDOW3_CONV, CUDD_REORDER_WINDOW4_CONV, CUDD_REORDER_GROUP_SIFT, CUDD_REORDER_GROUP_SIFT_CONV,
  CUDD_REORDER_ANNEALING, CUDD_REORDER_GENETIC, CUDD_REORDER_LINEAR, CUDD_REORDER_LINEAR_CONVERGE,
  CUDD_REORDER_LAZY_SIFT, CUDD_REORDER_EXACT
}
 
enum  Cudd_AggregationType {
  CUDD_NO_CHECK, CUDD_GROUP_CHECK, CUDD_GROUP_CHECK2, CUDD_GROUP_CHECK3,
  CUDD_GROUP_CHECK4, CUDD_GROUP_CHECK5, CUDD_GROUP_CHECK6, CUDD_GROUP_CHECK7,
  CUDD_GROUP_CHECK8, CUDD_GROUP_CHECK9
}
 
enum  Cudd_HookType { CUDD_PRE_GC_HOOK, CUDD_POST_GC_HOOK, CUDD_PRE_REORDERING_HOOK, CUDD_POST_REORDERING_HOOK }
 
enum  Cudd_ErrorType {
  CUDD_NO_ERROR, CUDD_MEMORY_OUT, CUDD_TOO_MANY_NODES, CUDD_MAX_MEM_EXCEEDED,
  CUDD_TIMEOUT_EXPIRED, CUDD_INVALID_ARG, CUDD_INTERNAL_ERROR
}
 
enum  Cudd_LazyGroupType { CUDD_LAZY_NONE, CUDD_LAZY_SOFT_GROUP, CUDD_LAZY_HARD_GROUP, CUDD_LAZY_UNGROUP }
 
enum  Cudd_VariableType { CUDD_VAR_PRIMARY_INPUT, CUDD_VAR_PRESENT_STATE, CUDD_VAR_NEXT_STATE }
 

Functions

DdNodeCudd_addNewVar (DdManager *dd)
 
DdNodeCudd_addNewVarAtLevel (DdManager *dd, int level)
 
DdNodeCudd_bddNewVar (DdManager *dd)
 
DdNodeCudd_bddNewVarAtLevel (DdManager *dd, int level)
 
DdNodeCudd_addIthVar (DdManager *dd, int i)
 
DdNodeCudd_bddIthVar (DdManager *dd, int i)
 
DdNodeCudd_zddIthVar (DdManager *dd, int i)
 
int Cudd_zddVarsFromBddVars (DdManager *dd, int multiplicity)
 
DdNodeCudd_addConst (DdManager *dd, CUDD_VALUE_TYPE c)
 
int Cudd_IsNonConstant (DdNode *f)
 
unsigned long Cudd_ReadStartTime (DdManager *unique)
 
unsigned long Cudd_ReadElapsedTime (DdManager *unique)
 
void Cudd_SetStartTime (DdManager *unique, unsigned long st)
 
void Cudd_ResetStartTime (DdManager *unique)
 
unsigned long Cudd_ReadTimeLimit (DdManager *unique)
 
void Cudd_SetTimeLimit (DdManager *unique, unsigned long tl)
 
void Cudd_UpdateTimeLimit (DdManager *unique)
 
void Cudd_IncreaseTimeLimit (DdManager *unique, unsigned long increase)
 
void Cudd_UnsetTimeLimit (DdManager *unique)
 
int Cudd_TimeLimited (DdManager *unique)
 
void Cudd_AutodynEnable (DdManager *unique, Cudd_ReorderingType method)
 
void Cudd_AutodynDisable (DdManager *unique)
 
int Cudd_ReorderingStatus (DdManager *unique, Cudd_ReorderingType *method)
 
void Cudd_AutodynEnableZdd (DdManager *unique, Cudd_ReorderingType method)
 
void Cudd_AutodynDisableZdd (DdManager *unique)
 
int Cudd_ReorderingStatusZdd (DdManager *unique, Cudd_ReorderingType *method)
 
int Cudd_zddRealignmentEnabled (DdManager *unique)
 
void Cudd_zddRealignEnable (DdManager *unique)
 
void Cudd_zddRealignDisable (DdManager *unique)
 
int Cudd_bddRealignmentEnabled (DdManager *unique)
 
void Cudd_bddRealignEnable (DdManager *unique)
 
void Cudd_bddRealignDisable (DdManager *unique)
 
DdNodeCudd_ReadOne (DdManager *dd)
 
DdNodeCudd_ReadZddOne (DdManager *dd, int i)
 
DdNodeCudd_ReadZero (DdManager *dd)
 
DdNodeCudd_ReadLogicZero (DdManager *dd)
 
DdNodeCudd_ReadPlusInfinity (DdManager *dd)
 
DdNodeCudd_ReadMinusInfinity (DdManager *dd)
 
DdNodeCudd_ReadBackground (DdManager *dd)
 
void Cudd_SetBackground (DdManager *dd, DdNode *bck)
 
unsigned int Cudd_ReadCacheSlots (DdManager *dd)
 
double Cudd_ReadCacheUsedSlots (DdManager *dd)
 
double Cudd_ReadCacheLookUps (DdManager *dd)
 
double Cudd_ReadCacheHits (DdManager *dd)
 
double Cudd_ReadRecursiveCalls (DdManager *dd)
 
unsigned int Cudd_ReadMinHit (DdManager *dd)
 
void Cudd_SetMinHit (DdManager *dd, unsigned int hr)
 
unsigned int Cudd_ReadLooseUpTo (DdManager *dd)
 
void Cudd_SetLooseUpTo (DdManager *dd, unsigned int lut)
 
unsigned int Cudd_ReadMaxCache (DdManager *dd)
 
unsigned int Cudd_ReadMaxCacheHard (DdManager *dd)
 
void Cudd_SetMaxCacheHard (DdManager *dd, unsigned int mc)
 
int Cudd_ReadSize (DdManager *dd)
 
int Cudd_ReadZddSize (DdManager *dd)
 
unsigned int Cudd_ReadSlots (DdManager *dd)
 
double Cudd_ReadUsedSlots (DdManager *dd)
 
double Cudd_ExpectedUsedSlots (DdManager *dd)
 
unsigned int Cudd_ReadKeys (DdManager *dd)
 
unsigned int Cudd_ReadDead (DdManager *dd)
 
unsigned int Cudd_ReadMinDead (DdManager *dd)
 
unsigned int Cudd_ReadReorderings (DdManager *dd)
 
unsigned int Cudd_ReadMaxReorderings (DdManager *dd)
 
void Cudd_SetMaxReorderings (DdManager *dd, unsigned int mr)
 
long Cudd_ReadReorderingTime (DdManager *dd)
 
int Cudd_ReadGarbageCollections (DdManager *dd)
 
long Cudd_ReadGarbageCollectionTime (DdManager *dd)
 
double Cudd_ReadNodesFreed (DdManager *dd)
 
double Cudd_ReadNodesDropped (DdManager *dd)
 
double Cudd_ReadUniqueLookUps (DdManager *dd)
 
double Cudd_ReadUniqueLinks (DdManager *dd)
 
int Cudd_ReadSiftMaxVar (DdManager *dd)
 
void Cudd_SetSiftMaxVar (DdManager *dd, int smv)
 
int Cudd_ReadSiftMaxSwap (DdManager *dd)
 
void Cudd_SetSiftMaxSwap (DdManager *dd, int sms)
 
double Cudd_ReadMaxGrowth (DdManager *dd)
 
void Cudd_SetMaxGrowth (DdManager *dd, double mg)
 
double Cudd_ReadMaxGrowthAlternate (DdManager *dd)
 
void Cudd_SetMaxGrowthAlternate (DdManager *dd, double mg)
 
int Cudd_ReadReorderingCycle (DdManager *dd)
 
void Cudd_SetReorderingCycle (DdManager *dd, int cycle)
 
MtrNodeCudd_ReadTree (DdManager *dd)
 
void Cudd_SetTree (DdManager *dd, MtrNode *tree)
 
void Cudd_FreeTree (DdManager *dd)
 
MtrNodeCudd_ReadZddTree (DdManager *dd)
 
void Cudd_SetZddTree (DdManager *dd, MtrNode *tree)
 
void Cudd_FreeZddTree (DdManager *dd)
 
unsigned int Cudd_NodeReadIndex (DdNode *node)
 
int Cudd_ReadPerm (DdManager *dd, int i)
 
int Cudd_ReadPermZdd (DdManager *dd, int i)
 
int Cudd_ReadInvPerm (DdManager *dd, int i)
 
int Cudd_ReadInvPermZdd (DdManager *dd, int i)
 
DdNodeCudd_ReadVars (DdManager *dd, int i)
 
CUDD_VALUE_TYPE Cudd_ReadEpsilon (DdManager *dd)
 
void Cudd_SetEpsilon (DdManager *dd, CUDD_VALUE_TYPE ep)
 
Cudd_AggregationType Cudd_ReadGroupcheck (DdManager *dd)
 
void Cudd_SetGroupcheck (DdManager *dd, Cudd_AggregationType gc)
 
int Cudd_GarbageCollectionEnabled (DdManager *dd)
 
void Cudd_EnableGarbageCollection (DdManager *dd)
 
void Cudd_DisableGarbageCollection (DdManager *dd)
 
int Cudd_DeadAreCounted (DdManager *dd)
 
void Cudd_TurnOnCountDead (DdManager *dd)
 
void Cudd_TurnOffCountDead (DdManager *dd)
 
int Cudd_ReadRecomb (DdManager *dd)
 
void Cudd_SetRecomb (DdManager *dd, int recomb)
 
int Cudd_ReadSymmviolation (DdManager *dd)
 
void Cudd_SetSymmviolation (DdManager *dd, int symmviolation)
 
int Cudd_ReadArcviolation (DdManager *dd)
 
void Cudd_SetArcviolation (DdManager *dd, int arcviolation)
 
int Cudd_ReadPopulationSize (DdManager *dd)
 
void Cudd_SetPopulationSize (DdManager *dd, int populationSize)
 
int Cudd_ReadNumberXovers (DdManager *dd)
 
void Cudd_SetNumberXovers (DdManager *dd, int numberXovers)
 
unsigned int Cudd_ReadOrderRandomization (DdManager *dd)
 
void Cudd_SetOrderRandomization (DdManager *dd, unsigned int factor)
 
unsigned long Cudd_ReadMemoryInUse (DdManager *dd)
 
int Cudd_PrintInfo (DdManager *dd, FILE *fp)
 
long Cudd_ReadPeakNodeCount (DdManager *dd)
 
int Cudd_ReadPeakLiveNodeCount (DdManager *dd)
 
long Cudd_ReadNodeCount (DdManager *dd)
 
long Cudd_zddReadNodeCount (DdManager *dd)
 
int Cudd_AddHook (DdManager *dd, DD_HFP f, Cudd_HookType where)
 
int Cudd_RemoveHook (DdManager *dd, DD_HFP f, Cudd_HookType where)
 
int Cudd_IsInHook (DdManager *dd, DD_HFP f, Cudd_HookType where)
 
int Cudd_StdPreReordHook (DdManager *dd, const char *str, void *data)
 
int Cudd_StdPostReordHook (DdManager *dd, const char *str, void *data)
 
int Cudd_EnableReorderingReporting (DdManager *dd)
 
int Cudd_DisableReorderingReporting (DdManager *dd)
 
int Cudd_ReorderingReporting (DdManager *dd)
 
int Cudd_PrintGroupedOrder (DdManager *dd, const char *str, void *data)
 
int Cudd_EnableOrderingMonitoring (DdManager *dd)
 
int Cudd_DisableOrderingMonitoring (DdManager *dd)
 
int Cudd_OrderingMonitoring (DdManager *dd)
 
Cudd_ErrorType Cudd_ReadErrorCode (DdManager *dd)
 
void Cudd_ClearErrorCode (DdManager *dd)
 
FILE * Cudd_ReadStdout (DdManager *dd)
 
void Cudd_SetStdout (DdManager *dd, FILE *fp)
 
FILE * Cudd_ReadStderr (DdManager *dd)
 
void Cudd_SetStderr (DdManager *dd, FILE *fp)
 
unsigned int Cudd_ReadNextReordering (DdManager *dd)
 
void Cudd_SetNextReordering (DdManager *dd, unsigned int next)
 
double Cudd_ReadSwapSteps (DdManager *dd)
 
unsigned int Cudd_ReadMaxLive (DdManager *dd)
 
void Cudd_SetMaxLive (DdManager *dd, unsigned int maxLive)
 
unsigned long Cudd_ReadMaxMemory (DdManager *dd)
 
void Cudd_SetMaxMemory (DdManager *dd, unsigned long maxMemory)
 
int Cudd_bddBindVar (DdManager *dd, int index)
 
int Cudd_bddUnbindVar (DdManager *dd, int index)
 
int Cudd_bddVarIsBound (DdManager *dd, int index)
 
DdNodeCudd_addExistAbstract (DdManager *manager, DdNode *f, DdNode *cube)
 
DdNodeCudd_addUnivAbstract (DdManager *manager, DdNode *f, DdNode *cube)
 
DdNodeCudd_addOrAbstract (DdManager *manager, DdNode *f, DdNode *cube)
 
DdNodeCudd_addApply (DdManager *dd, DdNode *(*)(DdManager *, DdNode **, DdNode **), DdNode *f, DdNode *g)
 
DdNodeCudd_addPlus (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addTimes (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addThreshold (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addSetNZ (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addDivide (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addMinus (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addMinimum (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addMaximum (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addOneZeroMaximum (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addDiff (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addAgreement (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addOr (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addNand (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addNor (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addXor (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addXnor (DdManager *dd, DdNode **f, DdNode **g)
 
DdNodeCudd_addMonadicApply (DdManager *dd, DdNode *(*op)(DdManager *, DdNode *), DdNode *f)
 
DdNodeCudd_addLog (DdManager *dd, DdNode *f)
 
DdNodeCudd_addFindMax (DdManager *dd, DdNode *f)
 
DdNodeCudd_addFindMin (DdManager *dd, DdNode *f)
 
DdNodeCudd_addIthBit (DdManager *dd, DdNode *f, int bit)
 
DdNodeCudd_addScalarInverse (DdManager *dd, DdNode *f, DdNode *epsilon)
 
DdNodeCudd_addIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
 
DdNodeCudd_addIteConstant (DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
 
DdNodeCudd_addEvalConst (DdManager *dd, DdNode *f, DdNode *g)
 
int Cudd_addLeq (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_addCmpl (DdManager *dd, DdNode *f)
 
DdNodeCudd_addNegate (DdManager *dd, DdNode *f)
 
DdNodeCudd_addRoundOff (DdManager *dd, DdNode *f, int N)
 
DdNodeCudd_addWalsh (DdManager *dd, DdNode **x, DdNode **y, int n)
 
DdNodeCudd_addResidue (DdManager *dd, int n, int m, int options, int top)
 
DdNodeCudd_bddAndAbstract (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
 
DdNodeCudd_bddAndAbstractLimit (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube, unsigned int limit)
 
int Cudd_ApaNumberOfDigits (int binaryDigits)
 
DdApaNumber Cudd_NewApaNumber (int digits)
 
void Cudd_ApaCopy (int digits, DdApaNumber source, DdApaNumber dest)
 
DdApaDigit Cudd_ApaAdd (int digits, DdApaNumber a, DdApaNumber b, DdApaNumber sum)
 
DdApaDigit Cudd_ApaSubtract (int digits, DdApaNumber a, DdApaNumber b, DdApaNumber diff)
 
DdApaDigit Cudd_ApaShortDivision (int digits, DdApaNumber dividend, DdApaDigit divisor, DdApaNumber quotient)
 
unsigned int Cudd_ApaIntDivision (int digits, DdApaNumber dividend, unsigned int divisor, DdApaNumber quotient)
 
void Cudd_ApaShiftRight (int digits, DdApaDigit in, DdApaNumber a, DdApaNumber b)
 
void Cudd_ApaSetToLiteral (int digits, DdApaNumber number, DdApaDigit literal)
 
void Cudd_ApaPowerOfTwo (int digits, DdApaNumber number, int power)
 
int Cudd_ApaCompare (int digitsFirst, DdApaNumber first, int digitsSecond, DdApaNumber second)
 
int Cudd_ApaCompareRatios (int digitsFirst, DdApaNumber firstNum, unsigned int firstDen, int digitsSecond, DdApaNumber secondNum, unsigned int secondDen)
 
int Cudd_ApaPrintHex (FILE *fp, int digits, DdApaNumber number)
 
int Cudd_ApaPrintDecimal (FILE *fp, int digits, DdApaNumber number)
 
int Cudd_ApaPrintExponential (FILE *fp, int digits, DdApaNumber number, int precision)
 
DdApaNumber Cudd_ApaCountMinterm (DdManager *manager, DdNode *node, int nvars, int *digits)
 
int Cudd_ApaPrintMinterm (FILE *fp, DdManager *dd, DdNode *node, int nvars)
 
int Cudd_ApaPrintMintermExp (FILE *fp, DdManager *dd, DdNode *node, int nvars, int precision)
 
int Cudd_ApaPrintDensity (FILE *fp, DdManager *dd, DdNode *node, int nvars)
 
DdNodeCudd_UnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, int safe, double quality)
 
DdNodeCudd_OverApprox (DdManager *dd, DdNode *f, int numVars, int threshold, int safe, double quality)
 
DdNodeCudd_RemapUnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, double quality)
 
DdNodeCudd_RemapOverApprox (DdManager *dd, DdNode *f, int numVars, int threshold, double quality)
 
DdNodeCudd_BiasedUnderApprox (DdManager *dd, DdNode *f, DdNode *b, int numVars, int threshold, double quality1, double quality0)
 
DdNodeCudd_BiasedOverApprox (DdManager *dd, DdNode *f, DdNode *b, int numVars, int threshold, double quality1, double quality0)
 
DdNodeCudd_bddExistAbstract (DdManager *manager, DdNode *f, DdNode *cube)
 
DdNodeCudd_bddExistAbstractLimit (DdManager *manager, DdNode *f, DdNode *cube, unsigned int limit)
 
DdNodeCudd_bddXorExistAbstract (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
 
DdNodeCudd_bddUnivAbstract (DdManager *manager, DdNode *f, DdNode *cube)
 
DdNodeCudd_bddBooleanDiff (DdManager *manager, DdNode *f, int x)
 
int Cudd_bddVarIsDependent (DdManager *dd, DdNode *f, DdNode *var)
 
double Cudd_bddCorrelation (DdManager *manager, DdNode *f, DdNode *g)
 
double Cudd_bddCorrelationWeights (DdManager *manager, DdNode *f, DdNode *g, double *prob)
 
DdNodeCudd_bddIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
 
DdNodeCudd_bddIteLimit (DdManager *dd, DdNode *f, DdNode *g, DdNode *h, unsigned int limit)
 
DdNodeCudd_bddIteConstant (DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
 
DdNodeCudd_bddIntersect (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddAnd (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddAndLimit (DdManager *dd, DdNode *f, DdNode *g, unsigned int limit)
 
DdNodeCudd_bddOr (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddOrLimit (DdManager *dd, DdNode *f, DdNode *g, unsigned int limit)
 
DdNodeCudd_bddNand (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddNor (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddXor (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddXnor (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_bddXnorLimit (DdManager *dd, DdNode *f, DdNode *g, unsigned int limit)
 
int Cudd_bddLeq (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_addBddThreshold (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE value)
 
DdNodeCudd_addBddStrictThreshold (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE value)
 
DdNodeCudd_addBddInterval (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE lower, CUDD_VALUE_TYPE upper)
 
DdNodeCudd_addBddIthBit (DdManager *dd, DdNode *f, int bit)
 
DdNodeCudd_BddToAdd (DdManager *dd, DdNode *B)
 
DdNodeCudd_addBddPattern (DdManager *dd, DdNode *f)
 
DdNodeCudd_bddTransfer (DdManager *ddSource, DdManager *ddDestination, DdNode *f)
 
int Cudd_DebugCheck (DdManager *table)
 
int Cudd_CheckKeys (DdManager *table)
 
DdNodeCudd_bddClippingAnd (DdManager *dd, DdNode *f, DdNode *g, int maxDepth, int direction)
 
DdNodeCudd_bddClippingAndAbstract (DdManager *dd, DdNode *f, DdNode *g, DdNode *cube, int maxDepth, int direction)
 
DdNodeCudd_Cofactor (DdManager *dd, DdNode *f, DdNode *g)
 
int Cudd_CheckCube (DdManager *dd, DdNode *g)
 
DdNodeCudd_bddCompose (DdManager *dd, DdNode *f, DdNode *g, int v)
 
DdNodeCudd_addCompose (DdManager *dd, DdNode *f, DdNode *g, int v)
 
DdNodeCudd_addPermute (DdManager *manager, DdNode *node, int *permut)
 
DdNodeCudd_addSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n)
 
DdNodeCudd_bddPermute (DdManager *manager, DdNode *node, int *permut)
 
DdNodeCudd_bddVarMap (DdManager *manager, DdNode *f)
 
int Cudd_SetVarMap (DdManager *manager, DdNode **x, DdNode **y, int n)
 
DdNodeCudd_bddSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n)
 
DdNodeCudd_bddAdjPermuteX (DdManager *dd, DdNode *B, DdNode **x, int n)
 
DdNodeCudd_addVectorCompose (DdManager *dd, DdNode *f, DdNode **vector)
 
DdNodeCudd_addGeneralVectorCompose (DdManager *dd, DdNode *f, DdNode **vectorOn, DdNode **vectorOff)
 
DdNodeCudd_addNonSimCompose (DdManager *dd, DdNode *f, DdNode **vector)
 
DdNodeCudd_bddVectorCompose (DdManager *dd, DdNode *f, DdNode **vector)
 
int Cudd_bddApproxConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts)
 
int Cudd_bddApproxDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts)
 
int Cudd_bddIterConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts)
 
int Cudd_bddIterDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts)
 
int Cudd_bddGenConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts)
 
int Cudd_bddGenDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts)
 
int Cudd_bddVarConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts)
 
int Cudd_bddVarDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts)
 
DdNodeCudd_FindEssential (DdManager *dd, DdNode *f)
 
int Cudd_bddIsVarEssential (DdManager *manager, DdNode *f, int id, int phase)
 
DdTlcInfoCudd_FindTwoLiteralClauses (DdManager *dd, DdNode *f)
 
int Cudd_PrintTwoLiteralClauses (DdManager *dd, DdNode *f, char **names, FILE *fp)
 
int Cudd_ReadIthClause (DdTlcInfo *tlc, int i, DdHalfWord *var1, DdHalfWord *var2, int *phase1, int *phase2)
 
void Cudd_tlcInfoFree (DdTlcInfo *t)
 
int Cudd_DumpBlif (DdManager *dd, int n, DdNode **f, char **inames, char **onames, char *mname, FILE *fp, int mv)
 
int Cudd_DumpBlifBody (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp, int mv)
 
int Cudd_DumpDot (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp)
 
int Cudd_DumpDaVinci (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp)
 
int Cudd_DumpDDcal (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp)
 
int Cudd_DumpFactoredForm (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp)
 
DdNodeCudd_bddConstrain (DdManager *dd, DdNode *f, DdNode *c)
 
DdNodeCudd_bddRestrict (DdManager *dd, DdNode *f, DdNode *c)
 
DdNodeCudd_bddNPAnd (DdManager *dd, DdNode *f, DdNode *c)
 
DdNodeCudd_addConstrain (DdManager *dd, DdNode *f, DdNode *c)
 
DdNode ** Cudd_bddConstrainDecomp (DdManager *dd, DdNode *f)
 
DdNodeCudd_addRestrict (DdManager *dd, DdNode *f, DdNode *c)
 
DdNode ** Cudd_bddCharToVect (DdManager *dd, DdNode *f)
 
DdNodeCudd_bddLICompaction (DdManager *dd, DdNode *f, DdNode *c)
 
DdNodeCudd_bddSqueeze (DdManager *dd, DdNode *l, DdNode *u)
 
DdNodeCudd_bddMinimize (DdManager *dd, DdNode *f, DdNode *c)
 
DdNodeCudd_SubsetCompress (DdManager *dd, DdNode *f, int nvars, int threshold)
 
DdNodeCudd_SupersetCompress (DdManager *dd, DdNode *f, int nvars, int threshold)
 
MtrNodeCudd_MakeTreeNode (DdManager *dd, unsigned int low, unsigned int size, unsigned int type)
 
int Cudd_addHarwell (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, DdNode ***xn, DdNode ***yn_, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy, int pr)
 
DdManagerCudd_Init (unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
 
void Cudd_Quit (DdManager *unique)
 
int Cudd_PrintLinear (DdManager *table)
 
int Cudd_ReadLinear (DdManager *table, int x, int y)
 
DdNodeCudd_bddLiteralSetIntersection (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_addMatrixMultiply (DdManager *dd, DdNode *A, DdNode *B, DdNode **z, int nz)
 
DdNodeCudd_addTimesPlus (DdManager *dd, DdNode *A, DdNode *B, DdNode **z, int nz)
 
DdNodeCudd_addTriangle (DdManager *dd, DdNode *f, DdNode *g, DdNode **z, int nz)
 
DdNodeCudd_addOuterSum (DdManager *dd, DdNode *M, DdNode *r, DdNode *c)
 
DdNodeCudd_PrioritySelect (DdManager *dd, DdNode *R, DdNode **x, DdNode **y, DdNode **z, DdNode *Pi, int n, DdNode *(*)(DdManager *, int, DdNode **, DdNode **, DdNode **))
 
DdNodeCudd_Xgty (DdManager *dd, int N, DdNode **z, DdNode **x, DdNode **y)
 
DdNodeCudd_Xeqy (DdManager *dd, int N, DdNode **x, DdNode **y)
 
DdNodeCudd_addXeqy (DdManager *dd, int N, DdNode **x, DdNode **y)
 
DdNodeCudd_Dxygtdxz (DdManager *dd, int N, DdNode **x, DdNode **y, DdNode **z)
 
DdNodeCudd_Dxygtdyz (DdManager *dd, int N, DdNode **x, DdNode **y, DdNode **z)
 
DdNodeCudd_Inequality (DdManager *dd, int N, int c, DdNode **x, DdNode **y)
 
DdNodeCudd_Disequality (DdManager *dd, int N, int c, DdNode **x, DdNode **y)
 
DdNodeCudd_bddInterval (DdManager *dd, int N, DdNode **x, unsigned int lowerB, unsigned int upperB)
 
DdNodeCudd_CProjection (DdManager *dd, DdNode *R, DdNode *Y)
 
DdNodeCudd_addHamming (DdManager *dd, DdNode **xVars, DdNode **yVars, int nVars)
 
int Cudd_MinHammingDist (DdManager *dd, DdNode *f, int *minterm, int upperBound)
 
DdNodeCudd_bddClosestCube (DdManager *dd, DdNode *f, DdNode *g, int *distance)
 
int Cudd_addRead (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, DdNode ***xn, DdNode ***yn_, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy)
 
int Cudd_bddRead (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy)
 
void Cudd_Ref (DdNode *n)
 
void Cudd_RecursiveDeref (DdManager *table, DdNode *n)
 
void Cudd_IterDerefBdd (DdManager *table, DdNode *n)
 
void Cudd_DelayedDerefBdd (DdManager *table, DdNode *n)
 
void Cudd_RecursiveDerefZdd (DdManager *table, DdNode *n)
 
void Cudd_Deref (DdNode *node)
 
int Cudd_CheckZeroRef (DdManager *manager)
 
int Cudd_ReduceHeap (DdManager *table, Cudd_ReorderingType heuristic, int minsize)
 
int Cudd_ShuffleHeap (DdManager *table, int *permutation)
 
DdNodeCudd_Eval (DdManager *dd, DdNode *f, int *inputs)
 
DdNodeCudd_ShortestPath (DdManager *manager, DdNode *f, int *weight, int *support, int *length)
 
DdNodeCudd_LargestCube (DdManager *manager, DdNode *f, int *length)
 
int Cudd_ShortestLength (DdManager *manager, DdNode *f, int *weight)
 
DdNodeCudd_Decreasing (DdManager *dd, DdNode *f, int i)
 
DdNodeCudd_Increasing (DdManager *dd, DdNode *f, int i)
 
int Cudd_EquivDC (DdManager *dd, DdNode *F, DdNode *G, DdNode *D)
 
int Cudd_bddLeqUnless (DdManager *dd, DdNode *f, DdNode *g, DdNode *D)
 
int Cudd_EqualSupNorm (DdManager *dd, DdNode *f, DdNode *g, CUDD_VALUE_TYPE tolerance, int pr)
 
DdNodeCudd_bddMakePrime (DdManager *dd, DdNode *cube, DdNode *f)
 
DdNodeCudd_bddMaximallyExpand (DdManager *dd, DdNode *lb, DdNode *ub, DdNode *f)
 
DdNodeCudd_bddLargestPrimeUnate (DdManager *dd, DdNode *f, DdNode *phaseBdd)
 
double * Cudd_CofMinterm (DdManager *dd, DdNode *node)
 
DdNodeCudd_SolveEqn (DdManager *bdd, DdNode *F, DdNode *Y, DdNode **G, int **yIndex, int n)
 
DdNodeCudd_VerifySol (DdManager *bdd, DdNode *F, DdNode **G, int *yIndex, int n)
 
DdNodeCudd_SplitSet (DdManager *manager, DdNode *S, DdNode **xVars, int n, double m)
 
DdNodeCudd_SubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold)
 
DdNodeCudd_SupersetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold)
 
DdNodeCudd_SubsetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit)
 
DdNodeCudd_SupersetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit)
 
void Cudd_SymmProfile (DdManager *table, int lower, int upper)
 
unsigned int Cudd_Prime (unsigned int p)
 
int Cudd_Reserve (DdManager *manager, int amount)
 
int Cudd_PrintMinterm (DdManager *manager, DdNode *node)
 
int Cudd_bddPrintCover (DdManager *dd, DdNode *l, DdNode *u)
 
int Cudd_PrintDebug (DdManager *dd, DdNode *f, int n, int pr)
 
int Cudd_DagSize (DdNode *node)
 
int Cudd_EstimateCofactor (DdManager *dd, DdNode *node, int i, int phase)
 
int Cudd_EstimateCofactorSimple (DdNode *node, int i)
 
int Cudd_SharingSize (DdNode **nodeArray, int n)
 
double Cudd_CountMinterm (DdManager *manager, DdNode *node, int nvars)
 
int Cudd_EpdCountMinterm (DdManager *manager, DdNode *node, int nvars, EpDouble *epd)
 
double Cudd_CountPath (DdNode *node)
 
double Cudd_CountPathsToNonZero (DdNode *node)
 
int Cudd_SupportIndices (DdManager *dd, DdNode *f, int **indices)
 
DdNodeCudd_Support (DdManager *dd, DdNode *f)
 
int * Cudd_SupportIndex (DdManager *dd, DdNode *f)
 
int Cudd_SupportSize (DdManager *dd, DdNode *f)
 
int Cudd_VectorSupportIndices (DdManager *dd, DdNode **F, int n, int **indices)
 
DdNodeCudd_VectorSupport (DdManager *dd, DdNode **F, int n)
 
int * Cudd_VectorSupportIndex (DdManager *dd, DdNode **F, int n)
 
int Cudd_VectorSupportSize (DdManager *dd, DdNode **F, int n)
 
int Cudd_ClassifySupport (DdManager *dd, DdNode *f, DdNode *g, DdNode **common, DdNode **onlyF, DdNode **onlyG)
 
int Cudd_CountLeaves (DdNode *node)
 
int Cudd_bddPickOneCube (DdManager *ddm, DdNode *node, char *string)
 
DdNodeCudd_bddPickOneMinterm (DdManager *dd, DdNode *f, DdNode **vars, int n)
 
DdNode ** Cudd_bddPickArbitraryMinterms (DdManager *dd, DdNode *f, DdNode **vars, int n, int k)
 
DdNodeCudd_SubsetWithMaskVars (DdManager *dd, DdNode *f, DdNode **vars, int nvars, DdNode **maskVars, int mvars)
 
DdGenCudd_FirstCube (DdManager *dd, DdNode *f, int **cube, CUDD_VALUE_TYPE *value)
 
int Cudd_NextCube (DdGen *gen, int **cube, CUDD_VALUE_TYPE *value)
 
DdGenCudd_FirstPrime (DdManager *dd, DdNode *l, DdNode *u, int **cube)
 
int Cudd_NextPrime (DdGen *gen, int **cube)
 
DdNodeCudd_bddComputeCube (DdManager *dd, DdNode **vars, int *phase, int n)
 
DdNodeCudd_addComputeCube (DdManager *dd, DdNode **vars, int *phase, int n)
 
DdNodeCudd_CubeArrayToBdd (DdManager *dd, int *array)
 
int Cudd_BddToCubeArray (DdManager *dd, DdNode *cube, int *array)
 
DdGenCudd_FirstNode (DdManager *dd, DdNode *f, DdNode **node)
 
int Cudd_NextNode (DdGen *gen, DdNode **node)
 
int Cudd_GenFree (DdGen *gen)
 
int Cudd_IsGenEmpty (DdGen *gen)
 
DdNodeCudd_IndicesToCube (DdManager *dd, int *array, int n)
 
void Cudd_PrintVersion (FILE *fp)
 
double Cudd_AverageDistance (DdManager *dd)
 
long Cudd_Random (void)
 
void Cudd_Srandom (long seed)
 
double Cudd_Density (DdManager *dd, DdNode *f, int nvars)
 
void Cudd_OutOfMem (long size)
 
int Cudd_zddCount (DdManager *zdd, DdNode *P)
 
double Cudd_zddCountDouble (DdManager *zdd, DdNode *P)
 
DdNodeCudd_zddProduct (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddUnateProduct (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddWeakDiv (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddDivide (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddWeakDivF (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddDivideF (DdManager *dd, DdNode *f, DdNode *g)
 
DdNodeCudd_zddComplement (DdManager *dd, DdNode *node)
 
MtrNodeCudd_MakeZddTreeNode (DdManager *dd, unsigned int low, unsigned int size, unsigned int type)
 
DdNodeCudd_zddIsop (DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I)
 
DdNodeCudd_bddIsop (DdManager *dd, DdNode *L, DdNode *U)
 
DdNodeCudd_MakeBddFromZddCover (DdManager *dd, DdNode *node)
 
int Cudd_zddDagSize (DdNode *p_node)
 
double Cudd_zddCountMinterm (DdManager *zdd, DdNode *node, int path)
 
void Cudd_zddPrintSubtable (DdManager *table)
 
DdNodeCudd_zddPortFromBdd (DdManager *dd, DdNode *B)
 
DdNodeCudd_zddPortToBdd (DdManager *dd, DdNode *f)
 
int Cudd_zddReduceHeap (DdManager *table, Cudd_ReorderingType heuristic, int minsize)
 
int Cudd_zddShuffleHeap (DdManager *table, int *permutation)
 
DdNodeCudd_zddIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
 
DdNodeCudd_zddUnion (DdManager *dd, DdNode *P, DdNode *Q)
 
DdNodeCudd_zddIntersect (DdManager *dd, DdNode *P, DdNode *Q)
 
DdNodeCudd_zddDiff (DdManager *dd, DdNode *P, DdNode *Q)
 
DdNodeCudd_zddDiffConst (DdManager *zdd, DdNode *P, DdNode *Q)
 
DdNodeCudd_zddSubset1 (DdManager *dd, DdNode *P, int var)
 
DdNodeCudd_zddSubset0 (DdManager *dd, DdNode *P, int var)
 
DdNodeCudd_zddChange (DdManager *dd, DdNode *P, int var)
 
void Cudd_zddSymmProfile (DdManager *table, int lower, int upper)
 
int Cudd_zddPrintMinterm (DdManager *zdd, DdNode *node)
 
int Cudd_zddPrintCover (DdManager *zdd, DdNode *node)
 
int Cudd_zddPrintDebug (DdManager *zdd, DdNode *f, int n, int pr)
 
DdGenCudd_zddFirstPath (DdManager *zdd, DdNode *f, int **path)
 
int Cudd_zddNextPath (DdGen *gen, int **path)
 
char * Cudd_zddCoverPathToString (DdManager *zdd, int *path, char *str)
 
DdNodeCudd_zddSupport (DdManager *dd, DdNode *f)
 
int Cudd_zddDumpDot (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp)
 
int Cudd_bddSetPiVar (DdManager *dd, int index)
 
int Cudd_bddSetPsVar (DdManager *dd, int index)
 
int Cudd_bddSetNsVar (DdManager *dd, int index)
 
int Cudd_bddIsPiVar (DdManager *dd, int index)
 
int Cudd_bddIsPsVar (DdManager *dd, int index)
 
int Cudd_bddIsNsVar (DdManager *dd, int index)
 
int Cudd_bddSetPairIndex (DdManager *dd, int index, int pairIndex)
 
int Cudd_bddReadPairIndex (DdManager *dd, int index)
 
int Cudd_bddSetVarToBeGrouped (DdManager *dd, int index)
 
int Cudd_bddSetVarHardGroup (DdManager *dd, int index)
 
int Cudd_bddResetVarToBeGrouped (DdManager *dd, int index)
 
int Cudd_bddIsVarToBeGrouped (DdManager *dd, int index)
 
int Cudd_bddSetVarToBeUngrouped (DdManager *dd, int index)
 
int Cudd_bddIsVarToBeUngrouped (DdManager *dd, int index)
 
int Cudd_bddIsVarHardGroup (DdManager *dd, int index)
 

Macro Definition Documentation

◆ CUDD_CACHE_SLOTS

#define CUDD_CACHE_SLOTS   262144 /* default size of the cache */

Definition at line 94 of file cudd.h.

◆ Cudd_Complement

#define Cudd_Complement (   node)    ((DdNode *)((unsigned long)(node) | 01))

Macro***********************************************************************

Synopsis [Returns the complemented version of a pointer.]

Description []

SideEffects [none]

SeeAlso [Cudd_Regular Cudd_IsComplement]

Definition at line 398 of file cudd.h.

◆ CUDD_CONST_INDEX

#define CUDD_CONST_INDEX   CUDD_MAXINDEX

Definition at line 113 of file cudd.h.

◆ Cudd_E

#define Cudd_E (   node)    ((Cudd_Regular(node))->type.kids.E)

Macro***********************************************************************

Synopsis [Returns the else child of an internal node.]

Description [Returns the else child of an internal node. If node is a constant node, the result is unpredictable.]

SideEffects [none]

SeeAlso [Cudd_T Cudd_V]

Definition at line 442 of file cudd.h.

◆ CUDD_FALSE

#define CUDD_FALSE   0

Definition at line 88 of file cudd.h.

◆ Cudd_ForeachCube

#define Cudd_ForeachCube (   manager,
  f,
  gen,
  cube,
  value 
)
Value:
for((gen) = Cudd_FirstCube(manager, f, &cube, &value);\
Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : CUDD_TRUE;\
(void) Cudd_NextCube(gen, &cube, &value))
#define CUDD_TRUE
Definition: cudd.h:87
int Cudd_NextCube(DdGen *gen, int **cube, CUDD_VALUE_TYPE *value)
Definition: cuddUtil.c:1925
int Cudd_GenFree(DdGen *gen)
Definition: cuddUtil.c:2499
DdGen * Cudd_FirstCube(DdManager *dd, DdNode *f, int **cube, CUDD_VALUE_TYPE *value)
Definition: cuddUtil.c:1806

Macro***********************************************************************

Synopsis [Iterates over the cubes of a decision diagram.]

Description [Iterates over the cubes of a decision diagram f.

Cudd_ForeachCube allocates and frees the generator. Therefore the application should not try to do that. Also, the cube is freed at the end of Cudd_ForeachCube and hence is not available outside of the loop.

CAUTION: It is assumed that dynamic reordering will not occur while there are open generators. It is the user's responsibility to make sure that dynamic reordering does not occur. As long as new nodes are not created during generation, and dynamic reordering is not called explicitly, dynamic reordering will not occur. Alternatively, it is sufficient to disable dynamic reordering. It is a mistake to dispose of a diagram on which generation is ongoing.]

SideEffects [none]

SeeAlso [Cudd_ForeachNode Cudd_FirstCube Cudd_NextCube Cudd_GenFree Cudd_IsGenEmpty Cudd_AutodynDisable]

Definition at line 506 of file cudd.h.

◆ Cudd_ForeachNode

#define Cudd_ForeachNode (   manager,
  f,
  gen,
  node 
)
Value:
for((gen) = Cudd_FirstNode(manager, f, &node);\
Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : CUDD_TRUE;\
(void) Cudd_NextNode(gen, &node))
DdGen * Cudd_FirstNode(DdManager *dd, DdNode *f, DdNode **node)
Definition: cuddUtil.c:2408
int Cudd_NextNode(DdGen *gen, DdNode **node)
Definition: cuddUtil.c:2467
#define CUDD_TRUE
Definition: cudd.h:87
int Cudd_GenFree(DdGen *gen)
Definition: cuddUtil.c:2499

Macro***********************************************************************

Synopsis [Iterates over the nodes of a decision diagram.]

Description [Iterates over the nodes of a decision diagram f.

The nodes are returned in a seemingly random order. Cudd_ForeachNode allocates and frees the generator. Therefore the application should not try to do that.

CAUTION: It is assumed that dynamic reordering will not occur while there are open generators. It is the user's responsibility to make sure that dynamic reordering does not occur. As long as new nodes are not created during generation, and dynamic reordering is not called explicitly, dynamic reordering will not occur. Alternatively, it is sufficient to disable dynamic reordering. It is a mistake to dispose of a diagram on which generation is ongoing.]

SideEffects [none]

SeeAlso [Cudd_ForeachCube Cudd_FirstNode Cudd_NextNode Cudd_GenFree Cudd_IsGenEmpty Cudd_AutodynDisable]

Definition at line 572 of file cudd.h.

◆ Cudd_ForeachPrime

#define Cudd_ForeachPrime (   manager,
  l,
  u,
  gen,
  cube 
)
Value:
for((gen) = Cudd_FirstPrime(manager, l, u, &cube);\
Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : CUDD_TRUE;\
(void) Cudd_NextPrime(gen, &cube))
int Cudd_NextPrime(DdGen *gen, int **cube)
Definition: cuddUtil.c:2138
#define CUDD_TRUE
Definition: cudd.h:87
DdGen * Cudd_FirstPrime(DdManager *dd, DdNode *l, DdNode *u, int **cube)
Definition: cuddUtil.c:2036
int Cudd_GenFree(DdGen *gen)
Definition: cuddUtil.c:2499

Macro***********************************************************************

Synopsis [Iterates over the primes of a Boolean function.]

Description [Iterates over the primes of a Boolean function producing a prime and irredundant cover.

The Boolean function is described by an upper bound and a lower bound. If the function is completely specified, the two bounds coincide. Cudd_ForeachPrime allocates and frees the generator. Therefore the application should not try to do that. Also, the cube is freed at the end of Cudd_ForeachPrime and hence is not available outside of the loop.

CAUTION: It is a mistake to change a diagram on which generation is ongoing.]

SideEffects [none]

SeeAlso [Cudd_ForeachCube Cudd_FirstPrime Cudd_NextPrime Cudd_GenFree Cudd_IsGenEmpty]

Definition at line 538 of file cudd.h.

◆ Cudd_IsComplement

#define Cudd_IsComplement (   node)    ((int) ((long) (node) & 01))

Macro***********************************************************************

Synopsis [Returns 1 if a pointer is complemented.]

Description []

SideEffects [none]

SeeAlso [Cudd_Regular Cudd_Complement]

Definition at line 412 of file cudd.h.

◆ Cudd_IsConstant

#define Cudd_IsConstant (   node)    ((Cudd_Regular(node))->index == CUDD_CONST_INDEX)

Macro***********************************************************************

Synopsis [Returns 1 if the node is a constant node.]

Description [Returns 1 if the node is a constant node (rather than an internal node). All constant nodes have the same index (CUDD_CONST_INDEX). The pointer passed to Cudd_IsConstant may be either regular or complemented.]

SideEffects [none]

SeeAlso []

Definition at line 339 of file cudd.h.

◆ CUDD_MAXINDEX

#define CUDD_MAXINDEX   ((DdHalfWord) ~0)

Definition at line 108 of file cudd.h.

◆ Cudd_Not

#define Cudd_Not (   node)    ((DdNode *)((long)(node) ^ 01))

Macro***********************************************************************

Synopsis [Complements a DD.]

Description [Complements a DD by flipping the complement attribute of the pointer (the least significant bit).]

SideEffects [none]

SeeAlso [Cudd_NotCond]

Definition at line 354 of file cudd.h.

◆ Cudd_NotCond

#define Cudd_NotCond (   node,
 
)    ((DdNode *)((long)(node) ^ (c)))

Macro***********************************************************************

Synopsis [Complements a DD if a condition is true.]

Description [Complements a DD if condition c is true; c should be either 0 or 1, because it is used directly (for efficiency). If in doubt on the values c may take, use "(c) ? Cudd_Not(node) : node".]

SideEffects [none]

SeeAlso [Cudd_Not]

Definition at line 370 of file cudd.h.

◆ CUDD_OUT_OF_MEM

#define CUDD_OUT_OF_MEM   -1

Definition at line 91 of file cudd.h.

◆ Cudd_ReadIndex

#define Cudd_ReadIndex (   dd,
  index 
)    (Cudd_ReadPerm(dd,index))

Macro***********************************************************************

Synopsis [Returns the current position in the order of variable index.]

Description [Returns the current position in the order of variable index. This macro is obsolete and is kept for compatibility. New applications should use Cudd_ReadPerm instead.]

SideEffects [none]

SeeAlso [Cudd_ReadPerm]

Definition at line 474 of file cudd.h.

◆ Cudd_Regular

#define Cudd_Regular (   node)    ((DdNode *)((unsigned long)(node) & ~01))

Macro***********************************************************************

Synopsis [Returns the regular version of a pointer.]

Description []

SideEffects [none]

SeeAlso [Cudd_Complement Cudd_IsComplement]

Definition at line 384 of file cudd.h.

◆ CUDD_RESIDUE_DEFAULT

#define CUDD_RESIDUE_DEFAULT   0

Definition at line 97 of file cudd.h.

◆ CUDD_RESIDUE_MSB

#define CUDD_RESIDUE_MSB   1

Definition at line 98 of file cudd.h.

◆ CUDD_RESIDUE_TC

#define CUDD_RESIDUE_TC   2

Definition at line 99 of file cudd.h.

◆ Cudd_T

#define Cudd_T (   node)    ((Cudd_Regular(node))->type.kids.T)

Macro***********************************************************************

Synopsis [Returns the then child of an internal node.]

Description [Returns the then child of an internal node. If node is a constant node, the result is unpredictable.]

SideEffects [none]

SeeAlso [Cudd_E Cudd_V]

Definition at line 427 of file cudd.h.

◆ CUDD_TRUE

#define CUDD_TRUE   1

Definition at line 87 of file cudd.h.

◆ CUDD_UNIQUE_SLOTS

#define CUDD_UNIQUE_SLOTS   256 /* initial size of subtables */

Definition at line 93 of file cudd.h.

◆ Cudd_V

#define Cudd_V (   node)    ((Cudd_Regular(node))->type.value)

Macro***********************************************************************

Synopsis [Returns the value of a constant node.]

Description [Returns the value of a constant node. If node is an internal node, the result is unpredictable.]

SideEffects [none]

SeeAlso [Cudd_T Cudd_E]

Definition at line 457 of file cudd.h.

◆ CUDD_VALUE_TYPE

#define CUDD_VALUE_TYPE   double

Definition at line 90 of file cudd.h.

◆ CUDD_VERSION

#define CUDD_VERSION   "2.5.0"

CHeaderFile*****************************************************************

FileName [cudd.h]

PackageName [cudd]

Synopsis [The University of Colorado decision diagram package.]

Description [External functions and data strucures of the CUDD package.

  • To turn on the gathering of statistics, define DD_STATS.
  • To link with mis, define DD_MIS.

Modified by Abelardo Pardo to interface it to VIS. ]

SeeAlso []

Author [Fabio Somenzi]

Copyright [Copyright (c) 1995-2012, Regents of the University of Colorado

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.]

Revision [

Id
cudd.h,v 1.180 2012/02/05 01:07:18 fabio Exp

]

Definition at line 75 of file cudd.h.

◆ Cudd_zddForeachPath

#define Cudd_zddForeachPath (   manager,
  f,
  gen,
  path 
)
Value:
for((gen) = Cudd_zddFirstPath(manager, f, &path);\
Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : CUDD_TRUE;\
(void) Cudd_zddNextPath(gen, &path))
#define CUDD_TRUE
Definition: cudd.h:87
int Cudd_zddNextPath(DdGen *gen, int **path)
DdGen * Cudd_zddFirstPath(DdManager *zdd, DdNode *f, int **path)
int Cudd_GenFree(DdGen *gen)
Definition: cuddUtil.c:2499

Macro***********************************************************************

Synopsis [Iterates over the paths of a ZDD.]

Description [Iterates over the paths of a ZDD f.

Cudd_zddForeachPath allocates and frees the generator. Therefore the application should not try to do that. Also, the path is freed at the end of Cudd_zddForeachPath and hence is not available outside of the loop.

CAUTION: It is assumed that dynamic reordering will not occur while there are open generators. It is the user's responsibility to make sure that dynamic reordering does not occur. As long as new nodes are not created during generation, and dynamic reordering is not called explicitly, dynamic reordering will not occur. Alternatively, it is sufficient to disable dynamic reordering. It is a mistake to dispose of a diagram on which generation is ongoing.]

SideEffects [none]

SeeAlso [Cudd_zddFirstPath Cudd_zddNextPath Cudd_GenFree Cudd_IsGenEmpty Cudd_AutodynDisable]

Definition at line 606 of file cudd.h.

◆ DD_APA_BASE

#define DD_APA_BASE   (1 << DD_APA_BITS)

Definition at line 126 of file cudd.h.

◆ DD_APA_BITS

#define DD_APA_BITS   16

Definition at line 125 of file cudd.h.

◆ DD_APA_HEXPRINT

#define DD_APA_HEXPRINT   "%04x"

Definition at line 127 of file cudd.h.

◆ DD_APA_MASK

#define DD_APA_MASK   (DD_APA_BASE - 1)

Definition at line 129 of file cudd.h.

◆ SIZEOF_LONG

#define SIZEOF_LONG   4

Definition at line 84 of file cudd.h.

Typedef Documentation

◆ DD_AOP

typedef DdNode*(* DD_AOP) (DdManager *, DdNode **, DdNode **)

Definition at line 304 of file cudd.h.

◆ DD_CTFP

typedef DdNode*(* DD_CTFP) (DdManager *, DdNode *, DdNode *)

Definition at line 308 of file cudd.h.

◆ DD_CTFP1

typedef DdNode*(* DD_CTFP1) (DdManager *, DdNode *)

Definition at line 309 of file cudd.h.

◆ DD_HFP

typedef int(* DD_HFP) (DdManager *, const char *, void *)

Definition at line 299 of file cudd.h.

◆ DD_MAOP

typedef DdNode*(* DD_MAOP) (DdManager *, DdNode *)

Definition at line 306 of file cudd.h.

◆ DD_OOMFP

typedef void(* DD_OOMFP) (long)

Definition at line 311 of file cudd.h.

◆ DD_PRFP

typedef DdNode*(* DD_PRFP) (DdManager *, int, DdNode **, DdNode **, DdNode **)

Definition at line 301 of file cudd.h.

◆ DD_QSFP

typedef int(* DD_QSFP) (const void *, const void *)

Definition at line 313 of file cudd.h.

◆ DdApaDigit

typedef unsigned short int DdApaDigit

Definition at line 290 of file cudd.h.

◆ DdApaDoubleDigit

typedef unsigned int DdApaDoubleDigit

Definition at line 291 of file cudd.h.

◆ DdApaNumber

Definition at line 293 of file cudd.h.

◆ DdChildren

typedef struct DdChildren DdChildren

◆ DdGen

typedef struct DdGen DdGen

Definition at line 282 of file cudd.h.

◆ DdHalfWord

typedef unsigned short DdHalfWord

Definition at line 259 of file cudd.h.

◆ DdManager

typedef struct DdManager DdManager

Definition at line 280 of file cudd.h.

◆ DdNode

typedef struct DdNode DdNode

Definition at line 262 of file cudd.h.

◆ DdTlcInfo

typedef struct DdTlcInfo DdTlcInfo

Definition at line 296 of file cudd.h.

Enumeration Type Documentation

◆ Cudd_AggregationType

Enum************************************************************************

Synopsis [Type of aggregation methods.]

Description [Type of aggregation methods.]

Enumerator
CUDD_NO_CHECK 
CUDD_GROUP_CHECK 
CUDD_GROUP_CHECK2 
CUDD_GROUP_CHECK3 
CUDD_GROUP_CHECK4 
CUDD_GROUP_CHECK5 
CUDD_GROUP_CHECK6 
CUDD_GROUP_CHECK7 
CUDD_GROUP_CHECK8 
CUDD_GROUP_CHECK9 

Definition at line 180 of file cudd.h.

◆ Cudd_ErrorType

Enum************************************************************************

Synopsis [Type of error codes.]

Description [Type of error codes.]

Enumerator
CUDD_NO_ERROR 
CUDD_MEMORY_OUT 
CUDD_TOO_MANY_NODES 
CUDD_MAX_MEM_EXCEEDED 
CUDD_TIMEOUT_EXPIRED 
CUDD_INVALID_ARG 
CUDD_INTERNAL_ERROR 

Definition at line 216 of file cudd.h.

◆ Cudd_HookType

Enum************************************************************************

Synopsis [Type of hooks.]

Description [Type of hooks.]

Enumerator
CUDD_PRE_GC_HOOK 
CUDD_POST_GC_HOOK 
CUDD_PRE_REORDERING_HOOK 
CUDD_POST_REORDERING_HOOK 

Definition at line 201 of file cudd.h.

◆ Cudd_LazyGroupType

Enum************************************************************************

Synopsis [Group type for lazy sifting.]

Description [Group type for lazy sifting.]

Enumerator
CUDD_LAZY_NONE 
CUDD_LAZY_SOFT_GROUP 
CUDD_LAZY_HARD_GROUP 
CUDD_LAZY_UNGROUP 

Definition at line 234 of file cudd.h.

◆ Cudd_ReorderingType

Enum************************************************************************

Synopsis [Type of reordering algorithm.]

Description [Type of reordering algorithm.]

Enumerator
CUDD_REORDER_SAME 
CUDD_REORDER_NONE 
CUDD_REORDER_RANDOM 
CUDD_REORDER_RANDOM_PIVOT 
CUDD_REORDER_SIFT 
CUDD_REORDER_SIFT_CONVERGE 
CUDD_REORDER_SYMM_SIFT 
CUDD_REORDER_SYMM_SIFT_CONV 
CUDD_REORDER_WINDOW2 
CUDD_REORDER_WINDOW3 
CUDD_REORDER_WINDOW4 
CUDD_REORDER_WINDOW2_CONV 
CUDD_REORDER_WINDOW3_CONV 
CUDD_REORDER_WINDOW4_CONV 
CUDD_REORDER_GROUP_SIFT 
CUDD_REORDER_GROUP_SIFT_CONV 
CUDD_REORDER_ANNEALING 
CUDD_REORDER_GENETIC 
CUDD_REORDER_LINEAR 
CUDD_REORDER_LINEAR_CONVERGE 
CUDD_REORDER_LAZY_SIFT 
CUDD_REORDER_EXACT 

Definition at line 147 of file cudd.h.

147  {
Cudd_ReorderingType
Definition: cudd.h:147

◆ Cudd_VariableType

Enum************************************************************************

Synopsis [Variable type.]

Description [Variable type. Currently used only in lazy sifting.]

Enumerator
CUDD_VAR_PRIMARY_INPUT 
CUDD_VAR_PRESENT_STATE 
CUDD_VAR_NEXT_STATE 

Definition at line 249 of file cudd.h.

Function Documentation

◆ Cudd_addAgreement()

DdNode* Cudd_addAgreement ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addApply()

DdNode* Cudd_addApply ( DdManager dd,
DdNode *)(DdManager *, DdNode **, DdNode **,
DdNode f,
DdNode g 
)

◆ Cudd_addBddInterval()

DdNode* Cudd_addBddInterval ( DdManager dd,
DdNode f,
CUDD_VALUE_TYPE  lower,
CUDD_VALUE_TYPE  upper 
)

◆ Cudd_addBddIthBit()

DdNode* Cudd_addBddIthBit ( DdManager dd,
DdNode f,
int  bit 
)

◆ Cudd_addBddPattern()

DdNode* Cudd_addBddPattern ( DdManager dd,
DdNode f 
)

◆ Cudd_addBddStrictThreshold()

DdNode* Cudd_addBddStrictThreshold ( DdManager dd,
DdNode f,
CUDD_VALUE_TYPE  value 
)

◆ Cudd_addBddThreshold()

DdNode* Cudd_addBddThreshold ( DdManager dd,
DdNode f,
CUDD_VALUE_TYPE  value 
)

◆ Cudd_addCmpl()

DdNode* Cudd_addCmpl ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Computes the complement of an ADD a la C language.]

Description [Computes the complement of an ADD a la C language: The complement of 0 is 1 and the complement of everything else is 0. Returns a pointer to the resulting ADD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_addNegate]

Definition at line 343 of file cuddAddIte.c.

346 {
347  DdNode *res;
348 
349  do {
350  dd->reordered = 0;
351  res = cuddAddCmplRecur(dd,f);
352  } while (dd->reordered == 1);
353  return(res);
354 
355 } /* end of Cudd_addCmpl */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddAddCmplRecur(DdManager *dd, DdNode *f)
Definition: cuddAddIte.c:558

◆ Cudd_addCompose()

DdNode* Cudd_addCompose ( DdManager dd,
DdNode f,
DdNode g,
int  v 
)

◆ Cudd_addComputeCube()

DdNode* Cudd_addComputeCube ( DdManager dd,
DdNode **  vars,
int *  phase,
int  n 
)

Function********************************************************************

Synopsis [Computes the cube of an array of ADD variables.]

Description [Computes the cube of an array of ADD variables. If non-null, the phase argument indicates which literal of each variable should appear in the cube. If phase[i] is nonzero, then the positive literal is used. If phase is NULL, the cube is positive unate. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [none]

SeeAlso [Cudd_bddComputeCube]

Definition at line 2254 of file cuddUtil.c.

2259 {
2260  DdNode *cube, *zero;
2261  DdNode *fn;
2262  int i;
2263 
2264  cube = DD_ONE(dd);
2265  cuddRef(cube);
2266  zero = DD_ZERO(dd);
2267 
2268  for (i = n - 1; i >= 0; i--) {
2269  if (phase == NULL || phase[i] != 0) {
2270  fn = Cudd_addIte(dd,vars[i],cube,zero);
2271  } else {
2272  fn = Cudd_addIte(dd,vars[i],zero,cube);
2273  }
2274  if (fn == NULL) {
2275  Cudd_RecursiveDeref(dd,cube);
2276  return(NULL);
2277  }
2278  cuddRef(fn);
2279  Cudd_RecursiveDeref(dd,cube);
2280  cube = fn;
2281  }
2282  cuddDeref(cube);
2283 
2284  return(cube);
2285 
2286 } /* end of Cudd_addComputeCube */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
static DdNode * zero
Definition: cuddUtil.c:149
DdNode * Cudd_addIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddAddIte.c:125
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addConst()

DdNode* Cudd_addConst ( DdManager dd,
CUDD_VALUE_TYPE  c 
)

Function********************************************************************

Synopsis [Returns the ADD for constant c.]

Description [Retrieves the ADD for constant c if it already exists, or creates a new ADD. Returns a pointer to the ADD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_addNewVar Cudd_addIthVar]

Definition at line 634 of file cuddAPI.c.

637 {
638  return(cuddUniqueConst(dd,c));
639 
640 } /* end of Cudd_addConst */
DdNode * cuddUniqueConst(DdManager *unique, CUDD_VALUE_TYPE value)
Definition: cuddTable.c:1479

◆ Cudd_addConstrain()

DdNode* Cudd_addConstrain ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_addDiff()

DdNode* Cudd_addDiff ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addDivide()

DdNode* Cudd_addDivide ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addEvalConst()

DdNode* Cudd_addEvalConst ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Checks whether ADD g is constant whenever ADD f is 1.]

Description [Checks whether ADD g is constant whenever ADD f is 1. f must be a 0-1 ADD. Returns a pointer to the resulting ADD (which may or may not be constant) or DD_NON_CONSTANT. If f is identically 0, the check is assumed to be successful, and the background value is returned. No new nodes are created.]

SideEffects [None]

SeeAlso [Cudd_addIteConstant Cudd_addLeq]

Definition at line 256 of file cuddAddIte.c.

260 {
261  DdNode *zero;
262  DdNode *Fv,*Fnv,*Gv,*Gnv,*r,*t,*e;
263  unsigned int topf,topg;
264 
265 #ifdef DD_DEBUG
267 #endif
268 
269  statLine(dd);
270  /* Terminal cases. */
271  if (f == DD_ONE(dd) || cuddIsConstant(g)) {
272  return(g);
273  }
274  if (f == (zero = DD_ZERO(dd))) {
275  return(dd->background);
276  }
277 
278 #ifdef DD_DEBUG
279  assert(!cuddIsConstant(f));
280 #endif
281  /* From now on, f and g are known not to be constants. */
282 
283  topf = cuddI(dd,f->index);
284  topg = cuddI(dd,g->index);
285 
286  /* Check cache. */
288  if (r != NULL) {
289  return(r);
290  }
291 
292  /* Compute cofactors. */
293  if (topf <= topg) {
294  Fv = cuddT(f); Fnv = cuddE(f);
295  } else {
296  Fv = Fnv = f;
297  }
298  if (topg <= topf) {
299  Gv = cuddT(g); Gnv = cuddE(g);
300  } else {
301  Gv = Gnv = g;
302  }
303 
304  /* Recursive step. */
305  if (Fv != zero) {
306  t = Cudd_addEvalConst(dd,Fv,Gv);
307  if (t == DD_NON_CONSTANT || !cuddIsConstant(t)) {
309  return(DD_NON_CONSTANT);
310  }
311  if (Fnv != zero) {
312  e = Cudd_addEvalConst(dd,Fnv,Gnv);
313  if (e == DD_NON_CONSTANT || !cuddIsConstant(e) || t != e) {
315  return(DD_NON_CONSTANT);
316  }
317  }
319  return(t);
320  } else { /* Fnv must be != zero */
321  e = Cudd_addEvalConst(dd,Fnv,Gnv);
322  cuddCacheInsert2(dd, Cudd_addEvalConst, f, g, e);
323  return(e);
324  }
325 
326 } /* end of Cudd_addEvalConst */
Definition: cudd.h:270
#define assert(ex)
Definition: util.h:141
DdNode * Cudd_addEvalConst(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddAddIte.c:256
#define statLine(dd)
Definition: cuddInt.h:990
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define DD_ADD_EVAL_CONST_TAG
Definition: cuddInt.h:186
#define cuddT(node)
Definition: cuddInt.h:609
#define cuddI(dd, index)
Definition: cuddInt.h:659
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
static DdNode * zero
Definition: cuddSat.c:105
DdNode * cuddConstantLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:690
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode * background
Definition: cuddInt.h:333
#define DD_NON_CONSTANT
Definition: cuddInt.h:124
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addExistAbstract()

DdNode* Cudd_addExistAbstract ( DdManager manager,
DdNode f,
DdNode cube 
)

◆ Cudd_addFindMax()

DdNode* Cudd_addFindMax ( DdManager dd,
DdNode f 
)

◆ Cudd_addFindMin()

DdNode* Cudd_addFindMin ( DdManager dd,
DdNode f 
)

◆ Cudd_addGeneralVectorCompose()

DdNode* Cudd_addGeneralVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vectorOn,
DdNode **  vectorOff 
)

◆ Cudd_addHamming()

DdNode* Cudd_addHamming ( DdManager dd,
DdNode **  xVars,
DdNode **  yVars,
int  nVars 
)

◆ Cudd_addHarwell()

int Cudd_addHarwell ( FILE *  fp,
DdManager dd,
DdNode **  E,
DdNode ***  x,
DdNode ***  y,
DdNode ***  xn,
DdNode ***  yn_,
int *  nx,
int *  ny,
int *  m,
int *  n,
int  bx,
int  sx,
int  by,
int  sy,
int  pr 
)

◆ Cudd_AddHook()

int Cudd_AddHook ( DdManager dd,
DD_HFP  f,
Cudd_HookType  where 
)

Function********************************************************************

Synopsis [Adds a function to a hook.]

Description [Adds a function to a hook. A hook is a list of application-provided functions called on certain occasions by the package. Returns 1 if the function is successfully added; 2 if the function was already in the list; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_RemoveHook]

Definition at line 3569 of file cuddAPI.c.

3573 {
3574  DdHook **hook, *nextHook, *newHook;
3575 
3576  switch (where) {
3577  case CUDD_PRE_GC_HOOK:
3578  hook = &(dd->preGCHook);
3579  break;
3580  case CUDD_POST_GC_HOOK:
3581  hook = &(dd->postGCHook);
3582  break;
3584  hook = &(dd->preReorderingHook);
3585  break;
3587  hook = &(dd->postReorderingHook);
3588  break;
3589  default:
3590  return(0);
3591  }
3592  /* Scan the list and find whether the function is already there.
3593  ** If so, just return. */
3594  nextHook = *hook;
3595  while (nextHook != NULL) {
3596  if (nextHook->f == f) {
3597  return(2);
3598  }
3599  hook = &(nextHook->next);
3600  nextHook = nextHook->next;
3601  }
3602  /* The function was not in the list. Create a new item and append it
3603  ** to the end of the list. */
3604  newHook = ALLOC(DdHook,1);
3605  if (newHook == NULL) {
3606  dd->errorCode = CUDD_MEMORY_OUT;
3607  return(0);
3608  }
3609  newHook->next = NULL;
3610  newHook->f = f;
3611  *hook = newHook;
3612  return(1);
3613 
3614 } /* end of Cudd_AddHook */
DdHook * preReorderingHook
Definition: cuddInt.h:421
DD_HFP f
Definition: cuddInt.h:241
DdHook * postReorderingHook
Definition: cuddInt.h:422
#define ALLOC(type, num)
Definition: util.h:76
struct DdHook * next
Definition: cuddInt.h:242
DdHook * postGCHook
Definition: cuddInt.h:420
DdHook * preGCHook
Definition: cuddInt.h:419
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_addIte()

DdNode* Cudd_addIte ( DdManager dd,
DdNode f,
DdNode g,
DdNode h 
)

AutomaticEnd Function********************************************************************

Synopsis [Implements ITE(f,g,h).]

Description [Implements ITE(f,g,h). This procedure assumes that f is a 0-1 ADD. Returns a pointer to the resulting ADD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddIte Cudd_addIteConstant Cudd_addApply]

Definition at line 125 of file cuddAddIte.c.

130 {
131  DdNode *res;
132 
133  do {
134  dd->reordered = 0;
135  res = cuddAddIteRecur(dd,f,g,h);
136  } while (dd->reordered == 1);
137  return(res);
138 
139 } /* end of Cudd_addIte */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddAddIteRecur(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddAddIte.c:441

◆ Cudd_addIteConstant()

DdNode* Cudd_addIteConstant ( DdManager dd,
DdNode f,
DdNode g,
DdNode h 
)

Function********************************************************************

Synopsis [Implements ITEconstant for ADDs.]

Description [Implements ITEconstant for ADDs. f must be a 0-1 ADD. Returns a pointer to the resulting ADD (which may or may not be constant) or DD_NON_CONSTANT. No new nodes are created. This function can be used, for instance, to check that g has a constant value (specified by h) whenever f is 1. If the constant value is unknown, then one should use Cudd_addEvalConst.]

SideEffects [None]

SeeAlso [Cudd_addIte Cudd_addEvalConst Cudd_bddIteConstant]

Definition at line 159 of file cuddAddIte.c.

164 {
165  DdNode *one,*zero;
166  DdNode *Fv,*Fnv,*Gv,*Gnv,*Hv,*Hnv,*r,*t,*e;
167  unsigned int topf,topg,toph,v;
168 
169  statLine(dd);
170  /* Trivial cases. */
171  if (f == (one = DD_ONE(dd))) { /* ITE(1,G,H) = G */
172  return(g);
173  }
174  if (f == (zero = DD_ZERO(dd))) { /* ITE(0,G,H) = H */
175  return(h);
176  }
177 
178  /* From now on, f is known not to be a constant. */
179  addVarToConst(f,&g,&h,one,zero);
180 
181  /* Check remaining one variable cases. */
182  if (g == h) { /* ITE(F,G,G) = G */
183  return(g);
184  }
185  if (cuddIsConstant(g) && cuddIsConstant(h)) {
186  return(DD_NON_CONSTANT);
187  }
188 
189  topf = cuddI(dd,f->index);
190  topg = cuddI(dd,g->index);
191  toph = cuddI(dd,h->index);
192  v = ddMin(topg,toph);
193 
194  /* ITE(F,G,H) = (x,G,H) (non constant) if F = (x,1,0), x < top(G,H). */
195  if (topf < v && cuddIsConstant(cuddT(f)) && cuddIsConstant(cuddE(f))) {
196  return(DD_NON_CONSTANT);
197  }
198 
199  /* Check cache. */
201  if (r != NULL) {
202  return(r);
203  }
204 
205  /* Compute cofactors. */
206  if (topf <= v) {
207  v = ddMin(topf,v); /* v = top_var(F,G,H) */
208  Fv = cuddT(f); Fnv = cuddE(f);
209  } else {
210  Fv = Fnv = f;
211  }
212  if (topg == v) {
213  Gv = cuddT(g); Gnv = cuddE(g);
214  } else {
215  Gv = Gnv = g;
216  }
217  if (toph == v) {
218  Hv = cuddT(h); Hnv = cuddE(h);
219  } else {
220  Hv = Hnv = h;
221  }
222 
223  /* Recursive step. */
224  t = Cudd_addIteConstant(dd,Fv,Gv,Hv);
225  if (t == DD_NON_CONSTANT || !cuddIsConstant(t)) {
227  return(DD_NON_CONSTANT);
228  }
229  e = Cudd_addIteConstant(dd,Fnv,Gnv,Hnv);
230  if (e == DD_NON_CONSTANT || !cuddIsConstant(e) || t != e) {
232  return(DD_NON_CONSTANT);
233  }
234  cuddCacheInsert(dd, DD_ADD_ITE_CONSTANT_TAG, f, g, h, t);
235  return(t);
236 
237 } /* end of Cudd_addIteConstant */
DdNode * Cudd_addIteConstant(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddAddIte.c:159
Definition: cudd.h:270
static void addVarToConst(DdNode *f, DdNode **gp, DdNode **hp, DdNode *one, DdNode *zero)
Definition: cuddAddIte.c:621
#define DD_ADD_ITE_CONSTANT_TAG
Definition: cuddInt.h:185
#define statLine(dd)
Definition: cuddInt.h:990
static DdNode * one
Definition: cuddSat.c:105
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define ddMin(x, y)
Definition: cuddInt.h:771
#define cuddT(node)
Definition: cuddInt.h:609
#define cuddI(dd, index)
Definition: cuddInt.h:659
DdHalfWord index
Definition: cudd.h:271
static DdNode * zero
Definition: cuddSat.c:105
DdNode * cuddConstantLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:690
#define cuddE(node)
Definition: cuddInt.h:625
void cuddCacheInsert(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data)
Definition: cuddCache.c:217
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_NON_CONSTANT
Definition: cuddInt.h:124
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addIthBit()

DdNode* Cudd_addIthBit ( DdManager dd,
DdNode f,
int  bit 
)

◆ Cudd_addIthVar()

DdNode* Cudd_addIthVar ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the ADD variable with index i.]

Description [Retrieves the ADD variable with index i if it already exists, or creates a new ADD variable. Returns a pointer to the variable if successful; NULL otherwise. An ADD variable differs from a BDD variable because it points to the arithmetic zero, instead of having a complement pointer to 1. ]

SideEffects [None]

SeeAlso [Cudd_addNewVar Cudd_bddIthVar Cudd_addConst Cudd_addNewVarAtLevel]

Definition at line 398 of file cuddAPI.c.

401 {
402  DdNode *res;
403 
404  if ((unsigned int) i >= CUDD_MAXINDEX - 1) return(NULL);
405  do {
406  dd->reordered = 0;
407  res = cuddUniqueInter(dd,i,DD_ONE(dd),DD_ZERO(dd));
408  } while (dd->reordered == 1);
409 
410  return(res);
411 
412 } /* end of Cudd_addIthVar */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
#define CUDD_MAXINDEX
Definition: cudd.h:108
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addLeq()

int Cudd_addLeq ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Determines whether f is less than or equal to g.]

Description [Returns 1 if f is less than or equal to g; 0 otherwise. No new nodes are created. This procedure works for arbitrary ADDs. For 0-1 ADDs Cudd_addEvalConst is more efficient.]

SideEffects [None]

SeeAlso [Cudd_addIteConstant Cudd_addEvalConst Cudd_bddLeq]

Definition at line 372 of file cuddAddIte.c.

376 {
377  DdNode *tmp, *fv, *fvn, *gv, *gvn;
378  unsigned int topf, topg, res;
379 
380  /* Terminal cases. */
381  if (f == g) return(1);
382 
383  statLine(dd);
384  if (cuddIsConstant(f)) {
385  if (cuddIsConstant(g)) return(cuddV(f) <= cuddV(g));
386  if (f == DD_MINUS_INFINITY(dd)) return(1);
387  if (f == DD_PLUS_INFINITY(dd)) return(0); /* since f != g */
388  }
389  if (g == DD_PLUS_INFINITY(dd)) return(1);
390  if (g == DD_MINUS_INFINITY(dd)) return(0); /* since f != g */
391 
392  /* Check cache. */
393  tmp = cuddCacheLookup2(dd,(DD_CTFP)Cudd_addLeq,f,g);
394  if (tmp != NULL) {
395  return(tmp == DD_ONE(dd));
396  }
397 
398  /* Compute cofactors. One of f and g is not constant. */
399  topf = cuddI(dd,f->index);
400  topg = cuddI(dd,g->index);
401  if (topf <= topg) {
402  fv = cuddT(f); fvn = cuddE(f);
403  } else {
404  fv = fvn = f;
405  }
406  if (topg <= topf) {
407  gv = cuddT(g); gvn = cuddE(g);
408  } else {
409  gv = gvn = g;
410  }
411 
412  res = Cudd_addLeq(dd,fvn,gvn) && Cudd_addLeq(dd,fv,gv);
413 
414  /* Store result in cache and return. */
416  Cudd_NotCond(DD_ONE(dd),res==0));
417  return(res);
418 
419 } /* end of Cudd_addLeq */
Definition: cudd.h:270
DdNode * cuddCacheLookup2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
#define statLine(dd)
Definition: cuddInt.h:990
#define DD_MINUS_INFINITY(dd)
Definition: cuddInt.h:908
#define cuddV(node)
Definition: cuddInt.h:641
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
int Cudd_addLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddAddIte.c:372
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
#define cuddI(dd, index)
Definition: cuddInt.h:659
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
#define DD_PLUS_INFINITY(dd)
Definition: cuddInt.h:894
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_addLog()

DdNode* Cudd_addLog ( DdManager dd,
DdNode f 
)

◆ Cudd_addMatrixMultiply()

DdNode* Cudd_addMatrixMultiply ( DdManager dd,
DdNode A,
DdNode B,
DdNode **  z,
int  nz 
)

◆ Cudd_addMaximum()

DdNode* Cudd_addMaximum ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addMinimum()

DdNode* Cudd_addMinimum ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addMinus()

DdNode* Cudd_addMinus ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addMonadicApply()

DdNode* Cudd_addMonadicApply ( DdManager dd,
DdNode *(*)(DdManager *, DdNode *)  op,
DdNode f 
)

◆ Cudd_addNand()

DdNode* Cudd_addNand ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addNegate()

DdNode* Cudd_addNegate ( DdManager dd,
DdNode f 
)

◆ Cudd_addNewVar()

DdNode* Cudd_addNewVar ( DdManager dd)

AutomaticStart

AutomaticEnd Function********************************************************************

Synopsis [Returns a new ADD variable.]

Description [Creates a new ADD variable. The new variable has an index equal to the largest previous index plus 1. Returns a pointer to the new variable if successful; NULL otherwise. An ADD variable differs from a BDD variable because it points to the arithmetic zero, instead of having a complement pointer to 1. ]

SideEffects [None]

SeeAlso [Cudd_bddNewVar Cudd_addIthVar Cudd_addConst Cudd_addNewVarAtLevel]

Definition at line 273 of file cuddAPI.c.

275 {
276  DdNode *res;
277 
278  if ((unsigned int) dd->size >= CUDD_MAXINDEX - 1) return(NULL);
279  do {
280  dd->reordered = 0;
281  res = cuddUniqueInter(dd,dd->size,DD_ONE(dd),DD_ZERO(dd));
282  } while (dd->reordered == 1);
283 
284  return(res);
285 
286 } /* end of Cudd_addNewVar */
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
int reordered
Definition: cuddInt.h:392
#define CUDD_MAXINDEX
Definition: cudd.h:108
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addNewVarAtLevel()

DdNode* Cudd_addNewVarAtLevel ( DdManager dd,
int  level 
)

Function********************************************************************

Synopsis [Returns a new ADD variable at a specified level.]

Description [Creates a new ADD variable. The new variable has an index equal to the largest previous index plus 1 and is positioned at the specified level in the order. Returns a pointer to the new variable if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_addNewVar Cudd_addIthVar Cudd_bddNewVarAtLevel]

Definition at line 304 of file cuddAPI.c.

307 {
308  DdNode *res;
309 
310  if ((unsigned int) dd->size >= CUDD_MAXINDEX - 1) return(NULL);
311  if (level >= dd->size) return(Cudd_addIthVar(dd,level));
312  if (!cuddInsertSubtables(dd,1,level)) return(NULL);
313  do {
314  dd->reordered = 0;
315  res = cuddUniqueInter(dd,dd->size - 1,DD_ONE(dd),DD_ZERO(dd));
316  } while (dd->reordered == 1);
317 
318  return(res);
319 
320 } /* end of Cudd_addNewVarAtLevel */
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
int reordered
Definition: cuddInt.h:392
int cuddInsertSubtables(DdManager *unique, int n, int level)
Definition: cuddTable.c:1824
DdNode * Cudd_addIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:398
#define CUDD_MAXINDEX
Definition: cudd.h:108
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_addNonSimCompose()

DdNode* Cudd_addNonSimCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

◆ Cudd_addNor()

DdNode* Cudd_addNor ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addOneZeroMaximum()

DdNode* Cudd_addOneZeroMaximum ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addOr()

DdNode* Cudd_addOr ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addOrAbstract()

DdNode* Cudd_addOrAbstract ( DdManager manager,
DdNode f,
DdNode cube 
)

◆ Cudd_addOuterSum()

DdNode* Cudd_addOuterSum ( DdManager dd,
DdNode M,
DdNode r,
DdNode c 
)

◆ Cudd_addPermute()

DdNode* Cudd_addPermute ( DdManager manager,
DdNode node,
int *  permut 
)

◆ Cudd_addPlus()

DdNode* Cudd_addPlus ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addRead()

int Cudd_addRead ( FILE *  fp,
DdManager dd,
DdNode **  E,
DdNode ***  x,
DdNode ***  y,
DdNode ***  xn,
DdNode ***  yn_,
int *  nx,
int *  ny,
int *  m,
int *  n,
int  bx,
int  sx,
int  by,
int  sy 
)

◆ Cudd_addResidue()

DdNode* Cudd_addResidue ( DdManager dd,
int  n,
int  m,
int  options,
int  top 
)

◆ Cudd_addRestrict()

DdNode* Cudd_addRestrict ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_addRoundOff()

DdNode* Cudd_addRoundOff ( DdManager dd,
DdNode f,
int  N 
)

◆ Cudd_addScalarInverse()

DdNode* Cudd_addScalarInverse ( DdManager dd,
DdNode f,
DdNode epsilon 
)

◆ Cudd_addSetNZ()

DdNode* Cudd_addSetNZ ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addSwapVariables()

DdNode* Cudd_addSwapVariables ( DdManager dd,
DdNode f,
DdNode **  x,
DdNode **  y,
int  n 
)

◆ Cudd_addThreshold()

DdNode* Cudd_addThreshold ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addTimes()

DdNode* Cudd_addTimes ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addTimesPlus()

DdNode* Cudd_addTimesPlus ( DdManager dd,
DdNode A,
DdNode B,
DdNode **  z,
int  nz 
)

◆ Cudd_addTriangle()

DdNode* Cudd_addTriangle ( DdManager dd,
DdNode f,
DdNode g,
DdNode **  z,
int  nz 
)

◆ Cudd_addUnivAbstract()

DdNode* Cudd_addUnivAbstract ( DdManager manager,
DdNode f,
DdNode cube 
)

◆ Cudd_addVectorCompose()

DdNode* Cudd_addVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

◆ Cudd_addWalsh()

DdNode* Cudd_addWalsh ( DdManager dd,
DdNode **  x,
DdNode **  y,
int  n 
)

◆ Cudd_addXeqy()

DdNode* Cudd_addXeqy ( DdManager dd,
int  N,
DdNode **  x,
DdNode **  y 
)

◆ Cudd_addXnor()

DdNode* Cudd_addXnor ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_addXor()

DdNode* Cudd_addXor ( DdManager dd,
DdNode **  f,
DdNode **  g 
)

◆ Cudd_ApaAdd()

DdApaDigit Cudd_ApaAdd ( int  digits,
DdApaNumber  a,
DdApaNumber  b,
DdApaNumber  sum 
)

◆ Cudd_ApaCompare()

int Cudd_ApaCompare ( int  digitsFirst,
DdApaNumber  first,
int  digitsSecond,
DdApaNumber  second 
)

◆ Cudd_ApaCompareRatios()

int Cudd_ApaCompareRatios ( int  digitsFirst,
DdApaNumber  firstNum,
unsigned int  firstDen,
int  digitsSecond,
DdApaNumber  secondNum,
unsigned int  secondDen 
)

◆ Cudd_ApaCopy()

void Cudd_ApaCopy ( int  digits,
DdApaNumber  source,
DdApaNumber  dest 
)

◆ Cudd_ApaCountMinterm()

DdApaNumber Cudd_ApaCountMinterm ( DdManager manager,
DdNode node,
int  nvars,
int *  digits 
)

◆ Cudd_ApaIntDivision()

unsigned int Cudd_ApaIntDivision ( int  digits,
DdApaNumber  dividend,
unsigned int  divisor,
DdApaNumber  quotient 
)

◆ Cudd_ApaNumberOfDigits()

int Cudd_ApaNumberOfDigits ( int  binaryDigits)

◆ Cudd_ApaPowerOfTwo()

void Cudd_ApaPowerOfTwo ( int  digits,
DdApaNumber  number,
int  power 
)

◆ Cudd_ApaPrintDecimal()

int Cudd_ApaPrintDecimal ( FILE *  fp,
int  digits,
DdApaNumber  number 
)

◆ Cudd_ApaPrintDensity()

int Cudd_ApaPrintDensity ( FILE *  fp,
DdManager dd,
DdNode node,
int  nvars 
)

◆ Cudd_ApaPrintExponential()

int Cudd_ApaPrintExponential ( FILE *  fp,
int  digits,
DdApaNumber  number,
int  precision 
)

◆ Cudd_ApaPrintHex()

int Cudd_ApaPrintHex ( FILE *  fp,
int  digits,
DdApaNumber  number 
)

◆ Cudd_ApaPrintMinterm()

int Cudd_ApaPrintMinterm ( FILE *  fp,
DdManager dd,
DdNode node,
int  nvars 
)

◆ Cudd_ApaPrintMintermExp()

int Cudd_ApaPrintMintermExp ( FILE *  fp,
DdManager dd,
DdNode node,
int  nvars,
int  precision 
)

◆ Cudd_ApaSetToLiteral()

void Cudd_ApaSetToLiteral ( int  digits,
DdApaNumber  number,
DdApaDigit  literal 
)

◆ Cudd_ApaShiftRight()

void Cudd_ApaShiftRight ( int  digits,
DdApaDigit  in,
DdApaNumber  a,
DdApaNumber  b 
)

◆ Cudd_ApaShortDivision()

DdApaDigit Cudd_ApaShortDivision ( int  digits,
DdApaNumber  dividend,
DdApaDigit  divisor,
DdApaNumber  quotient 
)

◆ Cudd_ApaSubtract()

DdApaDigit Cudd_ApaSubtract ( int  digits,
DdApaNumber  a,
DdApaNumber  b,
DdApaNumber  diff 
)

◆ Cudd_AutodynDisable()

void Cudd_AutodynDisable ( DdManager unique)

Function********************************************************************

Synopsis [Disables automatic dynamic reordering.]

Description []

SideEffects [None]

SeeAlso [Cudd_AutodynEnable Cudd_ReorderingStatus Cudd_AutodynDisableZdd]

Definition at line 948 of file cuddAPI.c.

950 {
951  unique->autoDyn = 0;
952  return;
953 
954 } /* end of Cudd_AutodynDisable */
int autoDyn
Definition: cuddInt.h:400

◆ Cudd_AutodynDisableZdd()

void Cudd_AutodynDisableZdd ( DdManager unique)

Function********************************************************************

Synopsis [Disables automatic dynamic reordering of ZDDs.]

Description []

SideEffects [None]

SeeAlso [Cudd_AutodynEnableZdd Cudd_ReorderingStatusZdd Cudd_AutodynDisable]

Definition at line 1026 of file cuddAPI.c.

1028 {
1029  unique->autoDynZ = 0;
1030  return;
1031 
1032 } /* end of Cudd_AutodynDisableZdd */
int autoDynZ
Definition: cuddInt.h:401

◆ Cudd_AutodynEnable()

void Cudd_AutodynEnable ( DdManager unique,
Cudd_ReorderingType  method 
)

Function********************************************************************

Synopsis [Enables automatic dynamic reordering of BDDs and ADDs.]

Description [Enables automatic dynamic reordering of BDDs and ADDs. Parameter method is used to determine the method used for reordering. If CUDD_REORDER_SAME is passed, the method is unchanged.]

SideEffects [None]

SeeAlso [Cudd_AutodynDisable Cudd_ReorderingStatus Cudd_AutodynEnableZdd]

Definition at line 909 of file cuddAPI.c.

912 {
913  unique->autoDyn = 1;
914  if (method != CUDD_REORDER_SAME) {
915  unique->autoMethod = method;
916  }
917 #ifndef DD_NO_DEATH_ROW
918  /* If reordering is enabled, using the death row causes too many
919  ** invocations. Hence, we shrink the death row to just one entry.
920  */
921  cuddClearDeathRow(unique);
922  unique->deathRowDepth = 1;
923  unique->deadMask = unique->deathRowDepth - 1;
924  if ((unsigned) unique->nextDead > unique->deadMask) {
925  unique->nextDead = 0;
926  }
927  unique->deathRow = REALLOC(DdNodePtr, unique->deathRow,
928  unique->deathRowDepth);
929 #endif
930  return;
931 
932 } /* end of Cudd_AutodynEnable */
Cudd_ReorderingType autoMethod
Definition: cuddInt.h:402
Definition: cudd.h:270
unsigned deadMask
Definition: cuddInt.h:387
DdNode ** deathRow
Definition: cuddInt.h:384
int nextDead
Definition: cuddInt.h:386
int deathRowDepth
Definition: cuddInt.h:385
#define REALLOC(type, obj, num)
Definition: util.h:78
void cuddClearDeathRow(DdManager *table)
Definition: cuddRef.c:722
int autoDyn
Definition: cuddInt.h:400

◆ Cudd_AutodynEnableZdd()

void Cudd_AutodynEnableZdd ( DdManager unique,
Cudd_ReorderingType  method 
)

Function********************************************************************

Synopsis [Enables automatic dynamic reordering of ZDDs.]

Description [Enables automatic dynamic reordering of ZDDs. Parameter method is used to determine the method used for reordering ZDDs. If CUDD_REORDER_SAME is passed, the method is unchanged.]

SideEffects [None]

SeeAlso [Cudd_AutodynDisableZdd Cudd_ReorderingStatusZdd Cudd_AutodynEnable]

Definition at line 1000 of file cuddAPI.c.

1003 {
1004  unique->autoDynZ = 1;
1005  if (method != CUDD_REORDER_SAME) {
1006  unique->autoMethodZ = method;
1007  }
1008  return;
1009 
1010 } /* end of Cudd_AutodynEnableZdd */
Cudd_ReorderingType autoMethodZ
Definition: cuddInt.h:403
int autoDynZ
Definition: cuddInt.h:401

◆ Cudd_AverageDistance()

double Cudd_AverageDistance ( DdManager dd)

Function********************************************************************

Synopsis [Computes the average distance between adjacent nodes.]

Description [Computes the average distance between adjacent nodes in the manager. Adjacent nodes are node pairs such that the second node is the then child, else child, or next node in the collision list.]

SideEffects [None]

SeeAlso []

Definition at line 2622 of file cuddUtil.c.

2624 {
2625  double tetotal, nexttotal;
2626  double tesubtotal, nextsubtotal;
2627  double temeasured, nextmeasured;
2628  int i, j;
2629  int slots, nvars;
2630  long diff;
2631  DdNode *scan;
2632  DdNodePtr *nodelist;
2633  DdNode *sentinel = &(dd->sentinel);
2634 
2635  nvars = dd->size;
2636  if (nvars == 0) return(0.0);
2637 
2638  /* Initialize totals. */
2639  tetotal = 0.0;
2640  nexttotal = 0.0;
2641  temeasured = 0.0;
2642  nextmeasured = 0.0;
2643 
2644  /* Scan the variable subtables. */
2645  for (i = 0; i < nvars; i++) {
2646  nodelist = dd->subtables[i].nodelist;
2647  tesubtotal = 0.0;
2648  nextsubtotal = 0.0;
2649  slots = dd->subtables[i].slots;
2650  for (j = 0; j < slots; j++) {
2651  scan = nodelist[j];
2652  while (scan != sentinel) {
2653  diff = (long) scan - (long) cuddT(scan);
2654  tesubtotal += (double) ddAbs(diff);
2655  diff = (long) scan - (long) Cudd_Regular(cuddE(scan));
2656  tesubtotal += (double) ddAbs(diff);
2657  temeasured += 2.0;
2658  if (scan->next != sentinel) {
2659  diff = (long) scan - (long) scan->next;
2660  nextsubtotal += (double) ddAbs(diff);
2661  nextmeasured += 1.0;
2662  }
2663  scan = scan->next;
2664  }
2665  }
2666  tetotal += tesubtotal;
2667  nexttotal += nextsubtotal;
2668  }
2669 
2670  /* Scan the constant table. */
2671  nodelist = dd->constants.nodelist;
2672  nextsubtotal = 0.0;
2673  slots = dd->constants.slots;
2674  for (j = 0; j < slots; j++) {
2675  scan = nodelist[j];
2676  while (scan != NULL) {
2677  if (scan->next != NULL) {
2678  diff = (long) scan - (long) scan->next;
2679  nextsubtotal += (double) ddAbs(diff);
2680  nextmeasured += 1.0;
2681  }
2682  scan = scan->next;
2683  }
2684  }
2685  nexttotal += nextsubtotal;
2686 
2687  return((tetotal + nexttotal) / (temeasured + nextmeasured));
2688 
2689 } /* end of Cudd_AverageDistance */
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
DdSubtable * subtables
Definition: cuddInt.h:349
DdNode sentinel
Definition: cuddInt.h:328
DdNode * next
Definition: cudd.h:273
#define ddAbs(x)
Definition: cuddInt.h:799
DdNode ** nodelist
Definition: cuddInt.h:311
#define cuddT(node)
Definition: cuddInt.h:609
unsigned int slots
Definition: cuddInt.h:313
#define cuddE(node)
Definition: cuddInt.h:625
DdSubtable constants
Definition: cuddInt.h:351

◆ Cudd_bddAdjPermuteX()

DdNode* Cudd_bddAdjPermuteX ( DdManager dd,
DdNode B,
DdNode **  x,
int  n 
)

◆ Cudd_bddAnd()

DdNode* Cudd_bddAnd ( DdManager dd,
DdNode f,
DdNode g 
)

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]

Definition at line 350 of file cuddBddIte.c.

354 {
355  DdNode *res;
356 
357  do {
358  dd->reordered = 0;
359  res = cuddBddAndRecur(dd,f,g);
360  } while (dd->reordered == 1);
361  return(res);
362 
363 } /* end of Cudd_bddAnd */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddAndAbstract()

DdNode* Cudd_bddAndAbstract ( DdManager manager,
DdNode f,
DdNode g,
DdNode cube 
)

◆ Cudd_bddAndAbstractLimit()

DdNode* Cudd_bddAndAbstractLimit ( DdManager manager,
DdNode f,
DdNode g,
DdNode cube,
unsigned int  limit 
)

◆ Cudd_bddAndLimit()

DdNode* Cudd_bddAndLimit ( DdManager dd,
DdNode f,
DdNode g,
unsigned int  limit 
)

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 limit are required.]

SideEffects [None]

SeeAlso [Cudd_bddAnd]

Definition at line 382 of file cuddBddIte.c.

387 {
388  DdNode *res;
389  unsigned int saveLimit = dd->maxLive;
390 
391  dd->maxLive = (dd->keys - dd->dead) + (dd->keysZ - dd->deadZ) + limit;
392  do {
393  dd->reordered = 0;
394  res = cuddBddAndRecur(dd,f,g);
395  } while (dd->reordered == 1);
396  dd->maxLive = saveLimit;
397  return(res);
398 
399 } /* end of Cudd_bddAndLimit */
Definition: cudd.h:270
unsigned int deadZ
Definition: cuddInt.h:356
int reordered
Definition: cuddInt.h:392
unsigned int dead
Definition: cuddInt.h:355
unsigned int maxLive
Definition: cuddInt.h:357
unsigned int keys
Definition: cuddInt.h:353
unsigned int keysZ
Definition: cuddInt.h:354
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddApproxConjDecomp()

int Cudd_bddApproxConjDecomp ( DdManager dd,
DdNode f,
DdNode ***  conjuncts 
)

◆ Cudd_bddApproxDisjDecomp()

int Cudd_bddApproxDisjDecomp ( DdManager dd,
DdNode f,
DdNode ***  disjuncts 
)

◆ Cudd_bddBindVar()

int Cudd_bddBindVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Prevents sifting of a variable.]

Description [This function sets a flag to prevent sifting of a variable. Returns 1 if successful; 0 otherwise (i.e., invalid variable index).]

SideEffects [Changes the "bindVar" flag in DdSubtable.]

SeeAlso [Cudd_bddUnbindVar]

Definition at line 4352 of file cuddAPI.c.

4355 {
4356  if (index >= dd->size || index < 0) return(0);
4357  dd->subtables[dd->perm[index]].bindVar = 1;
4358  return(1);
4359 
4360 } /* end of Cudd_bddBindVar */
int size
Definition: cuddInt.h:345
int bindVar
Definition: cuddInt.h:318
DdSubtable * subtables
Definition: cuddInt.h:349
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddBooleanDiff()

DdNode* Cudd_bddBooleanDiff ( DdManager manager,
DdNode f,
int  x 
)

Function********************************************************************

Synopsis [Computes the boolean difference of f with respect to x.]

Description [Computes the boolean difference of f with respect to the variable with index x. Returns the BDD of the boolean difference if successful; NULL otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 287 of file cuddBddAbs.c.

291 {
292  DdNode *res, *var;
293 
294  /* If the variable is not currently in the manager, f cannot
295  ** depend on it.
296  */
297  if (x >= manager->size) return(Cudd_Not(DD_ONE(manager)));
298  var = manager->vars[x];
299 
300  do {
301  manager->reordered = 0;
302  res = cuddBddBooleanDiffRecur(manager, Cudd_Regular(f), var);
303  } while (manager->reordered == 1);
304 
305  return(res);
306 
307 } /* end of Cudd_bddBooleanDiff */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddBooleanDiffRecur(DdManager *manager, DdNode *f, DdNode *var)
Definition: cuddBddAbs.c:675
DdNode ** vars
Definition: cuddInt.h:373
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_bddCharToVect()

DdNode** Cudd_bddCharToVect ( DdManager dd,
DdNode f 
)

◆ Cudd_bddClippingAnd()

DdNode* Cudd_bddClippingAnd ( DdManager dd,
DdNode f,
DdNode g,
int  maxDepth,
int  direction 
)

◆ Cudd_bddClippingAndAbstract()

DdNode* Cudd_bddClippingAndAbstract ( DdManager dd,
DdNode f,
DdNode g,
DdNode cube,
int  maxDepth,
int  direction 
)

◆ Cudd_bddClosestCube()

DdNode* Cudd_bddClosestCube ( DdManager dd,
DdNode f,
DdNode g,
int *  distance 
)

◆ Cudd_bddCompose()

DdNode* Cudd_bddCompose ( DdManager dd,
DdNode f,
DdNode g,
int  v 
)

◆ Cudd_bddComputeCube()

DdNode* Cudd_bddComputeCube ( DdManager dd,
DdNode **  vars,
int *  phase,
int  n 
)

Function********************************************************************

Synopsis [Computes the cube of an array of BDD variables.]

Description [Computes the cube of an array of BDD variables. If non-null, the phase argument indicates which literal of each variable should appear in the cube. If phase[i] is nonzero, then the positive literal is used. If phase is NULL, the cube is positive unate. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_addComputeCube Cudd_IndicesToCube Cudd_CubeArrayToBdd]

Definition at line 2204 of file cuddUtil.c.

2209 {
2210  DdNode *cube;
2211  DdNode *fn;
2212  int i;
2213 
2214  cube = DD_ONE(dd);
2215  cuddRef(cube);
2216 
2217  for (i = n - 1; i >= 0; i--) {
2218  if (phase == NULL || phase[i] != 0) {
2219  fn = Cudd_bddAnd(dd,vars[i],cube);
2220  } else {
2221  fn = Cudd_bddAnd(dd,Cudd_Not(vars[i]),cube);
2222  }
2223  if (fn == NULL) {
2224  Cudd_RecursiveDeref(dd,cube);
2225  return(NULL);
2226  }
2227  cuddRef(fn);
2228  Cudd_RecursiveDeref(dd,cube);
2229  cube = fn;
2230  }
2231  cuddDeref(cube);
2232 
2233  return(cube);
2234 
2235 } /* end of Cudd_bddComputeCube */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_bddConstrain()

DdNode* Cudd_bddConstrain ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_bddConstrainDecomp()

DdNode** Cudd_bddConstrainDecomp ( DdManager dd,
DdNode f 
)

◆ Cudd_bddCorrelation()

double Cudd_bddCorrelation ( DdManager manager,
DdNode f,
DdNode g 
)

◆ Cudd_bddCorrelationWeights()

double Cudd_bddCorrelationWeights ( DdManager manager,
DdNode f,
DdNode g,
double *  prob 
)

◆ Cudd_bddExistAbstract()

DdNode* Cudd_bddExistAbstract ( DdManager manager,
DdNode f,
DdNode cube 
)

AutomaticEnd Function********************************************************************

Synopsis [Existentially abstracts all the variables in cube from f.]

Description [Existentially abstracts all the variables in cube from f. Returns the abstracted BDD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddUnivAbstract Cudd_addExistAbstract]

Definition at line 127 of file cuddBddAbs.c.

131 {
132  DdNode *res;
133 
134  if (bddCheckPositiveCube(manager, cube) == 0) {
135  (void) fprintf(manager->err,
136  "Error: Can only abstract positive cubes\n");
137  manager->errorCode = CUDD_INVALID_ARG;
138  return(NULL);
139  }
140 
141  do {
142  manager->reordered = 0;
143  res = cuddBddExistAbstractRecur(manager, f, cube);
144  } while (manager->reordered == 1);
145 
146  return(res);
147 
148 } /* end of Cudd_bddExistAbstract */
DdNode * cuddBddExistAbstractRecur(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:393
Definition: cudd.h:270
FILE * err
Definition: cuddInt.h:424
int reordered
Definition: cuddInt.h:392
static int bddCheckPositiveCube(DdManager *manager, DdNode *cube)
Definition: cuddBddAbs.c:747
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_bddExistAbstractLimit()

DdNode* Cudd_bddExistAbstractLimit ( DdManager manager,
DdNode f,
DdNode cube,
unsigned int  limit 
)

Function********************************************************************

Synopsis [Existentially abstracts all the variables in cube from f.]

Description [Existentially abstracts all the variables in cube from f. Returns the abstracted BDD if successful; NULL if the intermediate result blows up or more new nodes than limit are required.]

SideEffects [None]

SeeAlso [Cudd_bddExistAbstract]

Definition at line 166 of file cuddBddAbs.c.

171 {
172  DdNode *res;
173  unsigned int saveLimit = manager->maxLive;
174 
175  if (bddCheckPositiveCube(manager, cube) == 0) {
176  (void) fprintf(manager->err,
177  "Error: Can only abstract positive cubes\n");
178  manager->errorCode = CUDD_INVALID_ARG;
179  return(NULL);
180  }
181 
182  manager->maxLive = (manager->keys - manager->dead) +
183  (manager->keysZ - manager->deadZ) + limit;
184  do {
185  manager->reordered = 0;
186  res = cuddBddExistAbstractRecur(manager, f, cube);
187  } while (manager->reordered == 1);
188  manager->maxLive = saveLimit;
189 
190  return(res);
191 
192 } /* end of Cudd_bddExistAbstractLimit */
DdNode * cuddBddExistAbstractRecur(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:393
Definition: cudd.h:270
unsigned int deadZ
Definition: cuddInt.h:356
FILE * err
Definition: cuddInt.h:424
int reordered
Definition: cuddInt.h:392
unsigned int dead
Definition: cuddInt.h:355
unsigned int maxLive
Definition: cuddInt.h:357
unsigned int keys
Definition: cuddInt.h:353
static int bddCheckPositiveCube(DdManager *manager, DdNode *cube)
Definition: cuddBddAbs.c:747
unsigned int keysZ
Definition: cuddInt.h:354
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_bddGenConjDecomp()

int Cudd_bddGenConjDecomp ( DdManager dd,
DdNode f,
DdNode ***  conjuncts 
)

◆ Cudd_bddGenDisjDecomp()

int Cudd_bddGenDisjDecomp ( DdManager dd,
DdNode f,
DdNode ***  disjuncts 
)

◆ Cudd_bddIntersect()

DdNode* Cudd_bddIntersect ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Returns a function included in the intersection of f and g.]

Description [Computes a function included in the intersection of f and g. (That is, a witness that the intersection is not empty.) Cudd_bddIntersect tries to build as few new nodes as possible. If the only result of interest is whether f and g intersect, Cudd_bddLeq should be used instead.]

SideEffects [None]

SeeAlso [Cudd_bddLeq Cudd_bddIteConstant]

Definition at line 318 of file cuddBddIte.c.

322 {
323  DdNode *res;
324 
325  do {
326  dd->reordered = 0;
327  res = cuddBddIntersectRecur(dd,f,g);
328  } while (dd->reordered == 1);
329 
330  return(res);
331 
332 } /* end of Cudd_bddIntersect */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddIntersectRecur(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:880

◆ Cudd_bddInterval()

DdNode* Cudd_bddInterval ( DdManager dd,
int  N,
DdNode **  x,
unsigned int  lowerB,
unsigned int  upperB 
)

◆ Cudd_bddIsNsVar()

int Cudd_bddIsNsVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is next state.]

Description [Checks whether a variable is next state. Returns 1 if the variable's type is present state; 0 if the variable exists but is not a present state; -1 if the variable does not exist.]

SideEffects [none]

SeeAlso [Cudd_bddSetNsVar Cudd_bddIsPiVar Cudd_bddIsPsVar]

Definition at line 4551 of file cuddAPI.c.

4554 {
4555  if (index >= dd->size || index < 0) return -1;
4556  return (dd->subtables[dd->perm[index]].varType == CUDD_VAR_NEXT_STATE);
4557 
4558 } /* end of Cudd_bddIsNsVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIsop()

DdNode* Cudd_bddIsop ( DdManager dd,
DdNode L,
DdNode U 
)

Function********************************************************************

Synopsis [Computes a BDD in the interval between L and U with a simple sum-of-product cover.]

Description [Computes a BDD in the interval between L and U with a simple sum-of-product cover. This procedure is similar to Cudd_zddIsop, but it does not return the ZDD for the cover. Returns a pointer to the BDD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddIsop]

Definition at line 170 of file cuddZddIsop.c.

174 {
175  DdNode *res;
176 
177  do {
178  dd->reordered = 0;
179  res = cuddBddIsop(dd, L, U);
180  } while (dd->reordered == 1);
181  return(res);
182 
183 } /* end of Cudd_bddIsop */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddIsop(DdManager *dd, DdNode *L, DdNode *U)
Definition: cuddZddIsop.c:572

◆ Cudd_bddIsPiVar()

int Cudd_bddIsPiVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is primary input.]

Description [Checks whether a variable is primary input. Returns 1 if the variable's type is primary input; 0 if the variable exists but is not a primary input; -1 if the variable does not exist.]

SideEffects [none]

SeeAlso [Cudd_bddSetPiVar Cudd_bddIsPsVar Cudd_bddIsNsVar]

Definition at line 4503 of file cuddAPI.c.

4506 {
4507  if (index >= dd->size || index < 0) return -1;
4508  return (dd->subtables[dd->perm[index]].varType == CUDD_VAR_PRIMARY_INPUT);
4509 
4510 } /* end of Cudd_bddIsPiVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIsPsVar()

int Cudd_bddIsPsVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is present state.]

Description [Checks whether a variable is present state. Returns 1 if the variable's type is present state; 0 if the variable exists but is not a present state; -1 if the variable does not exist.]

SideEffects [none]

SeeAlso [Cudd_bddSetPsVar Cudd_bddIsPiVar Cudd_bddIsNsVar]

Definition at line 4527 of file cuddAPI.c.

4530 {
4531  if (index >= dd->size || index < 0) return -1;
4532  return (dd->subtables[dd->perm[index]].varType == CUDD_VAR_PRESENT_STATE);
4533 
4534 } /* end of Cudd_bddIsPsVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIsVarEssential()

int Cudd_bddIsVarEssential ( DdManager manager,
DdNode f,
int  id,
int  phase 
)

◆ Cudd_bddIsVarHardGroup()

int Cudd_bddIsVarHardGroup ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is set to be in a hard group.]

Description [Checks whether a variable is set to be in a hard group. This function is used for lazy sifting. Returns 1 if the variable is marked to be in a hard group; 0 if the variable exists, but it is not marked to be in a hard group; -1 if the variable does not exist.]

SideEffects [none]

SeeAlso [Cudd_bddSetVarHardGroup]

Definition at line 4779 of file cuddAPI.c.

4782 {
4783  if (index >= dd->size || index < 0) return(-1);
4784  if (dd->subtables[dd->perm[index]].varToBeGrouped == CUDD_LAZY_HARD_GROUP)
4785  return(1);
4786  return(0);
4787 
4788 } /* end of Cudd_bddIsVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIsVarToBeGrouped()

int Cudd_bddIsVarToBeGrouped ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is set to be grouped.]

Description [Checks whether a variable is set to be grouped. This function is used for lazy sifting.]

SideEffects [none]

SeeAlso []

Definition at line 4702 of file cuddAPI.c.

4705 {
4706  if (index >= dd->size || index < 0) return(-1);
4707  if (dd->subtables[dd->perm[index]].varToBeGrouped == CUDD_LAZY_UNGROUP)
4708  return(0);
4709  else
4710  return(dd->subtables[dd->perm[index]].varToBeGrouped);
4711 
4712 } /* end of Cudd_bddIsVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIsVarToBeUngrouped()

int Cudd_bddIsVarToBeUngrouped ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Checks whether a variable is set to be ungrouped.]

Description [Checks whether a variable is set to be ungrouped. This function is used for lazy sifting. Returns 1 if the variable is marked to be ungrouped; 0 if the variable exists, but it is not marked to be ungrouped; -1 if the variable does not exist.]

SideEffects [none]

SeeAlso [Cudd_bddSetVarToBeUngrouped]

Definition at line 4754 of file cuddAPI.c.

4757 {
4758  if (index >= dd->size || index < 0) return(-1);
4759  return dd->subtables[dd->perm[index]].varToBeGrouped == CUDD_LAZY_UNGROUP;
4760 
4761 } /* end of Cudd_bddIsVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddIte()

DdNode* Cudd_bddIte ( DdManager dd,
DdNode f,
DdNode g,
DdNode h 
)

AutomaticEnd Function********************************************************************

Synopsis [Implements ITE(f,g,h).]

Description [Implements ITE(f,g,h). Returns a pointer to the resulting BDD if successful; NULL if the intermediate result blows up.]

SideEffects [None]

SeeAlso [Cudd_addIte Cudd_bddIteConstant Cudd_bddIntersect]

Definition at line 142 of file cuddBddIte.c.

147 {
148  DdNode *res;
149 
150  do {
151  dd->reordered = 0;
152  res = cuddBddIteRecur(dd,f,g,h);
153  } while (dd->reordered == 1);
154  return(res);
155 
156 } /* end of Cudd_bddIte */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddIteRecur(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:742

◆ Cudd_bddIteConstant()

DdNode* Cudd_bddIteConstant ( DdManager dd,
DdNode f,
DdNode g,
DdNode h 
)

Function********************************************************************

Synopsis [Implements ITEconstant(f,g,h).]

Description [Implements ITEconstant(f,g,h). Returns a pointer to the resulting BDD (which may or may not be constant) or DD_NON_CONSTANT. No new nodes are created.]

SideEffects [None]

SeeAlso [Cudd_bddIte Cudd_bddIntersect Cudd_bddLeq Cudd_addIteConstant]

Definition at line 210 of file cuddBddIte.c.

215 {
216  DdNode *r, *Fv, *Fnv, *Gv, *Gnv, *H, *Hv, *Hnv, *t, *e;
217  DdNode *one = DD_ONE(dd);
218  DdNode *zero = Cudd_Not(one);
219  int comple;
220  unsigned int topf, topg, toph, v;
221 
222  statLine(dd);
223  /* Trivial cases. */
224  if (f == one) /* ITE(1,G,H) => G */
225  return(g);
226 
227  if (f == zero) /* ITE(0,G,H) => H */
228  return(h);
229 
230  /* f now not a constant. */
231  bddVarToConst(f, &g, &h, one); /* possibly convert g or h */
232  /* to constants */
233 
234  if (g == h) /* ITE(F,G,G) => G */
235  return(g);
236 
237  if (Cudd_IsConstant(g) && Cudd_IsConstant(h))
238  return(DD_NON_CONSTANT); /* ITE(F,1,0) or ITE(F,0,1) */
239  /* => DD_NON_CONSTANT */
240 
241  if (g == Cudd_Not(h))
242  return(DD_NON_CONSTANT); /* ITE(F,G,G') => DD_NON_CONSTANT */
243  /* if F != G and F != G' */
244 
245  comple = bddVarToCanonical(dd, &f, &g, &h, &topf, &topg, &toph);
246 
247  /* Cache lookup. */
249  if (r != NULL) {
250  return(Cudd_NotCond(r,comple && r != DD_NON_CONSTANT));
251  }
252 
253  v = ddMin(topg, toph);
254 
255  /* ITE(F,G,H) = (v,G,H) (non constant) if F = (v,1,0), v < top(G,H). */
256  if (topf < v && cuddT(f) == one && cuddE(f) == zero) {
257  return(DD_NON_CONSTANT);
258  }
259 
260  /* Compute cofactors. */
261  if (topf <= v) {
262  v = ddMin(topf, v); /* v = top_var(F,G,H) */
263  Fv = cuddT(f); Fnv = cuddE(f);
264  } else {
265  Fv = Fnv = f;
266  }
267 
268  if (topg == v) {
269  Gv = cuddT(g); Gnv = cuddE(g);
270  } else {
271  Gv = Gnv = g;
272  }
273 
274  if (toph == v) {
275  H = Cudd_Regular(h);
276  Hv = cuddT(H); Hnv = cuddE(H);
277  if (Cudd_IsComplement(h)) {
278  Hv = Cudd_Not(Hv);
279  Hnv = Cudd_Not(Hnv);
280  }
281  } else {
282  Hv = Hnv = h;
283  }
284 
285  /* Recursion. */
286  t = Cudd_bddIteConstant(dd, Fv, Gv, Hv);
287  if (t == DD_NON_CONSTANT || !Cudd_IsConstant(t)) {
289  return(DD_NON_CONSTANT);
290  }
291  e = Cudd_bddIteConstant(dd, Fnv, Gnv, Hnv);
292  if (e == DD_NON_CONSTANT || !Cudd_IsConstant(e) || t != e) {
294  return(DD_NON_CONSTANT);
295  }
296  cuddCacheInsert(dd, DD_BDD_ITE_CONSTANT_TAG, f, g, h, t);
297  return(Cudd_NotCond(t,comple));
298 
299 } /* end of Cudd_bddIteConstant */
static int bddVarToCanonical(DdManager *dd, DdNode **fp, DdNode **gp, DdNode **hp, unsigned int *topfp, unsigned int *topgp, unsigned int *tophp)
Definition: cuddBddIte.c:1279
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define DD_BDD_ITE_CONSTANT_TAG
Definition: cuddInt.h:187
#define Cudd_IsConstant(node)
Definition: cudd.h:339
#define Cudd_Regular(node)
Definition: cudd.h:384
DdNode * Cudd_bddIteConstant(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:210
#define statLine(dd)
Definition: cuddInt.h:990
static DdNode * one
Definition: cuddSat.c:105
static void bddVarToConst(DdNode *f, DdNode **gp, DdNode **hp, DdNode *one)
Definition: cuddBddIte.c:1244
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define ddMin(x, y)
Definition: cuddInt.h:771
#define cuddT(node)
Definition: cuddInt.h:609
static DdNode * zero
Definition: cuddSat.c:105
DdNode * cuddConstantLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:690
#define cuddE(node)
Definition: cuddInt.h:625
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
void cuddCacheInsert(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data)
Definition: cuddCache.c:217
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_NON_CONSTANT
Definition: cuddInt.h:124

◆ Cudd_bddIteLimit()

DdNode* Cudd_bddIteLimit ( DdManager dd,
DdNode f,
DdNode g,
DdNode h,
unsigned int  limit 
)

Function********************************************************************

Synopsis [Implements ITE(f,g,h). Returns NULL if too many nodes are required.]

Description [Implements ITE(f,g,h). Returns a pointer to the resulting BDD if successful; NULL if the intermediate result blows up or more new nodes than limit are required.]

SideEffects [None]

SeeAlso [Cudd_bddIte]

Definition at line 175 of file cuddBddIte.c.

181 {
182  DdNode *res;
183  unsigned int saveLimit = dd->maxLive;
184 
185  dd->maxLive = (dd->keys - dd->dead) + (dd->keysZ - dd->deadZ) + limit;
186  do {
187  dd->reordered = 0;
188  res = cuddBddIteRecur(dd,f,g,h);
189  } while (dd->reordered == 1);
190  dd->maxLive = saveLimit;
191  return(res);
192 
193 } /* end of Cudd_bddIteLimit */
Definition: cudd.h:270
unsigned int deadZ
Definition: cuddInt.h:356
int reordered
Definition: cuddInt.h:392
unsigned int dead
Definition: cuddInt.h:355
unsigned int maxLive
Definition: cuddInt.h:357
unsigned int keys
Definition: cuddInt.h:353
unsigned int keysZ
Definition: cuddInt.h:354
DdNode * cuddBddIteRecur(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:742

◆ Cudd_bddIterConjDecomp()

int Cudd_bddIterConjDecomp ( DdManager dd,
DdNode f,
DdNode ***  conjuncts 
)

◆ Cudd_bddIterDisjDecomp()

int Cudd_bddIterDisjDecomp ( DdManager dd,
DdNode f,
DdNode ***  disjuncts 
)

◆ Cudd_bddIthVar()

DdNode* Cudd_bddIthVar ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the BDD variable with index i.]

Description [Retrieves the BDD variable with index i if it already exists, or creates a new BDD variable. Returns a pointer to the variable if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddNewVar Cudd_addIthVar Cudd_bddNewVarAtLevel Cudd_ReadVars]

Definition at line 430 of file cuddAPI.c.

433 {
434  DdNode *res;
435 
436  if ((unsigned int) i >= CUDD_MAXINDEX - 1) return(NULL);
437  if (i < dd->size) {
438  res = dd->vars[i];
439  } else {
440  res = cuddUniqueInter(dd,i,dd->one,Cudd_Not(dd->one));
441  }
442 
443  return(res);
444 
445 } /* end of Cudd_bddIthVar */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode ** vars
Definition: cuddInt.h:373
DdNode * one
Definition: cuddInt.h:329
#define CUDD_MAXINDEX
Definition: cudd.h:108
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137

◆ Cudd_bddLargestPrimeUnate()

DdNode* Cudd_bddLargestPrimeUnate ( DdManager dd,
DdNode f,
DdNode phaseBdd 
)

Function********************************************************************

Synopsis [Find a largest prime of a unate function.]

Description [Find a largest prime implicant of a unate function. Returns the BDD for the prime if succesful; NULL otherwise. The behavior is undefined if f is not unate. The third argument is used to determine whether f is unate positive (increasing) or negative (decreasing) in each of the variables in its support.]

SideEffects [None]

SeeAlso [Cudd_bddMaximallyExpand]

Definition at line 941 of file cuddSat.c.

945 {
946  DdNode *res;
947  int *phases;
948  int retval;
949  st_table *table;
950 
951  /* Extract phase vector for quick access. */
952  phases = ALLOC(int, dd->size);
953  if (phases == NULL) return(NULL);
954  retval = Cudd_BddToCubeArray(dd, phaseBdd, phases);
955  if (retval == 0) {
956  FREE(phases);
957  return(NULL);
958  }
959  do {
960  dd->reordered = 0;
962  if (table == NULL) {
963  FREE(phases);
964  return(NULL);
965  }
966  (void) ddBddShortestPathUnate(dd, f, phases, table);
967  res = ddGetLargestCubeUnate(dd, f, phases, table);
968  st_free_table(table);
969  } while (dd->reordered == 1);
970 
971  FREE(phases);
972  return(res);
973 
974 } /* end of Cudd_bddLargestPrimeUnate */
Definition: st.h:60
Definition: cudd.h:270
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
void st_free_table(st_table *)
Definition: st.c:252
int reordered
Definition: cuddInt.h:392
#define ALLOC(type, num)
Definition: util.h:76
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
static DdNode * ddGetLargestCubeUnate(DdManager *dd, DdNode *f, int *phases, st_table *table)
Definition: cuddSat.c:1717
static int ddBddShortestPathUnate(DdManager *dd, DdNode *f, int *phases, st_table *table)
Definition: cuddSat.c:1665
int st_ptrhash(char *, int)
Definition: st.c:811
int Cudd_BddToCubeArray(DdManager *dd, DdNode *cube, int *array)
Definition: cuddUtil.c:2354

◆ Cudd_bddLeq()

int Cudd_bddLeq ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Determines whether f is less than or equal to g.]

Description [Returns 1 if f is less than or equal to g; 0 otherwise. No new nodes are created.]

SideEffects [None]

SeeAlso [Cudd_bddIteConstant Cudd_addEvalConst]

Definition at line 645 of file cuddBddIte.c.

649 {
650  DdNode *one, *zero, *tmp, *F, *fv, *fvn, *gv, *gvn;
651  unsigned int topf, topg, res;
652 
653  statLine(dd);
654  /* Terminal cases and normalization. */
655  if (f == g) return(1);
656 
657  if (Cudd_IsComplement(g)) {
658  /* Special case: if f is regular and g is complemented,
659  ** f(1,...,1) = 1 > 0 = g(1,...,1).
660  */
661  if (!Cudd_IsComplement(f)) return(0);
662  /* Both are complemented: Swap and complement because
663  ** f <= g <=> g' <= f' and we want the second argument to be regular.
664  */
665  tmp = g;
666  g = Cudd_Not(f);
667  f = Cudd_Not(tmp);
668  } else if (Cudd_IsComplement(f) && g < f) {
669  tmp = g;
670  g = Cudd_Not(f);
671  f = Cudd_Not(tmp);
672  }
673 
674  /* Now g is regular and, if f is not regular, f < g. */
675  one = DD_ONE(dd);
676  if (g == one) return(1); /* no need to test against zero */
677  if (f == one) return(0); /* since at this point g != one */
678  if (Cudd_Not(f) == g) return(0); /* because neither is constant */
679  zero = Cudd_Not(one);
680  if (f == zero) return(1);
681 
682  /* Here neither f nor g is constant. */
683 
684  /* Check cache. */
685  tmp = cuddCacheLookup2(dd,(DD_CTFP)Cudd_bddLeq,f,g);
686  if (tmp != NULL) {
687  return(tmp == one);
688  }
689 
690  /* Compute cofactors. */
691  F = Cudd_Regular(f);
692  topf = dd->perm[F->index];
693  topg = dd->perm[g->index];
694  if (topf <= topg) {
695  fv = cuddT(F); fvn = cuddE(F);
696  if (f != F) {
697  fv = Cudd_Not(fv);
698  fvn = Cudd_Not(fvn);
699  }
700  } else {
701  fv = fvn = f;
702  }
703  if (topg <= topf) {
704  gv = cuddT(g); gvn = cuddE(g);
705  } else {
706  gv = gvn = g;
707  }
708 
709  /* Recursive calls. Since we want to maximize the probability of
710  ** the special case f(1,...,1) > g(1,...,1), we consider the negative
711  ** cofactors first. Indeed, the complementation parity of the positive
712  ** cofactors is the same as the one of the parent functions.
713  */
714  res = Cudd_bddLeq(dd,fvn,gvn) && Cudd_bddLeq(dd,fv,gv);
715 
716  /* Store result in cache and return. */
717  cuddCacheInsert2(dd,(DD_CTFP)Cudd_bddLeq,f,g,(res ? one : zero));
718  return(res);
719 
720 } /* end of Cudd_bddLeq */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode * cuddCacheLookup2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
#define Cudd_Regular(node)
Definition: cudd.h:384
#define statLine(dd)
Definition: cuddInt.h:990
static DdNode * one
Definition: cuddSat.c:105
#define Cudd_IsComplement(node)
Definition: cudd.h:412
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
#define cuddT(node)
Definition: cuddInt.h:609
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
static DdNode * zero
Definition: cuddSat.c:105
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddLeqUnless()

int Cudd_bddLeqUnless ( DdManager dd,
DdNode f,
DdNode g,
DdNode D 
)

Function********************************************************************

Synopsis [Tells whether f is less than of equal to G unless D is 1.]

Description [Tells whether f is less than of equal to G unless D is

  1. f, g, and D are BDDs. The function returns 1 if f is less than of equal to G, and 0 otherwise. No new nodes are created.]

SideEffects [None]

SeeAlso [Cudd_EquivDC Cudd_bddLeq Cudd_bddIteConstant]

Definition at line 629 of file cuddSat.c.

634 {
635  DdNode *tmp, *One, *F, *G;
636  DdNode *Ft, *Fe, *Gt, *Ge, *Dt, *De;
637  int res;
638  unsigned int flevel, glevel, dlevel, top;
639 
640  statLine(dd);
641 
642  One = DD_ONE(dd);
643 
644  /* Check terminal cases. */
645  if (f == g || g == One || f == Cudd_Not(One) || D == One ||
646  D == f || D == Cudd_Not(g)) return(1);
647  /* Check for two-operand cases. */
648  if (D == Cudd_Not(One) || D == g || D == Cudd_Not(f))
649  return(Cudd_bddLeq(dd,f,g));
650  if (g == Cudd_Not(One) || g == Cudd_Not(f)) return(Cudd_bddLeq(dd,f,D));
651  if (f == One) return(Cudd_bddLeq(dd,Cudd_Not(g),D));
652 
653  /* From now on, f, g, and D are non-constant, distinct, and
654  ** non-complementary. */
655 
656  /* Normalize call to increase cache efficiency. We rely on the
657  ** fact that f <= g unless D is equivalent to not(g) <= not(f)
658  ** unless D and to f <= D unless g. We make sure that D is
659  ** regular, and that at most one of f and g is complemented. We also
660  ** ensure that when two operands can be swapped, the one with the
661  ** lowest address comes first. */
662 
663  if (Cudd_IsComplement(D)) {
664  if (Cudd_IsComplement(g)) {
665  /* Special case: if f is regular and g is complemented,
666  ** f(1,...,1) = 1 > 0 = g(1,...,1). If D(1,...,1) = 0, return 0.
667  */
668  if (!Cudd_IsComplement(f)) return(0);
669  /* !g <= D unless !f or !D <= g unless !f */
670  tmp = D;
671  D = Cudd_Not(f);
672  if (g < tmp) {
673  f = Cudd_Not(g);
674  g = tmp;
675  } else {
676  f = Cudd_Not(tmp);
677  }
678  } else {
679  if (Cudd_IsComplement(f)) {
680  /* !D <= !f unless g or !D <= g unless !f */
681  tmp = f;
682  f = Cudd_Not(D);
683  if (tmp < g) {
684  D = g;
685  g = Cudd_Not(tmp);
686  } else {
687  D = Cudd_Not(tmp);
688  }
689  } else {
690  /* f <= D unless g or !D <= !f unless g */
691  tmp = D;
692  D = g;
693  if (tmp < f) {
694  g = Cudd_Not(f);
695  f = Cudd_Not(tmp);
696  } else {
697  g = tmp;
698  }
699  }
700  }
701  } else {
702  if (Cudd_IsComplement(g)) {
703  if (Cudd_IsComplement(f)) {
704  /* !g <= !f unless D or !g <= D unless !f */
705  tmp = f;
706  f = Cudd_Not(g);
707  if (D < tmp) {
708  g = D;
709  D = Cudd_Not(tmp);
710  } else {
711  g = Cudd_Not(tmp);
712  }
713  } else {
714  /* f <= g unless D or !g <= !f unless D */
715  if (g < f) {
716  tmp = g;
717  g = Cudd_Not(f);
718  f = Cudd_Not(tmp);
719  }
720  }
721  } else {
722  /* f <= g unless D or f <= D unless g */
723  if (D < g) {
724  tmp = D;
725  D = g;
726  g = tmp;
727  }
728  }
729  }
730 
731  /* From now on, D is regular. */
732 
733  /* Check cache. */
734  tmp = cuddCacheLookup(dd,DD_BDD_LEQ_UNLESS_TAG,f,g,D);
735  if (tmp != NULL) return(tmp == One);
736 
737  /* Find splitting variable. */
738  F = Cudd_Regular(f);
739  flevel = dd->perm[F->index];
740  G = Cudd_Regular(g);
741  glevel = dd->perm[G->index];
742  top = ddMin(flevel,glevel);
743  dlevel = dd->perm[D->index];
744  top = ddMin(top,dlevel);
745 
746  /* Compute cofactors. */
747  if (top == flevel) {
748  Ft = cuddT(F);
749  Fe = cuddE(F);
750  if (F != f) {
751  Ft = Cudd_Not(Ft);
752  Fe = Cudd_Not(Fe);
753  }
754  } else {
755  Ft = Fe = f;
756  }
757  if (top == glevel) {
758  Gt = cuddT(G);
759  Ge = cuddE(G);
760  if (G != g) {
761  Gt = Cudd_Not(Gt);
762  Ge = Cudd_Not(Ge);
763  }
764  } else {
765  Gt = Ge = g;
766  }
767  if (top == dlevel) {
768  Dt = cuddT(D);
769  De = cuddE(D);
770  } else {
771  Dt = De = D;
772  }
773 
774  /* Solve recursively. */
775  res = Cudd_bddLeqUnless(dd,Ft,Gt,Dt);
776  if (res != 0) {
777  res = Cudd_bddLeqUnless(dd,Fe,Ge,De);
778  }
780 
781  return(res);
782 
783 } /* end of Cudd_bddLeqUnless */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define Cudd_Regular(node)
Definition: cudd.h:384
#define statLine(dd)
Definition: cuddInt.h:990
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define ddMin(x, y)
Definition: cuddInt.h:771
#define cuddT(node)
Definition: cuddInt.h:609
#define DD_BDD_LEQ_UNLESS_TAG
Definition: cuddInt.h:189
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
DdNode * cuddCacheLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:347
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
void cuddCacheInsert(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data)
Definition: cuddCache.c:217
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369
int Cudd_bddLeqUnless(DdManager *dd, DdNode *f, DdNode *g, DdNode *D)
Definition: cuddSat.c:629

◆ Cudd_bddLICompaction()

DdNode* Cudd_bddLICompaction ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_bddLiteralSetIntersection()

DdNode* Cudd_bddLiteralSetIntersection ( DdManager dd,
DdNode f,
DdNode g 
)

◆ Cudd_bddMakePrime()

DdNode* Cudd_bddMakePrime ( DdManager dd,
DdNode cube,
DdNode f 
)

Function********************************************************************

Synopsis [Expands cube to a prime implicant of f.]

Description [Expands cube to a prime implicant of f. Returns the prime if successful; NULL otherwise. In particular, NULL is returned if cube is not a real cube or is not an implicant of f.]

SideEffects [None]

SeeAlso [Cudd_bddMaximallyExpand]

Definition at line 871 of file cuddSat.c.

875 {
876  DdNode *res;
877 
878  if (!Cudd_bddLeq(dd,cube,f)) return(NULL);
879 
880  do {
881  dd->reordered = 0;
882  res = cuddBddMakePrime(dd,cube,f);
883  } while (dd->reordered == 1);
884  return(res);
885 
886 } /* end of Cudd_bddMakePrime */
Definition: cudd.h:270
DdNode * cuddBddMakePrime(DdManager *dd, DdNode *cube, DdNode *f)
Definition: cuddSat.c:995
int reordered
Definition: cuddInt.h:392
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645

◆ Cudd_bddMaximallyExpand()

DdNode* Cudd_bddMaximallyExpand ( DdManager dd,
DdNode lb,
DdNode ub,
DdNode f 
)

Function********************************************************************

Synopsis [Expands lb to prime implicants of (f and ub).]

Description [Expands lb to all prime implicants of (f and ub) that contain lb. Assumes that lb is contained in ub. Returns the disjunction of the primes if lb is contained in f; returns the zero BDD if lb is not contained in f; returns NULL in case of failure. In particular, NULL is returned if cube is not a real cube or is not an implicant of f. Returning the disjunction of all prime implicants works because the resulting function is unate.]

SideEffects [None]

SeeAlso [Cudd_bddMakePrime]

Definition at line 906 of file cuddSat.c.

911 {
912  DdNode *res;
913 
914  if (!Cudd_bddLeq(dd,lb,ub)) return(NULL);
915 
916  do {
917  dd->reordered = 0;
918  res = ddBddMaximallyExpand(dd,lb,ub,f);
919  } while (dd->reordered == 1);
920  return(res);
921 
922 } /* end of Cudd_bddMaximallyExpand */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
static DdNode * ddBddMaximallyExpand(DdManager *dd, DdNode *lb, DdNode *ub, DdNode *f)
Definition: cuddSat.c:1456
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645

◆ Cudd_bddMinimize()

DdNode* Cudd_bddMinimize ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_bddNand()

DdNode* Cudd_bddNand ( DdManager dd,
DdNode f,
DdNode g 
)

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; NULL if the intermediate result blows up.]

SideEffects [None]

SeeAlso [Cudd_bddIte Cudd_addApply Cudd_bddAnd Cudd_bddOr Cudd_bddNor Cudd_bddXor Cudd_bddXnor]

Definition at line 486 of file cuddBddIte.c.

490 {
491  DdNode *res;
492 
493  do {
494  dd->reordered = 0;
495  res = cuddBddAndRecur(dd,f,g);
496  } while (dd->reordered == 1);
497  res = Cudd_NotCond(res,res != NULL);
498  return(res);
499 
500 } /* end of Cudd_bddNand */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddNewVar()

DdNode* Cudd_bddNewVar ( DdManager dd)

Function********************************************************************

Synopsis [Returns a new BDD variable.]

Description [Creates a new BDD variable. The new variable has an index equal to the largest previous index plus 1. Returns a pointer to the new variable if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_addNewVar Cudd_bddIthVar Cudd_bddNewVarAtLevel]

Definition at line 337 of file cuddAPI.c.

339 {
340  DdNode *res;
341 
342  if ((unsigned int) dd->size >= CUDD_MAXINDEX - 1) return(NULL);
343  res = cuddUniqueInter(dd,dd->size,dd->one,Cudd_Not(dd->one));
344 
345  return(res);
346 
347 } /* end of Cudd_bddNewVar */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int size
Definition: cuddInt.h:345
DdNode * one
Definition: cuddInt.h:329
#define CUDD_MAXINDEX
Definition: cudd.h:108
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137

◆ Cudd_bddNewVarAtLevel()

DdNode* Cudd_bddNewVarAtLevel ( DdManager dd,
int  level 
)

Function********************************************************************

Synopsis [Returns a new BDD variable at a specified level.]

Description [Creates a new BDD variable. The new variable has an index equal to the largest previous index plus 1 and is positioned at the specified level in the order. Returns a pointer to the new variable if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddNewVar Cudd_bddIthVar Cudd_addNewVarAtLevel]

Definition at line 365 of file cuddAPI.c.

368 {
369  DdNode *res;
370 
371  if ((unsigned int) dd->size >= CUDD_MAXINDEX - 1) return(NULL);
372  if (level >= dd->size) return(Cudd_bddIthVar(dd,level));
373  if (!cuddInsertSubtables(dd,1,level)) return(NULL);
374  res = dd->vars[dd->size - 1];
375 
376  return(res);
377 
378 } /* end of Cudd_bddNewVarAtLevel */
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:430
int cuddInsertSubtables(DdManager *unique, int n, int level)
Definition: cuddTable.c:1824
DdNode ** vars
Definition: cuddInt.h:373
#define CUDD_MAXINDEX
Definition: cudd.h:108

◆ Cudd_bddNor()

DdNode* Cudd_bddNor ( DdManager dd,
DdNode f,
DdNode g 
)

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]

Definition at line 518 of file cuddBddIte.c.

522 {
523  DdNode *res;
524 
525  do {
526  dd->reordered = 0;
527  res = cuddBddAndRecur(dd,Cudd_Not(f),Cudd_Not(g));
528  } while (dd->reordered == 1);
529  return(res);
530 
531 } /* end of Cudd_bddNor */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddNPAnd()

DdNode* Cudd_bddNPAnd ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_bddOr()

DdNode* Cudd_bddOr ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Computes the disjunction of two BDDs f and g.]

Description [Computes the disjunction 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_bddNand Cudd_bddNor Cudd_bddXor Cudd_bddXnor]

Definition at line 417 of file cuddBddIte.c.

421 {
422  DdNode *res;
423 
424  do {
425  dd->reordered = 0;
426  res = cuddBddAndRecur(dd,Cudd_Not(f),Cudd_Not(g));
427  } while (dd->reordered == 1);
428  res = Cudd_NotCond(res,res != NULL);
429  return(res);
430 
431 } /* end of Cudd_bddOr */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int reordered
Definition: cuddInt.h:392
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddOrLimit()

DdNode* Cudd_bddOrLimit ( DdManager dd,
DdNode f,
DdNode g,
unsigned int  limit 
)

Function********************************************************************

Synopsis [Computes the disjunction of two BDDs f and g. Returns NULL if too many nodes are required.]

Description [Computes the disjunction 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 limit are required.]

SideEffects [None]

SeeAlso [Cudd_bddOr]

Definition at line 450 of file cuddBddIte.c.

455 {
456  DdNode *res;
457  unsigned int saveLimit = dd->maxLive;
458 
459  dd->maxLive = (dd->keys - dd->dead) + (dd->keysZ - dd->deadZ) + limit;
460  do {
461  dd->reordered = 0;
462  res = cuddBddAndRecur(dd,Cudd_Not(f),Cudd_Not(g));
463  } while (dd->reordered == 1);
464  dd->maxLive = saveLimit;
465  res = Cudd_NotCond(res,res != NULL);
466  return(res);
467 
468 } /* end of Cudd_bddOrLimit */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
unsigned int deadZ
Definition: cuddInt.h:356
int reordered
Definition: cuddInt.h:392
unsigned int dead
Definition: cuddInt.h:355
unsigned int maxLive
Definition: cuddInt.h:357
unsigned int keys
Definition: cuddInt.h:353
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
unsigned int keysZ
Definition: cuddInt.h:354
DdNode * cuddBddAndRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:995

◆ Cudd_bddPermute()

DdNode* Cudd_bddPermute ( DdManager manager,
DdNode node,
int *  permut 
)

◆ Cudd_bddPickArbitraryMinterms()

DdNode** Cudd_bddPickArbitraryMinterms ( DdManager dd,
DdNode f,
DdNode **  vars,
int  n,
int  k 
)

Function********************************************************************

Synopsis [Picks k on-set minterms evenly distributed from given DD.]

Description [Picks k on-set minterms evenly distributed from given DD. The minterms are in terms of vars. The array vars should contain at least all variables in the support of f; if this condition is not met the minterms built by this procedure may not be contained in f. Builds an array of BDDs for the minterms and returns a pointer to it if successful; NULL otherwise. There are three reasons why the procedure may fail:

  • It may run out of memory;
  • the function f may be the constant 0;
  • the minterms may not be contained in f.

]

SideEffects [None]

SeeAlso [Cudd_bddPickOneMinterm Cudd_bddPickOneCube]

Definition at line 1401 of file cuddUtil.c.

1407 {
1408  char **string;
1409  int i, j, l, size;
1410  int *indices;
1411  int result;
1412  DdNode **old, *neW;
1413  double minterms;
1414  char *saveString;
1415  int saveFlag, savePoint, isSame;
1416 
1417  minterms = Cudd_CountMinterm(dd,f,n);
1418  if ((double)k > minterms) {
1419  return(NULL);
1420  }
1421 
1422  size = dd->size;
1423  string = ALLOC(char *, k);
1424  if (string == NULL) {
1425  dd->errorCode = CUDD_MEMORY_OUT;
1426  return(NULL);
1427  }
1428  for (i = 0; i < k; i++) {
1429  string[i] = ALLOC(char, size + 1);
1430  if (string[i] == NULL) {
1431  for (j = 0; j < i; j++)
1432  FREE(string[i]);
1433  FREE(string);
1434  dd->errorCode = CUDD_MEMORY_OUT;
1435  return(NULL);
1436  }
1437  for (j = 0; j < size; j++) string[i][j] = '2';
1438  string[i][size] = '\0';
1439  }
1440  indices = ALLOC(int,n);
1441  if (indices == NULL) {
1442  dd->errorCode = CUDD_MEMORY_OUT;
1443  for (i = 0; i < k; i++)
1444  FREE(string[i]);
1445  FREE(string);
1446  return(NULL);
1447  }
1448 
1449  for (i = 0; i < n; i++) {
1450  indices[i] = vars[i]->index;
1451  }
1452 
1453  result = ddPickArbitraryMinterms(dd,f,n,k,string);
1454  if (result == 0) {
1455  for (i = 0; i < k; i++)
1456  FREE(string[i]);
1457  FREE(string);
1458  FREE(indices);
1459  return(NULL);
1460  }
1461 
1462  old = ALLOC(DdNode *, k);
1463  if (old == NULL) {
1464  dd->errorCode = CUDD_MEMORY_OUT;
1465  for (i = 0; i < k; i++)
1466  FREE(string[i]);
1467  FREE(string);
1468  FREE(indices);
1469  return(NULL);
1470  }
1471  saveString = ALLOC(char, size + 1);
1472  if (saveString == NULL) {
1473  dd->errorCode = CUDD_MEMORY_OUT;
1474  for (i = 0; i < k; i++)
1475  FREE(string[i]);
1476  FREE(string);
1477  FREE(indices);
1478  FREE(old);
1479  return(NULL);
1480  }
1481  saveFlag = 0;
1482 
1483  /* Build result BDD array. */
1484  for (i = 0; i < k; i++) {
1485  isSame = 0;
1486  if (!saveFlag) {
1487  for (j = i + 1; j < k; j++) {
1488  if (strcmp(string[i], string[j]) == 0) {
1489  savePoint = i;
1490  strcpy(saveString, string[i]);
1491  saveFlag = 1;
1492  break;
1493  }
1494  }
1495  } else {
1496  if (strcmp(string[i], saveString) == 0) {
1497  isSame = 1;
1498  } else {
1499  saveFlag = 0;
1500  for (j = i + 1; j < k; j++) {
1501  if (strcmp(string[i], string[j]) == 0) {
1502  savePoint = i;
1503  strcpy(saveString, string[i]);
1504  saveFlag = 1;
1505  break;
1506  }
1507  }
1508  }
1509  }
1510  /* Randomize choice for don't cares. */
1511  for (j = 0; j < n; j++) {
1512  if (string[i][indices[j]] == '2')
1513  string[i][indices[j]] =
1514  (char) ((Cudd_Random() & 0x20) ? '1' : '0');
1515  }
1516 
1517  while (isSame) {
1518  isSame = 0;
1519  for (j = savePoint; j < i; j++) {
1520  if (strcmp(string[i], string[j]) == 0) {
1521  isSame = 1;
1522  break;
1523  }
1524  }
1525  if (isSame) {
1526  strcpy(string[i], saveString);
1527  /* Randomize choice for don't cares. */
1528  for (j = 0; j < n; j++) {
1529  if (string[i][indices[j]] == '2')
1530  string[i][indices[j]] =
1531  (char) ((Cudd_Random() & 0x20) ? '1' : '0');
1532  }
1533  }
1534  }
1535 
1536  old[i] = Cudd_ReadOne(dd);
1537  cuddRef(old[i]);
1538 
1539  for (j = 0; j < n; j++) {
1540  if (string[i][indices[j]] == '0') {
1541  neW = Cudd_bddAnd(dd,old[i],Cudd_Not(vars[j]));
1542  } else {
1543  neW = Cudd_bddAnd(dd,old[i],vars[j]);
1544  }
1545  if (neW == NULL) {
1546  FREE(saveString);
1547  for (l = 0; l < k; l++)
1548  FREE(string[l]);
1549  FREE(string);
1550  FREE(indices);
1551  for (l = 0; l <= i; l++)
1552  Cudd_RecursiveDeref(dd,old[l]);
1553  FREE(old);
1554  return(NULL);
1555  }
1556  cuddRef(neW);
1557  Cudd_RecursiveDeref(dd,old[i]);
1558  old[i] = neW;
1559  }
1560 
1561  /* Test. */
1562  if (!Cudd_bddLeq(dd,old[i],f)) {
1563  FREE(saveString);
1564  for (l = 0; l < k; l++)
1565  FREE(string[l]);
1566  FREE(string);
1567  FREE(indices);
1568  for (l = 0; l <= i; l++)
1569  Cudd_RecursiveDeref(dd,old[l]);
1570  FREE(old);
1571  return(NULL);
1572  }
1573  }
1574 
1575  FREE(saveString);
1576  for (i = 0; i < k; i++) {
1577  cuddDeref(old[i]);
1578  FREE(string[i]);
1579  }
1580  FREE(string);
1581  FREE(indices);
1582  return(old);
1583 
1584 } /* end of Cudd_bddPickArbitraryMinterms */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
int strcmp()
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
static int ddPickArbitraryMinterms(DdManager *dd, DdNode *node, int nvars, int nminterms, char **string)
Definition: cuddUtil.c:3804
int size
Definition: cuddInt.h:345
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
Definition: cuddUtil.c:582
char * strcpy()
long Cudd_Random(void)
Definition: cuddUtil.c:2710
#define ALLOC(type, num)
Definition: util.h:76
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:1227
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
DdHalfWord index
Definition: cudd.h:271
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_bddPickOneCube()

int Cudd_bddPickOneCube ( DdManager ddm,
DdNode node,
char *  string 
)

Function********************************************************************

Synopsis [Picks one on-set cube randomly from the given DD.]

Description [Picks one on-set cube randomly from the given DD. The cube is written into an array of characters. The array must have at least as many entries as there are variables. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddPickOneMinterm]

Definition at line 1229 of file cuddUtil.c.

1233 {
1234  DdNode *N, *T, *E;
1235  DdNode *one, *bzero;
1236  char dir;
1237  int i;
1238 
1239  if (string == NULL || node == NULL) return(0);
1240 
1241  /* The constant 0 function has no on-set cubes. */
1242  one = DD_ONE(ddm);
1243  bzero = Cudd_Not(one);
1244  if (node == bzero) return(0);
1245 
1246  for (i = 0; i < ddm->size; i++) string[i] = 2;
1247 
1248  for (;;) {
1249 
1250  if (node == one) break;
1251 
1252  N = Cudd_Regular(node);
1253 
1254  T = cuddT(N); E = cuddE(N);
1255  if (Cudd_IsComplement(node)) {
1256  T = Cudd_Not(T); E = Cudd_Not(E);
1257  }
1258  if (T == bzero) {
1259  string[N->index] = 0;
1260  node = E;
1261  } else if (E == bzero) {
1262  string[N->index] = 1;
1263  node = T;
1264  } else {
1265  dir = (char) ((Cudd_Random() & 0x2000) >> 13);
1266  string[N->index] = dir;
1267  node = dir ? T : E;
1268  }
1269  }
1270  return(1);
1271 
1272 } /* end of Cudd_bddPickOneCube */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
long Cudd_Random(void)
Definition: cuddUtil.c:2710
static DdNode * one
Definition: cuddSat.c:105
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define cuddT(node)
Definition: cuddInt.h:609
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_bddPickOneMinterm()

DdNode* Cudd_bddPickOneMinterm ( DdManager dd,
DdNode f,
DdNode **  vars,
int  n 
)

Function********************************************************************

Synopsis [Picks one on-set minterm randomly from the given DD.]

Description [Picks one on-set minterm randomly from the given DD. The minterm is in terms of vars. The array vars should contain at least all variables in the support of f; if this condition is not met the minterm built by this procedure may not be contained in f. Builds a BDD for the minterm and returns a pointer to it if successful; NULL otherwise. There are three reasons why the procedure may fail:

  • It may run out of memory;
  • the function f may be the constant 0;
  • the minterm may not be contained in f.

]

SideEffects [None]

SeeAlso [Cudd_bddPickOneCube]

Definition at line 1299 of file cuddUtil.c.

1304 {
1305  char *string;
1306  int i, size;
1307  int *indices;
1308  int result;
1309  DdNode *old, *neW;
1310 
1311  size = dd->size;
1312  string = ALLOC(char, size);
1313  if (string == NULL) {
1314  dd->errorCode = CUDD_MEMORY_OUT;
1315  return(NULL);
1316  }
1317  indices = ALLOC(int,n);
1318  if (indices == NULL) {
1319  dd->errorCode = CUDD_MEMORY_OUT;
1320  FREE(string);
1321  return(NULL);
1322  }
1323 
1324  for (i = 0; i < n; i++) {
1325  indices[i] = vars[i]->index;
1326  }
1327 
1328  result = Cudd_bddPickOneCube(dd,f,string);
1329  if (result == 0) {
1330  FREE(string);
1331  FREE(indices);
1332  return(NULL);
1333  }
1334 
1335  /* Randomize choice for don't cares. */
1336  for (i = 0; i < n; i++) {
1337  if (string[indices[i]] == 2)
1338  string[indices[i]] = (char) ((Cudd_Random() & 0x20) >> 5);
1339  }
1340 
1341  /* Build result BDD. */
1342  old = Cudd_ReadOne(dd);
1343  cuddRef(old);
1344 
1345  for (i = n-1; i >= 0; i--) {
1346  neW = Cudd_bddAnd(dd,old,Cudd_NotCond(vars[i],string[indices[i]]==0));
1347  if (neW == NULL) {
1348  FREE(string);
1349  FREE(indices);
1350  Cudd_RecursiveDeref(dd,old);
1351  return(NULL);
1352  }
1353  cuddRef(neW);
1354  Cudd_RecursiveDeref(dd,old);
1355  old = neW;
1356  }
1357 
1358 #ifdef DD_DEBUG
1359  /* Test. */
1360  if (Cudd_bddLeq(dd,old,f)) {
1361  cuddDeref(old);
1362  } else {
1363  Cudd_RecursiveDeref(dd,old);
1364  old = NULL;
1365  }
1366 #else
1367  cuddDeref(old);
1368 #endif
1369 
1370  FREE(string);
1371  FREE(indices);
1372  return(old);
1373 
1374 } /* end of Cudd_bddPickOneMinterm */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
long Cudd_Random(void)
Definition: cuddUtil.c:2710
#define ALLOC(type, num)
Definition: util.h:76
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:1227
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
int Cudd_bddPickOneCube(DdManager *ddm, DdNode *node, char *string)
Definition: cuddUtil.c:1229
DdHalfWord index
Definition: cudd.h:271
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_bddPrintCover()

int Cudd_bddPrintCover ( DdManager dd,
DdNode l,
DdNode u 
)

Function********************************************************************

Synopsis [Prints a sum of prime implicants of a BDD.]

Description [Prints a sum of product cover for an incompletely specified function given by a lower bound and an upper bound. Each product is a prime implicant obtained by expanding the product corresponding to a path from node to the constant one. Uses the package default output file. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_PrintMinterm]

Definition at line 257 of file cuddUtil.c.

261 {
262  int *array;
263  int q, result;
264  DdNode *lb;
265 #ifdef DD_DEBUG
266  DdNode *cover;
267 #endif
268 
269  array = ALLOC(int, Cudd_ReadSize(dd));
270  if (array == NULL) return(0);
271  lb = l;
272  cuddRef(lb);
273 #ifdef DD_DEBUG
274  cover = Cudd_ReadLogicZero(dd);
275  cuddRef(cover);
276 #endif
277  while (lb != Cudd_ReadLogicZero(dd)) {
278  DdNode *implicant, *prime, *tmp;
279  int length;
280  implicant = Cudd_LargestCube(dd,lb,&length);
281  if (implicant == NULL) {
282  Cudd_RecursiveDeref(dd,lb);
283  FREE(array);
284  return(0);
285  }
286  cuddRef(implicant);
287  prime = Cudd_bddMakePrime(dd,implicant,u);
288  if (prime == NULL) {
289  Cudd_RecursiveDeref(dd,lb);
290  Cudd_RecursiveDeref(dd,implicant);
291  FREE(array);
292  return(0);
293  }
294  cuddRef(prime);
295  Cudd_RecursiveDeref(dd,implicant);
296  tmp = Cudd_bddAnd(dd,lb,Cudd_Not(prime));
297  if (tmp == NULL) {
298  Cudd_RecursiveDeref(dd,lb);
299  Cudd_RecursiveDeref(dd,prime);
300  FREE(array);
301  return(0);
302  }
303  cuddRef(tmp);
304  Cudd_RecursiveDeref(dd,lb);
305  lb = tmp;
306  result = Cudd_BddToCubeArray(dd,prime,array);
307  if (result == 0) {
308  Cudd_RecursiveDeref(dd,lb);
309  Cudd_RecursiveDeref(dd,prime);
310  FREE(array);
311  return(0);
312  }
313  for (q = 0; q < dd->size; q++) {
314  switch (array[q]) {
315  case 0:
316  (void) fprintf(dd->out, "0");
317  break;
318  case 1:
319  (void) fprintf(dd->out, "1");
320  break;
321  case 2:
322  (void) fprintf(dd->out, "-");
323  break;
324  default:
325  (void) fprintf(dd->out, "?");
326  }
327  }
328  (void) fprintf(dd->out, " 1\n");
329 #ifdef DD_DEBUG
330  tmp = Cudd_bddOr(dd,prime,cover);
331  if (tmp == NULL) {
332  Cudd_RecursiveDeref(dd,cover);
333  Cudd_RecursiveDeref(dd,lb);
334  Cudd_RecursiveDeref(dd,prime);
335  FREE(array);
336  return(0);
337  }
338  cuddRef(tmp);
339  Cudd_RecursiveDeref(dd,cover);
340  cover = tmp;
341 #endif
342  Cudd_RecursiveDeref(dd,prime);
343  }
344  (void) fprintf(dd->out, "\n");
345  Cudd_RecursiveDeref(dd,lb);
346  FREE(array);
347 #ifdef DD_DEBUG
348  if (!Cudd_bddLeq(dd,cover,u) || !Cudd_bddLeq(dd,l,cover)) {
349  Cudd_RecursiveDeref(dd,cover);
350  return(0);
351  }
352  Cudd_RecursiveDeref(dd,cover);
353 #endif
354  return(1);
355 
356 } /* end of Cudd_bddPrintCover */
#define cuddRef(n)
Definition: cuddInt.h:557
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1298
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1681
DdNode * Cudd_LargestCube(DdManager *manager, DdNode *f, int *length)
Definition: cuddSat.c:288
DdNode * Cudd_bddMakePrime(DdManager *dd, DdNode *cube, DdNode *f)
Definition: cuddSat.c:871
int Cudd_BddToCubeArray(DdManager *dd, DdNode *cube, int *array)
Definition: cuddUtil.c:2354
#define ALLOC(type, num)
Definition: util.h:76
FILE * out
Definition: cuddInt.h:423
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:417
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121

◆ Cudd_bddRead()

int Cudd_bddRead ( FILE *  fp,
DdManager dd,
DdNode **  E,
DdNode ***  x,
DdNode ***  y,
int *  nx,
int *  ny,
int *  m,
int *  n,
int  bx,
int  sx,
int  by,
int  sy 
)

◆ Cudd_bddReadPairIndex()

int Cudd_bddReadPairIndex ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Reads a corresponding pair index for a given index.]

Description [Reads a corresponding pair index for a given index. These pair indices are present and next state variable. Returns the corresponding variable index if the variable exists; -1 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetPairIndex]

Definition at line 4601 of file cuddAPI.c.

4604 {
4605  if (index >= dd->size || index < 0) return -1;
4606  return dd->subtables[dd->perm[index]].pairIndex;
4607 
4608 } /* end of Cudd_bddReadPairIndex */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
int pairIndex
Definition: cuddInt.h:321
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddRealignDisable()

void Cudd_bddRealignDisable ( DdManager unique)

Function********************************************************************

Synopsis [Disables realignment of ZDD order to BDD order.]

Description []

SideEffects [None]

SeeAlso [Cudd_bddRealignEnable Cudd_bddRealignmentEnabled Cudd_zddRealignEnable Cudd_zddRealignmentEnabled]

Definition at line 1205 of file cuddAPI.c.

1207 {
1208  unique->realignZ = 0;
1209  return;
1210 
1211 } /* end of Cudd_bddRealignDisable */
int realignZ
Definition: cuddInt.h:405

◆ Cudd_bddRealignEnable()

void Cudd_bddRealignEnable ( DdManager unique)

Function********************************************************************

Synopsis [Enables realignment of BDD order to ZDD order.]

Description [Enables realignment of the BDD variable order to the ZDD variable order after the ZDDs have been reordered. The number of ZDD variables must be a multiple of the number of BDD variables for realignment to make sense. If this condition is not met, Cudd_zddReduceHeap will return 0. Let M be the ratio of the two numbers. For the purpose of realignment, the ZDD variables from M*i to (M+1)*i-1 are reagarded as corresponding to BDD variable i. Realignment is initially disabled.]

SideEffects [None]

SeeAlso [Cudd_zddReduceHeap Cudd_bddRealignDisable Cudd_bddRealignmentEnabled Cudd_zddRealignDisable Cudd_zddRealignmentEnabled]

Definition at line 1183 of file cuddAPI.c.

1185 {
1186  unique->realignZ = 1;
1187  return;
1188 
1189 } /* end of Cudd_bddRealignEnable */
int realignZ
Definition: cuddInt.h:405

◆ Cudd_bddRealignmentEnabled()

int Cudd_bddRealignmentEnabled ( DdManager unique)

Function********************************************************************

Synopsis [Tells whether the realignment of BDD order to ZDD order is enabled.]

Description [Returns 1 if the realignment of BDD order to ZDD order is enabled; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddRealignEnable Cudd_bddRealignDisable Cudd_zddRealignEnable Cudd_zddRealignDisable]

Definition at line 1153 of file cuddAPI.c.

1155 {
1156  return(unique->realignZ);
1157 
1158 } /* end of Cudd_bddRealignmentEnabled */
int realignZ
Definition: cuddInt.h:405

◆ Cudd_bddResetVarToBeGrouped()

int Cudd_bddResetVarToBeGrouped ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Resets a variable not to be grouped.]

Description [Resets a variable not to be grouped. This function is used for lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetVarToBeGrouped Cudd_bddSetVarHardGroup]

Definition at line 4675 of file cuddAPI.c.

4678 {
4679  if (index >= dd->size || index < 0) return(0);
4680  if (dd->subtables[dd->perm[index]].varToBeGrouped <=
4682  dd->subtables[dd->perm[index]].varToBeGrouped = CUDD_LAZY_NONE;
4683  }
4684  return(1);
4685 
4686 } /* end of Cudd_bddResetVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddRestrict()

DdNode* Cudd_bddRestrict ( DdManager dd,
DdNode f,
DdNode c 
)

◆ Cudd_bddSetNsVar()

int Cudd_bddSetNsVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable type to next state.]

Description [Sets a variable type to next state. The variable type is used by lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetPiVar Cudd_bddSetPsVar Cudd_bddIsNsVar]

Definition at line 4478 of file cuddAPI.c.

4481 {
4482  if (index >= dd->size || index < 0) return (0);
4483  dd->subtables[dd->perm[index]].varType = CUDD_VAR_NEXT_STATE;
4484  return(1);
4485 
4486 } /* end of Cudd_bddSetNsVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetPairIndex()

int Cudd_bddSetPairIndex ( DdManager dd,
int  index,
int  pairIndex 
)

Function********************************************************************

Synopsis [Sets a corresponding pair index for a given index.]

Description [Sets a corresponding pair index for a given index. These pair indices are present and next state variable. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddReadPairIndex]

Definition at line 4575 of file cuddAPI.c.

4579 {
4580  if (index >= dd->size || index < 0) return(0);
4581  dd->subtables[dd->perm[index]].pairIndex = pairIndex;
4582  return(1);
4583 
4584 } /* end of Cudd_bddSetPairIndex */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
int pairIndex
Definition: cuddInt.h:321
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetPiVar()

int Cudd_bddSetPiVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable type to primary input.]

Description [Sets a variable type to primary input. The variable type is used by lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetPsVar Cudd_bddSetNsVar Cudd_bddIsPiVar]

Definition at line 4430 of file cuddAPI.c.

4433 {
4434  if (index >= dd->size || index < 0) return (0);
4435  dd->subtables[dd->perm[index]].varType = CUDD_VAR_PRIMARY_INPUT;
4436  return(1);
4437 
4438 } /* end of Cudd_bddSetPiVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetPsVar()

int Cudd_bddSetPsVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable type to present state.]

Description [Sets a variable type to present state. The variable type is used by lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetPiVar Cudd_bddSetNsVar Cudd_bddIsPsVar]

Definition at line 4454 of file cuddAPI.c.

4457 {
4458  if (index >= dd->size || index < 0) return (0);
4459  dd->subtables[dd->perm[index]].varType = CUDD_VAR_PRESENT_STATE;
4460  return(1);
4461 
4462 } /* end of Cudd_bddSetPsVar */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_VariableType varType
Definition: cuddInt.h:320
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetVarHardGroup()

int Cudd_bddSetVarHardGroup ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable to be a hard group.]

Description [Sets a variable to be a hard group. This function is used for lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetVarToBeGrouped Cudd_bddResetVarToBeGrouped Cudd_bddIsVarHardGroup]

Definition at line 4651 of file cuddAPI.c.

4654 {
4655  if (index >= dd->size || index < 0) return(0);
4657  return(1);
4658 
4659 } /* end of Cudd_bddSetVarHardGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetVarToBeGrouped()

int Cudd_bddSetVarToBeGrouped ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable to be grouped.]

Description [Sets a variable to be grouped. This function is used for lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddSetVarHardGroup Cudd_bddResetVarToBeGrouped]

Definition at line 4624 of file cuddAPI.c.

4627 {
4628  if (index >= dd->size || index < 0) return(0);
4629  if (dd->subtables[dd->perm[index]].varToBeGrouped <= CUDD_LAZY_SOFT_GROUP) {
4631  }
4632  return(1);
4633 
4634 } /* end of Cudd_bddSetVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSetVarToBeUngrouped()

int Cudd_bddSetVarToBeUngrouped ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Sets a variable to be ungrouped.]

Description [Sets a variable to be ungrouped. This function is used for lazy sifting. Returns 1 if successful; 0 otherwise.]

SideEffects [modifies the manager]

SeeAlso [Cudd_bddIsVarToBeUngrouped]

Definition at line 4728 of file cuddAPI.c.

4731 {
4732  if (index >= dd->size || index < 0) return(0);
4733  dd->subtables[dd->perm[index]].varToBeGrouped = CUDD_LAZY_UNGROUP;
4734  return(1);
4735 
4736 } /* end of Cudd_bddSetVarToBeGrouped */
int size
Definition: cuddInt.h:345
DdSubtable * subtables
Definition: cuddInt.h:349
Cudd_LazyGroupType varToBeGrouped
Definition: cuddInt.h:323
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddSqueeze()

DdNode* Cudd_bddSqueeze ( DdManager dd,
DdNode l,
DdNode u 
)

◆ Cudd_bddSwapVariables()

DdNode* Cudd_bddSwapVariables ( DdManager dd,
DdNode f,
DdNode **  x,
DdNode **  y,
int  n 
)

◆ Cudd_BddToAdd()

DdNode* Cudd_BddToAdd ( DdManager dd,
DdNode B 
)

◆ Cudd_BddToCubeArray()

int Cudd_BddToCubeArray ( DdManager dd,
DdNode cube,
int *  array 
)

Function********************************************************************

Synopsis [Builds a positional array from the BDD of a cube.]

Description [Builds a positional array from the BDD of a cube. Array must have one entry for each BDD variable. The positional array has 1 in i-th position if the variable of index i appears in true form in the cube; it has 0 in i-th position if the variable of index i appears in complemented form in the cube; finally, it has 2 in i-th position if the variable of index i does not appear in the cube. Returns 1 if successful (the BDD is indeed a cube); 0 otherwise.]

SideEffects [The result is in the array passed by reference.]

SeeAlso [Cudd_CubeArrayToBdd]

Definition at line 2354 of file cuddUtil.c.

2358 {
2359  DdNode *scan, *t, *e;
2360  int i;
2361  int size = Cudd_ReadSize(dd);
2362  DdNode *zero = Cudd_Not(DD_ONE(dd));
2363 
2364  for (i = size-1; i >= 0; i--) {
2365  array[i] = 2;
2366  }
2367  scan = cube;
2368  while (!Cudd_IsConstant(scan)) {
2369  int index = Cudd_Regular(scan)->index;
2370  cuddGetBranches(scan,&t,&e);
2371  if (t == zero) {
2372  array[index] = 0;
2373  scan = e;
2374  } else if (e == zero) {
2375  array[index] = 1;
2376  scan = t;
2377  } else {
2378  return(0); /* cube is not a cube */
2379  }
2380  }
2381  if (scan == zero) {
2382  return(0);
2383  } else {
2384  return(1);
2385  }
2386 
2387 } /* end of Cudd_BddToCubeArray */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define Cudd_IsConstant(node)
Definition: cudd.h:339
#define Cudd_Regular(node)
Definition: cudd.h:384
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1681
static DdNode * zero
Definition: cuddUtil.c:149
void cuddGetBranches(DdNode *g, DdNode **g1, DdNode **g0)
Definition: cuddCof.c:196
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_bddTransfer()

DdNode* Cudd_bddTransfer ( DdManager ddSource,
DdManager ddDestination,
DdNode f 
)

◆ Cudd_bddUnbindVar()

int Cudd_bddUnbindVar ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Allows the sifting of a variable.]

Description [This function resets the flag that prevents the sifting of a variable. In successive variable reorderings, the variable will NOT be skipped, that is, sifted. Initially all variables can be sifted. It is necessary to call this function only to re-enable sifting after a call to Cudd_bddBindVar. Returns 1 if successful; 0 otherwise (i.e., invalid variable index).]

SideEffects [Changes the "bindVar" flag in DdSubtable.]

SeeAlso [Cudd_bddBindVar]

Definition at line 4380 of file cuddAPI.c.

4383 {
4384  if (index >= dd->size || index < 0) return(0);
4385  dd->subtables[dd->perm[index]].bindVar = 0;
4386  return(1);
4387 
4388 } /* end of Cudd_bddUnbindVar */
int size
Definition: cuddInt.h:345
int bindVar
Definition: cuddInt.h:318
DdSubtable * subtables
Definition: cuddInt.h:349
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddUnivAbstract()

DdNode* Cudd_bddUnivAbstract ( DdManager manager,
DdNode f,
DdNode cube 
)

Function********************************************************************

Synopsis [Universally abstracts all the variables in cube from f.]

Description [Universally abstracts all the variables in cube from f. Returns the abstracted BDD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddExistAbstract Cudd_addUnivAbstract]

Definition at line 248 of file cuddBddAbs.c.

252 {
253  DdNode *res;
254 
255  if (bddCheckPositiveCube(manager, cube) == 0) {
256  (void) fprintf(manager->err,
257  "Error: Can only abstract positive cubes\n");
258  manager->errorCode = CUDD_INVALID_ARG;
259  return(NULL);
260  }
261 
262  do {
263  manager->reordered = 0;
264  res = cuddBddExistAbstractRecur(manager, Cudd_Not(f), cube);
265  } while (manager->reordered == 1);
266  if (res != NULL) res = Cudd_Not(res);
267 
268  return(res);
269 
270 } /* end of Cudd_bddUnivAbstract */
DdNode * cuddBddExistAbstractRecur(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:393
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
FILE * err
Definition: cuddInt.h:424
int reordered
Definition: cuddInt.h:392
static int bddCheckPositiveCube(DdManager *manager, DdNode *cube)
Definition: cuddBddAbs.c:747
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_bddVarConjDecomp()

int Cudd_bddVarConjDecomp ( DdManager dd,
DdNode f,
DdNode ***  conjuncts 
)

◆ Cudd_bddVarDisjDecomp()

int Cudd_bddVarDisjDecomp ( DdManager dd,
DdNode f,
DdNode ***  disjuncts 
)

◆ Cudd_bddVarIsBound()

int Cudd_bddVarIsBound ( DdManager dd,
int  index 
)

Function********************************************************************

Synopsis [Tells whether a variable can be sifted.]

Description [This function returns 1 if a variable is enabled for sifting. Initially all variables can be sifted. This function returns 0 only if there has been a previous call to Cudd_bddBindVar for that variable not followed by a call to Cudd_bddUnbindVar. The function returns 0 also in the case in which the index of the variable is out of bounds.]

SideEffects [none]

SeeAlso [Cudd_bddBindVar Cudd_bddUnbindVar]

Definition at line 4407 of file cuddAPI.c.

4410 {
4411  if (index >= dd->size || index < 0) return(0);
4412  return(dd->subtables[dd->perm[index]].bindVar);
4413 
4414 } /* end of Cudd_bddVarIsBound */
int size
Definition: cuddInt.h:345
int bindVar
Definition: cuddInt.h:318
DdSubtable * subtables
Definition: cuddInt.h:349
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddVarIsDependent()

int Cudd_bddVarIsDependent ( DdManager dd,
DdNode f,
DdNode var 
)

Function********************************************************************

Synopsis [Checks whether a variable is dependent on others in a function.]

Description [Checks whether a variable is dependent on others in a function. Returns 1 if the variable is dependent; 0 otherwise. No new nodes are created.]

SideEffects [None]

SeeAlso []

Definition at line 325 of file cuddBddAbs.c.

329 {
330  DdNode *F, *res, *zero, *ft, *fe;
331  unsigned topf, level;
332  DD_CTFP cacheOp;
333  int retval;
334 
335  zero = Cudd_Not(DD_ONE(dd));
336  if (Cudd_IsConstant(f)) return(f == zero);
337 
338  /* From now on f is not constant. */
339  F = Cudd_Regular(f);
340  topf = (unsigned) dd->perm[F->index];
341  level = (unsigned) dd->perm[var->index];
342 
343  /* Check terminal case. If topf > index of var, f does not depend on var.
344  ** Therefore, var is not dependent in f. */
345  if (topf > level) {
346  return(0);
347  }
348 
349  cacheOp = (DD_CTFP) Cudd_bddVarIsDependent;
350  res = cuddCacheLookup2(dd,cacheOp,f,var);
351  if (res != NULL) {
352  return(res != zero);
353  }
354 
355  /* Compute cofactors. */
356  ft = Cudd_NotCond(cuddT(F), f != F);
357  fe = Cudd_NotCond(cuddE(F), f != F);
358 
359  if (topf == level) {
360  retval = Cudd_bddLeq(dd,ft,Cudd_Not(fe));
361  } else {
362  retval = Cudd_bddVarIsDependent(dd,ft,var) &&
363  Cudd_bddVarIsDependent(dd,fe,var);
364  }
365 
366  cuddCacheInsert2(dd,cacheOp,f,var,Cudd_NotCond(zero,retval));
367 
368  return(retval);
369 
370 } /* Cudd_bddVarIsDependent */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode * cuddCacheLookup2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
#define Cudd_IsConstant(node)
Definition: cudd.h:339
#define Cudd_Regular(node)
Definition: cudd.h:384
int Cudd_bddVarIsDependent(DdManager *dd, DdNode *f, DdNode *var)
Definition: cuddBddAbs.c:325
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
#define cuddT(node)
Definition: cuddInt.h:609
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
static DdNode * zero
Definition: cuddSat.c:105
#define cuddE(node)
Definition: cuddInt.h:625
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369

◆ Cudd_bddVarMap()

DdNode* Cudd_bddVarMap ( DdManager manager,
DdNode f 
)

◆ Cudd_bddVectorCompose()

DdNode* Cudd_bddVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

◆ Cudd_bddXnor()

DdNode* Cudd_bddXnor ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Computes the exclusive NOR of two BDDs f and g.]

Description [Computes the exclusive 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_bddNor Cudd_bddXor]

Definition at line 580 of file cuddBddIte.c.

584 {
585  DdNode *res;
586 
587  do {
588  dd->reordered = 0;
589  res = cuddBddXorRecur(dd,f,Cudd_Not(g));
590  } while (dd->reordered == 1);
591  return(res);
592 
593 } /* end of Cudd_bddXnor */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddXorRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:1123

◆ Cudd_bddXnorLimit()

DdNode* Cudd_bddXnorLimit ( DdManager dd,
DdNode f,
DdNode g,
unsigned int  limit 
)

Function********************************************************************

Synopsis [Computes the exclusive NOR of two BDDs f and g. Returns NULL if too many nodes are required.]

Description [Computes the exclusive NOR 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 limit are required.]

SideEffects [None]

SeeAlso [Cudd_bddXnor]

Definition at line 612 of file cuddBddIte.c.

617 {
618  DdNode *res;
619  unsigned int saveLimit = dd->maxLive;
620 
621  dd->maxLive = (dd->keys - dd->dead) + (dd->keysZ - dd->deadZ) + limit;
622  do {
623  dd->reordered = 0;
624  res = cuddBddXorRecur(dd,f,Cudd_Not(g));
625  } while (dd->reordered == 1);
626  dd->maxLive = saveLimit;
627  return(res);
628 
629 } /* end of Cudd_bddXnorLimit */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
unsigned int deadZ
Definition: cuddInt.h:356
int reordered
Definition: cuddInt.h:392
unsigned int dead
Definition: cuddInt.h:355
unsigned int maxLive
Definition: cuddInt.h:357
unsigned int keys
Definition: cuddInt.h:353
DdNode * cuddBddXorRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:1123
unsigned int keysZ
Definition: cuddInt.h:354

◆ Cudd_bddXor()

DdNode* Cudd_bddXor ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Computes the exclusive OR of two BDDs f and g.]

Description [Computes the exclusive OR 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_bddNor Cudd_bddXnor]

Definition at line 549 of file cuddBddIte.c.

553 {
554  DdNode *res;
555 
556  do {
557  dd->reordered = 0;
558  res = cuddBddXorRecur(dd,f,g);
559  } while (dd->reordered == 1);
560  return(res);
561 
562 } /* end of Cudd_bddXor */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddXorRecur(DdManager *manager, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:1123

◆ Cudd_bddXorExistAbstract()

DdNode* Cudd_bddXorExistAbstract ( DdManager manager,
DdNode f,
DdNode g,
DdNode cube 
)

Function********************************************************************

Synopsis [Takes the exclusive OR of two BDDs and simultaneously abstracts the variables in cube.]

Description [Takes the exclusive OR 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_bddUnivAbstract Cudd_bddExistAbstract Cudd_bddAndAbstract]

Definition at line 210 of file cuddBddAbs.c.

215 {
216  DdNode *res;
217 
218  if (bddCheckPositiveCube(manager, cube) == 0) {
219  (void) fprintf(manager->err,
220  "Error: Can only abstract positive cubes\n");
221  manager->errorCode = CUDD_INVALID_ARG;
222  return(NULL);
223  }
224 
225  do {
226  manager->reordered = 0;
227  res = cuddBddXorExistAbstractRecur(manager, f, g, cube);
228  } while (manager->reordered == 1);
229 
230  return(res);
231 
232 } /* end of Cudd_bddXorExistAbstract */
Definition: cudd.h:270
FILE * err
Definition: cuddInt.h:424
int reordered
Definition: cuddInt.h:392
DdNode * cuddBddXorExistAbstractRecur(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
Definition: cuddBddAbs.c:503
static int bddCheckPositiveCube(DdManager *manager, DdNode *cube)
Definition: cuddBddAbs.c:747
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_BiasedOverApprox()

DdNode* Cudd_BiasedOverApprox ( DdManager dd,
DdNode f,
DdNode b,
int  numVars,
int  threshold,
double  quality1,
double  quality0 
)

◆ Cudd_BiasedUnderApprox()

DdNode* Cudd_BiasedUnderApprox ( DdManager dd,
DdNode f,
DdNode b,
int  numVars,
int  threshold,
double  quality1,
double  quality0 
)

◆ Cudd_CheckCube()

int Cudd_CheckCube ( DdManager dd,
DdNode g 
)

Function********************************************************************

Synopsis [Checks whether g is the BDD of a cube.]

Description [Checks whether g is the BDD of a cube. Returns 1 in case of success; 0 otherwise. The constant 1 is a valid cube, but all other constant functions cause cuddCheckCube to return 0.]

SideEffects [None]

SeeAlso []

Definition at line 155 of file cuddCof.c.

158 {
159  DdNode *g1,*g0,*one,*zero;
160 
161  one = DD_ONE(dd);
162  if (g == one) return(1);
163  if (Cudd_IsConstant(g)) return(0);
164 
165  zero = Cudd_Not(one);
166  cuddGetBranches(g,&g1,&g0);
167 
168  if (g0 == zero) {
169  return(Cudd_CheckCube(dd, g1));
170  }
171  if (g1 == zero) {
172  return(Cudd_CheckCube(dd, g0));
173  }
174  return(0);
175 
176 } /* end of Cudd_CheckCube */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define Cudd_IsConstant(node)
Definition: cudd.h:339
void cuddGetBranches(DdNode *g, DdNode **g1, DdNode **g0)
Definition: cuddCof.c:196
static DdNode * one
Definition: cuddSat.c:105
static DdNode * zero
Definition: cuddSat.c:105
int Cudd_CheckCube(DdManager *dd, DdNode *g)
Definition: cuddCof.c:155
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_CheckKeys()

int Cudd_CheckKeys ( DdManager table)

Function********************************************************************

Synopsis [Checks for several conditions that should not occur.]

Description [Checks for the following conditions:

  • Wrong sizes of subtables.
  • Wrong number of keys found in unique subtable.
  • Wrong number of dead found in unique subtable.
  • Wrong number of keys found in the constant table
  • Wrong number of dead found in the constant table
  • Wrong number of total slots found
  • Wrong number of maximum keys found
  • Wrong number of total dead found

Reports the average length of non-empty lists. Returns the number of subtables for which the number of keys is wrong.]

SideEffects [None]

SeeAlso [Cudd_DebugCheck]

Definition at line 460 of file cuddCheck.c.

462 {
463  int size;
464  int i,j;
465  DdNodePtr *nodelist;
466  DdNode *node;
467  DdNode *sentinel = &(table->sentinel);
468  DdSubtable *subtable;
469  int keys;
470  int dead;
471  int count = 0;
472  int totalKeys = 0;
473  int totalSlots = 0;
474  int totalDead = 0;
475  int nonEmpty = 0;
476  unsigned int slots;
477  int logSlots;
478  int shift;
479 
480  size = table->size;
481 
482  for (i = 0; i < size; i++) {
483  subtable = &(table->subtables[i]);
484  nodelist = subtable->nodelist;
485  keys = subtable->keys;
486  dead = subtable->dead;
487  totalKeys += keys;
488  slots = subtable->slots;
489  shift = subtable->shift;
490  logSlots = sizeof(int) * 8 - shift;
491  if (((slots >> logSlots) << logSlots) != slots) {
492  (void) fprintf(table->err,
493  "Unique table %d is not the right power of 2\n", i);
494  (void) fprintf(table->err,
495  " slots = %u shift = %d\n", slots, shift);
496  }
497  totalSlots += slots;
498  totalDead += dead;
499  for (j = 0; (unsigned) j < slots; j++) {
500  node = nodelist[j];
501  if (node != sentinel) {
502  nonEmpty++;
503  }
504  while (node != sentinel) {
505  keys--;
506  if (node->ref == 0) {
507  dead--;
508  }
509  node = node->next;
510  }
511  }
512  if (keys != 0) {
513  (void) fprintf(table->err, "Wrong number of keys found \
514 in unique table %d (difference=%d)\n", i, keys);
515  count++;
516  }
517  if (dead != 0) {
518  (void) fprintf(table->err, "Wrong number of dead found \
519 in unique table no. %d (difference=%d)\n", i, dead);
520  }
521  } /* for each BDD/ADD subtable */
522 
523  /* Check the ZDD subtables. */
524  size = table->sizeZ;
525 
526  for (i = 0; i < size; i++) {
527  subtable = &(table->subtableZ[i]);
528  nodelist = subtable->nodelist;
529  keys = subtable->keys;
530  dead = subtable->dead;
531  totalKeys += keys;
532  totalSlots += subtable->slots;
533  totalDead += dead;
534  for (j = 0; (unsigned) j < subtable->slots; j++) {
535  node = nodelist[j];
536  if (node != NULL) {
537  nonEmpty++;
538  }
539  while (node != NULL) {
540  keys--;
541  if (node->ref == 0) {
542  dead--;
543  }
544  node = node->next;
545  }
546  }
547  if (keys != 0) {
548  (void) fprintf(table->err, "Wrong number of keys found \
549 in ZDD unique table no. %d (difference=%d)\n", i, keys);
550  count++;
551  }
552  if (dead != 0) {
553  (void) fprintf(table->err, "Wrong number of dead found \
554 in ZDD unique table no. %d (difference=%d)\n", i, dead);
555  }
556  } /* for each ZDD subtable */
557 
558  /* Check the constant table. */
559  subtable = &(table->constants);
560  nodelist = subtable->nodelist;
561  keys = subtable->keys;
562  dead = subtable->dead;
563  totalKeys += keys;
564  totalSlots += subtable->slots;
565  totalDead += dead;
566  for (j = 0; (unsigned) j < subtable->slots; j++) {
567  node = nodelist[j];
568  if (node != NULL) {
569  nonEmpty++;
570  }
571  while (node != NULL) {
572  keys--;
573  if (node->ref == 0) {
574  dead--;
575  }
576  node = node->next;
577  }
578  }
579  if (keys != 0) {
580  (void) fprintf(table->err, "Wrong number of keys found \
581 in the constant table (difference=%d)\n", keys);
582  count++;
583  }
584  if (dead != 0) {
585  (void) fprintf(table->err, "Wrong number of dead found \
586 in the constant table (difference=%d)\n", dead);
587  }
588  if ((unsigned) totalKeys != table->keys + table->keysZ) {
589  (void) fprintf(table->err, "Wrong number of total keys found \
590 (difference=%d)\n", (int) (totalKeys-table->keys));
591  }
592  if ((unsigned) totalSlots != table->slots) {
593  (void) fprintf(table->err, "Wrong number of total slots found \
594 (difference=%d)\n", (int) (totalSlots-table->slots));
595  }
596  if (table->minDead != (unsigned) (table->gcFrac * table->slots)) {
597  (void) fprintf(table->err, "Wrong number of minimum dead found \
598 (%u vs. %u)\n", table->minDead,
599  (unsigned) (table->gcFrac * (double) table->slots));
600  }
601  if ((unsigned) totalDead != table->dead + table->deadZ) {
602  (void) fprintf(table->err, "Wrong number of total dead found \
603 (difference=%d)\n", (int) (totalDead-table->dead));
604  }
605  (void) fprintf(table->out,"Average length of non-empty lists = %g\n",
606  (double) table->keys / (double) nonEmpty);
607 
608  return(count);
609 
610 } /* end of Cudd_CheckKeys */
DdHalfWord ref
Definition: cudd.h:272
unsigned int keys
Definition: cuddInt.h:314
Definition: cudd.h:270
unsigned int deadZ
Definition: cuddInt.h:356
int size
Definition: cuddInt.h:345
double gcFrac
Definition: cuddInt.h:359
unsigned int slots
Definition: cuddInt.h:352
FILE * err
Definition: cuddInt.h:424
DdSubtable * subtables
Definition: cuddInt.h:349
unsigned int dead
Definition: cuddInt.h:355
DdNode sentinel
Definition: cuddInt.h:328
unsigned int keys
Definition: cuddInt.h:353
unsigned int dead
Definition: cuddInt.h:316
FILE * out
Definition: cuddInt.h:423
DdNode * next
Definition: cudd.h:273
DdNode ** nodelist
Definition: cuddInt.h:311
int sizeZ
Definition: cuddInt.h:346
unsigned int slots
Definition: cuddInt.h:313
DdSubtable constants
Definition: cuddInt.h:351
int shift
Definition: cuddInt.h:312
unsigned int keysZ
Definition: cuddInt.h:354
unsigned int minDead
Definition: cuddInt.h:358
DdSubtable * subtableZ
Definition: cuddInt.h:350

◆ Cudd_CheckZeroRef()

int Cudd_CheckZeroRef ( DdManager manager)

Function********************************************************************

Synopsis [Checks the unique table for nodes with non-zero reference counts.]

Description [Checks the unique table for nodes with non-zero reference counts. It is normally called before Cudd_Quit to make sure that there are no memory leaks due to missing Cudd_RecursiveDeref's. Takes into account that reference counts may saturate and that the basic constants and the projection functions are referenced by the manager. Returns the number of nodes with non-zero reference count. (Except for the cases mentioned above.)]

SideEffects [None]

SeeAlso []

Definition at line 462 of file cuddRef.c.

464 {
465  int size;
466  int i, j;
467  int remain; /* the expected number of remaining references to one */
468  DdNodePtr *nodelist;
469  DdNode *node;
470  DdNode *sentinel = &(manager->sentinel);
471  DdSubtable *subtable;
472  int count = 0;
473  int index;
474 
475 #ifndef DD_NO_DEATH_ROW
476  cuddClearDeathRow(manager);
477 #endif
478 
479  /* First look at the BDD/ADD subtables. */
480  remain = 1; /* reference from the manager */
481  size = manager->size;
482  remain += 2 * size; /* reference from the BDD projection functions */
483 
484  for (i = 0; i < size; i++) {
485  subtable = &(manager->subtables[i]);
486  nodelist = subtable->nodelist;
487  for (j = 0; (unsigned) j < subtable->slots; j++) {
488  node = nodelist[j];
489  while (node != sentinel) {
490  if (node->ref != 0 && node->ref != DD_MAXREF) {
491  index = (int) node->index;
492  if (node != manager->vars[index]) {
493  count++;
494  } else {
495  if (node->ref != 1) {
496  count++;
497  }
498  }
499  }
500  node = node->next;
501  }
502  }
503  }
504 
505  /* Then look at the ZDD subtables. */
506  size = manager->sizeZ;
507  if (size) /* references from ZDD universe */
508  remain += 2;
509 
510  for (i = 0; i < size; i++) {
511  subtable = &(manager->subtableZ[i]);
512  nodelist = subtable->nodelist;
513  for (j = 0; (unsigned) j < subtable->slots; j++) {
514  node = nodelist[j];
515  while (node != NULL) {
516  if (node->ref != 0 && node->ref != DD_MAXREF) {
517  index = (int) node->index;
518  if (node == manager->univ[manager->permZ[index]]) {
519  if (node->ref > 2) {
520  count++;
521  }
522  } else {
523  count++;
524  }
525  }
526  node = node->next;
527  }
528  }
529  }
530 
531  /* Now examine the constant table. Plusinfinity, minusinfinity, and
532  ** zero are referenced by the manager. One is referenced by the
533  ** manager, by the ZDD universe, and by all projection functions.
534  ** All other nodes should have no references.
535  */
536  nodelist = manager->constants.nodelist;
537  for (j = 0; (unsigned) j < manager->constants.slots; j++) {
538  node = nodelist[j];
539  while (node != NULL) {
540  if (node->ref != 0 && node->ref != DD_MAXREF) {
541  if (node == manager->one) {
542  if ((int) node->ref != remain) {
543  count++;
544  }
545  } else if (node == manager->zero ||
546  node == manager->plusinfinity ||
547  node == manager->minusinfinity) {
548  if (node->ref != 1) {
549  count++;
550  }
551  } else {
552  count++;
553  }
554  }
555  node = node->next;
556  }
557  }
558  return(count);
559 
560 } /* end of Cudd_CheckZeroRef */
DdHalfWord ref
Definition: cudd.h:272
#define DD_MAXREF
Definition: cuddInt.h:101
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
DdNode * zero
Definition: cuddInt.h:330
DdSubtable * subtables
Definition: cuddInt.h:349
int * permZ
Definition: cuddInt.h:370
DdNode sentinel
Definition: cuddInt.h:328
DdNode * next
Definition: cudd.h:273
DdNode ** nodelist
Definition: cuddInt.h:311
int sizeZ
Definition: cuddInt.h:346
DdHalfWord index
Definition: cudd.h:271
DdNode ** vars
Definition: cuddInt.h:373
DdNode * one
Definition: cuddInt.h:329
DdNode * plusinfinity
Definition: cuddInt.h:331
DdSubtable constants
Definition: cuddInt.h:351
DdNode * minusinfinity
Definition: cuddInt.h:332
void cuddClearDeathRow(DdManager *table)
Definition: cuddRef.c:722
DdSubtable * subtableZ
Definition: cuddInt.h:350
DdNode ** univ
Definition: cuddInt.h:375
if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool(dvf dda.cpp) else() add_executable(dvf dda.cpp) target_link_libraries(dvf Svf Cudd $
Definition: CMakeLists.txt:2

◆ Cudd_ClassifySupport()

int Cudd_ClassifySupport ( DdManager dd,
DdNode f,
DdNode g,
DdNode **  common,
DdNode **  onlyF,
DdNode **  onlyG 
)

Function********************************************************************

Synopsis [Classifies the variables in the support of two DDs.]

Description [Classifies the variables in the support of two DDs f and g, depending on whther they appear in both DDs, only in f, or only in g. Returns 1 if successful; 0 otherwise.]

SideEffects [The cubes of the three classes of variables are returned as side effects.]

SeeAlso [Cudd_Support Cudd_VectorSupport]

Definition at line 1101 of file cuddUtil.c.

1108 {
1109  int *supportF, *supportG;
1110  int fi, gi;
1111  int sizeF, sizeG;
1112 
1113  sizeF = Cudd_SupportIndices(dd, f, &supportF);
1114  if (sizeF == CUDD_OUT_OF_MEM)
1115  return(0);
1116 
1117  sizeG = Cudd_SupportIndices(dd, g, &supportG);
1118  if (sizeG == CUDD_OUT_OF_MEM) {
1119  FREE(supportF);
1120  return(0);
1121  }
1122 
1123  /* Classify variables and create cubes. This part of the procedure
1124  ** relies on the sorting of the indices in the two support arrays.
1125  */
1126  *common = *onlyF = *onlyG = DD_ONE(dd);
1127  cuddRef(*common); cuddRef(*onlyF); cuddRef(*onlyG);
1128  fi = sizeF - 1;
1129  gi = sizeG - 1;
1130  while (fi >= 0 || gi >= 0) {
1131  int indexF = fi >= 0 ? supportF[fi] : -1;
1132  int indexG = gi >= 0 ? supportG[gi] : -1;
1133  int index = ddMax(indexF, indexG);
1134  DdNode *var = dd->vars[index];
1135 #ifdef DD_DEBUG
1136  assert(index >= 0);
1137 #endif
1138  if (indexF == indexG) {
1139  DdNode *tmp = Cudd_bddAnd(dd,*common,var);
1140  if (tmp == NULL) {
1141  Cudd_RecursiveDeref(dd,*common);
1142  Cudd_RecursiveDeref(dd,*onlyF);
1143  Cudd_RecursiveDeref(dd,*onlyG);
1144  FREE(supportF); FREE(supportG);
1145  return(0);
1146  }
1147  cuddRef(tmp);
1148  Cudd_RecursiveDeref(dd,*common);
1149  *common = tmp;
1150  fi--;
1151  gi--;
1152  } else if (index == indexF) {
1153  DdNode *tmp = Cudd_bddAnd(dd,*onlyF,var);
1154  if (tmp == NULL) {
1155  Cudd_RecursiveDeref(dd,*common);
1156  Cudd_RecursiveDeref(dd,*onlyF);
1157  Cudd_RecursiveDeref(dd,*onlyG);
1158  FREE(supportF); FREE(supportG);
1159  return(0);
1160  }
1161  cuddRef(tmp);
1162  Cudd_RecursiveDeref(dd,*onlyF);
1163  *onlyF = tmp;
1164  fi--;
1165  } else { /* index == indexG */
1166  DdNode *tmp = Cudd_bddAnd(dd,*onlyG,var);
1167  if (tmp == NULL) {
1168  Cudd_RecursiveDeref(dd,*common);
1169  Cudd_RecursiveDeref(dd,*onlyF);
1170  Cudd_RecursiveDeref(dd,*onlyG);
1171  FREE(supportF); FREE(supportG);
1172  return(0);
1173  }
1174  cuddRef(tmp);
1175  Cudd_RecursiveDeref(dd,*onlyG);
1176  *onlyG = tmp;
1177  gi--;
1178  }
1179  }
1180 
1181  FREE(supportF); FREE(supportG);
1182  cuddDeref(*common); cuddDeref(*onlyF); cuddDeref(*onlyG);
1183  return(1);
1184 
1185 } /* end of Cudd_ClassifySupport */
#define cuddRef(n)
Definition: cuddInt.h:557
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
#define cuddDeref(n)
Definition: cuddInt.h:577
int Cudd_SupportIndices(DdManager *dd, DdNode *f, int **indices)
Definition: cuddUtil.c:744
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define FREE(obj)
Definition: util.h:80
#define assert(ex)
Definition: util.h:141
#define ddMax(x, y)
Definition: cuddInt.h:785
DdNode ** vars
Definition: cuddInt.h:373
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_ClearErrorCode()

void Cudd_ClearErrorCode ( DdManager dd)

Function********************************************************************

Synopsis [Clear the error code of a manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadErrorCode]

Definition at line 4085 of file cuddAPI.c.

4087 {
4088  dd->errorCode = CUDD_NO_ERROR;
4089 
4090 } /* end of Cudd_ClearErrorCode */
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_Cofactor()

DdNode* Cudd_Cofactor ( DdManager dd,
DdNode f,
DdNode g 
)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Computes the cofactor of f with respect to g.]

Description [Computes the cofactor of f with respect to g; g must be the BDD or the ADD of a cube. Returns a pointer to the cofactor if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddConstrain Cudd_bddRestrict]

Definition at line 119 of file cuddCof.c.

123 {
124  DdNode *res,*zero;
125 
126  zero = Cudd_Not(DD_ONE(dd));
127  if (g == zero || g == DD_ZERO(dd)) {
128  (void) fprintf(dd->err,"Cudd_Cofactor: Invalid restriction 1\n");
130  return(NULL);
131  }
132  do {
133  dd->reordered = 0;
134  res = cuddCofactorRecur(dd,f,g);
135  } while (dd->reordered == 1);
136  return(res);
137 
138 } /* end of Cudd_Cofactor */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
FILE * err
Definition: cuddInt.h:424
int reordered
Definition: cuddInt.h:392
DdNode * cuddCofactorRecur(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:226
static DdNode * zero
Definition: cuddSat.c:105
#define DD_ONE(dd)
Definition: cuddInt.h:864
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_CofMinterm()

double* Cudd_CofMinterm ( DdManager dd,
DdNode node 
)

◆ Cudd_CountLeaves()

int Cudd_CountLeaves ( DdNode node)

Function********************************************************************

Synopsis [Counts the number of leaves in a DD.]

Description [Counts the number of leaves in a DD. Returns the number of leaves in the DD rooted at node if successful; CUDD_OUT_OF_MEM otherwise.]

SideEffects [None]

SeeAlso [Cudd_PrintDebug]

Definition at line 1202 of file cuddUtil.c.

1204 {
1205  int i;
1206 
1207  i = ddLeavesInt(Cudd_Regular(node));
1208  ddClearFlag(Cudd_Regular(node));
1209  return(i);
1210 
1211 } /* end of Cudd_CountLeaves */
#define Cudd_Regular(node)
Definition: cudd.h:384
static int ddLeavesInt(DdNode *n)
Definition: cuddUtil.c:3772
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741

◆ Cudd_CountMinterm()

double Cudd_CountMinterm ( DdManager manager,
DdNode node,
int  nvars 
)

Function********************************************************************

Synopsis [Counts the number of minterms of a DD.]

Description [Counts the number of minterms of a DD. The function is assumed to depend on nvars variables. The minterm count is represented as a double, to allow for a larger number of variables. Returns the number of minterms of the function rooted at node if successful; (double) CUDD_OUT_OF_MEM otherwise.]

SideEffects [None]

SeeAlso [Cudd_PrintDebug Cudd_CountPath]

Definition at line 582 of file cuddUtil.c.

586 {
587  double max;
588  DdHashTable *table;
589  double res;
590  CUDD_VALUE_TYPE epsilon;
591 
592  background = manager->background;
593  zero = Cudd_Not(manager->one);
594 
595  max = pow(2.0,(double)nvars);
596  table = cuddHashTableInit(manager,1,2);
597  if (table == NULL) {
598  return((double)CUDD_OUT_OF_MEM);
599  }
600  epsilon = Cudd_ReadEpsilon(manager);
601  Cudd_SetEpsilon(manager,(CUDD_VALUE_TYPE)0.0);
602  res = ddCountMintermAux(node,max,table);
603  cuddHashTableQuit(table);
604  Cudd_SetEpsilon(manager,epsilon);
605 
606  return(res);
607 
608 } /* end of Cudd_CountMinterm */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
#define Cudd_Not(node)
Definition: cudd.h:354
static DdNode * background
Definition: cuddUtil.c:149
void Cudd_SetEpsilon(DdManager *dd, CUDD_VALUE_TYPE ep)
Definition: cuddAPI.c:2733
static DdNode * zero
Definition: cuddUtil.c:149
void cuddHashTableQuit(DdHashTable *hash)
Definition: cuddLCache.c:607
#define CUDD_VALUE_TYPE
Definition: cudd.h:90
DdNode * one
Definition: cuddInt.h:329
static double ddCountMintermAux(DdNode *node, double max, DdHashTable *table)
Definition: cuddUtil.c:3447
DdHashTable * cuddHashTableInit(DdManager *manager, unsigned int keySize, unsigned int initSize)
Definition: cuddLCache.c:557
CUDD_VALUE_TYPE Cudd_ReadEpsilon(DdManager *dd)
Definition: cuddAPI.c:2712
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_CountPath()

double Cudd_CountPath ( DdNode node)

Function********************************************************************

Synopsis [Counts the number of paths of a DD.]

Description [Counts the number of paths of a DD. Paths to all terminal nodes are counted. The path count is represented as a double, to allow for a larger number of variables. Returns the number of paths of the function rooted at node if successful; (double) CUDD_OUT_OF_MEM otherwise.]

SideEffects [None]

SeeAlso [Cudd_CountMinterm]

Definition at line 627 of file cuddUtil.c.

629 {
630 
631  st_table *table;
632  double i;
633 
635  if (table == NULL) {
636  return((double)CUDD_OUT_OF_MEM);
637  }
638  i = ddCountPathAux(Cudd_Regular(node),table);
639  st_foreach(table, cuddStCountfree, NULL);
640  st_free_table(table);
641  return(i);
642 
643 } /* end of Cudd_CountPath */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
Definition: st.h:60
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
static double ddCountPathAux(DdNode *node, st_table *table)
Definition: cuddUtil.c:3520
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
enum st_retval cuddStCountfree(char *key, char *value, char *arg)
Definition: cuddUtil.c:2903
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
int st_ptrhash(char *, int)
Definition: st.c:811

◆ Cudd_CountPathsToNonZero()

double Cudd_CountPathsToNonZero ( DdNode node)

Function********************************************************************

Synopsis [Counts the number of paths to a non-zero terminal of a DD.]

Description [Counts the number of paths to a non-zero terminal of a DD. The path count is represented as a double, to allow for a larger number of variables. Returns the number of paths of the function rooted at node.]

SideEffects [None]

SeeAlso [Cudd_CountMinterm Cudd_CountPath]

Definition at line 711 of file cuddUtil.c.

713 {
714 
715  st_table *table;
716  double i;
717 
719  if (table == NULL) {
720  return((double)CUDD_OUT_OF_MEM);
721  }
722  i = ddCountPathsToNonZero(node,table);
723  st_foreach(table, cuddStCountfree, NULL);
724  st_free_table(table);
725  return(i);
726 
727 } /* end of Cudd_CountPathsToNonZero */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
Definition: st.h:60
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
static double ddCountPathsToNonZero(DdNode *N, st_table *table)
Definition: cuddUtil.c:3653
void st_free_table(st_table *)
Definition: st.c:252
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
enum st_retval cuddStCountfree(char *key, char *value, char *arg)
Definition: cuddUtil.c:2903
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
int st_ptrhash(char *, int)
Definition: st.c:811

◆ Cudd_CProjection()

DdNode* Cudd_CProjection ( DdManager dd,
DdNode R,
DdNode Y 
)

◆ Cudd_CubeArrayToBdd()

DdNode* Cudd_CubeArrayToBdd ( DdManager dd,
int *  array 
)

Function********************************************************************

Synopsis [Builds the BDD of a cube from a positional array.]

Description [Builds a cube from a positional array. The array must have one integer entry for each BDD variable. If the i-th entry is 1, the variable of index i appears in true form in the cube; If the i-th entry is 0, the variable of index i appears complemented in the cube; otherwise the variable does not appear in the cube. Returns a pointer to the BDD for the cube if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddComputeCube Cudd_IndicesToCube Cudd_BddToCubeArray]

Definition at line 2306 of file cuddUtil.c.

2309 {
2310  DdNode *cube, *var, *tmp;
2311  int i;
2312  int size = Cudd_ReadSize(dd);
2313 
2314  cube = DD_ONE(dd);
2315  cuddRef(cube);
2316  for (i = size - 1; i >= 0; i--) {
2317  if ((array[i] & ~1) == 0) {
2318  var = Cudd_bddIthVar(dd,i);
2319  tmp = Cudd_bddAnd(dd,cube,Cudd_NotCond(var,array[i]==0));
2320  if (tmp == NULL) {
2321  Cudd_RecursiveDeref(dd,cube);
2322  return(NULL);
2323  }
2324  cuddRef(tmp);
2325  Cudd_RecursiveDeref(dd,cube);
2326  cube = tmp;
2327  }
2328  }
2329  cuddDeref(cube);
2330  return(cube);
2331 
2332 } /* end of Cudd_CubeArrayToBdd */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1681
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:430
#define Cudd_NotCond(node, c)
Definition: cudd.h:370
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_DagSize()

int Cudd_DagSize ( DdNode node)

Function********************************************************************

Synopsis [Counts the number of nodes in a DD.]

Description [Counts the number of nodes in a DD. Returns the number of nodes in the graph rooted at node.]

SideEffects [None]

SeeAlso [Cudd_SharingSize Cudd_PrintDebug]

Definition at line 446 of file cuddUtil.c.

448 {
449  int i;
450 
451  i = ddDagInt(Cudd_Regular(node));
452  ddClearFlag(Cudd_Regular(node));
453 
454  return(i);
455 
456 } /* end of Cudd_DagSize */
#define Cudd_Regular(node)
Definition: cudd.h:384
static int ddDagInt(DdNode *n)
Definition: cuddUtil.c:3173
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741

◆ Cudd_DeadAreCounted()

int Cudd_DeadAreCounted ( DdManager dd)

Function********************************************************************

Synopsis [Tells whether dead nodes are counted towards triggering reordering.]

Description [Tells whether dead nodes are counted towards triggering reordering. Returns 1 if dead nodes are counted; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_TurnOnCountDead Cudd_TurnOffCountDead]

Definition at line 2867 of file cuddAPI.c.

2869 {
2870  return(dd->countDead == 0 ? 1 : 0);
2871 
2872 } /* end of Cudd_DeadAreCounted */
unsigned int countDead
Definition: cuddInt.h:407

◆ Cudd_DebugCheck()

int Cudd_DebugCheck ( DdManager table)

AutomaticEnd Function********************************************************************

Synopsis [Checks for inconsistencies in the DD heap.]

Description [Checks for inconsistencies in the DD heap:

  • node has illegal index
  • live node has dead children
  • node has illegal Then or Else pointers
  • BDD/ADD node has identical children
  • ZDD node has zero then child
  • wrong number of total nodes
  • wrong number of dead nodes
  • ref count error at node

Returns 0 if no inconsistencies are found; DD_OUT_OF_MEM if there is not enough memory; 1 otherwise.]

SideEffects [None]

SeeAlso [Cudd_CheckKeys]

Definition at line 138 of file cuddCheck.c.

140 {
141  unsigned int i;
142  int j,count;
143  int slots;
144  DdNodePtr *nodelist;
145  DdNode *f;
146  DdNode *sentinel = &(table->sentinel);
147  st_table *edgeTable; /* stores internal ref count for each node */
148  st_generator *gen;
149  int flag = 0;
150  int totalNode;
151  int deadNode;
152  int index;
153  int shift;
154 
155  edgeTable = st_init_table(st_ptrcmp,st_ptrhash);
156  if (edgeTable == NULL) return(CUDD_OUT_OF_MEM);
157 
158  /* Check the BDD/ADD subtables. */
159  for (i = 0; i < (unsigned) table->size; i++) {
160  index = table->invperm[i];
161  if (i != (unsigned) table->perm[index]) {
162  (void) fprintf(table->err,
163  "Permutation corrupted: invperm[%u] = %d\t perm[%d] = %d\n",
164  i, index, index, table->perm[index]);
165  }
166  nodelist = table->subtables[i].nodelist;
167  slots = table->subtables[i].slots;
168  shift = table->subtables[i].shift;
169 
170  totalNode = 0;
171  deadNode = 0;
172  for (j = 0; j < slots; j++) { /* for each subtable slot */
173  f = nodelist[j];
174  while (f != sentinel) {
175  totalNode++;
176  if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref != 0) {
177  if ((int) f->index != index) {
178  (void) fprintf(table->err,
179  "Error: node has illegal index\n");
180  cuddPrintNode(f,table->err);
181  flag = 1;
182  }
183  if ((unsigned) cuddI(table,cuddT(f)->index) <= i ||
184  (unsigned) cuddI(table,Cudd_Regular(cuddE(f))->index)
185  <= i) {
186  (void) fprintf(table->err,
187  "Error: node has illegal children\n");
188  cuddPrintNode(f,table->err);
189  flag = 1;
190  }
191  if (Cudd_Regular(cuddT(f)) != cuddT(f)) {
192  (void) fprintf(table->err,
193  "Error: node has illegal form\n");
194  cuddPrintNode(f,table->err);
195  flag = 1;
196  }
197  if (cuddT(f) == cuddE(f)) {
198  (void) fprintf(table->err,
199  "Error: node has identical children\n");
200  cuddPrintNode(f,table->err);
201  flag = 1;
202  }
203  if (cuddT(f)->ref == 0 || Cudd_Regular(cuddE(f))->ref == 0) {
204  (void) fprintf(table->err,
205  "Error: live node has dead children\n");
206  cuddPrintNode(f,table->err);
207  flag =1;
208  }
209  if (ddHash(cuddT(f),cuddE(f),shift) != j) {
210  (void) fprintf(table->err, "Error: misplaced node\n");
211  cuddPrintNode(f,table->err);
212  flag =1;
213  }
214  /* Increment the internal reference count for the
215  ** then child of the current node.
216  */
217  if (st_lookup_int(edgeTable,(char *)cuddT(f),&count)) {
218  count++;
219  } else {
220  count = 1;
221  }
222  if (st_insert(edgeTable,(char *)cuddT(f),
223  (char *)(long)count) == ST_OUT_OF_MEM) {
224  st_free_table(edgeTable);
225  return(CUDD_OUT_OF_MEM);
226  }
227 
228  /* Increment the internal reference count for the
229  ** else child of the current node.
230  */
231  if (st_lookup_int(edgeTable,(char *)Cudd_Regular(cuddE(f)),
232  &count)) {
233  count++;
234  } else {
235  count = 1;
236  }
237  if (st_insert(edgeTable,(char *)Cudd_Regular(cuddE(f)),
238  (char *)(long)count) == ST_OUT_OF_MEM) {
239  st_free_table(edgeTable);
240  return(CUDD_OUT_OF_MEM);
241  }
242  } else if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref == 0) {
243  deadNode++;
244 #if 0
245  debugCheckParent(table,f);
246 #endif
247  } else {
248  fprintf(table->err,
249  "Error: node has illegal Then or Else pointers\n");
250  cuddPrintNode(f,table->err);
251  flag = 1;
252  }
253 
254  f = f->next;
255  } /* for each element of the collision list */
256  } /* for each subtable slot */
257 
258  if ((unsigned) totalNode != table->subtables[i].keys) {
259  fprintf(table->err,"Error: wrong number of total nodes\n");
260  flag = 1;
261  }
262  if ((unsigned) deadNode != table->subtables[i].dead) {
263  fprintf(table->err,"Error: wrong number of dead nodes\n");
264  flag = 1;
265  }
266  } /* for each BDD/ADD subtable */
267 
268  /* Check the ZDD subtables. */
269  for (i = 0; i < (unsigned) table->sizeZ; i++) {
270  index = table->invpermZ[i];
271  if (i != (unsigned) table->permZ[index]) {
272  (void) fprintf(table->err,
273  "Permutation corrupted: invpermZ[%u] = %d\t permZ[%d] = %d in ZDD\n",
274  i, index, index, table->permZ[index]);
275  }
276  nodelist = table->subtableZ[i].nodelist;
277  slots = table->subtableZ[i].slots;
278 
279  totalNode = 0;
280  deadNode = 0;
281  for (j = 0; j < slots; j++) { /* for each subtable slot */
282  f = nodelist[j];
283  while (f != NULL) {
284  totalNode++;
285  if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref != 0) {
286  if ((int) f->index != index) {
287  (void) fprintf(table->err,
288  "Error: ZDD node has illegal index\n");
289  cuddPrintNode(f,table->err);
290  flag = 1;
291  }
292  if (Cudd_IsComplement(cuddT(f)) ||
293  Cudd_IsComplement(cuddE(f))) {
294  (void) fprintf(table->err,
295  "Error: ZDD node has complemented children\n");
296  cuddPrintNode(f,table->err);
297  flag = 1;
298  }
299  if ((unsigned) cuddIZ(table,cuddT(f)->index) <= i ||
300  (unsigned) cuddIZ(table,cuddE(f)->index) <= i) {
301  (void) fprintf(table->err,
302  "Error: ZDD node has illegal children\n");
303  cuddPrintNode(f,table->err);
304  cuddPrintNode(cuddT(f),table->err);
305  cuddPrintNode(cuddE(f),table->err);
306  flag = 1;
307  }
308  if (cuddT(f) == DD_ZERO(table)) {
309  (void) fprintf(table->err,
310  "Error: ZDD node has zero then child\n");
311  cuddPrintNode(f,table->err);
312  flag = 1;
313  }
314  if (cuddT(f)->ref == 0 || cuddE(f)->ref == 0) {
315  (void) fprintf(table->err,
316  "Error: ZDD live node has dead children\n");
317  cuddPrintNode(f,table->err);
318  flag =1;
319  }
320  /* Increment the internal reference count for the
321  ** then child of the current node.
322  */
323  if (st_lookup_int(edgeTable,(char *)cuddT(f),&count)) {
324  count++;
325  } else {
326  count = 1;
327  }
328  if (st_insert(edgeTable,(char *)cuddT(f),
329  (char *)(long)count) == ST_OUT_OF_MEM) {
330  st_free_table(edgeTable);
331  return(CUDD_OUT_OF_MEM);
332  }
333 
334  /* Increment the internal reference count for the
335  ** else child of the current node.
336  */
337  if (st_lookup_int(edgeTable,(char *)cuddE(f),&count)) {
338  count++;
339  } else {
340  count = 1;
341  }
342  if (st_insert(edgeTable,(char *)cuddE(f),
343  (char *)(long)count) == ST_OUT_OF_MEM) {
344  st_free_table(edgeTable);
345  table->errorCode = CUDD_MEMORY_OUT;
346  return(CUDD_OUT_OF_MEM);
347  }
348  } else if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref == 0) {
349  deadNode++;
350 #if 0
351  debugCheckParent(table,f);
352 #endif
353  } else {
354  fprintf(table->err,
355  "Error: ZDD node has illegal Then or Else pointers\n");
356  cuddPrintNode(f,table->err);
357  flag = 1;
358  }
359 
360  f = f->next;
361  } /* for each element of the collision list */
362  } /* for each subtable slot */
363 
364  if ((unsigned) totalNode != table->subtableZ[i].keys) {
365  fprintf(table->err,
366  "Error: wrong number of total nodes in ZDD\n");
367  flag = 1;
368  }
369  if ((unsigned) deadNode != table->subtableZ[i].dead) {
370  fprintf(table->err,
371  "Error: wrong number of dead nodes in ZDD\n");
372  flag = 1;
373  }
374  } /* for each ZDD subtable */
375 
376  /* Check the constant table. */
377  nodelist = table->constants.nodelist;
378  slots = table->constants.slots;
379 
380  totalNode = 0;
381  deadNode = 0;
382  for (j = 0; j < slots; j++) {
383  f = nodelist[j];
384  while (f != NULL) {
385  totalNode++;
386  if (f->ref != 0) {
387  if (f->index != CUDD_CONST_INDEX) {
388  fprintf(table->err,"Error: node has illegal index\n");
389 #if SIZEOF_VOID_P == 8
390  fprintf(table->err,
391  " node 0x%lx, id = %u, ref = %u, value = %g\n",
392  (ptruint)f,f->index,f->ref,cuddV(f));
393 #else
394  fprintf(table->err,
395  " node 0x%x, id = %hu, ref = %hu, value = %g\n",
396  (ptruint)f,f->index,f->ref,cuddV(f));
397 #endif
398  flag = 1;
399  }
400  } else {
401  deadNode++;
402  }
403  f = f->next;
404  }
405  }
406  if ((unsigned) totalNode != table->constants.keys) {
407  (void) fprintf(table->err,
408  "Error: wrong number of total nodes in constants\n");
409  flag = 1;
410  }
411  if ((unsigned) deadNode != table->constants.dead) {
412  (void) fprintf(table->err,
413  "Error: wrong number of dead nodes in constants\n");
414  flag = 1;
415  }
416  gen = st_init_gen(edgeTable);
417  while (st_gen(gen, &f, &count)) {
418  if (count > (int)(f->ref) && f->ref != DD_MAXREF) {
419 #if SIZEOF_VOID_P == 8
420  fprintf(table->err,"ref count error at node 0x%lx, count = %d, id = %u, ref = %u, then = 0x%lx, else = 0x%lx\n",(ptruint)f,count,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
421 #else
422  fprintf(table->err,"ref count error at node 0x%x, count = %d, id = %hu, ref = %hu, then = 0x%x, else = 0x%x\n",(ptruint)f,count,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
423 #endif
424  debugFindParent(table,f);
425  flag = 1;
426  }
427  }
428  st_free_gen(gen);
429  st_free_table(edgeTable);
430 
431  return (flag);
432 
433 } /* end of Cudd_DebugCheck */
DdHalfWord ref
Definition: cudd.h:272
#define DD_MAXREF
Definition: cuddInt.h:101
unsigned int keys
Definition: cuddInt.h:314
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
#define ddHash(f, g, s)
Definition: cuddInt.h:696
Definition: st.h:60
#define cuddIZ(dd, index)
Definition: cuddInt.h:677
int st_lookup_int(st_table *, void *, int *)
Definition: st.c:322
Definition: cudd.h:270
void st_free_gen(st_generator *)
Definition: st.c:994
int * invpermZ
Definition: cuddInt.h:372
static void debugFindParent(DdManager *table, DdNode *node)
Definition: cuddCheck.c:812
int size
Definition: cuddInt.h:345
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
int st_gen(st_generator *, void *, void *)
Definition: st.c:908
FILE * err
Definition: cuddInt.h:424
st_generator * st_init_gen(st_table *)
Definition: st.c:870
DdSubtable * subtables
Definition: cuddInt.h:349
int * permZ
Definition: cuddInt.h:370
#define cuddV(node)
Definition: cuddInt.h:641
int st_insert(st_table *, void *, void *)
Definition: st.c:358
#define Cudd_IsComplement(node)
Definition: cudd.h:412
DdNode sentinel
Definition: cuddInt.h:328
void cuddPrintNode(DdNode *f, FILE *fp)
Definition: cuddCheck.c:712
unsigned int dead
Definition: cuddInt.h:316
DdNode * next
Definition: cudd.h:273
#define CUDD_CONST_INDEX
Definition: cudd.h:113
DdNode ** nodelist
Definition: cuddInt.h:311
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
#define cuddT(node)
Definition: cuddInt.h:609
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
#define ST_OUT_OF_MEM
Definition: st.h:41
#define cuddI(dd, index)
Definition: cuddInt.h:659
unsigned int ptruint
Definition: cuddInt.h:250
int sizeZ
Definition: cuddInt.h:346
DdHalfWord index
Definition: cudd.h:271
unsigned int slots
Definition: cuddInt.h:313
#define cuddE(node)
Definition: cuddInt.h:625
int st_ptrhash(char *, int)
Definition: st.c:811
int * invperm
Definition: cuddInt.h:371
DdSubtable constants
Definition: cuddInt.h:351
int shift
Definition: cuddInt.h:312
int * perm
Definition: cuddInt.h:369
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdSubtable * subtableZ
Definition: cuddInt.h:350
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_Decreasing()

DdNode* Cudd_Decreasing ( DdManager dd,
DdNode f,
int  i 
)

Function********************************************************************

Synopsis [Determines whether a BDD is negative unate in a variable.]

Description [Determines whether the function represented by BDD f is negative unate (monotonic decreasing) in variable i. Returns the constant one is f is unate and the (logical) constant zero if it is not. This function does not generate any new nodes.]

SideEffects [None]

SeeAlso [Cudd_Increasing]

Definition at line 424 of file cuddSat.c.

428 {
429  unsigned int topf, level;
430  DdNode *F, *fv, *fvn, *res;
431  DD_CTFP cacheOp;
432 
433  statLine(dd);
434 #ifdef DD_DEBUG
435  assert(0 <= i && i < dd->size);
436 #endif
437 
438  F = Cudd_Regular(f);
439  topf = cuddI(dd,F->index);
440 
441  /* Check terminal case. If topf > i, f does not depend on var.
442  ** Therefore, f is unate in i.
443  */
444  level = (unsigned) dd->perm[i];
445  if (topf > level) {
446  return(DD_ONE(dd));
447  }
448 
449  /* From now on, f is not constant. */
450 
451  /* Check cache. */
452  cacheOp = (DD_CTFP) Cudd_Decreasing;
453  res = cuddCacheLookup2(dd,cacheOp,f,dd->vars[i]);
454  if (res != NULL) {
455  return(res);
456  }
457 
458  /* Compute cofactors. */
459  fv = cuddT(F); fvn = cuddE(F);
460  if (F != f) {
461  fv = Cudd_Not(fv);
462  fvn = Cudd_Not(fvn);
463  }
464 
465  if (topf == (unsigned) level) {
466  /* Special case: if fv is regular, fv(1,...,1) = 1;
467  ** If in addition fvn is complemented, fvn(1,...,1) = 0.
468  ** But then f(1,1,...,1) > f(0,1,...,1). Hence f is not
469  ** monotonic decreasing in i.
470  */
471  if (!Cudd_IsComplement(fv) && Cudd_IsComplement(fvn)) {
472  return(Cudd_Not(DD_ONE(dd)));
473  }
474  res = Cudd_bddLeq(dd,fv,fvn) ? DD_ONE(dd) : Cudd_Not(DD_ONE(dd));
475  } else {
476  res = Cudd_Decreasing(dd,fv,i);
477  if (res == DD_ONE(dd)) {
478  res = Cudd_Decreasing(dd,fvn,i);
479  }
480  }
481 
482  cuddCacheInsert2(dd,cacheOp,f,dd->vars[i],res);
483  return(res);
484 
485 } /* end of Cudd_Decreasing */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define assert(ex)
Definition: util.h:141
DdNode * cuddCacheLookup2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
#define Cudd_Regular(node)
Definition: cudd.h:384
#define statLine(dd)
Definition: cuddInt.h:990
#define Cudd_IsComplement(node)
Definition: cudd.h:412
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
#define cuddT(node)
Definition: cuddInt.h:609
#define cuddI(dd, index)
Definition: cuddInt.h:659
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdNode * Cudd_Decreasing(DdManager *dd, DdNode *f, int i)
Definition: cuddSat.c:424
DdHalfWord index
Definition: cudd.h:271
DdNode ** vars
Definition: cuddInt.h:373
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369
if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool(dvf dda.cpp) else() add_executable(dvf dda.cpp) target_link_libraries(dvf Svf Cudd $
Definition: CMakeLists.txt:2

◆ Cudd_DelayedDerefBdd()

void Cudd_DelayedDerefBdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of BDD node n.]

Description [Enqueues node n for later dereferencing. If the queue is full decreases the reference count of the oldest node N to make room for n. If N dies, recursively decreases the reference counts of its children. It is used to dispose of a BDD that is currently not needed, but may be useful again in the near future. The dereferencing proper is done as in Cudd_IterDerefBdd.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_IterDerefBdd]

Definition at line 270 of file cuddRef.c.

273 {
274  DdNode *N;
275  int ord;
276  DdNodePtr *stack;
277  int SP;
278 
279  unsigned int live = table->keys - table->dead;
280  if (live > table->peakLiveNodes) {
281  table->peakLiveNodes = live;
282  }
283 
284  n = Cudd_Regular(n);
285 #ifdef DD_DEBUG
286  assert(n->ref != 0);
287 #endif
288 
289 #ifdef DD_NO_DEATH_ROW
290  N = n;
291 #else
292  if (cuddIsConstant(n) || n->ref > 1) {
293 #ifdef DD_DEBUG
294  assert(n->ref != 1 && (!cuddIsConstant(n) || n == DD_ONE(table)));
295 #endif
296  cuddSatDec(n->ref);
297  return;
298  }
299 
300  N = table->deathRow[table->nextDead];
301 
302  if (N != NULL) {
303 #endif
304 #ifdef DD_DEBUG
306 #endif
307  stack = table->stack;
308  SP = 1;
309  do {
310 #ifdef DD_DEBUG
311  assert(N->ref != 0);
312 #endif
313  if (N->ref == 1) {
314  N->ref = 0;
315  table->dead++;
316 #ifdef DD_STATS
317  table->nodesDropped++;
318 #endif
319  ord = table->perm[N->index];
320  stack[SP++] = Cudd_Regular(cuddE(N));
321  table->subtables[ord].dead++;
322  N = cuddT(N);
323  } else {
324  cuddSatDec(N->ref);
325  N = stack[--SP];
326  }
327  } while (SP != 0);
328 #ifndef DD_NO_DEATH_ROW
329  }
330  table->deathRow[table->nextDead] = n;
331 
332  /* Udate insertion point. */
333  table->nextDead++;
334  table->nextDead &= table->deadMask;
335 #if 0
336  if (table->nextDead == table->deathRowDepth) {
337  if (table->deathRowDepth < table->looseUpTo / 2) {
338  extern void (*MMoutOfMemory)(long);
339  void (*saveHandler)(long) = MMoutOfMemory;
340  DdNodePtr *newRow;
342  newRow = REALLOC(DdNodePtr,table->deathRow,2*table->deathRowDepth);
343  MMoutOfMemory = saveHandler;
344  if (newRow == NULL) {
345  table->nextDead = 0;
346  } else {
347  int i;
348  table->memused += table->deathRowDepth;
349  i = table->deathRowDepth;
350  table->deathRowDepth <<= 1;
351  for (; i < table->deathRowDepth; i++) {
352  newRow[i] = NULL;
353  }
354  table->deadMask = table->deathRowDepth - 1;
355  table->deathRow = newRow;
356  }
357  } else {
358  table->nextDead = 0;
359  }
360  }
361 #endif
362 #endif
363 
364 } /* end of Cudd_DelayedDerefBdd */
DdHalfWord ref
Definition: cudd.h:272
void Cudd_OutOfMem(long size)
Definition: cuddUtil.c:2845
unsigned int peakLiveNodes
Definition: cuddInt.h:445
Definition: cudd.h:270
unsigned deadMask
Definition: cuddInt.h:387
#define assert(ex)
Definition: util.h:141
#define Cudd_Regular(node)
Definition: cudd.h:384
DdSubtable * subtables
Definition: cuddInt.h:349
DdNode ** deathRow
Definition: cuddInt.h:384
DdNode ** stack
Definition: cuddInt.h:364
unsigned int dead
Definition: cuddInt.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:412
unsigned int keys
Definition: cuddInt.h:353
unsigned int dead
Definition: cuddInt.h:316
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
int nextDead
Definition: cuddInt.h:386
void(* MMoutOfMemory)(long)
Definition: safe_mem.c:32
unsigned long memused
Definition: cuddInt.h:429
int deathRowDepth
Definition: cuddInt.h:385
#define REALLOC(type, obj, num)
Definition: util.h:78
DdHalfWord index
Definition: cudd.h:271
unsigned int looseUpTo
Definition: cuddInt.h:361
#define cuddE(node)
Definition: cuddInt.h:625
#define cuddSatDec(x)
Definition: cuddInt.h:849
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369

◆ Cudd_Density()

double Cudd_Density ( DdManager dd,
DdNode f,
int  nvars 
)

Function********************************************************************

Synopsis [Computes the density of a BDD or ADD.]

Description [Computes the density of a BDD or ADD. The density is the ratio of the number of minterms to the number of nodes. If 0 is passed as number of variables, the number of variables existing in the manager is used. Returns the density if successful; (double) CUDD_OUT_OF_MEM otherwise.]

SideEffects [None]

SeeAlso [Cudd_CountMinterm Cudd_DagSize]

Definition at line 2810 of file cuddUtil.c.

2814 {
2815  double minterms;
2816  int nodes;
2817  double density;
2818 
2819  if (nvars == 0) nvars = dd->size;
2820  minterms = Cudd_CountMinterm(dd,f,nvars);
2821  if (minterms == (double) CUDD_OUT_OF_MEM) return(minterms);
2822  nodes = Cudd_DagSize(f);
2823  density = minterms / (double) nodes;
2824  return(density);
2825 
2826 } /* end of Cudd_Density */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
int size
Definition: cuddInt.h:345
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:446
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
Definition: cuddUtil.c:582

◆ Cudd_Deref()

void Cudd_Deref ( DdNode node)

Function********************************************************************

Synopsis [Decreases the reference count of node.]

Description [Decreases the reference count of node. It is primarily used in recursive procedures to decrease the ref count of a result node before returning it. This accomplishes the goal of removing the protection applied by a previous Cudd_Ref.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_RecursiveDerefZdd Cudd_Ref]

Definition at line 434 of file cuddRef.c.

436 {
437  node = Cudd_Regular(node);
438  cuddSatDec(node->ref);
439 
440 } /* end of Cudd_Deref */
DdHalfWord ref
Definition: cudd.h:272
#define Cudd_Regular(node)
Definition: cudd.h:384
#define cuddSatDec(x)
Definition: cuddInt.h:849

◆ Cudd_DisableGarbageCollection()

void Cudd_DisableGarbageCollection ( DdManager dd)

Function********************************************************************

Synopsis [Disables garbage collection.]

Description [Disables garbage collection. Garbage collection is initially enabled. This function may be called to disable it. However, garbage collection will still occur when a new node must be created and no memory is left, or when garbage collection is required for correctness. (E.g., before reordering.)]

SideEffects [None]

SeeAlso [Cudd_EnableGarbageCollection Cudd_GarbageCollectionEnabled]

Definition at line 2845 of file cuddAPI.c.

2847 {
2848  dd->gcEnabled = 0;
2849 
2850 } /* end of Cudd_DisableGarbageCollection */
int gcEnabled
Definition: cuddInt.h:360

◆ Cudd_DisableOrderingMonitoring()

int Cudd_DisableOrderingMonitoring ( DdManager dd)

Function********************************************************************

Synopsis [Disables monitoring of ordering.]

Description [Disables monitoring of ordering. Returns 1 if successful; 0 otherwise.]

SideEffects [Removes functions from the pre-reordering and post-reordering hooks.]

SeeAlso [Cudd_EnableOrderingMonitoring]

Definition at line 4011 of file cuddAPI.c.

4013 {
4015  return(0);
4016  }
4018  return(0);
4019  }
4021  return(0);
4022  }
4024  return(0);
4025  }
4026  return(1);
4027 
4028 } /* end of Cudd_DisableOrderingMonitoring */
int Cudd_StdPostReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3826
int Cudd_StdPreReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3733
int Cudd_PrintGroupedOrder(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3939
int Cudd_RemoveHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3631

◆ Cudd_DisableReorderingReporting()

int Cudd_DisableReorderingReporting ( DdManager dd)

Function********************************************************************

Synopsis [Disables reporting of reordering stats.]

Description [Disables reporting of reordering stats. Returns 1 if successful; 0 otherwise.]

SideEffects [Removes functions from the pre-reordering and post-reordering hooks.]

SeeAlso [Cudd_EnableReorderingReporting Cudd_ReorderingReporting]

Definition at line 3889 of file cuddAPI.c.

3891 {
3893  return(0);
3894  }
3896  return(0);
3897  }
3898  return(1);
3899 
3900 } /* end of Cudd_DisableReorderingReporting */
int Cudd_StdPostReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3826
int Cudd_StdPreReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3733
int Cudd_RemoveHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3631

◆ Cudd_Disequality()

DdNode* Cudd_Disequality ( DdManager dd,
int  N,
int  c,
DdNode **  x,
DdNode **  y 
)

◆ Cudd_DumpBlif()

int Cudd_DumpBlif ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
char *  mname,
FILE *  fp,
int  mv 
)

◆ Cudd_DumpBlifBody()

int Cudd_DumpBlifBody ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp,
int  mv 
)

◆ Cudd_DumpDaVinci()

int Cudd_DumpDaVinci ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp 
)

◆ Cudd_DumpDDcal()

int Cudd_DumpDDcal ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp 
)

◆ Cudd_DumpDot()

int Cudd_DumpDot ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp 
)

◆ Cudd_DumpFactoredForm()

int Cudd_DumpFactoredForm ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp 
)

◆ Cudd_Dxygtdxz()

DdNode* Cudd_Dxygtdxz ( DdManager dd,
int  N,
DdNode **  x,
DdNode **  y,
DdNode **  z 
)

◆ Cudd_Dxygtdyz()

DdNode* Cudd_Dxygtdyz ( DdManager dd,
int  N,
DdNode **  x,
DdNode **  y,
DdNode **  z 
)

◆ Cudd_EnableGarbageCollection()

void Cudd_EnableGarbageCollection ( DdManager dd)

Function********************************************************************

Synopsis [Enables garbage collection.]

Description [Enables garbage collection. Garbage collection is initially enabled. Therefore it is necessary to call this function only if garbage collection has been explicitly disabled.]

SideEffects [None]

SeeAlso [Cudd_DisableGarbageCollection Cudd_GarbageCollectionEnabled]

Definition at line 2821 of file cuddAPI.c.

2823 {
2824  dd->gcEnabled = 1;
2825 
2826 } /* end of Cudd_EnableGarbageCollection */
int gcEnabled
Definition: cuddInt.h:360

◆ Cudd_EnableOrderingMonitoring()

int Cudd_EnableOrderingMonitoring ( DdManager dd)

Function********************************************************************

Synopsis [Enables monitoring of ordering.]

Description [Enables monitoring of ordering. Returns 1 if successful; 0 otherwise.]

SideEffects [Installs functions in the pre-reordering and post-reordering hooks.]

SeeAlso [Cudd_EnableReorderingReporting]

Definition at line 3977 of file cuddAPI.c.

3979 {
3981  return(0);
3982  }
3984  return(0);
3985  }
3987  return(0);
3988  }
3990  return(0);
3991  }
3992  return(1);
3993 
3994 } /* end of Cudd_EnableOrderingMonitoring */
int Cudd_StdPostReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3826
int Cudd_StdPreReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3733
int Cudd_AddHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3569
int Cudd_PrintGroupedOrder(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3939

◆ Cudd_EnableReorderingReporting()

int Cudd_EnableReorderingReporting ( DdManager dd)

Function********************************************************************

Synopsis [Enables reporting of reordering stats.]

Description [Enables reporting of reordering stats. Returns 1 if successful; 0 otherwise.]

SideEffects [Installs functions in the pre-reordering and post-reordering hooks.]

SeeAlso [Cudd_DisableReorderingReporting Cudd_ReorderingReporting]

Definition at line 3861 of file cuddAPI.c.

3863 {
3865  return(0);
3866  }
3868  return(0);
3869  }
3870  return(1);
3871 
3872 } /* end of Cudd_EnableReorderingReporting */
int Cudd_StdPostReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3826
int Cudd_StdPreReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3733
int Cudd_AddHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3569

◆ Cudd_EpdCountMinterm()

int Cudd_EpdCountMinterm ( DdManager manager,
DdNode node,
int  nvars,
EpDouble epd 
)

Function********************************************************************

Synopsis [Counts the number of minterms of a DD with extended precision.]

Description [Counts the number of minterms of a DD with extended precision. The function is assumed to depend on nvars variables. The minterm count is represented as an EpDouble, to allow any number of variables. Returns 0 if successful; CUDD_OUT_OF_MEM otherwise.]

SideEffects [None]

SeeAlso [Cudd_PrintDebug Cudd_CountPath]

Definition at line 661 of file cuddUtil.c.

666 {
667  EpDouble max, tmp;
668  st_table *table;
669  int status;
670 
671  background = manager->background;
672  zero = Cudd_Not(manager->one);
673 
674  EpdPow2(nvars, &max);
675  table = st_init_table(EpdCmp, st_ptrhash);
676  if (table == NULL) {
677  EpdMakeZero(epd, 0);
678  return(CUDD_OUT_OF_MEM);
679  }
680  status = ddEpdCountMintermAux(Cudd_Regular(node),&max,epd,table);
681  st_foreach(table, ddEpdFree, NULL);
682  st_free_table(table);
683  if (status == CUDD_OUT_OF_MEM) {
684  EpdMakeZero(epd, 0);
685  return(CUDD_OUT_OF_MEM);
686  }
687  if (Cudd_IsComplement(node)) {
688  EpdSubtract3(&max, epd, &tmp);
689  EpdCopy(&tmp, epd);
690  }
691  return(0);
692 
693 } /* end of Cudd_EpdCountMinterm */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
Definition: st.h:60
#define Cudd_Not(node)
Definition: cudd.h:354
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
int EpdCmp(const char *key1, const char *key2)
Definition: epd.c:92
static DdNode * background
Definition: cuddUtil.c:149
#define Cudd_IsComplement(node)
Definition: cudd.h:412
static enum st_retval ddEpdFree(char *key, char *value, char *arg)
Definition: cuddUtil.c:3928
static int ddEpdCountMintermAux(DdNode *node, EpDouble *max, EpDouble *epd, st_table *table)
Definition: cuddUtil.c:3581
static DdNode * zero
Definition: cuddUtil.c:149
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
void EpdPow2(int n, EpDouble *epd)
Definition: epd.c:916
void EpdSubtract3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
Definition: epd.c:849
void EpdMakeZero(EpDouble *epd, int sign)
Definition: epd.c:1136
DdNode * one
Definition: cuddInt.h:329
int st_ptrhash(char *, int)
Definition: st.c:811
void EpdCopy(EpDouble *from, EpDouble *to)
Definition: epd.c:1181
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_EqualSupNorm()

int Cudd_EqualSupNorm ( DdManager dd,
DdNode f,
DdNode g,
CUDD_VALUE_TYPE  tolerance,
int  pr 
)

Function********************************************************************

Synopsis [Compares two ADDs for equality within tolerance.]

Description [Compares two ADDs for equality within tolerance. Two ADDs are reported to be equal if the maximum difference between them (the sup norm of their difference) is less than or equal to the tolerance parameter. Returns 1 if the two ADDs are equal (within tolerance); 0 otherwise. If parameter pr is positive the first failure is reported to the standard output.]

SideEffects [None]

SeeAlso []

Definition at line 803 of file cuddSat.c.

809 {
810  DdNode *fv, *fvn, *gv, *gvn, *r;
811  unsigned int topf, topg;
812 
813  statLine(dd);
814  /* Check terminal cases. */
815  if (f == g) return(1);
816  if (Cudd_IsConstant(f) && Cudd_IsConstant(g)) {
817  if (ddEqualVal(cuddV(f),cuddV(g),tolerance)) {
818  return(1);
819  } else {
820  if (pr>0) {
821  (void) fprintf(dd->out,"Offending nodes:\n");
822  (void) fprintf(dd->out,
823  "f: address = %p\t value = %40.30f\n",
824  (void *) f, cuddV(f));
825  (void) fprintf(dd->out,
826  "g: address = %p\t value = %40.30f\n",
827  (void *) g, cuddV(g));
828  }
829  return(0);
830  }
831  }
832 
833  /* We only insert the result in the cache if the comparison is
834  ** successful. Therefore, if we hit we return 1. */
836  if (r != NULL) {
837  return(1);
838  }
839 
840  /* Compute the cofactors and solve the recursive subproblems. */
841  topf = cuddI(dd,f->index);
842  topg = cuddI(dd,g->index);
843 
844  if (topf <= topg) {fv = cuddT(f); fvn = cuddE(f);} else {fv = fvn = f;}
845  if (topg <= topf) {gv = cuddT(g); gvn = cuddE(g);} else {gv = gvn = g;}
846 
847  if (!Cudd_EqualSupNorm(dd,fv,gv,tolerance,pr)) return(0);
848  if (!Cudd_EqualSupNorm(dd,fvn,gvn,tolerance,pr)) return(0);
849 
851 
852  return(1);
853 
854 } /* end of Cudd_EqualSupNorm */
Definition: cudd.h:270
DdNode * cuddCacheLookup2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
#define Cudd_IsConstant(node)
Definition: cudd.h:339
int Cudd_EqualSupNorm(DdManager *dd, DdNode *f, DdNode *g, CUDD_VALUE_TYPE tolerance, int pr)
Definition: cuddSat.c:803
#define statLine(dd)
Definition: cuddInt.h:990
#define cuddV(node)
Definition: cuddInt.h:641
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
FILE * out
Definition: cuddInt.h:423
#define cuddT(node)
Definition: cuddInt.h:609
#define ddEqualVal(x, y, e)
Definition: cuddInt.h:814
#define cuddI(dd, index)
Definition: cuddInt.h:659
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_EquivDC()

int Cudd_EquivDC ( DdManager dd,
DdNode F,
DdNode G,
DdNode D 
)

Function********************************************************************

Synopsis [Tells whether F and G are identical wherever D is 0.]

Description [Tells whether F and G are identical wherever D is 0. F and G are either two ADDs or two BDDs. D is either a 0-1 ADD or a BDD. The function returns 1 if F and G are equivalent, and 0 otherwise. No new nodes are created.]

SideEffects [None]

SeeAlso [Cudd_bddLeqUnless]

Definition at line 529 of file cuddSat.c.

534 {
535  DdNode *tmp, *One, *Gr, *Dr;
536  DdNode *Fv, *Fvn, *Gv, *Gvn, *Dv, *Dvn;
537  int res;
538  unsigned int flevel, glevel, dlevel, top;
539 
540  One = DD_ONE(dd);
541 
542  statLine(dd);
543  /* Check terminal cases. */
544  if (D == One || F == G) return(1);
545  if (D == Cudd_Not(One) || D == DD_ZERO(dd) || F == Cudd_Not(G)) return(0);
546 
547  /* From now on, D is non-constant. */
548 
549  /* Normalize call to increase cache efficiency. */
550  if (F > G) {
551  tmp = F;
552  F = G;
553  G = tmp;
554  }
555  if (Cudd_IsComplement(F)) {
556  F = Cudd_Not(F);
557  G = Cudd_Not(G);
558  }
559 
560  /* From now on, F is regular. */
561 
562  /* Check cache. */
563  tmp = cuddCacheLookup(dd,DD_EQUIV_DC_TAG,F,G,D);
564  if (tmp != NULL) return(tmp == One);
565 
566  /* Find splitting variable. */
567  flevel = cuddI(dd,F->index);
568  Gr = Cudd_Regular(G);
569  glevel = cuddI(dd,Gr->index);
570  top = ddMin(flevel,glevel);
571  Dr = Cudd_Regular(D);
572  dlevel = dd->perm[Dr->index];
573  top = ddMin(top,dlevel);
574 
575  /* Compute cofactors. */
576  if (top == flevel) {
577  Fv = cuddT(F);
578  Fvn = cuddE(F);
579  } else {
580  Fv = Fvn = F;
581  }
582  if (top == glevel) {
583  Gv = cuddT(Gr);
584  Gvn = cuddE(Gr);
585  if (G != Gr) {
586  Gv = Cudd_Not(Gv);
587  Gvn = Cudd_Not(Gvn);
588  }
589  } else {
590  Gv = Gvn = G;
591  }
592  if (top == dlevel) {
593  Dv = cuddT(Dr);
594  Dvn = cuddE(Dr);
595  if (D != Dr) {
596  Dv = Cudd_Not(Dv);
597  Dvn = Cudd_Not(Dvn);
598  }
599  } else {
600  Dv = Dvn = D;
601  }
602 
603  /* Solve recursively. */
604  res = Cudd_EquivDC(dd,Fv,Gv,Dv);
605  if (res != 0) {
606  res = Cudd_EquivDC(dd,Fvn,Gvn,Dvn);
607  }
608  cuddCacheInsert(dd,DD_EQUIV_DC_TAG,F,G,D,(res) ? One : Cudd_Not(One));
609 
610  return(res);
611 
612 } /* end of Cudd_EquivDC */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int Cudd_EquivDC(DdManager *dd, DdNode *F, DdNode *G, DdNode *D)
Definition: cuddSat.c:529
#define Cudd_Regular(node)
Definition: cudd.h:384
#define statLine(dd)
Definition: cuddInt.h:990
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define ddMin(x, y)
Definition: cuddInt.h:771
#define cuddT(node)
Definition: cuddInt.h:609
#define cuddI(dd, index)
Definition: cuddInt.h:659
DdNode * cuddCacheLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:347
#define DD_EQUIV_DC_TAG
Definition: cuddInt.h:183
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
void cuddCacheInsert(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data)
Definition: cuddCache.c:217
#define DD_ONE(dd)
Definition: cuddInt.h:864
int * perm
Definition: cuddInt.h:369
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_EstimateCofactor()

int Cudd_EstimateCofactor ( DdManager dd,
DdNode f,
int  i,
int  phase 
)

Function********************************************************************

Synopsis [Estimates the number of nodes in a cofactor of a DD.]

Description [Estimates the number of nodes in a cofactor of a DD. Returns an estimate of the number of nodes in a cofactor of the graph rooted at node with respect to the variable whose index is i. In case of failure, returns CUDD_OUT_OF_MEM. This function uses a refinement of the algorithm of Cabodi et al. (ICCAD96). The refinement allows the procedure to account for part of the recombination that may occur in the part of the cofactor above the cofactoring variable. This procedure does not create any new node. It does keep a small table of results; therefore it may run out of memory. If this is a concern, one should use Cudd_EstimateCofactorSimple, which is faster, does not allocate any memory, but is less accurate.]

SideEffects [None]

SeeAlso [Cudd_DagSize Cudd_EstimateCofactorSimple]

Definition at line 481 of file cuddUtil.c.

487 {
488  int val;
489  DdNode *ptr;
490  st_table *table;
491 
493  if (table == NULL) return(CUDD_OUT_OF_MEM);
494  val = cuddEstimateCofactor(dd,table,Cudd_Regular(f),i,phase,&ptr);
496  st_free_table(table);
497 
498  return(val);
499 
500 } /* end of Cudd_EstimateCofactor */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
Definition: st.h:60
Definition: cudd.h:270
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
static int cuddEstimateCofactor(DdManager *dd, st_table *table, DdNode *node, int i, int phase, DdNode **ptr)
Definition: cuddUtil.c:3248
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
int st_ptrhash(char *, int)
Definition: st.c:811

◆ Cudd_EstimateCofactorSimple()

int Cudd_EstimateCofactorSimple ( DdNode node,
int  i 
)

Function********************************************************************

Synopsis [Estimates the number of nodes in a cofactor of a DD.]

Description [Estimates the number of nodes in a cofactor of a DD. Returns an estimate of the number of nodes in the positive cofactor of the graph rooted at node with respect to the variable whose index is i. This procedure implements with minor changes the algorithm of Cabodi et al. (ICCAD96). It does not allocate any memory, it does not change the state of the manager, and it is fast. However, it has been observed to overestimate the size of the cofactor by as much as a factor of 2.]

SideEffects [None]

SeeAlso [Cudd_DagSize]

Definition at line 521 of file cuddUtil.c.

524 {
525  int val;
526 
528  ddClearFlag(Cudd_Regular(node));
529 
530  return(val);
531 
532 } /* end of Cudd_EstimateCofactorSimple */
static int cuddEstimateCofactorSimple(DdNode *node, int i)
Definition: cuddUtil.c:3407
#define Cudd_Regular(node)
Definition: cudd.h:384
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741

◆ Cudd_Eval()

DdNode* Cudd_Eval ( DdManager dd,
DdNode f,
int *  inputs 
)

AutomaticEnd Function********************************************************************

Synopsis [Returns the value of a DD for a given variable assignment.]

Description [Finds the value of a DD for a given variable assignment. The variable assignment is passed in an array of int's, that should specify a zero or a one for each variable in the support of the function. Returns a pointer to a constant node. No new nodes are produced.]

SideEffects [None]

SeeAlso [Cudd_bddLeq Cudd_addEvalConst]

Definition at line 159 of file cuddSat.c.

163 {
164  int comple;
165  DdNode *ptr;
166 
167  comple = Cudd_IsComplement(f);
168  ptr = Cudd_Regular(f);
169 
170  while (!cuddIsConstant(ptr)) {
171  if (inputs[ptr->index] == 1) {
172  ptr = cuddT(ptr);
173  } else {
174  comple ^= Cudd_IsComplement(cuddE(ptr));
175  ptr = Cudd_Regular(cuddE(ptr));
176  }
177  }
178  return(Cudd_NotCond(ptr,comple));
179 
180 } /* end of Cudd_Eval */
Definition: cudd.h:270
#define Cudd_Regular(node)
Definition: cudd.h:384
#define Cudd_IsComplement(node)
Definition: cudd.h:412
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define Cudd_NotCond(node, c)
Definition: cudd.h:370

◆ Cudd_ExpectedUsedSlots()

double Cudd_ExpectedUsedSlots ( DdManager dd)

Function********************************************************************

Synopsis [Computes the expected fraction of used slots in the unique table.]

Description [Computes the fraction of slots in the unique table that should be in use. This expected value is based on the assumption that the hash function distributes the keys randomly; it can be compared with the result of Cudd_ReadUsedSlots to monitor the performance of the unique table hash function.]

SideEffects [None]

SeeAlso [Cudd_ReadSlots Cudd_ReadUsedSlots]

Definition at line 1812 of file cuddAPI.c.

1814 {
1815  int i;
1816  int size = dd->size;
1817  DdSubtable *subtable;
1818  double empty = 0.0;
1819 
1820  /* To each subtable we apply the corollary to Theorem 8.5 (occupancy
1821  ** distribution) from Sedgewick and Flajolet's Analysis of Algorithms.
1822  ** The corollary says that for a table with M buckets and a load ratio
1823  ** of r, the expected number of empty buckets is asymptotically given
1824  ** by M * exp(-r).
1825  */
1826 
1827  /* Scan each BDD/ADD subtable. */
1828  for (i = 0; i < size; i++) {
1829  subtable = &(dd->subtables[i]);
1830  empty += (double) subtable->slots *
1831  exp(-(double) subtable->keys / (double) subtable->slots);
1832  }
1833 
1834  /* Scan the ZDD subtables. */
1835  size = dd->sizeZ;
1836 
1837  for (i = 0; i < size; i++) {
1838  subtable = &(dd->subtableZ[i]);
1839  empty += (double) subtable->slots *
1840  exp(-(double) subtable->keys / (double) subtable->slots);
1841  }
1842 
1843  /* Constant table. */
1844  subtable = &(dd->constants);
1845  empty += (double) subtable->slots *
1846  exp(-(double) subtable->keys / (double) subtable->slots);
1847 
1848  return(1.0 - empty / (double) dd->slots);
1849 
1850 } /* end of Cudd_ExpectedUsedSlots */
unsigned int keys
Definition: cuddInt.h:314
int size
Definition: cuddInt.h:345
unsigned int slots
Definition: cuddInt.h:352
DdSubtable * subtables
Definition: cuddInt.h:349
int sizeZ
Definition: cuddInt.h:346
unsigned int slots
Definition: cuddInt.h:313
DdSubtable constants
Definition: cuddInt.h:351
static DdNode * empty
Definition: cuddZddLin.c:94
DdSubtable * subtableZ
Definition: cuddInt.h:350

◆ Cudd_FindEssential()

DdNode* Cudd_FindEssential ( DdManager dd,
DdNode f 
)

◆ Cudd_FindTwoLiteralClauses()

DdTlcInfo* Cudd_FindTwoLiteralClauses ( DdManager dd,
DdNode f 
)

◆ Cudd_FirstCube()

DdGen* Cudd_FirstCube ( DdManager dd,
DdNode f,
int **  cube,
CUDD_VALUE_TYPE value 
)

Function********************************************************************

Synopsis [Finds the first cube of a decision diagram.]

Description [Defines an iterator on the onset of a decision diagram and finds its first cube. Returns a generator that contains the information necessary to continue the enumeration if successful; NULL otherwise.

A cube is represented as an array of literals, which are integers in {0, 1, 2}; 0 represents a complemented literal, 1 represents an uncomplemented literal, and 2 stands for don't care. The enumeration produces a disjoint cover of the function associated with the diagram. The size of the array equals the number of variables in the manager at the time Cudd_FirstCube is called.

For each cube, a value is also returned. This value is always 1 for a BDD, while it may be different from 1 for an ADD. For BDDs, the offset is the set of cubes whose value is the logical zero. For ADDs, the offset is the set of cubes whose value is the background value. The cubes of the offset are not enumerated.]

SideEffects [The first cube and its value are returned as side effects.]

SeeAlso [Cudd_ForeachCube Cudd_NextCube Cudd_GenFree Cudd_IsGenEmpty Cudd_FirstNode]

Definition at line 1806 of file cuddUtil.c.

1811 {
1812  DdGen *gen;
1813  DdNode *top, *treg, *next, *nreg, *prev, *preg;
1814  int i;
1815  int nvars;
1816 
1817  /* Sanity Check. */
1818  if (dd == NULL || f == NULL) return(NULL);
1819 
1820  /* Allocate generator an initialize it. */
1821  gen = ALLOC(DdGen,1);
1822  if (gen == NULL) {
1823  dd->errorCode = CUDD_MEMORY_OUT;
1824  return(NULL);
1825  }
1826 
1827  gen->manager = dd;
1828  gen->type = CUDD_GEN_CUBES;
1829  gen->status = CUDD_GEN_EMPTY;
1830  gen->gen.cubes.cube = NULL;
1831  gen->gen.cubes.value = DD_ZERO_VAL;
1832  gen->stack.sp = 0;
1833  gen->stack.stack = NULL;
1834  gen->node = NULL;
1835 
1836  nvars = dd->size;
1837  gen->gen.cubes.cube = ALLOC(int,nvars);
1838  if (gen->gen.cubes.cube == NULL) {
1839  dd->errorCode = CUDD_MEMORY_OUT;
1840  FREE(gen);
1841  return(NULL);
1842  }
1843  for (i = 0; i < nvars; i++) gen->gen.cubes.cube[i] = 2;
1844 
1845  /* The maximum stack depth is one plus the number of variables.
1846  ** because a path may have nodes at all levels, including the
1847  ** constant level.
1848  */
1849  gen->stack.stack = ALLOC(DdNodePtr, nvars+1);
1850  if (gen->stack.stack == NULL) {
1851  dd->errorCode = CUDD_MEMORY_OUT;
1852  FREE(gen->gen.cubes.cube);
1853  FREE(gen);
1854  return(NULL);
1855  }
1856  for (i = 0; i <= nvars; i++) gen->stack.stack[i] = NULL;
1857 
1858  /* Find the first cube of the onset. */
1859  gen->stack.stack[gen->stack.sp] = f; gen->stack.sp++;
1860 
1861  while (1) {
1862  top = gen->stack.stack[gen->stack.sp-1];
1863  treg = Cudd_Regular(top);
1864  if (!cuddIsConstant(treg)) {
1865  /* Take the else branch first. */
1866  gen->gen.cubes.cube[treg->index] = 0;
1867  next = cuddE(treg);
1868  if (top != treg) next = Cudd_Not(next);
1869  gen->stack.stack[gen->stack.sp] = next; gen->stack.sp++;
1870  } else if (top == Cudd_Not(DD_ONE(dd)) || top == dd->background) {
1871  /* Backtrack */
1872  while (1) {
1873  if (gen->stack.sp == 1) {
1874  /* The current node has no predecessor. */
1875  gen->status = CUDD_GEN_EMPTY;
1876  gen->stack.sp--;
1877  goto done;
1878  }
1879  prev = gen->stack.stack[gen->stack.sp-2];
1880  preg = Cudd_Regular(prev);
1881  nreg = cuddT(preg);
1882  if (prev != preg) {next = Cudd_Not(nreg);} else {next = nreg;}
1883  if (next != top) { /* follow the then branch next */
1884  gen->gen.cubes.cube[preg->index] = 1;
1885  gen->stack.stack[gen->stack.sp-1] = next;
1886  break;
1887  }
1888  /* Pop the stack and try again. */
1889  gen->gen.cubes.cube[preg->index] = 2;
1890  gen->stack.sp--;
1891  top = gen->stack.stack[gen->stack.sp-1];
1892  treg = Cudd_Regular(top);
1893  }
1894  } else {
1895  gen->status = CUDD_GEN_NONEMPTY;
1896  gen->gen.cubes.value = cuddV(top);
1897  goto done;
1898  }
1899  }
1900 
1901 done:
1902  *cube = gen->gen.cubes.cube;
1903  *value = gen->gen.cubes.value;
1904  return(gen);
1905 
1906 } /* end of Cudd_FirstCube */
DdNode * node
Definition: cuddInt.h:227
int type
Definition: cuddInt.h:208
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
Definition: cuddInt.h:206
#define DD_ZERO_VAL
Definition: cuddInt.h:109
#define CUDD_GEN_NONEMPTY
Definition: cuddInt.h:199
#define cuddV(node)
Definition: cuddInt.h:641
DdNode ** stack
Definition: cuddInt.h:225
#define ALLOC(type, num)
Definition: util.h:76
DdManager * manager
Definition: cuddInt.h:207
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
struct DdGen::@1::@3 cubes
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
DdHalfWord index
Definition: cudd.h:271
#define CUDD_GEN_CUBES
Definition: cuddInt.h:194
union DdGen::@1 gen
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdNode * background
Definition: cuddInt.h:333
int status
Definition: cuddInt.h:209

◆ Cudd_FirstNode()

DdGen* Cudd_FirstNode ( DdManager dd,
DdNode f,
DdNode **  node 
)

Function********************************************************************

Synopsis [Finds the first node of a decision diagram.]

Description [Defines an iterator on the nodes of a decision diagram and finds its first node. Returns a generator that contains the information necessary to continue the enumeration if successful; NULL otherwise. The nodes are enumerated in a reverse topological order, so that a node is always preceded in the enumeration by its descendants.]

SideEffects [The first node is returned as a side effect.]

SeeAlso [Cudd_ForeachNode Cudd_NextNode Cudd_GenFree Cudd_IsGenEmpty Cudd_FirstCube]

Definition at line 2408 of file cuddUtil.c.

2412 {
2413  DdGen *gen;
2414  int size;
2415 
2416  /* Sanity Check. */
2417  if (dd == NULL || f == NULL) return(NULL);
2418 
2419  /* Allocate generator an initialize it. */
2420  gen = ALLOC(DdGen,1);
2421  if (gen == NULL) {
2422  dd->errorCode = CUDD_MEMORY_OUT;
2423  return(NULL);
2424  }
2425 
2426  gen->manager = dd;
2427  gen->type = CUDD_GEN_NODES;
2428  gen->status = CUDD_GEN_EMPTY;
2429  gen->stack.sp = 0;
2430  gen->node = NULL;
2431 
2432  /* Collect all the nodes on the generator stack for later perusal. */
2433  gen->stack.stack = cuddNodeArray(Cudd_Regular(f), &size);
2434  if (gen->stack.stack == NULL) {
2435  FREE(gen);
2436  dd->errorCode = CUDD_MEMORY_OUT;
2437  return(NULL);
2438  }
2439  gen->gen.nodes.size = size;
2440 
2441  /* Find the first node. */
2442  if (gen->stack.sp < gen->gen.nodes.size) {
2443  gen->status = CUDD_GEN_NONEMPTY;
2444  gen->node = gen->stack.stack[gen->stack.sp];
2445  *node = gen->node;
2446  }
2447 
2448  return(gen);
2449 
2450 } /* end of Cudd_FirstNode */
DdNode * node
Definition: cuddInt.h:227
int type
Definition: cuddInt.h:208
#define FREE(obj)
Definition: util.h:80
#define CUDD_GEN_NODES
Definition: cuddInt.h:196
struct DdGen::@1::@5 nodes
#define Cudd_Regular(node)
Definition: cudd.h:384
Definition: cuddInt.h:206
#define CUDD_GEN_NONEMPTY
Definition: cuddInt.h:199
DdNode ** stack
Definition: cuddInt.h:225
#define ALLOC(type, num)
Definition: util.h:76
DdManager * manager
Definition: cuddInt.h:207
DdNodePtr * cuddNodeArray(DdNode *f, int *n)
Definition: cuddUtil.c:2987
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
union DdGen::@1 gen
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
int status
Definition: cuddInt.h:209

◆ Cudd_FirstPrime()

DdGen* Cudd_FirstPrime ( DdManager dd,
DdNode l,
DdNode u,
int **  cube 
)

Function********************************************************************

Synopsis [Finds the first prime of a Boolean function.]

Description [Defines an iterator on a pair of BDDs describing a (possibly incompletely specified) Boolean functions and finds the first cube of a cover of the function. Returns a generator that contains the information necessary to continue the enumeration if successful; NULL otherwise.

The two argument BDDs are the lower and upper bounds of an interval. It is a mistake to call this function with a lower bound that is not less than or equal to the upper bound.

A cube is represented as an array of literals, which are integers in {0, 1, 2}; 0 represents a complemented literal, 1 represents an uncomplemented literal, and 2 stands for don't care. The enumeration produces a prime and irredundant cover of the function associated with the two BDDs. The size of the array equals the number of variables in the manager at the time Cudd_FirstCube is called.

This iterator can only be used on BDDs.]

SideEffects [The first cube is returned as side effect.]

SeeAlso [Cudd_ForeachPrime Cudd_NextPrime Cudd_GenFree Cudd_IsGenEmpty Cudd_FirstCube Cudd_FirstNode]

Definition at line 2036 of file cuddUtil.c.

2041 {
2042  DdGen *gen;
2043  DdNode *implicant, *prime, *tmp;
2044  int length, result;
2045 
2046  /* Sanity Check. */
2047  if (dd == NULL || l == NULL || u == NULL) return(NULL);
2048 
2049  /* Allocate generator an initialize it. */
2050  gen = ALLOC(DdGen,1);
2051  if (gen == NULL) {
2052  dd->errorCode = CUDD_MEMORY_OUT;
2053  return(NULL);
2054  }
2055 
2056  gen->manager = dd;
2057  gen->type = CUDD_GEN_PRIMES;
2058  gen->status = CUDD_GEN_EMPTY;
2059  gen->gen.primes.cube = NULL;
2060  gen->gen.primes.ub = u;
2061  gen->stack.sp = 0;
2062  gen->stack.stack = NULL;
2063  gen->node = l;
2064  cuddRef(l);
2065 
2066  gen->gen.primes.cube = ALLOC(int,dd->size);
2067  if (gen->gen.primes.cube == NULL) {
2068  dd->errorCode = CUDD_MEMORY_OUT;
2069  FREE(gen);
2070  return(NULL);
2071  }
2072 
2073  if (gen->node == Cudd_ReadLogicZero(dd)) {
2074  gen->status = CUDD_GEN_EMPTY;
2075  } else {
2076  implicant = Cudd_LargestCube(dd,gen->node,&length);
2077  if (implicant == NULL) {
2078  Cudd_RecursiveDeref(dd,gen->node);
2079  FREE(gen->gen.primes.cube);
2080  FREE(gen);
2081  return(NULL);
2082  }
2083  cuddRef(implicant);
2084  prime = Cudd_bddMakePrime(dd,implicant,gen->gen.primes.ub);
2085  if (prime == NULL) {
2086  Cudd_RecursiveDeref(dd,gen->node);
2087  Cudd_RecursiveDeref(dd,implicant);
2088  FREE(gen->gen.primes.cube);
2089  FREE(gen);
2090  return(NULL);
2091  }
2092  cuddRef(prime);
2093  Cudd_RecursiveDeref(dd,implicant);
2094  tmp = Cudd_bddAnd(dd,gen->node,Cudd_Not(prime));
2095  if (tmp == NULL) {
2096  Cudd_RecursiveDeref(dd,gen->node);
2097  Cudd_RecursiveDeref(dd,prime);
2098  FREE(gen->gen.primes.cube);
2099  FREE(gen);
2100  return(NULL);
2101  }
2102  cuddRef(tmp);
2103  Cudd_RecursiveDeref(dd,gen->node);
2104  gen->node = tmp;
2105  result = Cudd_BddToCubeArray(dd,prime,gen->gen.primes.cube);
2106  if (result == 0) {
2107  Cudd_RecursiveDeref(dd,gen->node);
2108  Cudd_RecursiveDeref(dd,prime);
2109  FREE(gen->gen.primes.cube);
2110  FREE(gen);
2111  return(NULL);
2112  }
2113  Cudd_RecursiveDeref(dd,prime);
2114  gen->status = CUDD_GEN_NONEMPTY;
2115  }
2116  *cube = gen->gen.primes.cube;
2117  return(gen);
2118 
2119 } /* end of Cudd_FirstPrime */
#define cuddRef(n)
Definition: cuddInt.h:557
DdNode * node
Definition: cuddInt.h:227
int type
Definition: cuddInt.h:208
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1298
Definition: cuddInt.h:206
#define CUDD_GEN_NONEMPTY
Definition: cuddInt.h:199
DdNode * Cudd_LargestCube(DdManager *manager, DdNode *f, int *length)
Definition: cuddSat.c:288
DdNode * Cudd_bddMakePrime(DdManager *dd, DdNode *cube, DdNode *f)
Definition: cuddSat.c:871
int Cudd_BddToCubeArray(DdManager *dd, DdNode *cube, int *array)
Definition: cuddUtil.c:2354
DdNode ** stack
Definition: cuddInt.h:225
#define ALLOC(type, num)
Definition: util.h:76
DdManager * manager
Definition: cuddInt.h:207
struct DdGen::@1::@4 primes
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
union DdGen::@1 gen
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121
#define CUDD_GEN_PRIMES
Definition: cuddInt.h:195
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
int status
Definition: cuddInt.h:209

◆ Cudd_FreeTree()

void Cudd_FreeTree ( DdManager dd)

Function********************************************************************

Synopsis [Frees the variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetTree Cudd_ReadTree Cudd_FreeZddTree]

Definition at line 2462 of file cuddAPI.c.

2464 {
2465  if (dd->tree != NULL) {
2466  Mtr_FreeTree(dd->tree);
2467  dd->tree = NULL;
2468  }
2469  return;
2470 
2471 } /* end of Cudd_FreeTree */
void Mtr_FreeTree(MtrNode *node)
Definition: mtrBasic.c:187
MtrNode * tree
Definition: cuddInt.h:408

◆ Cudd_FreeZddTree()

void Cudd_FreeZddTree ( DdManager dd)

Function********************************************************************

Synopsis [Frees the variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetZddTree Cudd_ReadZddTree Cudd_FreeTree]

Definition at line 2534 of file cuddAPI.c.

2536 {
2537  if (dd->treeZ != NULL) {
2538  Mtr_FreeTree(dd->treeZ);
2539  dd->treeZ = NULL;
2540  }
2541  return;
2542 
2543 } /* end of Cudd_FreeZddTree */
void Mtr_FreeTree(MtrNode *node)
Definition: mtrBasic.c:187
MtrNode * treeZ
Definition: cuddInt.h:409

◆ Cudd_GarbageCollectionEnabled()

int Cudd_GarbageCollectionEnabled ( DdManager dd)

Function********************************************************************

Synopsis [Tells whether garbage collection is enabled.]

Description [Returns 1 if garbage collection is enabled; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_EnableGarbageCollection Cudd_DisableGarbageCollection]

Definition at line 2799 of file cuddAPI.c.

2801 {
2802  return(dd->gcEnabled);
2803 
2804 } /* end of Cudd_GarbageCollectionEnabled */
int gcEnabled
Definition: cuddInt.h:360

◆ Cudd_GenFree()

int Cudd_GenFree ( DdGen gen)

Function********************************************************************

Synopsis [Frees a CUDD generator.]

Description [Frees a CUDD generator. Always returns 0, so that it can be used in mis-like foreach constructs.]

SideEffects [None]

SeeAlso [Cudd_ForeachCube Cudd_ForeachNode Cudd_FirstCube Cudd_NextCube Cudd_FirstNode Cudd_NextNode Cudd_IsGenEmpty]

Definition at line 2499 of file cuddUtil.c.

2501 {
2502  if (gen == NULL) return(0);
2503  switch (gen->type) {
2504  case CUDD_GEN_CUBES:
2505  case CUDD_GEN_ZDD_PATHS:
2506  FREE(gen->gen.cubes.cube);
2507  FREE(gen->stack.stack);
2508  break;
2509  case CUDD_GEN_PRIMES:
2510  FREE(gen->gen.primes.cube);
2511  Cudd_RecursiveDeref(gen->manager,gen->node);
2512  break;
2513  case CUDD_GEN_NODES:
2514  FREE(gen->stack.stack);
2515  break;
2516  default:
2517  return(0);
2518  }
2519  FREE(gen);
2520  return(0);
2521 
2522 } /* end of Cudd_GenFree */
DdNode * node
Definition: cuddInt.h:227
int type
Definition: cuddInt.h:208
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
#define FREE(obj)
Definition: util.h:80
#define CUDD_GEN_ZDD_PATHS
Definition: cuddInt.h:197
#define CUDD_GEN_NODES
Definition: cuddInt.h:196
DdNode ** stack
Definition: cuddInt.h:225
DdManager * manager
Definition: cuddInt.h:207
struct DdGen::@1::@4 primes
struct DdGen::@1::@3 cubes
#define CUDD_GEN_CUBES
Definition: cuddInt.h:194
union DdGen::@1 gen
#define CUDD_GEN_PRIMES
Definition: cuddInt.h:195

◆ Cudd_IncreaseTimeLimit()

void Cudd_IncreaseTimeLimit ( DdManager unique,
unsigned long  increase 
)

Function********************************************************************

Synopsis [Increases the time limit for the manager.]

Description [Increases the time limit for the manager.]

SideEffects [None]

SeeAlso [Cudd_ReadTimeLimit Cudd_SetTimeLimit Cudd_UnsetTimeLimit Cudd_UpdateTimeLimit Cudd_TimeLimited Cudd_SetStartTime]

Definition at line 838 of file cuddAPI.c.

841 {
842  if (unique->timeLimit == ~0UL)
843  unique->timeLimit = increase;
844  else
845  unique->timeLimit += increase;
846 
847 } /* end of Cudd_IncreaseTimeLimit */
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_Increasing()

DdNode* Cudd_Increasing ( DdManager dd,
DdNode f,
int  i 
)

Function********************************************************************

Synopsis [Determines whether a BDD is positive unate in a variable.]

Description [Determines whether the function represented by BDD f is positive unate (monotonic increasing) in variable i. It is based on Cudd_Decreasing and the fact that f is monotonic increasing in i if and only if its complement is monotonic decreasing in i.]

SideEffects [None]

SeeAlso [Cudd_Decreasing]

Definition at line 504 of file cuddSat.c.

508 {
509  return(Cudd_Decreasing(dd,Cudd_Not(f),i));
510 
511 } /* end of Cudd_Increasing */
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode * Cudd_Decreasing(DdManager *dd, DdNode *f, int i)
Definition: cuddSat.c:424

◆ Cudd_IndicesToCube()

DdNode* Cudd_IndicesToCube ( DdManager dd,
int *  array,
int  n 
)

Function********************************************************************

Synopsis [Builds a cube of BDD variables from an array of indices.]

Description [Builds a cube of BDD variables from an array of indices. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddComputeCube Cudd_CubeArrayToBdd]

Definition at line 2561 of file cuddUtil.c.

2565 {
2566  DdNode *cube, *tmp;
2567  int i;
2568 
2569  cube = DD_ONE(dd);
2570  cuddRef(cube);
2571  for (i = n - 1; i >= 0; i--) {
2572  tmp = Cudd_bddAnd(dd,Cudd_bddIthVar(dd,array[i]),cube);
2573  if (tmp == NULL) {
2574  Cudd_RecursiveDeref(dd,cube);
2575  return(NULL);
2576  }
2577  cuddRef(tmp);
2578  Cudd_RecursiveDeref(dd,cube);
2579  cube = tmp;
2580  }
2581 
2582  cuddDeref(cube);
2583  return(cube);
2584 
2585 } /* end of Cudd_IndicesToCube */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:430
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_Inequality()

DdNode* Cudd_Inequality ( DdManager dd,
int  N,
int  c,
DdNode **  x,
DdNode **  y 
)

◆ Cudd_Init()

DdManager* Cudd_Init ( unsigned int  numVars,
unsigned int  numVarsZ,
unsigned int  numSlots,
unsigned int  cacheSize,
unsigned long  maxMemory 
)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Creates a new DD manager.]

Description [Creates a new DD manager, initializes the table, the basic constants and the projection functions. If maxMemory is 0, Cudd_Init decides suitable values for the maximum size of the cache and for the limit for fast unique table growth based on the available memory. Returns a pointer to the manager if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_Quit]

Definition at line 121 of file cuddInit.c.

127 {
128  DdManager *unique;
129  int i,result;
130  DdNode *one, *zero;
131  unsigned int maxCacheSize;
132  unsigned int looseUpTo;
133  extern DD_OOMFP MMoutOfMemory;
134  DD_OOMFP saveHandler;
135 
136  if (maxMemory == 0) {
137  maxMemory = getSoftDataLimit();
138  }
139  looseUpTo = (unsigned int) ((maxMemory / sizeof(DdNode)) /
141  unique = cuddInitTable(numVars,numVarsZ,numSlots,looseUpTo);
142  if (unique == NULL) return(NULL);
143  unique->maxmem = (unsigned long) maxMemory / 10 * 9;
144  maxCacheSize = (unsigned int) ((maxMemory / sizeof(DdCache)) /
146  result = cuddInitCache(unique,cacheSize,maxCacheSize);
147  if (result == 0) return(NULL);
148 
149  saveHandler = MMoutOfMemory;
150  MMoutOfMemory = Cudd_OutOfMem;
151  unique->stash = ALLOC(char,(maxMemory / DD_STASH_FRACTION) + 4);
152  MMoutOfMemory = saveHandler;
153  if (unique->stash == NULL) {
154  (void) fprintf(unique->err,"Unable to set aside memory\n");
155  }
156 
157  /* Initialize constants. */
158  unique->one = cuddUniqueConst(unique,1.0);
159  if (unique->one == NULL) return(0);
160  cuddRef(unique->one);
161  unique->zero = cuddUniqueConst(unique,0.0);
162  if (unique->zero == NULL) return(0);
163  cuddRef(unique->zero);
164 #ifdef HAVE_IEEE_754
165  if (DD_PLUS_INF_VAL != DD_PLUS_INF_VAL * 3 ||
167  (void) fprintf(unique->err,"Warning: Crippled infinite values\n");
168  (void) fprintf(unique->err,"Recompile without -DHAVE_IEEE_754\n");
169  }
170 #endif
171  unique->plusinfinity = cuddUniqueConst(unique,DD_PLUS_INF_VAL);
172  if (unique->plusinfinity == NULL) return(0);
173  cuddRef(unique->plusinfinity);
175  if (unique->minusinfinity == NULL) return(0);
176  cuddRef(unique->minusinfinity);
177  unique->background = unique->zero;
178 
179  /* The logical zero is different from the CUDD_VALUE_TYPE zero! */
180  one = unique->one;
181  zero = Cudd_Not(one);
182  /* Create the projection functions. */
183  unique->vars = ALLOC(DdNodePtr,unique->maxSize);
184  if (unique->vars == NULL) {
185  unique->errorCode = CUDD_MEMORY_OUT;
186  return(NULL);
187  }
188  for (i = 0; i < unique->size; i++) {
189  unique->vars[i] = cuddUniqueInter(unique,i,one,zero);
190  if (unique->vars[i] == NULL) return(0);
191  cuddRef(unique->vars[i]);
192  }
193 
194  if (unique->sizeZ)
195  cuddZddInitUniv(unique);
196 
197  unique->memused += sizeof(DdNode *) * unique->maxSize;
198 
199  return(unique);
200 
201 } /* end of Cudd_Init */
#define cuddRef(n)
Definition: cuddInt.h:557
int cuddZddInitUniv(DdManager *zdd)
Definition: cuddInit.c:245
void Cudd_OutOfMem(long size)
Definition: cuddUtil.c:2845
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define DD_MAX_CACHE_FRACTION
Definition: cuddInt.h:141
DdNode * cuddUniqueConst(DdManager *unique, CUDD_VALUE_TYPE value)
Definition: cuddTable.c:1479
int size
Definition: cuddInt.h:345
#define DD_STASH_FRACTION
Definition: cuddInt.h:143
DdNode * zero
Definition: cuddInt.h:330
#define DD_MAX_LOOSE_FRACTION
Definition: cuddInt.h:139
FILE * err
Definition: cuddInt.h:424
#define DD_PLUS_INF_VAL
Definition: cuddInt.h:118
void(* DD_OOMFP)(long)
Definition: cudd.h:311
static DdNode * one
Definition: cuddSat.c:105
char * stash
Definition: cuddInt.h:382
#define ALLOC(type, num)
Definition: util.h:76
int maxSize
Definition: cuddInt.h:347
unsigned long getSoftDataLimit(void)
Definition: datalimit.c:35
void(* MMoutOfMemory)(long)
Definition: safe_mem.c:32
DdManager * cuddInitTable(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int looseUpTo)
Definition: cuddTable.c:380
unsigned long memused
Definition: cuddInt.h:429
int sizeZ
Definition: cuddInt.h:346
DdNode ** vars
Definition: cuddInt.h:373
static DdNode * zero
Definition: cuddSat.c:105
DdNode * one
Definition: cuddInt.h:329
DdNode * plusinfinity
Definition: cuddInt.h:331
static int result
Definition: cuddGenetic.c:121
unsigned long maxmem
Definition: cuddInt.h:430
DdNode * minusinfinity
Definition: cuddInt.h:332
int cuddInitCache(DdManager *unique, unsigned int cacheSize, unsigned int maxCacheSize)
Definition: cuddCache.c:132
#define DD_MINUS_INF_VAL
Definition: cuddInt.h:122
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdNode * cuddUniqueInter(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1137
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_IsGenEmpty()

int Cudd_IsGenEmpty ( DdGen gen)

Function********************************************************************

Synopsis [Queries the status of a generator.]

Description [Queries the status of a generator. Returns 1 if the generator is empty or NULL; 0 otherswise.]

SideEffects [None]

SeeAlso [Cudd_ForeachCube Cudd_ForeachNode Cudd_FirstCube Cudd_NextCube Cudd_FirstNode Cudd_NextNode Cudd_GenFree]

Definition at line 2539 of file cuddUtil.c.

2541 {
2542  if (gen == NULL) return(1);
2543  return(gen->status == CUDD_GEN_EMPTY);
2544 
2545 } /* end of Cudd_IsGenEmpty */
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
int status
Definition: cuddInt.h:209

◆ Cudd_IsInHook()

int Cudd_IsInHook ( DdManager dd,
DD_HFP  f,
Cudd_HookType  where 
)

Function********************************************************************

Synopsis [Checks whether a function is in a hook.]

Description [Checks whether a function is in a hook. A hook is a list of application-provided functions called on certain occasions by the package. Returns 1 if the function is found; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_AddHook Cudd_RemoveHook]

Definition at line 3684 of file cuddAPI.c.

3688 {
3689  DdHook *hook;
3690 
3691  switch (where) {
3692  case CUDD_PRE_GC_HOOK:
3693  hook = dd->preGCHook;
3694  break;
3695  case CUDD_POST_GC_HOOK:
3696  hook = dd->postGCHook;
3697  break;
3699  hook = dd->preReorderingHook;
3700  break;
3702  hook = dd->postReorderingHook;
3703  break;
3704  default:
3705  return(0);
3706  }
3707  /* Scan the list and find whether the function is already there. */
3708  while (hook != NULL) {
3709  if (hook->f == f) {
3710  return(1);
3711  }
3712  hook = hook->next;
3713  }
3714  return(0);
3715 
3716 } /* end of Cudd_IsInHook */
DdHook * preReorderingHook
Definition: cuddInt.h:421
DD_HFP f
Definition: cuddInt.h:241
DdHook * postReorderingHook
Definition: cuddInt.h:422
struct DdHook * next
Definition: cuddInt.h:242
DdHook * postGCHook
Definition: cuddInt.h:420
DdHook * preGCHook
Definition: cuddInt.h:419

◆ Cudd_IsNonConstant()

int Cudd_IsNonConstant ( DdNode f)

Function********************************************************************

Synopsis [Returns 1 if a DD node is not constant.]

Description [Returns 1 if a DD node is not constant. This function is useful to test the results of Cudd_bddIteConstant, Cudd_addIteConstant, Cudd_addEvalConst. These results may be a special value signifying non-constant. In the other cases the macro Cudd_IsConstant can be used.]

SideEffects [None]

SeeAlso [Cudd_IsConstant Cudd_bddIteConstant Cudd_addIteConstant Cudd_addEvalConst]

Definition at line 659 of file cuddAPI.c.

661 {
662  return(f == DD_NON_CONSTANT || !Cudd_IsConstant(f));
663 
664 } /* end of Cudd_IsNonConstant */
#define Cudd_IsConstant(node)
Definition: cudd.h:339
#define DD_NON_CONSTANT
Definition: cuddInt.h:124

◆ Cudd_IterDerefBdd()

void Cudd_IterDerefBdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of BDD node n.]

Description [Decreases the reference count of node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a BDD that is no longer needed. It is more efficient than Cudd_RecursiveDeref, but it cannot be used on ADDs. The greater efficiency comes from being able to assume that no constant node will ever die as a result of a call to this procedure.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_DelayedDerefBdd]

Definition at line 213 of file cuddRef.c.

216 {
217  DdNode *N;
218  int ord;
219  DdNodePtr *stack = table->stack;
220  int SP = 1;
221 
222  unsigned int live = table->keys - table->dead;
223  if (live > table->peakLiveNodes) {
224  table->peakLiveNodes = live;
225  }
226 
227  N = Cudd_Regular(n);
228 
229  do {
230 #ifdef DD_DEBUG
231  assert(N->ref != 0);
232 #endif
233 
234  if (N->ref == 1) {
235  N->ref = 0;
236  table->dead++;
237 #ifdef DD_STATS
238  table->nodesDropped++;
239 #endif
240  ord = table->perm[N->index];
241  stack[SP++] = Cudd_Regular(cuddE(N));
242  table->subtables[ord].dead++;
243  N = cuddT(N);
244  } else {
245  cuddSatDec(N->ref);
246  N = stack[--SP];
247  }
248  } while (SP != 0);
249 
250 } /* end of Cudd_IterDerefBdd */
DdHalfWord ref
Definition: cudd.h:272
unsigned int peakLiveNodes
Definition: cuddInt.h:445
Definition: cudd.h:270
#define assert(ex)
Definition: util.h:141
#define Cudd_Regular(node)
Definition: cudd.h:384
DdSubtable * subtables
Definition: cuddInt.h:349
DdNode ** stack
Definition: cuddInt.h:364
unsigned int dead
Definition: cuddInt.h:355
unsigned int keys
Definition: cuddInt.h:353
unsigned int dead
Definition: cuddInt.h:316
#define cuddT(node)
Definition: cuddInt.h:609
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define cuddSatDec(x)
Definition: cuddInt.h:849
int * perm
Definition: cuddInt.h:369

◆ Cudd_LargestCube()

DdNode* Cudd_LargestCube ( DdManager manager,
DdNode f,
int *  length 
)

Function********************************************************************

Synopsis [Finds a largest cube in a DD.]

Description [Finds a largest cube in a DD. f is the DD we want to get the largest cube for. The problem is translated into the one of finding a shortest path in f, when both THEN and ELSE arcs are assumed to have unit length. This yields a largest cube in the disjoint cover corresponding to the DD. Therefore, it is not necessarily the largest implicant of f. Returns the largest cube as a BDD.]

SideEffects [The number of literals of the cube is returned in the location pointed by length if it is non-null.]

SeeAlso [Cudd_ShortestPath]

Definition at line 288 of file cuddSat.c.

292 {
293  register DdNode *F;
294  st_table *visited;
295  DdNode *sol;
296  cuddPathPair *rootPair;
297  int complement, cost;
298 
299  one = DD_ONE(manager);
300  zero = DD_ZERO(manager);
301 
302  if (f == Cudd_Not(one) || f == zero) {
303  if (length != NULL) {
304  *length = DD_BIGGY;
305  }
306  return(Cudd_Not(one));
307  }
308  /* From this point on, a path exists. */
309 
310  do {
311  manager->reordered = 0;
312 
313  /* Initialize visited table. */
314  visited = st_init_table(st_ptrcmp, st_ptrhash);
315 
316  /* Now get the length of the shortest path(s) from f to 1. */
317  (void) getLargest(f, visited);
318 
319  complement = Cudd_IsComplement(f);
320 
321  F = Cudd_Regular(f);
322 
323  if (!st_lookup(visited, F, &rootPair)) return(NULL);
324 
325  if (complement) {
326  cost = rootPair->neg;
327  } else {
328  cost = rootPair->pos;
329  }
330 
331  /* Recover an actual shortest path. */
332  sol = getCube(manager,visited,f,cost);
333 
334  st_foreach(visited, freePathPair, NULL);
335  st_free_table(visited);
336 
337  } while (manager->reordered == 1);
338 
339  if (length != NULL) {
340  *length = cost;
341  }
342  return(sol);
343 
344 } /* end of Cudd_LargestCube */
int st_lookup(st_table *, void *, void *)
Definition: st.c:286
Definition: st.h:60
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
static enum st_retval freePathPair(char *key, char *value, char *arg)
Definition: cuddSat.c:1060
int reordered
Definition: cuddInt.h:392
static DdNode * one
Definition: cuddSat.c:105
#define Cudd_IsComplement(node)
Definition: cudd.h:412
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
static DdNode * getCube(DdManager *manager, st_table *visited, DdNode *f, int cost)
Definition: cuddSat.c:1370
static DdNode * zero
Definition: cuddSat.c:105
int st_ptrhash(char *, int)
Definition: st.c:811
#define DD_BIGGY
Definition: cuddSat.c:82
#define DD_ONE(dd)
Definition: cuddInt.h:864
static cuddPathPair getLargest(DdNode *root, st_table *visited)
Definition: cuddSat.c:1282
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_MakeBddFromZddCover()

DdNode* Cudd_MakeBddFromZddCover ( DdManager dd,
DdNode node 
)

Function********************************************************************

Synopsis [Converts a ZDD cover to a BDD.]

Description [Converts a ZDD cover to a BDD for the function represented by the cover. If successful, it returns a BDD node, otherwise it returns NULL.]

SideEffects []

SeeAlso [Cudd_zddIsop]

Definition at line 200 of file cuddZddIsop.c.

203 {
204  DdNode *res;
205 
206  do {
207  dd->reordered = 0;
208  res = cuddMakeBddFromZddCover(dd, node);
209  } while (dd->reordered == 1);
210  return(res);
211 } /* end of Cudd_MakeBddFromZddCover */
Definition: cudd.h:270
DdNode * cuddMakeBddFromZddCover(DdManager *dd, DdNode *node)
Definition: cuddZddIsop.c:797
int reordered
Definition: cuddInt.h:392

◆ Cudd_MakeTreeNode()

MtrNode* Cudd_MakeTreeNode ( DdManager dd,
unsigned int  low,
unsigned int  size,
unsigned int  type 
)

AutomaticEnd Function********************************************************************

Synopsis [Creates a new variable group.]

Description [Creates a new variable group. The group starts at variable low and contains size variables. The parameter low is the index of the first variable. If the variable already exists, its current position in the order is known to the manager. If the variable does not exist yet, the position is assumed to be the same as the index. The group tree is created if it does not exist yet. Returns a pointer to the group if successful; NULL otherwise.]

SideEffects [The variable tree is changed.]

SeeAlso [Cudd_MakeZddTreeNode]

Definition at line 203 of file cuddGroup.c.

208 {
209  MtrNode *group;
210  MtrNode *tree;
211  unsigned int level;
212 
213  /* If the variable does not exist yet, the position is assumed to be
214  ** the same as the index. Therefore, applications that rely on
215  ** Cudd_bddNewVarAtLevel or Cudd_addNewVarAtLevel to create new
216  ** variables have to create the variables before they group them.
217  */
218  level = (low < (unsigned int) dd->size) ? dd->perm[low] : low;
219 
220  if (level + size - 1> (int) MTR_MAXHIGH)
221  return(NULL);
222 
223  /* If the tree does not exist yet, create it. */
224  tree = dd->tree;
225  if (tree == NULL) {
226  dd->tree = tree = Mtr_InitGroupTree(0, dd->size);
227  if (tree == NULL)
228  return(NULL);
229  tree->index = dd->size == 0 ? 0 : dd->invperm[0];
230  }
231 
232  /* Extend the upper bound of the tree if necessary. This allows the
233  ** application to create groups even before the variables are created.
234  */
235  tree->size = ddMax(tree->size, ddMax(level + size, (unsigned) dd->size));
236 
237  /* Create the group. */
238  group = Mtr_MakeGroup(tree, level, size, type);
239  if (group == NULL)
240  return(NULL);
241 
242  /* Initialize the index field to the index of the variable currently
243  ** in position low. This field will be updated by the reordering
244  ** procedure to provide a handle to the group once it has been moved.
245  */
246  group->index = (MtrHalfWord) low;
247 
248  return(group);
249 
250 } /* end of Cudd_MakeTreeNode */
#define MTR_MAXHIGH
Definition: mtr.h:107
unsigned short MtrHalfWord
Definition: mtr.h:123
MtrHalfWord size
Definition: mtr.h:129
int size
Definition: cuddInt.h:345
MtrNode * tree
Definition: cuddInt.h:408
MtrHalfWord index
Definition: mtr.h:130
#define ddMax(x, y)
Definition: cuddInt.h:785
Definition: mtr.h:126
MtrNode * Mtr_InitGroupTree(int lower, int size)
Definition: mtrGroup.c:120
int * invperm
Definition: cuddInt.h:371
MtrNode * Mtr_MakeGroup(MtrNode *root, unsigned int low, unsigned int high, unsigned int flags)
Definition: mtrGroup.c:156
int * perm
Definition: cuddInt.h:369

◆ Cudd_MakeZddTreeNode()

MtrNode* Cudd_MakeZddTreeNode ( DdManager dd,
unsigned int  low,
unsigned int  size,
unsigned int  type 
)

AutomaticEnd Function********************************************************************

Synopsis [Creates a new ZDD variable group.]

Description [Creates a new ZDD variable group. The group starts at variable and contains size variables. The parameter low is the index of the first variable. If the variable already exists, its current position in the order is known to the manager. If the variable does not exist yet, the position is assumed to be the same as the index. The group tree is created if it does not exist yet. Returns a pointer to the group if successful; NULL otherwise.]

SideEffects [The ZDD variable tree is changed.]

SeeAlso [Cudd_MakeTreeNode]

Definition at line 159 of file cuddZddGroup.c.

164 {
165  MtrNode *group;
166  MtrNode *tree;
167  unsigned int level;
168 
169  /* If the variable does not exist yet, the position is assumed to be
170  ** the same as the index. Therefore, applications that rely on
171  ** Cudd_bddNewVarAtLevel or Cudd_addNewVarAtLevel to create new
172  ** variables have to create the variables before they group them.
173  */
174  level = (low < (unsigned int) dd->sizeZ) ? dd->permZ[low] : low;
175 
176  if (level + size - 1> (int) MTR_MAXHIGH)
177  return(NULL);
178 
179  /* If the tree does not exist yet, create it. */
180  tree = dd->treeZ;
181  if (tree == NULL) {
182  dd->treeZ = tree = Mtr_InitGroupTree(0, dd->sizeZ);
183  if (tree == NULL)
184  return(NULL);
185  tree->index = dd->invpermZ[0];
186  }
187 
188  /* Extend the upper bound of the tree if necessary. This allows the
189  ** application to create groups even before the variables are created.
190  */
191  tree->size = ddMax(tree->size, level + size);
192 
193  /* Create the group. */
194  group = Mtr_MakeGroup(tree, level, size, type);
195  if (group == NULL)
196  return(NULL);
197 
198  /* Initialize the index field to the index of the variable currently
199  ** in position low. This field will be updated by the reordering
200  ** procedure to provide a handle to the group once it has been moved.
201  */
202  group->index = (MtrHalfWord) low;
203 
204  return(group);
205 
206 } /* end of Cudd_MakeZddTreeNode */
#define MTR_MAXHIGH
Definition: mtr.h:107
unsigned short MtrHalfWord
Definition: mtr.h:123
MtrHalfWord size
Definition: mtr.h:129
int * invpermZ
Definition: cuddInt.h:372
int * permZ
Definition: cuddInt.h:370
MtrHalfWord index
Definition: mtr.h:130
#define ddMax(x, y)
Definition: cuddInt.h:785
Definition: mtr.h:126
MtrNode * Mtr_InitGroupTree(int lower, int size)
Definition: mtrGroup.c:120
int sizeZ
Definition: cuddInt.h:346
MtrNode * treeZ
Definition: cuddInt.h:409
MtrNode * Mtr_MakeGroup(MtrNode *root, unsigned int low, unsigned int high, unsigned int flags)
Definition: mtrGroup.c:156

◆ Cudd_MinHammingDist()

int Cudd_MinHammingDist ( DdManager dd,
DdNode f,
int *  minterm,
int  upperBound 
)

◆ Cudd_NewApaNumber()

DdApaNumber Cudd_NewApaNumber ( int  digits)

◆ Cudd_NextCube()

int Cudd_NextCube ( DdGen gen,
int **  cube,
CUDD_VALUE_TYPE value 
)

Function********************************************************************

Synopsis [Generates the next cube of a decision diagram onset.]

Description [Generates the next cube of a decision diagram onset, using generator gen. Returns 0 if the enumeration is completed; 1 otherwise.]

SideEffects [The cube and its value are returned as side effects. The generator is modified.]

SeeAlso [Cudd_ForeachCube Cudd_FirstCube Cudd_GenFree Cudd_IsGenEmpty Cudd_NextNode]

Definition at line 1925 of file cuddUtil.c.

1929 {
1930  DdNode *top, *treg, *next, *nreg, *prev, *preg;
1931  DdManager *dd = gen->manager;
1932 
1933  /* Backtrack from previously reached terminal node. */
1934  while (1) {
1935  if (gen->stack.sp == 1) {
1936  /* The current node has no predecessor. */
1937  gen->status = CUDD_GEN_EMPTY;
1938  gen->stack.sp--;
1939  goto done;
1940  }
1941  top = gen->stack.stack[gen->stack.sp-1];
1942  treg = Cudd_Regular(top);
1943  prev = gen->stack.stack[gen->stack.sp-2];
1944  preg = Cudd_Regular(prev);
1945  nreg = cuddT(preg);
1946  if (prev != preg) {next = Cudd_Not(nreg);} else {next = nreg;}
1947  if (next != top) { /* follow the then branch next */
1948  gen->gen.cubes.cube[preg->index] = 1;
1949  gen->stack.stack[gen->stack.sp-1] = next;
1950  break;
1951  }
1952  /* Pop the stack and try again. */
1953  gen->gen.cubes.cube[preg->index] = 2;
1954  gen->stack.sp--;
1955  }
1956 
1957  while (1) {
1958  top = gen->stack.stack[gen->stack.sp-1];
1959  treg = Cudd_Regular(top);
1960  if (!cuddIsConstant(treg)) {
1961  /* Take the else branch first. */
1962  gen->gen.cubes.cube[treg->index] = 0;
1963  next = cuddE(treg);
1964  if (top != treg) next = Cudd_Not(next);
1965  gen->stack.stack[gen->stack.sp] = next; gen->stack.sp++;
1966  } else if (top == Cudd_Not(DD_ONE(dd)) || top == dd->background) {
1967  /* Backtrack */
1968  while (1) {
1969  if (gen->stack.sp == 1) {
1970  /* The current node has no predecessor. */
1971  gen->status = CUDD_GEN_EMPTY;
1972  gen->stack.sp--;
1973  goto done;
1974  }
1975  prev = gen->stack.stack[gen->stack.sp-2];
1976  preg = Cudd_Regular(prev);
1977  nreg = cuddT(preg);
1978  if (prev != preg) {next = Cudd_Not(nreg);} else {next = nreg;}
1979  if (next != top) { /* follow the then branch next */
1980  gen->gen.cubes.cube[preg->index] = 1;
1981  gen->stack.stack[gen->stack.sp-1] = next;
1982  break;
1983  }
1984  /* Pop the stack and try again. */
1985  gen->gen.cubes.cube[preg->index] = 2;
1986  gen->stack.sp--;
1987  top = gen->stack.stack[gen->stack.sp-1];
1988  treg = Cudd_Regular(top);
1989  }
1990  } else {
1991  gen->status = CUDD_GEN_NONEMPTY;
1992  gen->gen.cubes.value = cuddV(top);
1993  goto done;
1994  }
1995  }
1996 
1997 done:
1998  if (gen->status == CUDD_GEN_EMPTY) return(0);
1999  *cube = gen->gen.cubes.cube;
2000  *value = gen->gen.cubes.value;
2001  return(1);
2002 
2003 } /* end of Cudd_NextCube */
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define Cudd_Regular(node)
Definition: cudd.h:384
#define CUDD_GEN_NONEMPTY
Definition: cuddInt.h:199
#define cuddV(node)
Definition: cuddInt.h:641
DdNode ** stack
Definition: cuddInt.h:225
DdManager * manager
Definition: cuddInt.h:207
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
struct DdGen::@1::@3 cubes
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
DdHalfWord index
Definition: cudd.h:271
union DdGen::@1 gen
#define cuddE(node)
Definition: cuddInt.h:625
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode * background
Definition: cuddInt.h:333
int status
Definition: cuddInt.h:209

◆ Cudd_NextNode()

int Cudd_NextNode ( DdGen gen,
DdNode **  node 
)

Function********************************************************************

Synopsis [Finds the next node of a decision diagram.]

Description [Finds the node of a decision diagram, using generator gen. Returns 0 if the enumeration is completed; 1 otherwise.]

SideEffects [The next node is returned as a side effect.]

SeeAlso [Cudd_ForeachNode Cudd_FirstNode Cudd_GenFree Cudd_IsGenEmpty Cudd_NextCube]

Definition at line 2467 of file cuddUtil.c.

2470 {
2471  /* Find the next node. */
2472  gen->stack.sp++;
2473  if (gen->stack.sp < gen->gen.nodes.size) {
2474  gen->node = gen->stack.stack[gen->stack.sp];
2475  *node = gen->node;
2476  return(1);
2477  } else {
2478  gen->status = CUDD_GEN_EMPTY;
2479  return(0);
2480  }
2481 
2482 } /* end of Cudd_NextNode */
DdNode * node
Definition: cuddInt.h:227
struct DdGen::@1::@5 nodes
DdNode ** stack
Definition: cuddInt.h:225
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
union DdGen::@1 gen
int status
Definition: cuddInt.h:209

◆ Cudd_NextPrime()

int Cudd_NextPrime ( DdGen gen,
int **  cube 
)

Function********************************************************************

Synopsis [Generates the next prime of a Boolean function.]

Description [Generates the next cube of a Boolean function, using generator gen. Returns 0 if the enumeration is completed; 1 otherwise.]

SideEffects [The cube and is returned as side effects. The generator is modified.]

SeeAlso [Cudd_ForeachPrime Cudd_FirstPrime Cudd_GenFree Cudd_IsGenEmpty Cudd_NextCube Cudd_NextNode]

Definition at line 2138 of file cuddUtil.c.

2141 {
2142  DdNode *implicant, *prime, *tmp;
2143  DdManager *dd = gen->manager;
2144  int length, result;
2145 
2146  if (gen->node == Cudd_ReadLogicZero(dd)) {
2147  gen->status = CUDD_GEN_EMPTY;
2148  } else {
2149  implicant = Cudd_LargestCube(dd,gen->node,&length);
2150  if (implicant == NULL) {
2151  gen->status = CUDD_GEN_EMPTY;
2152  return(0);
2153  }
2154  cuddRef(implicant);
2155  prime = Cudd_bddMakePrime(dd,implicant,gen->gen.primes.ub);
2156  if (prime == NULL) {
2157  Cudd_RecursiveDeref(dd,implicant);
2158  gen->status = CUDD_GEN_EMPTY;
2159  return(0);
2160  }
2161  cuddRef(prime);
2162  Cudd_RecursiveDeref(dd,implicant);
2163  tmp = Cudd_bddAnd(dd,gen->node,Cudd_Not(prime));
2164  if (tmp == NULL) {
2165  Cudd_RecursiveDeref(dd,prime);
2166  gen->status = CUDD_GEN_EMPTY;
2167  return(0);
2168  }
2169  cuddRef(tmp);
2170  Cudd_RecursiveDeref(dd,gen->node);
2171  gen->node = tmp;
2172  result = Cudd_BddToCubeArray(dd,prime,gen->gen.primes.cube);
2173  if (result == 0) {
2174  Cudd_RecursiveDeref(dd,prime);
2175  gen->status = CUDD_GEN_EMPTY;
2176  return(0);
2177  }
2178  Cudd_RecursiveDeref(dd,prime);
2179  gen->status = CUDD_GEN_NONEMPTY;
2180  }
2181  if (gen->status == CUDD_GEN_EMPTY) return(0);
2182  *cube = gen->gen.primes.cube;
2183  return(1);
2184 
2185 } /* end of Cudd_NextPrime */
#define cuddRef(n)
Definition: cuddInt.h:557
DdNode * node
Definition: cuddInt.h:227
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1298
#define CUDD_GEN_NONEMPTY
Definition: cuddInt.h:199
DdNode * Cudd_LargestCube(DdManager *manager, DdNode *f, int *length)
Definition: cuddSat.c:288
DdNode * Cudd_bddMakePrime(DdManager *dd, DdNode *cube, DdNode *f)
Definition: cuddSat.c:871
int Cudd_BddToCubeArray(DdManager *dd, DdNode *cube, int *array)
Definition: cuddUtil.c:2354
DdManager * manager
Definition: cuddInt.h:207
struct DdGen::@1::@4 primes
#define CUDD_GEN_EMPTY
Definition: cuddInt.h:198
union DdGen::@1 gen
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121
int status
Definition: cuddInt.h:209

◆ Cudd_NodeReadIndex()

unsigned int Cudd_NodeReadIndex ( DdNode node)

Function********************************************************************

Synopsis [Returns the index of the node.]

Description [Returns the index of the node. The node pointer can be either regular or complemented.]

SideEffects [None]

SeeAlso [Cudd_ReadIndex]

Definition at line 2559 of file cuddAPI.c.

2561 {
2562  return((unsigned int) Cudd_Regular(node)->index);
2563 
2564 } /* end of Cudd_NodeReadIndex */
#define Cudd_Regular(node)
Definition: cudd.h:384

◆ Cudd_OrderingMonitoring()

int Cudd_OrderingMonitoring ( DdManager dd)

Function********************************************************************

Synopsis [Returns 1 if monitoring of ordering is enabled.]

Description [Returns 1 if monitoring of ordering is enabled; 0 otherwise.]

SideEffects [none]

SeeAlso [Cudd_EnableOrderingMonitoring Cudd_DisableOrderingMonitoring]

Definition at line 4044 of file cuddAPI.c.

4046 {
4048 
4049 } /* end of Cudd_OrderingMonitoring */
int Cudd_IsInHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3684
int Cudd_PrintGroupedOrder(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3939

◆ Cudd_OutOfMem()

void Cudd_OutOfMem ( long  size)

Function********************************************************************

Synopsis [Warns that a memory allocation failed.]

Description [Warns that a memory allocation failed. This function can be used as replacement of MMout_of_memory to prevent the safe_mem functions of the util package from exiting when malloc returns NULL. One possible use is in case of discretionary allocations; for instance, the allocation of memory to enlarge the computed table.]

SideEffects [None]

SeeAlso []

Definition at line 2845 of file cuddUtil.c.

2847 {
2848  (void) fflush(stdout);
2849  (void) fprintf(stderr, "\nunable to allocate %ld bytes\n", size);
2850  return;
2851 
2852 } /* end of Cudd_OutOfMem */

◆ Cudd_OverApprox()

DdNode* Cudd_OverApprox ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
int  safe,
double  quality 
)

◆ Cudd_Prime()

unsigned int Cudd_Prime ( unsigned int  p)

AutomaticEnd Function********************************************************************

Synopsis [Returns the next prime >= p.]

Description []

SideEffects [None]

Definition at line 185 of file cuddTable.c.

187 {
188  int i,pn;
189 
190  p--;
191  do {
192  p++;
193  if (p&1) {
194  pn = 1;
195  i = 3;
196  while ((unsigned) (i * i) <= p) {
197  if (p % i == 0) {
198  pn = 0;
199  break;
200  }
201  i += 2;
202  }
203  } else {
204  pn = 0;
205  }
206  } while (!pn);
207  return(p);
208 
209 } /* end of Cudd_Prime */

◆ Cudd_PrintDebug()

int Cudd_PrintDebug ( DdManager dd,
DdNode f,
int  n,
int  pr 
)

Function********************************************************************

Synopsis [Prints to the standard output a DD and its statistics.]

Description [Prints to the standard output a DD and its statistics. The statistics include the number of nodes, the number of leaves, and the number of minterms. (The number of minterms is the number of assignments to the variables that cause the function to be different from the logical zero (for BDDs) and from the background value (for ADDs.) The statistics are printed if pr > 0. Specifically:

  • pr = 0 : prints nothing
  • pr = 1 : prints counts of nodes and minterms
  • pr = 2 : prints counts + disjoint sum of product
  • pr = 3 : prints counts + list of nodes
  • pr > 3 : prints counts + disjoint sum of product + list of nodes

For the purpose of counting the number of minterms, the function is supposed to depend on n variables. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_DagSize Cudd_CountLeaves Cudd_CountMinterm Cudd_PrintMinterm]

Definition at line 386 of file cuddUtil.c.

391 {
392  DdNode *azero, *bzero;
393  int nodes;
394  int leaves;
395  double minterms;
396  int retval = 1;
397 
398  if (f == NULL) {
399  (void) fprintf(dd->out,": is the NULL DD\n");
400  (void) fflush(dd->out);
401  return(0);
402  }
403  azero = DD_ZERO(dd);
404  bzero = Cudd_Not(DD_ONE(dd));
405  if ((f == azero || f == bzero) && pr > 0){
406  (void) fprintf(dd->out,": is the zero DD\n");
407  (void) fflush(dd->out);
408  return(1);
409  }
410  if (pr > 0) {
411  nodes = Cudd_DagSize(f);
412  if (nodes == CUDD_OUT_OF_MEM) retval = 0;
413  leaves = Cudd_CountLeaves(f);
414  if (leaves == CUDD_OUT_OF_MEM) retval = 0;
415  minterms = Cudd_CountMinterm(dd, f, n);
416  if (minterms == (double)CUDD_OUT_OF_MEM) retval = 0;
417  (void) fprintf(dd->out,": %d nodes %d leaves %g minterms\n",
418  nodes, leaves, minterms);
419  if (pr > 2) {
420  if (!cuddP(dd, f)) retval = 0;
421  }
422  if (pr == 2 || pr > 3) {
423  if (!Cudd_PrintMinterm(dd,f)) retval = 0;
424  (void) fprintf(dd->out,"\n");
425  }
426  (void) fflush(dd->out);
427  }
428  return(retval);
429 
430 } /* end of Cudd_PrintDebug */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:446
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
Definition: cuddUtil.c:582
FILE * out
Definition: cuddInt.h:423
int Cudd_PrintMinterm(DdManager *manager, DdNode *node)
Definition: cuddUtil.c:220
int Cudd_CountLeaves(DdNode *node)
Definition: cuddUtil.c:1202
int cuddP(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:2874
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_PrintGroupedOrder()

int Cudd_PrintGroupedOrder ( DdManager dd,
const char *  str,
void *  data 
)

Function********************************************************************

Synopsis [Hook function to print the current variable order.]

Description [Hook function to print the current variable order. It may be called before or after reordering. Prints on the manager's stdout a parenthesized list that describes the variable groups. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_StdPreReordHook]

Definition at line 3939 of file cuddAPI.c.

3943 {
3944  int isBdd = strcmp(str, "ZDD");
3945  MtrNode *tree = isBdd ? dd->tree : dd->treeZ;
3946  int *invperm = isBdd ? dd->invperm : dd->invpermZ;
3947  int size = isBdd ? dd->size : dd->sizeZ;
3948  if (tree == NULL) {
3949  int i, retval;
3950  for (i=0; i < size; i++) {
3951  retval = fprintf(dd->out, "%c%d", i==0 ? '(' : ',', invperm[i]);
3952  if (retval == EOF) return(0);
3953  }
3954  retval = fprintf(dd->out,")\n");
3955  return (retval != EOF);
3956  } else {
3957  return Mtr_PrintGroupedOrder(tree,invperm,dd->out);
3958  }
3959 
3960 } /* end of Cudd_PrintGroupedOrder */
int strcmp()
int * invpermZ
Definition: cuddInt.h:372
int size
Definition: cuddInt.h:345
MtrNode * tree
Definition: cuddInt.h:408
FILE * out
Definition: cuddInt.h:423
Definition: mtr.h:126
int Mtr_PrintGroupedOrder(MtrNode *root, int *invperm, FILE *fp)
Definition: mtrGroup.c:662
int sizeZ
Definition: cuddInt.h:346
MtrNode * treeZ
Definition: cuddInt.h:409
int * invperm
Definition: cuddInt.h:371

◆ Cudd_PrintInfo()

int Cudd_PrintInfo ( DdManager dd,
FILE *  fp 
)

Function********************************************************************

Synopsis [Prints out statistics and settings for a CUDD manager.]

Description [Prints out statistics and settings for a CUDD manager. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 3263 of file cuddAPI.c.

3266 {
3267  int retval;
3268  Cudd_ReorderingType autoMethod, autoMethodZ;
3269 
3270  /* Modifiable parameters. */
3271  retval = fprintf(fp,"**** CUDD modifiable parameters ****\n");
3272  if (retval == EOF) return(0);
3273  retval = fprintf(fp,"Hard limit for cache size: %u\n",
3274  Cudd_ReadMaxCacheHard(dd));
3275  if (retval == EOF) return(0);
3276  retval = fprintf(fp,"Cache hit threshold for resizing: %u%%\n",
3277  Cudd_ReadMinHit(dd));
3278  if (retval == EOF) return(0);
3279  retval = fprintf(fp,"Garbage collection enabled: %s\n",
3280  Cudd_GarbageCollectionEnabled(dd) ? "yes" : "no");
3281  if (retval == EOF) return(0);
3282  retval = fprintf(fp,"Limit for fast unique table growth: %u\n",
3283  Cudd_ReadLooseUpTo(dd));
3284  if (retval == EOF) return(0);
3285  retval = fprintf(fp,
3286  "Maximum number of variables sifted per reordering: %d\n",
3287  Cudd_ReadSiftMaxVar(dd));
3288  if (retval == EOF) return(0);
3289  retval = fprintf(fp,
3290  "Maximum number of variable swaps per reordering: %d\n",
3291  Cudd_ReadSiftMaxSwap(dd));
3292  if (retval == EOF) return(0);
3293  retval = fprintf(fp,"Maximum growth while sifting a variable: %g\n",
3294  Cudd_ReadMaxGrowth(dd));
3295  if (retval == EOF) return(0);
3296  retval = fprintf(fp,"Dynamic reordering of BDDs enabled: %s\n",
3297  Cudd_ReorderingStatus(dd,&autoMethod) ? "yes" : "no");
3298  if (retval == EOF) return(0);
3299  retval = fprintf(fp,"Default BDD reordering method: %d\n",
3300  (int) autoMethod);
3301  if (retval == EOF) return(0);
3302  retval = fprintf(fp,"Dynamic reordering of ZDDs enabled: %s\n",
3303  Cudd_ReorderingStatusZdd(dd,&autoMethodZ) ? "yes" : "no");
3304  if (retval == EOF) return(0);
3305  retval = fprintf(fp,"Default ZDD reordering method: %d\n",
3306  (int) autoMethodZ);
3307  if (retval == EOF) return(0);
3308  retval = fprintf(fp,"Realignment of ZDDs to BDDs enabled: %s\n",
3309  Cudd_zddRealignmentEnabled(dd) ? "yes" : "no");
3310  if (retval == EOF) return(0);
3311  retval = fprintf(fp,"Realignment of BDDs to ZDDs enabled: %s\n",
3312  Cudd_bddRealignmentEnabled(dd) ? "yes" : "no");
3313  if (retval == EOF) return(0);
3314  retval = fprintf(fp,"Dead nodes counted in triggering reordering: %s\n",
3315  Cudd_DeadAreCounted(dd) ? "yes" : "no");
3316  if (retval == EOF) return(0);
3317  retval = fprintf(fp,"Group checking criterion: %d\n",
3318  (int) Cudd_ReadGroupcheck(dd));
3319  if (retval == EOF) return(0);
3320  retval = fprintf(fp,"Recombination threshold: %d\n", Cudd_ReadRecomb(dd));
3321  if (retval == EOF) return(0);
3322  retval = fprintf(fp,"Symmetry violation threshold: %d\n",
3324  if (retval == EOF) return(0);
3325  retval = fprintf(fp,"Arc violation threshold: %d\n",
3326  Cudd_ReadArcviolation(dd));
3327  if (retval == EOF) return(0);
3328  retval = fprintf(fp,"GA population size: %d\n",
3330  if (retval == EOF) return(0);
3331  retval = fprintf(fp,"Number of crossovers for GA: %d\n",
3332  Cudd_ReadNumberXovers(dd));
3333  if (retval == EOF) return(0);
3334  retval = fprintf(fp,"Next reordering threshold: %u\n",
3336  if (retval == EOF) return(0);
3337 
3338  /* Non-modifiable parameters. */
3339  retval = fprintf(fp,"**** CUDD non-modifiable parameters ****\n");
3340  if (retval == EOF) return(0);
3341  retval = fprintf(fp,"Memory in use: %lu\n", Cudd_ReadMemoryInUse(dd));
3342  if (retval == EOF) return(0);
3343  retval = fprintf(fp,"Peak number of nodes: %ld\n",
3345  if (retval == EOF) return(0);
3346  retval = fprintf(fp,"Peak number of live nodes: %d\n",
3348  if (retval == EOF) return(0);
3349  retval = fprintf(fp,"Number of BDD variables: %d\n", dd->size);
3350  if (retval == EOF) return(0);
3351  retval = fprintf(fp,"Number of ZDD variables: %d\n", dd->sizeZ);
3352  if (retval == EOF) return(0);
3353  retval = fprintf(fp,"Number of cache entries: %u\n", dd->cacheSlots);
3354  if (retval == EOF) return(0);
3355  retval = fprintf(fp,"Number of cache look-ups: %.0f\n",
3356  Cudd_ReadCacheLookUps(dd));
3357  if (retval == EOF) return(0);
3358  retval = fprintf(fp,"Number of cache hits: %.0f\n",
3359  Cudd_ReadCacheHits(dd));
3360  if (retval == EOF) return(0);
3361  retval = fprintf(fp,"Number of cache insertions: %.0f\n",
3362  dd->cacheinserts);
3363  if (retval == EOF) return(0);
3364  retval = fprintf(fp,"Number of cache collisions: %.0f\n",
3365  dd->cachecollisions);
3366  if (retval == EOF) return(0);
3367  retval = fprintf(fp,"Number of cache deletions: %.0f\n",
3368  dd->cachedeletions);
3369  if (retval == EOF) return(0);
3370  retval = cuddCacheProfile(dd,fp);
3371  if (retval == 0) return(0);
3372  retval = fprintf(fp,"Soft limit for cache size: %u\n",
3373  Cudd_ReadMaxCache(dd));
3374  if (retval == EOF) return(0);
3375  retval = fprintf(fp,"Number of buckets in unique table: %u\n", dd->slots);
3376  if (retval == EOF) return(0);
3377  retval = fprintf(fp,"Used buckets in unique table: %.2f%% (expected %.2f%%)\n",
3378  100.0 * Cudd_ReadUsedSlots(dd),
3379  100.0 * Cudd_ExpectedUsedSlots(dd));
3380  if (retval == EOF) return(0);
3381 #ifdef DD_UNIQUE_PROFILE
3382  retval = fprintf(fp,"Unique lookups: %.0f\n", dd->uniqueLookUps);
3383  if (retval == EOF) return(0);
3384  retval = fprintf(fp,"Unique links: %.0f (%g per lookup)\n",
3385  dd->uniqueLinks, dd->uniqueLinks / dd->uniqueLookUps);
3386  if (retval == EOF) return(0);
3387 #endif
3388  retval = fprintf(fp,"Number of BDD and ADD nodes: %u\n", dd->keys);
3389  if (retval == EOF) return(0);
3390  retval = fprintf(fp,"Number of ZDD nodes: %u\n", dd->keysZ);
3391  if (retval == EOF) return(0);
3392  retval = fprintf(fp,"Number of dead BDD and ADD nodes: %u\n", dd->dead);
3393  if (retval == EOF) return(0);
3394  retval = fprintf(fp,"Number of dead ZDD nodes: %u\n", dd->deadZ);
3395  if (retval == EOF) return(0);
3396  retval = fprintf(fp,"Total number of nodes allocated: %.0f\n",
3397  dd->allocated);
3398  if (retval == EOF) return(0);
3399  retval = fprintf(fp,"Total number of nodes reclaimed: %.0f\n",
3400  dd->reclaimed);
3401  if (retval == EOF) return(0);
3402 #ifdef DD_STATS
3403  retval = fprintf(fp,"Nodes freed: %.0f\n", dd->nodesFreed);
3404  if (retval == EOF) return(0);
3405  retval = fprintf(fp,"Nodes dropped: %.0f\n", dd->nodesDropped);
3406  if (retval == EOF) return(0);
3407 #endif
3408 #ifdef DD_COUNT
3409  retval = fprintf(fp,"Number of recursive calls: %.0f\n",
3411  if (retval == EOF) return(0);
3412 #endif
3413  retval = fprintf(fp,"Garbage collections so far: %d\n",
3415  if (retval == EOF) return(0);
3416  retval = fprintf(fp,"Time for garbage collection: %.2f sec\n",
3417  ((double)Cudd_ReadGarbageCollectionTime(dd)/1000.0));
3418  if (retval == EOF) return(0);
3419  retval = fprintf(fp,"Reorderings so far: %d\n", dd->reorderings);
3420  if (retval == EOF) return(0);
3421  retval = fprintf(fp,"Time for reordering: %.2f sec\n",
3422  ((double)Cudd_ReadReorderingTime(dd)/1000.0));
3423  if (retval == EOF) return(0);
3424 #ifdef DD_COUNT
3425  retval = fprintf(fp,"Node swaps in reordering: %.0f\n",
3426  Cudd_ReadSwapSteps(dd));
3427  if (retval == EOF) return(0);
3428 #endif
3429 
3430  return(1);
3431 
3432 } /* end of Cudd_PrintInfo */
double allocated
Definition: cuddInt.h:365
int Cudd_ReadSiftMaxSwap(DdManager *dd)
Definition: cuddAPI.c:2220
unsigned int deadZ
Definition: cuddInt.h:356
double Cudd_ExpectedUsedSlots(DdManager *dd)
Definition: cuddAPI.c:1812
unsigned int Cudd_ReadMaxCache(DdManager *dd)
Definition: cuddAPI.c:1611
long Cudd_ReadPeakNodeCount(DdManager *dd)
Definition: cuddAPI.c:3449
int Cudd_ReorderingStatusZdd(DdManager *unique, Cudd_ReorderingType *method)
Definition: cuddAPI.c:1052
int size
Definition: cuddInt.h:345
int Cudd_ReadRecomb(DdManager *dd)
Definition: cuddAPI.c:2939
double Cudd_ReadSwapSteps(DdManager *dd)
Definition: cuddAPI.c:4240
unsigned int slots
Definition: cuddInt.h:352
Cudd_AggregationType Cudd_ReadGroupcheck(DdManager *dd)
Definition: cuddAPI.c:2756
unsigned int Cudd_ReadMaxCacheHard(DdManager *dd)
Definition: cuddAPI.c:1631
int Cudd_GarbageCollectionEnabled(DdManager *dd)
Definition: cuddAPI.c:2799
unsigned int Cudd_ReadMinHit(DdManager *dd)
Definition: cuddAPI.c:1512
int Cudd_DeadAreCounted(DdManager *dd)
Definition: cuddAPI.c:2867
int cuddCacheProfile(DdManager *table, FILE *fp)
Definition: cuddCache.c:749
unsigned long Cudd_ReadMemoryInUse(DdManager *dd)
Definition: cuddAPI.c:3242
double cachecollisions
Definition: cuddInt.h:437
int Cudd_ReadArcviolation(DdManager *dd)
Definition: cuddAPI.c:3046
double cacheinserts
Definition: cuddInt.h:438
unsigned int dead
Definition: cuddInt.h:355
unsigned int cacheSlots
Definition: cuddInt.h:337
unsigned int keys
Definition: cuddInt.h:353
int Cudd_ReadSymmviolation(DdManager *dd)
Definition: cuddAPI.c:2992
unsigned int Cudd_ReadNextReordering(DdManager *dd)
Definition: cuddAPI.c:4195
double Cudd_ReadCacheLookUps(DdManager *dd)
Definition: cuddAPI.c:1444
int Cudd_ReadPopulationSize(DdManager *dd)
Definition: cuddAPI.c:3099
int Cudd_bddRealignmentEnabled(DdManager *unique)
Definition: cuddAPI.c:1153
int Cudd_ReadPeakLiveNodeCount(DdManager *dd)
Definition: cuddAPI.c:3476
double Cudd_ReadUsedSlots(DdManager *dd)
Definition: cuddAPI.c:1743
double Cudd_ReadCacheHits(DdManager *dd)
Definition: cuddAPI.c:1465
int Cudd_zddRealignmentEnabled(DdManager *unique)
Definition: cuddAPI.c:1077
unsigned int Cudd_ReadLooseUpTo(DdManager *dd)
Definition: cuddAPI.c:1561
int Cudd_ReadSiftMaxVar(DdManager *dd)
Definition: cuddAPI.c:2173
long Cudd_ReadReorderingTime(DdManager *dd)
Definition: cuddAPI.c:2000
double Cudd_ReadMaxGrowth(DdManager *dd)
Definition: cuddAPI.c:2270
int Cudd_ReadGarbageCollections(DdManager *dd)
Definition: cuddAPI.c:2023
int Cudd_ReadNumberXovers(DdManager *dd)
Definition: cuddAPI.c:3152
int sizeZ
Definition: cuddInt.h:346
unsigned int reorderings
Definition: cuddInt.h:393
int Cudd_ReorderingStatus(DdManager *unique, Cudd_ReorderingType *method)
Definition: cuddAPI.c:975
double cachedeletions
Definition: cuddInt.h:440
unsigned int keysZ
Definition: cuddInt.h:354
double Cudd_ReadRecursiveCalls(DdManager *dd)
Definition: cuddAPI.c:1486
Cudd_ReorderingType
Definition: cudd.h:147
long Cudd_ReadGarbageCollectionTime(DdManager *dd)
Definition: cuddAPI.c:2044
double reclaimed
Definition: cuddInt.h:367

◆ Cudd_PrintLinear()

int Cudd_PrintLinear ( DdManager table)

AutomaticEnd Function********************************************************************

Synopsis [Prints the linear transform matrix.]

Description [Prints the linear transform matrix. Returns 1 in case of success; 0 otherwise.]

SideEffects [none]

SeeAlso []

Definition at line 149 of file cuddLinear.c.

151 {
152  int i,j,k;
153  int retval;
154  int nvars = table->linearSize;
155  int wordsPerRow = ((nvars - 1) >> LOGBPL) + 1;
156  long word;
157 
158  for (i = 0; i < nvars; i++) {
159  for (j = 0; j < wordsPerRow; j++) {
160  word = table->linear[i*wordsPerRow + j];
161  for (k = 0; k < BPL; k++) {
162  retval = fprintf(table->out,"%ld",word & 1);
163  if (retval == 0) return(0);
164  word >>= 1;
165  }
166  }
167  retval = fprintf(table->out,"\n");
168  if (retval == 0) return(0);
169  }
170  return(1);
171 
172 } /* end of Cudd_PrintLinear */
#define BPL
Definition: cuddLinear.c:78
#define LOGBPL
Definition: cuddLinear.c:79
FILE * out
Definition: cuddInt.h:423
long * linear
Definition: cuddInt.h:378
int linearSize
Definition: cuddInt.h:376

◆ Cudd_PrintMinterm()

int Cudd_PrintMinterm ( DdManager manager,
DdNode node 
)

AutomaticEnd Function********************************************************************

Synopsis [Prints a disjoint sum of products.]

Description [Prints a disjoint sum of product cover for the function rooted at node. Each product corresponds to a path from node to a leaf node different from the logical zero, and different from the background value. Uses the package default output file. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_PrintDebug Cudd_bddPrintCover]

Definition at line 220 of file cuddUtil.c.

223 {
224  int i, *list;
225 
226  background = manager->background;
227  zero = Cudd_Not(manager->one);
228  list = ALLOC(int,manager->size);
229  if (list == NULL) {
230  manager->errorCode = CUDD_MEMORY_OUT;
231  return(0);
232  }
233  for (i = 0; i < manager->size; i++) list[i] = 2;
234  ddPrintMintermAux(manager,node,list);
235  FREE(list);
236  return(1);
237 
238 } /* end of Cudd_PrintMinterm */
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
static DdNode * background
Definition: cuddUtil.c:149
#define ALLOC(type, num)
Definition: util.h:76
static void ddPrintMintermAux(DdManager *dd, DdNode *node, int *list)
Definition: cuddUtil.c:3119
static DdNode * zero
Definition: cuddUtil.c:149
DdNode * one
Definition: cuddInt.h:329
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_PrintTwoLiteralClauses()

int Cudd_PrintTwoLiteralClauses ( DdManager dd,
DdNode f,
char **  names,
FILE *  fp 
)

◆ Cudd_PrintVersion()

void Cudd_PrintVersion ( FILE *  fp)

Function********************************************************************

Synopsis [Prints the package version number.]

Description []

SideEffects [None]

SeeAlso []

Definition at line 2600 of file cuddUtil.c.

2602 {
2603  (void) fprintf(fp, "%s\n", CUDD_VERSION);
2604 
2605 } /* end of Cudd_PrintVersion */
#define CUDD_VERSION
Definition: cudd.h:75

◆ Cudd_PrioritySelect()

DdNode* Cudd_PrioritySelect ( DdManager dd,
DdNode R,
DdNode **  x,
DdNode **  y,
DdNode **  z,
DdNode Pi,
int  n,
DdNode *)(DdManager *, int, DdNode **, DdNode **, DdNode ** 
)

◆ Cudd_Quit()

void Cudd_Quit ( DdManager unique)

Function********************************************************************

Synopsis [Deletes resources associated with a DD manager.]

Description [Deletes resources associated with a DD manager and resets the global statistical counters. (Otherwise, another manaqger subsequently created would inherit the stats of this one.)]

SideEffects [None]

SeeAlso [Cudd_Init]

Definition at line 218 of file cuddInit.c.

220 {
221  if (unique->stash != NULL) FREE(unique->stash);
222  cuddFreeTable(unique);
223 
224 } /* end of Cudd_Quit */
#define FREE(obj)
Definition: util.h:80
char * stash
Definition: cuddInt.h:382
void cuddFreeTable(DdManager *unique)
Definition: cuddTable.c:692

◆ Cudd_Random()

long Cudd_Random ( void  )

Function********************************************************************

Synopsis [Portable random number generator.]

Description [Portable number generator based on ran2 from "Numerical Recipes in C." It is a long period (> 2 * 10^18) random number generator of L'Ecuyer with Bays-Durham shuffle. Returns a long integer uniformly distributed between 0 and 2147483561 (inclusive of the endpoint values). The random generator can be explicitly initialized by calling Cudd_Srandom. If no explicit initialization is performed, then the seed 1 is assumed.]

SideEffects [None]

SeeAlso [Cudd_Srandom]

Definition at line 2710 of file cuddUtil.c.

2711 {
2712  int i; /* index in the shuffle table */
2713  long int w; /* work variable */
2714 
2715  /* cuddRand == 0 if the geneartor has not been initialized yet. */
2716  if (cuddRand == 0) Cudd_Srandom(1);
2717 
2718  /* Compute cuddRand = (cuddRand * LEQA1) % MODULUS1 avoiding
2719  ** overflows by Schrage's method.
2720  */
2721  w = cuddRand / LEQQ1;
2722  cuddRand = LEQA1 * (cuddRand - w * LEQQ1) - w * LEQR1;
2723  cuddRand += (cuddRand < 0) * MODULUS1;
2724 
2725  /* Compute cuddRand2 = (cuddRand2 * LEQA2) % MODULUS2 avoiding
2726  ** overflows by Schrage's method.
2727  */
2728  w = cuddRand2 / LEQQ2;
2729  cuddRand2 = LEQA2 * (cuddRand2 - w * LEQQ2) - w * LEQR2;
2730  cuddRand2 += (cuddRand2 < 0) * MODULUS2;
2731 
2732  /* cuddRand is shuffled with the Bays-Durham algorithm.
2733  ** shuffleSelect and cuddRand2 are combined to generate the output.
2734  */
2735 
2736  /* Pick one element from the shuffle table; "i" will be in the range
2737  ** from 0 to STAB_SIZE-1.
2738  */
2739  i = (int) (shuffleSelect / STAB_DIV);
2740  /* Mix the element of the shuffle table with the current iterate of
2741  ** the second sub-generator, and replace the chosen element of the
2742  ** shuffle table with the current iterate of the first sub-generator.
2743  */
2745  shuffleTable[i] = cuddRand;
2746  shuffleSelect += (shuffleSelect < 1) * (MODULUS1 - 1);
2747  /* Since shuffleSelect != 0, and we want to be able to return 0,
2748  ** here we subtract 1 before returning.
2749  */
2750  return(shuffleSelect - 1);
2751 
2752 } /* end of Cudd_Random */
void Cudd_Srandom(long seed)
Definition: cuddUtil.c:2772
#define LEQQ1
Definition: cuddUtil.c:123
#define LEQQ2
Definition: cuddUtil.c:127
#define MODULUS1
Definition: cuddUtil.c:121
#define LEQR2
Definition: cuddUtil.c:128
static long shuffleSelect
Definition: cuddUtil.c:153
static long shuffleTable[STAB_SIZE]
Definition: cuddUtil.c:154
static long cuddRand
Definition: cuddUtil.c:151
#define LEQA2
Definition: cuddUtil.c:126
#define LEQR1
Definition: cuddUtil.c:124
#define STAB_DIV
Definition: cuddUtil.c:130
static long cuddRand2
Definition: cuddUtil.c:152
#define MODULUS2
Definition: cuddUtil.c:125
#define LEQA1
Definition: cuddUtil.c:122

◆ Cudd_ReadArcviolation()

int Cudd_ReadArcviolation ( DdManager dd)

Function********************************************************************

Synopsis [Returns the current value of the arcviolation parameter used in group sifting.]

Description [Returns the current value of the arcviolation parameter. This parameter is used in group sifting to decide how many arcs into y not coming from x are tolerable when checking for aggregation due to extended symmetry. The value should be between 0 and 100. A small value causes fewer variables to be aggregated. The default value is 0.]

SideEffects [None]

SeeAlso [Cudd_SetArcviolation]

Definition at line 3046 of file cuddAPI.c.

3048 {
3049  return(dd->arcviolation);
3050 
3051 } /* end of Cudd_ReadArcviolation */
int arcviolation
Definition: cuddInt.h:413

◆ Cudd_ReadBackground()

DdNode* Cudd_ReadBackground ( DdManager dd)

Function********************************************************************

Synopsis [Reads the background constant of the manager.]

Description []

SideEffects [None]

Definition at line 1352 of file cuddAPI.c.

1354 {
1355  return(dd->background);
1356 
1357 } /* end of Cudd_ReadBackground */
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_ReadCacheHits()

double Cudd_ReadCacheHits ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of cache hits.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadCacheLookUps]

Definition at line 1465 of file cuddAPI.c.

1467 {
1468  return(dd->cacheHits + dd->totCachehits);
1469 
1470 } /* end of Cudd_ReadCacheHits */
double cacheHits
Definition: cuddInt.h:340
double totCachehits
Definition: cuddInt.h:435

◆ Cudd_ReadCacheLookUps()

double Cudd_ReadCacheLookUps ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of cache look-ups.]

Description [Returns the number of cache look-ups.]

SideEffects [None]

SeeAlso [Cudd_ReadCacheHits]

Definition at line 1444 of file cuddAPI.c.

1446 {
1447  return(dd->cacheHits + dd->cacheMisses +
1448  dd->totCachehits + dd->totCacheMisses);
1449 
1450 } /* end of Cudd_ReadCacheLookUps */
double totCacheMisses
Definition: cuddInt.h:436
double cacheHits
Definition: cuddInt.h:340
double cacheMisses
Definition: cuddInt.h:339
double totCachehits
Definition: cuddInt.h:435

◆ Cudd_ReadCacheSlots()

unsigned int Cudd_ReadCacheSlots ( DdManager dd)

Function********************************************************************

Synopsis [Reads the number of slots in the cache.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadCacheUsedSlots]

Definition at line 1392 of file cuddAPI.c.

1394 {
1395  return(dd->cacheSlots);
1396 
1397 } /* end of Cudd_ReadCacheSlots */
unsigned int cacheSlots
Definition: cuddInt.h:337

◆ Cudd_ReadCacheUsedSlots()

double Cudd_ReadCacheUsedSlots ( DdManager dd)

Function********************************************************************

Synopsis [Reads the fraction of used slots in the cache.]

Description [Reads the fraction of used slots in the cache. The unused slots are those in which no valid data is stored. Garbage collection, variable reordering, and cache resizing may cause used slots to become unused.]

SideEffects [None]

SeeAlso [Cudd_ReadCacheSlots]

Definition at line 1415 of file cuddAPI.c.

1417 {
1418  unsigned long used = 0;
1419  int slots = dd->cacheSlots;
1420  DdCache *cache = dd->cache;
1421  int i;
1422 
1423  for (i = 0; i < slots; i++) {
1424  used += cache[i].h != 0;
1425  }
1426 
1427  return((double)used / (double) dd->cacheSlots);
1428 
1429 } /* end of Cudd_ReadCacheUsedSlots */
ptruint h
Definition: cuddInt.h:303
unsigned int cacheSlots
Definition: cuddInt.h:337
DdCache * cache
Definition: cuddInt.h:336

◆ Cudd_ReadDead()

unsigned int Cudd_ReadDead ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of dead nodes in the unique table.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadKeys]

Definition at line 1886 of file cuddAPI.c.

1888 {
1889  return(dd->dead);
1890 
1891 } /* end of Cudd_ReadDead */
unsigned int dead
Definition: cuddInt.h:355

◆ Cudd_ReadElapsedTime()

unsigned long Cudd_ReadElapsedTime ( DdManager unique)

Function********************************************************************

Synopsis [Returns the time elapsed since the start time of the manager.]

Description [Returns the time elapsed since the start time of the manager.]

SideEffects [None]

SeeAlso [Cudd_ReadStartTime Cudd_SetStartTime]

Definition at line 701 of file cuddAPI.c.

703 {
704  return util_cpu_time() - unique->startTime;
705 
706 } /* end of Cudd_ReadElapsedTime */
unsigned long startTime
Definition: cuddInt.h:426
long util_cpu_time(void)
Definition: cpu_time.c:34

◆ Cudd_ReadEpsilon()

CUDD_VALUE_TYPE Cudd_ReadEpsilon ( DdManager dd)

Function********************************************************************

Synopsis [Reads the epsilon parameter of the manager.]

Description [Reads the epsilon parameter of the manager. The epsilon parameter control the comparison between floating point numbers.]

SideEffects [None]

SeeAlso [Cudd_SetEpsilon]

Definition at line 2712 of file cuddAPI.c.

2714 {
2715  return(dd->epsilon);
2716 
2717 } /* end of Cudd_ReadEpsilon */
CUDD_VALUE_TYPE epsilon
Definition: cuddInt.h:390

◆ Cudd_ReadErrorCode()

Cudd_ErrorType Cudd_ReadErrorCode ( DdManager dd)

Function********************************************************************

Synopsis [Returns the code of the last error.]

Description [Returns the code of the last error. The error codes are defined in cudd.h.]

SideEffects [None]

SeeAlso [Cudd_ClearErrorCode]

Definition at line 4065 of file cuddAPI.c.

4067 {
4068  return(dd->errorCode);
4069 
4070 } /* end of Cudd_ReadErrorCode */
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_ReadGarbageCollections()

int Cudd_ReadGarbageCollections ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of times garbage collection has occurred.]

Description [Returns the number of times garbage collection has occurred in the manager. The number includes both the calls from reordering procedures and those caused by requests to create new nodes.]

SideEffects [None]

SeeAlso [Cudd_ReadGarbageCollectionTime]

Definition at line 2023 of file cuddAPI.c.

2025 {
2026  return(dd->garbageCollections);
2027 
2028 } /* end of Cudd_ReadGarbageCollections */
int garbageCollections
Definition: cuddInt.h:432

◆ Cudd_ReadGarbageCollectionTime()

long Cudd_ReadGarbageCollectionTime ( DdManager dd)

Function********************************************************************

Synopsis [Returns the time spent in garbage collection.]

Description [Returns the number of milliseconds spent doing garbage collection since the manager was initialized.]

SideEffects [None]

SeeAlso [Cudd_ReadGarbageCollections]

Definition at line 2044 of file cuddAPI.c.

2046 {
2047  return(dd->GCTime);
2048 
2049 } /* end of Cudd_ReadGarbageCollectionTime */
unsigned long GCTime
Definition: cuddInt.h:433

◆ Cudd_ReadGroupcheck()

Cudd_AggregationType Cudd_ReadGroupcheck ( DdManager dd)

Function********************************************************************

Synopsis [Reads the groupcheck parameter of the manager.]

Description [Reads the groupcheck parameter of the manager. The groupcheck parameter determines the aggregation criterion in group sifting.]

SideEffects [None]

SeeAlso [Cudd_SetGroupcheck]

Definition at line 2756 of file cuddAPI.c.

2758 {
2759  return(dd->groupcheck);
2760 
2761 } /* end of Cudd_ReadGroupCheck */
Cudd_AggregationType groupcheck
Definition: cuddInt.h:410

◆ Cudd_ReadInvPerm()

int Cudd_ReadInvPerm ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the index of the variable currently in the i-th position of the order.]

Description [Returns the index of the variable currently in the i-th position of the order. If the index is CUDD_CONST_INDEX, returns CUDD_CONST_INDEX; otherwise, if the index is out of bounds returns -1.]

SideEffects [None]

SeeAlso [Cudd_ReadPerm Cudd_ReadInvPermZdd]

Definition at line 2636 of file cuddAPI.c.

2639 {
2640  if (i == CUDD_CONST_INDEX) return(CUDD_CONST_INDEX);
2641  if (i < 0 || i >= dd->size) return(-1);
2642  return(dd->invperm[i]);
2643 
2644 } /* end of Cudd_ReadInvPerm */
int size
Definition: cuddInt.h:345
#define CUDD_CONST_INDEX
Definition: cudd.h:113
int * invperm
Definition: cuddInt.h:371

◆ Cudd_ReadInvPermZdd()

int Cudd_ReadInvPermZdd ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the index of the ZDD variable currently in the i-th position of the order.]

Description [Returns the index of the ZDD variable currently in the i-th position of the order. If the index is CUDD_CONST_INDEX, returns CUDD_CONST_INDEX; otherwise, if the index is out of bounds returns -1.]

SideEffects [None]

SeeAlso [Cudd_ReadPerm Cudd_ReadInvPermZdd]

Definition at line 2662 of file cuddAPI.c.

2665 {
2666  if (i == CUDD_CONST_INDEX) return(CUDD_CONST_INDEX);
2667  if (i < 0 || i >= dd->sizeZ) return(-1);
2668  return(dd->invpermZ[i]);
2669 
2670 } /* end of Cudd_ReadInvPermZdd */
int * invpermZ
Definition: cuddInt.h:372
#define CUDD_CONST_INDEX
Definition: cudd.h:113
int sizeZ
Definition: cuddInt.h:346

◆ Cudd_ReadIthClause()

int Cudd_ReadIthClause ( DdTlcInfo tlc,
int  i,
DdHalfWord var1,
DdHalfWord var2,
int *  phase1,
int *  phase2 
)

◆ Cudd_ReadKeys()

unsigned int Cudd_ReadKeys ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of nodes in the unique table.]

Description [Returns the total number of nodes currently in the unique table, including the dead nodes.]

SideEffects [None]

SeeAlso [Cudd_ReadDead]

Definition at line 1866 of file cuddAPI.c.

1868 {
1869  return(dd->keys);
1870 
1871 } /* end of Cudd_ReadKeys */
unsigned int keys
Definition: cuddInt.h:353

◆ Cudd_ReadLinear()

int Cudd_ReadLinear ( DdManager table,
int  x,
int  y 
)

Function********************************************************************

Synopsis [Reads an entry of the linear transform matrix.]

Description [Reads an entry of the linear transform matrix.]

SideEffects [none]

SeeAlso []

Definition at line 187 of file cuddLinear.c.

191 {
192  int nvars = table->size;
193  int wordsPerRow = ((nvars - 1) >> LOGBPL) + 1;
194  long word;
195  int bit;
196  int result;
197 
198  assert(table->size == table->linearSize);
199 
200  word = wordsPerRow * x + (y >> LOGBPL);
201  bit = y & (BPL-1);
202  result = (int) ((table->linear[word] >> bit) & 1);
203  return(result);
204 
205 } /* end of Cudd_ReadLinear */
#define assert(ex)
Definition: util.h:141
#define BPL
Definition: cuddLinear.c:78
int size
Definition: cuddInt.h:345
#define LOGBPL
Definition: cuddLinear.c:79
long * linear
Definition: cuddInt.h:378
int linearSize
Definition: cuddInt.h:376
static int result
Definition: cuddGenetic.c:121

◆ Cudd_ReadLogicZero()

DdNode* Cudd_ReadLogicZero ( DdManager dd)

Function********************************************************************

Synopsis [Returns the logic zero constant of the manager.]

Description [Returns the zero constant of the manager. The logic zero constant is the complement of the one constant, and is distinct from the arithmetic zero.]

SideEffects [None]

SeeAlso [Cudd_ReadOne Cudd_ReadZero]

Definition at line 1298 of file cuddAPI.c.

1300 {
1301  return(Cudd_Not(DD_ONE(dd)));
1302 
1303 } /* end of Cudd_ReadLogicZero */
#define Cudd_Not(node)
Definition: cudd.h:354
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_ReadLooseUpTo()

unsigned int Cudd_ReadLooseUpTo ( DdManager dd)

Function********************************************************************

Synopsis [Reads the looseUpTo parameter of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetLooseUpTo Cudd_ReadMinHit Cudd_ReadMinDead]

Definition at line 1561 of file cuddAPI.c.

1563 {
1564  return(dd->looseUpTo);
1565 
1566 } /* end of Cudd_ReadLooseUpTo */
unsigned int looseUpTo
Definition: cuddInt.h:361

◆ Cudd_ReadMaxCache()

unsigned int Cudd_ReadMaxCache ( DdManager dd)

Function********************************************************************

Synopsis [Returns the soft limit for the cache size.]

Description [Returns the soft limit for the cache size.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxCacheHard]

Definition at line 1611 of file cuddAPI.c.

1613 {
1614  return(2 * dd->cacheSlots + dd->cacheSlack);
1615 
1616 } /* end of Cudd_ReadMaxCache */
unsigned int cacheSlots
Definition: cuddInt.h:337
int cacheSlack
Definition: cuddInt.h:342

◆ Cudd_ReadMaxCacheHard()

unsigned int Cudd_ReadMaxCacheHard ( DdManager dd)

Function********************************************************************

Synopsis [Reads the maxCacheHard parameter of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetMaxCacheHard Cudd_ReadMaxCache]

Definition at line 1631 of file cuddAPI.c.

1633 {
1634  return(dd->maxCacheHard);
1635 
1636 } /* end of Cudd_ReadMaxCache */
unsigned int maxCacheHard
Definition: cuddInt.h:343

◆ Cudd_ReadMaxGrowth()

double Cudd_ReadMaxGrowth ( DdManager dd)

Function********************************************************************

Synopsis [Reads the maxGrowth parameter of the manager.]

Description [Reads the maxGrowth parameter of the manager. This parameter determines how much the number of nodes can grow during sifting of a variable. Overall, sifting never increases the size of the decision diagrams. This parameter only refers to intermediate results. A lower value will speed up sifting, possibly at the expense of quality.]

SideEffects [None]

SeeAlso [Cudd_SetMaxGrowth Cudd_ReadMaxGrowthAlternate]

Definition at line 2270 of file cuddAPI.c.

2272 {
2273  return(dd->maxGrowth);
2274 
2275 } /* end of Cudd_ReadMaxGrowth */
double maxGrowth
Definition: cuddInt.h:397

◆ Cudd_ReadMaxGrowthAlternate()

double Cudd_ReadMaxGrowthAlternate ( DdManager dd)

Function********************************************************************

Synopsis [Reads the maxGrowthAlt parameter of the manager.]

Description [Reads the maxGrowthAlt parameter of the manager. This parameter is analogous to the maxGrowth paramter, and is used every given number of reorderings instead of maxGrowth. The number of reorderings is set with Cudd_SetReorderingCycle. If the number of reorderings is 0 (default) maxGrowthAlt is never used.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxGrowth Cudd_SetMaxGrowthAlternate Cudd_SetReorderingCycle Cudd_ReadReorderingCycle]

Definition at line 2321 of file cuddAPI.c.

2323 {
2324  return(dd->maxGrowthAlt);
2325 
2326 } /* end of Cudd_ReadMaxGrowthAlternate */
double maxGrowthAlt
Definition: cuddInt.h:398

◆ Cudd_ReadMaxLive()

unsigned int Cudd_ReadMaxLive ( DdManager dd)

Function********************************************************************

Synopsis [Reads the maximum allowed number of live nodes.]

Description [Reads the maximum allowed number of live nodes. When this number is exceeded, the package returns NULL.]

SideEffects [none]

SeeAlso [Cudd_SetMaxLive]

Definition at line 4265 of file cuddAPI.c.

4267 {
4268  return(dd->maxLive);
4269 
4270 } /* end of Cudd_ReadMaxLive */
unsigned int maxLive
Definition: cuddInt.h:357

◆ Cudd_ReadMaxMemory()

unsigned long Cudd_ReadMaxMemory ( DdManager dd)

Function********************************************************************

Synopsis [Reads the maximum allowed memory.]

Description [Reads the maximum allowed memory. When this number is exceeded, the package returns NULL.]

SideEffects [none]

SeeAlso [Cudd_SetMaxMemory]

Definition at line 4308 of file cuddAPI.c.

4310 {
4311  return(dd->maxmemhard);
4312 
4313 } /* end of Cudd_ReadMaxMemory */
unsigned long maxmemhard
Definition: cuddInt.h:431

◆ Cudd_ReadMaxReorderings()

unsigned int Cudd_ReadMaxReorderings ( DdManager dd)

Function********************************************************************

Synopsis [Returns the maximum number of times reordering may be invoked.]

Description [Returns the maximum number of times reordering may be invoked in this manager.]

SideEffects [None]

SeeAlso [Cudd_ReadReorderings Cudd_SetMaxReorderings Cudd_ReduceHeap]

Definition at line 1957 of file cuddAPI.c.

1959 {
1960  return(dd->maxReorderings);
1961 
1962 } /* end of Cudd_ReadMaxReorderings */
unsigned int maxReorderings
Definition: cuddInt.h:394

◆ Cudd_ReadMemoryInUse()

unsigned long Cudd_ReadMemoryInUse ( DdManager dd)

Function********************************************************************

Synopsis [Returns the memory in use by the manager measured in bytes.]

Description []

SideEffects [None]

SeeAlso []

Definition at line 3242 of file cuddAPI.c.

3244 {
3245  return(dd->memused);
3246 
3247 } /* end of Cudd_ReadMemoryInUse */
unsigned long memused
Definition: cuddInt.h:429

◆ Cudd_ReadMinDead()

unsigned int Cudd_ReadMinDead ( DdManager dd)

Function********************************************************************

Synopsis [Reads the minDead parameter of the manager.]

Description [Reads the minDead parameter of the manager. The minDead parameter is used by the package to decide whether to collect garbage or resize a subtable of the unique table when the subtable becomes too full. The application can indirectly control the value of minDead by setting the looseUpTo parameter.]

SideEffects [None]

SeeAlso [Cudd_ReadDead Cudd_ReadLooseUpTo Cudd_SetLooseUpTo]

Definition at line 1910 of file cuddAPI.c.

1912 {
1913  return(dd->minDead);
1914 
1915 } /* end of Cudd_ReadMinDead */
unsigned int minDead
Definition: cuddInt.h:358

◆ Cudd_ReadMinHit()

unsigned int Cudd_ReadMinHit ( DdManager dd)

Function********************************************************************

Synopsis [Reads the hit rate that causes resizinig of the computed table.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetMinHit]

Definition at line 1512 of file cuddAPI.c.

1514 {
1515  /* Internally, the package manipulates the ratio of hits to
1516  ** misses instead of the ratio of hits to accesses. */
1517  return((unsigned int) (0.5 + 100 * dd->minHit / (1 + dd->minHit)));
1518 
1519 } /* end of Cudd_ReadMinHit */
double minHit
Definition: cuddInt.h:341

◆ Cudd_ReadMinusInfinity()

DdNode* Cudd_ReadMinusInfinity ( DdManager dd)

Function********************************************************************

Synopsis [Reads the minus-infinity constant from the manager.]

Description []

SideEffects [None]

Definition at line 1334 of file cuddAPI.c.

1336 {
1337  return(dd->minusinfinity);
1338 
1339 } /* end of Cudd_ReadMinusInfinity */
DdNode * minusinfinity
Definition: cuddInt.h:332

◆ Cudd_ReadNextReordering()

unsigned int Cudd_ReadNextReordering ( DdManager dd)

Function********************************************************************

Synopsis [Returns the threshold for the next dynamic reordering.]

Description [Returns the threshold for the next dynamic reordering. The threshold is in terms of number of nodes and is in effect only if reordering is enabled. The count does not include the dead nodes, unless the countDead parameter of the manager has been changed from its default setting.]

SideEffects [None]

SeeAlso [Cudd_SetNextReordering]

Definition at line 4195 of file cuddAPI.c.

4197 {
4198  return(dd->nextDyn);
4199 
4200 } /* end of Cudd_ReadNextReordering */
unsigned int nextDyn
Definition: cuddInt.h:406

◆ Cudd_ReadNodeCount()

long Cudd_ReadNodeCount ( DdManager dd)

Function********************************************************************

Synopsis [Reports the number of nodes in BDDs and ADDs.]

Description [Reports the number of live nodes in BDDs and ADDs. This number does not include the isolated projection functions and the unused constants. These nodes that are not counted are not part of the DDs manipulated by the application.]

SideEffects [None]

SeeAlso [Cudd_ReadPeakNodeCount Cudd_zddReadNodeCount]

Definition at line 3504 of file cuddAPI.c.

3506 {
3507  long count;
3508  int i;
3509 
3510 #ifndef DD_NO_DEATH_ROW
3511  cuddClearDeathRow(dd);
3512 #endif
3513 
3514  count = (long) (dd->keys - dd->dead);
3515 
3516  /* Count isolated projection functions. Their number is subtracted
3517  ** from the node count because they are not part of the BDDs.
3518  */
3519  for (i=0; i < dd->size; i++) {
3520  if (dd->vars[i]->ref == 1) count--;
3521  }
3522  /* Subtract from the count the unused constants. */
3523  if (DD_ZERO(dd)->ref == 1) count--;
3524  if (DD_PLUS_INFINITY(dd)->ref == 1) count--;
3525  if (DD_MINUS_INFINITY(dd)->ref == 1) count--;
3526 
3527  return(count);
3528 
3529 } /* end of Cudd_ReadNodeCount */
DdHalfWord ref
Definition: cudd.h:272
int size
Definition: cuddInt.h:345
#define DD_MINUS_INFINITY(dd)
Definition: cuddInt.h:908
unsigned int dead
Definition: cuddInt.h:355
unsigned int keys
Definition: cuddInt.h:353
void cuddClearDeathRow(DdManager *table)
Definition: cuddRef.c:722
DdNode ** vars
Definition: cuddInt.h:373
#define DD_PLUS_INFINITY(dd)
Definition: cuddInt.h:894
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_ReadNodesDropped()

double Cudd_ReadNodesDropped ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of nodes dropped.]

Description [Returns the number of nodes killed by dereferencing if the keeping of this statistic is enabled; -1 otherwise. This statistic is enabled only if the package is compiled with DD_STATS defined.]

SideEffects [None]

SeeAlso [Cudd_ReadNodesFreed]

Definition at line 2092 of file cuddAPI.c.

2094 {
2095 #ifdef DD_STATS
2096  return(dd->nodesDropped);
2097 #else
2098  return(-1.0);
2099 #endif
2100 
2101 } /* end of Cudd_ReadNodesDropped */

◆ Cudd_ReadNodesFreed()

double Cudd_ReadNodesFreed ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of nodes freed.]

Description [Returns the number of nodes returned to the free list if the keeping of this statistic is enabled; -1 otherwise. This statistic is enabled only if the package is compiled with DD_STATS defined.]

SideEffects [None]

SeeAlso [Cudd_ReadNodesDropped]

Definition at line 2066 of file cuddAPI.c.

2068 {
2069 #ifdef DD_STATS
2070  return(dd->nodesFreed);
2071 #else
2072  return(-1.0);
2073 #endif
2074 
2075 } /* end of Cudd_ReadNodesFreed */

◆ Cudd_ReadNumberXovers()

int Cudd_ReadNumberXovers ( DdManager dd)

Function********************************************************************

Synopsis [Reads the current number of crossovers used by the genetic algorithm for reordering.]

Description [Reads the current number of crossovers used by the genetic algorithm for variable reordering. A larger number of crossovers will cause the genetic algorithm to take more time, but will generally produce better results. The default value is 0, in which case the package uses three times the number of variables as number of crossovers, with a maximum of 60.]

SideEffects [None]

SeeAlso [Cudd_SetNumberXovers]

Definition at line 3152 of file cuddAPI.c.

3154 {
3155  return(dd->numberXovers);
3156 
3157 } /* end of Cudd_ReadNumberXovers */
int numberXovers
Definition: cuddInt.h:415

◆ Cudd_ReadOne()

DdNode* Cudd_ReadOne ( DdManager dd)

Function********************************************************************

Synopsis [Returns the one constant of the manager.]

Description [Returns the one constant of the manager. The one constant is common to ADDs and BDDs.]

SideEffects [None]

SeeAlso [Cudd_ReadZero Cudd_ReadLogicZero Cudd_ReadZddOne]

Definition at line 1227 of file cuddAPI.c.

1229 {
1230  return(dd->one);
1231 
1232 } /* end of Cudd_ReadOne */
DdNode * one
Definition: cuddInt.h:329

◆ Cudd_ReadOrderRandomization()

unsigned int Cudd_ReadOrderRandomization ( DdManager dd)

Function********************************************************************

Synopsis [Returns the order randomization factor.]

Description [Returns the order randomization factor. If non-zero this factor is used to determine a perturbation of the next reordering threshold. Larger factors cause larger perturbations.]

SideEffects [None]

SeeAlso [Cudd_SetOrderRandomization]

Definition at line 3201 of file cuddAPI.c.

3203 {
3204  return(dd->randomizeOrder);
3205 
3206 } /* end of Cudd_ReadOrderRandomization */
unsigned int randomizeOrder
Definition: cuddInt.h:416

◆ Cudd_ReadPeakLiveNodeCount()

int Cudd_ReadPeakLiveNodeCount ( DdManager dd)

Function********************************************************************

Synopsis [Reports the peak number of live nodes.]

Description [Reports the peak number of live nodes.]

SideEffects [None]

SeeAlso [Cudd_ReadNodeCount Cudd_PrintInfo Cudd_ReadPeakNodeCount]

Definition at line 3476 of file cuddAPI.c.

3478 {
3479  unsigned int live = dd->keys - dd->dead;
3480 
3481  if (live > dd->peakLiveNodes) {
3482  dd->peakLiveNodes = live;
3483  }
3484  return((int)dd->peakLiveNodes);
3485 
3486 } /* end of Cudd_ReadPeakLiveNodeCount */
unsigned int peakLiveNodes
Definition: cuddInt.h:445
unsigned int dead
Definition: cuddInt.h:355
unsigned int keys
Definition: cuddInt.h:353

◆ Cudd_ReadPeakNodeCount()

long Cudd_ReadPeakNodeCount ( DdManager dd)

Function********************************************************************

Synopsis [Reports the peak number of nodes.]

Description [Reports the peak number of nodes. This number includes node on the free list. At the peak, the number of nodes on the free list is guaranteed to be less than DD_MEM_CHUNK.]

SideEffects [None]

SeeAlso [Cudd_ReadNodeCount Cudd_PrintInfo]

Definition at line 3449 of file cuddAPI.c.

3451 {
3452  long count = 0;
3453  DdNodePtr *scan = dd->memoryList;
3454 
3455  while (scan != NULL) {
3456  count += DD_MEM_CHUNK;
3457  scan = (DdNodePtr *) *scan;
3458  }
3459  return(count);
3460 
3461 } /* end of Cudd_ReadPeakNodeCount */
Definition: cudd.h:270
DdNode ** memoryList
Definition: cuddInt.h:380
#define DD_MEM_CHUNK
Definition: cuddInt.h:105

◆ Cudd_ReadPerm()

int Cudd_ReadPerm ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the current position of the i-th variable in the order.]

Description [Returns the current position of the i-th variable in the order. If the index is CUDD_CONST_INDEX, returns CUDD_CONST_INDEX; otherwise, if the index is out of bounds returns -1.]

SideEffects [None]

SeeAlso [Cudd_ReadInvPerm Cudd_ReadPermZdd]

Definition at line 2583 of file cuddAPI.c.

2586 {
2587  if (i == CUDD_CONST_INDEX) return(CUDD_CONST_INDEX);
2588  if (i < 0 || i >= dd->size) return(-1);
2589  return(dd->perm[i]);
2590 
2591 } /* end of Cudd_ReadPerm */
int size
Definition: cuddInt.h:345
#define CUDD_CONST_INDEX
Definition: cudd.h:113
int * perm
Definition: cuddInt.h:369

◆ Cudd_ReadPermZdd()

int Cudd_ReadPermZdd ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the current position of the i-th ZDD variable in the order.]

Description [Returns the current position of the i-th ZDD variable in the order. If the index is CUDD_CONST_INDEX, returns CUDD_CONST_INDEX; otherwise, if the index is out of bounds returns -1.]

SideEffects [None]

SeeAlso [Cudd_ReadInvPermZdd Cudd_ReadPerm]

Definition at line 2610 of file cuddAPI.c.

2613 {
2614  if (i == CUDD_CONST_INDEX) return(CUDD_CONST_INDEX);
2615  if (i < 0 || i >= dd->sizeZ) return(-1);
2616  return(dd->permZ[i]);
2617 
2618 } /* end of Cudd_ReadPermZdd */
int * permZ
Definition: cuddInt.h:370
#define CUDD_CONST_INDEX
Definition: cudd.h:113
int sizeZ
Definition: cuddInt.h:346

◆ Cudd_ReadPlusInfinity()

DdNode* Cudd_ReadPlusInfinity ( DdManager dd)

Function********************************************************************

Synopsis [Reads the plus-infinity constant from the manager.]

Description []

SideEffects [None]

Definition at line 1316 of file cuddAPI.c.

1318 {
1319  return(dd->plusinfinity);
1320 
1321 } /* end of Cudd_ReadPlusInfinity */
DdNode * plusinfinity
Definition: cuddInt.h:331

◆ Cudd_ReadPopulationSize()

int Cudd_ReadPopulationSize ( DdManager dd)

Function********************************************************************

Synopsis [Reads the current size of the population used by the genetic algorithm for reordering.]

Description [Reads the current size of the population used by the genetic algorithm for variable reordering. A larger population size will cause the genetic algorithm to take more time, but will generally produce better results. The default value is 0, in which case the package uses three times the number of variables as population size, with a maximum of 120.]

SideEffects [None]

SeeAlso [Cudd_SetPopulationSize]

Definition at line 3099 of file cuddAPI.c.

3101 {
3102  return(dd->populationSize);
3103 
3104 } /* end of Cudd_ReadPopulationSize */
int populationSize
Definition: cuddInt.h:414

◆ Cudd_ReadRecomb()

int Cudd_ReadRecomb ( DdManager dd)

Function********************************************************************

Synopsis [Returns the current value of the recombination parameter used in group sifting.]

Description [Returns the current value of the recombination parameter used in group sifting. A larger (positive) value makes the aggregation of variables due to the second difference criterion more likely. A smaller (negative) value makes aggregation less likely.]

SideEffects [None]

SeeAlso [Cudd_SetRecomb]

Definition at line 2939 of file cuddAPI.c.

2941 {
2942  return(dd->recomb);
2943 
2944 } /* end of Cudd_ReadRecomb */
int recomb
Definition: cuddInt.h:411

◆ Cudd_ReadRecursiveCalls()

double Cudd_ReadRecursiveCalls ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of recursive calls.]

Description [Returns the number of recursive calls if the package is compiled with DD_COUNT defined.]

SideEffects [None]

SeeAlso []

Definition at line 1486 of file cuddAPI.c.

1488 {
1489 #ifdef DD_COUNT
1490  return(dd->recursiveCalls);
1491 #else
1492  return(-1.0);
1493 #endif
1494 
1495 } /* end of Cudd_ReadRecursiveCalls */

◆ Cudd_ReadReorderingCycle()

int Cudd_ReadReorderingCycle ( DdManager dd)

Function********************************************************************

Synopsis [Reads the reordCycle parameter of the manager.]

Description [Reads the reordCycle parameter of the manager. This parameter determines how often the alternate threshold on maximum growth is used in reordering.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxGrowthAlternate Cudd_SetMaxGrowthAlternate Cudd_SetReorderingCycle]

Definition at line 2370 of file cuddAPI.c.

2372 {
2373  return(dd->reordCycle);
2374 
2375 } /* end of Cudd_ReadReorderingCycle */
int reordCycle
Definition: cuddInt.h:399

◆ Cudd_ReadReorderings()

unsigned int Cudd_ReadReorderings ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of times reordering has occurred.]

Description [Returns the number of times reordering has occurred in the manager. The number includes both the calls to Cudd_ReduceHeap from the application program and those automatically performed by the package. However, calls that do not even initiate reordering are not counted. A call may not initiate reordering if there are fewer than minsize live nodes in the manager, or if CUDD_REORDER_NONE is specified as reordering method. The calls to Cudd_ShuffleHeap are not counted.]

SideEffects [None]

SeeAlso [Cudd_ReduceHeap Cudd_ReadReorderingTime]

Definition at line 1936 of file cuddAPI.c.

1938 {
1939  return(dd->reorderings);
1940 
1941 } /* end of Cudd_ReadReorderings */
unsigned int reorderings
Definition: cuddInt.h:393

◆ Cudd_ReadReorderingTime()

long Cudd_ReadReorderingTime ( DdManager dd)

Function********************************************************************

Synopsis [Returns the time spent in reordering.]

Description [Returns the number of milliseconds spent reordering variables since the manager was initialized. The time spent in collecting garbage before reordering is included.]

SideEffects [None]

SeeAlso [Cudd_ReadReorderings]

Definition at line 2000 of file cuddAPI.c.

2002 {
2003  return(dd->reordTime);
2004 
2005 } /* end of Cudd_ReadReorderingTime */
unsigned long reordTime
Definition: cuddInt.h:434

◆ Cudd_ReadSiftMaxSwap()

int Cudd_ReadSiftMaxSwap ( DdManager dd)

Function********************************************************************

Synopsis [Reads the siftMaxSwap parameter of the manager.]

Description [Reads the siftMaxSwap parameter of the manager. This parameter gives the maximum number of swaps that will be attempted for each invocation of sifting. The real number of swaps may exceed the set limit because the package will always complete the sifting of the variable that causes the limit to be reached.]

SideEffects [None]

SeeAlso [Cudd_ReadSiftMaxVar Cudd_SetSiftMaxSwap]

Definition at line 2220 of file cuddAPI.c.

2222 {
2223  return(dd->siftMaxSwap);
2224 
2225 } /* end of Cudd_ReadSiftMaxSwap */
int siftMaxSwap
Definition: cuddInt.h:396

◆ Cudd_ReadSiftMaxVar()

int Cudd_ReadSiftMaxVar ( DdManager dd)

Function********************************************************************

Synopsis [Reads the siftMaxVar parameter of the manager.]

Description [Reads the siftMaxVar parameter of the manager. This parameter gives the maximum number of variables that will be sifted for each invocation of sifting.]

SideEffects [None]

SeeAlso [Cudd_ReadSiftMaxSwap Cudd_SetSiftMaxVar]

Definition at line 2173 of file cuddAPI.c.

2175 {
2176  return(dd->siftMaxVar);
2177 
2178 } /* end of Cudd_ReadSiftMaxVar */
int siftMaxVar
Definition: cuddInt.h:395

◆ Cudd_ReadSize()

int Cudd_ReadSize ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of BDD variables in existance.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadZddSize]

Definition at line 1681 of file cuddAPI.c.

1683 {
1684  return(dd->size);
1685 
1686 } /* end of Cudd_ReadSize */
int size
Definition: cuddInt.h:345

◆ Cudd_ReadSlots()

unsigned int Cudd_ReadSlots ( DdManager dd)

Function********************************************************************

Synopsis [Returns the total number of slots of the unique table.]

Description [Returns the total number of slots of the unique table. This number ismainly for diagnostic purposes.]

SideEffects [None]

Definition at line 1720 of file cuddAPI.c.

1722 {
1723  return(dd->slots);
1724 
1725 } /* end of Cudd_ReadSlots */
unsigned int slots
Definition: cuddInt.h:352

◆ Cudd_ReadStartTime()

unsigned long Cudd_ReadStartTime ( DdManager unique)

Function********************************************************************

Synopsis [Returns the start time of the manager.]

Description [Returns the start time of the manager. This is initially set to the number of milliseconds since the program started, but may be reset by the application.]

SideEffects [None]

SeeAlso [Cudd_SetStartTime Cudd_ResetStartTime Cudd_ReadTimeLimit]

Definition at line 681 of file cuddAPI.c.

683 {
684  return unique->startTime;
685 
686 } /* end of Cudd_ReadStartTime */
unsigned long startTime
Definition: cuddInt.h:426

◆ Cudd_ReadStderr()

FILE* Cudd_ReadStderr ( DdManager dd)

Function********************************************************************

Synopsis [Reads the stderr of a manager.]

Description [Reads the stderr of a manager. This is the file pointer to which messages normally going to stderr are written. It is initialized to stderr. Cudd_SetStderr allows the application to redirect it.]

SideEffects [None]

SeeAlso [Cudd_SetStderr Cudd_ReadStdout]

Definition at line 4150 of file cuddAPI.c.

4152 {
4153  return(dd->err);
4154 
4155 } /* end of Cudd_ReadStderr */
FILE * err
Definition: cuddInt.h:424

◆ Cudd_ReadStdout()

FILE* Cudd_ReadStdout ( DdManager dd)

Function********************************************************************

Synopsis [Reads the stdout of a manager.]

Description [Reads the stdout of a manager. This is the file pointer to which messages normally going to stdout are written. It is initialized to stdout. Cudd_SetStdout allows the application to redirect it.]

SideEffects [None]

SeeAlso [Cudd_SetStdout Cudd_ReadStderr]

Definition at line 4107 of file cuddAPI.c.

4109 {
4110  return(dd->out);
4111 
4112 } /* end of Cudd_ReadStdout */
FILE * out
Definition: cuddInt.h:423

◆ Cudd_ReadSwapSteps()

double Cudd_ReadSwapSteps ( DdManager dd)

Function********************************************************************

Synopsis [Reads the number of elementary reordering steps.]

Description []

SideEffects [none]

SeeAlso []

Definition at line 4240 of file cuddAPI.c.

4242 {
4243 #ifdef DD_COUNT
4244  return(dd->swapSteps);
4245 #else
4246  return(-1);
4247 #endif
4248 
4249 } /* end of Cudd_ReadSwapSteps */

◆ Cudd_ReadSymmviolation()

int Cudd_ReadSymmviolation ( DdManager dd)

Function********************************************************************

Synopsis [Returns the current value of the symmviolation parameter used in group sifting.]

Description [Returns the current value of the symmviolation parameter. This parameter is used in group sifting to decide how many violations to the symmetry conditions f10 = f01 or f11 = f00 are tolerable when checking for aggregation due to extended symmetry. The value should be between 0 and 100. A small value causes fewer variables to be aggregated. The default value is 0.]

SideEffects [None]

SeeAlso [Cudd_SetSymmviolation]

Definition at line 2992 of file cuddAPI.c.

2994 {
2995  return(dd->symmviolation);
2996 
2997 } /* end of Cudd_ReadSymmviolation */
int symmviolation
Definition: cuddInt.h:412

◆ Cudd_ReadTimeLimit()

unsigned long Cudd_ReadTimeLimit ( DdManager unique)

Function********************************************************************

Synopsis [Returns the time limit for the manager.]

Description [Returns the time limit for the manager. This is initially set to a very large number, but may be reset by the application.]

SideEffects [None]

SeeAlso [Cudd_SetTimeLimit Cudd_UpdateTimeLimit Cudd_UnsetTimeLimit Cudd_IncreaseTimeLimit Cudd_TimeLimited Cudd_ReadStartTime]

Definition at line 765 of file cuddAPI.c.

767 {
768  return unique->timeLimit;
769 
770 } /* end of Cudd_ReadTimeLimit */
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_ReadTree()

MtrNode* Cudd_ReadTree ( DdManager dd)

Function********************************************************************

Synopsis [Returns the variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetTree Cudd_FreeTree Cudd_ReadZddTree]

Definition at line 2414 of file cuddAPI.c.

2416 {
2417  return(dd->tree);
2418 
2419 } /* end of Cudd_ReadTree */
MtrNode * tree
Definition: cuddInt.h:408

◆ Cudd_ReadUniqueLinks()

double Cudd_ReadUniqueLinks ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of links followed in the unique table.]

Description [Returns the number of links followed during look-ups in the unique table if the keeping of this statistic is enabled; -1 otherwise. If an item is found in the first position of its collision list, the number of links followed is taken to be 0. If it is in second position, the number of links is 1, and so on. This statistic is enabled only if the package is compiled with DD_UNIQUE_PROFILE defined.]

SideEffects [None]

SeeAlso [Cudd_ReadUniqueLookUps]

Definition at line 2147 of file cuddAPI.c.

2149 {
2150 #ifdef DD_UNIQUE_PROFILE
2151  return(dd->uniqueLinks);
2152 #else
2153  return(-1.0);
2154 #endif
2155 
2156 } /* end of Cudd_ReadUniqueLinks */

◆ Cudd_ReadUniqueLookUps()

double Cudd_ReadUniqueLookUps ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of look-ups in the unique table.]

Description [Returns the number of look-ups in the unique table if the keeping of this statistic is enabled; -1 otherwise. This statistic is enabled only if the package is compiled with DD_UNIQUE_PROFILE defined.]

SideEffects [None]

SeeAlso [Cudd_ReadUniqueLinks]

Definition at line 2118 of file cuddAPI.c.

2120 {
2121 #ifdef DD_UNIQUE_PROFILE
2122  return(dd->uniqueLookUps);
2123 #else
2124  return(-1.0);
2125 #endif
2126 
2127 } /* end of Cudd_ReadUniqueLookUps */

◆ Cudd_ReadUsedSlots()

double Cudd_ReadUsedSlots ( DdManager dd)

Function********************************************************************

Synopsis [Reads the fraction of used slots in the unique table.]

Description [Reads the fraction of used slots in the unique table. The unused slots are those in which no valid data is stored. Garbage collection, variable reordering, and subtable resizing may cause used slots to become unused.]

SideEffects [None]

SeeAlso [Cudd_ReadSlots]

Definition at line 1743 of file cuddAPI.c.

1745 {
1746  unsigned long used = 0;
1747  int i, j;
1748  int size = dd->size;
1749  DdNodePtr *nodelist;
1750  DdSubtable *subtable;
1751  DdNode *node;
1752  DdNode *sentinel = &(dd->sentinel);
1753 
1754  /* Scan each BDD/ADD subtable. */
1755  for (i = 0; i < size; i++) {
1756  subtable = &(dd->subtables[i]);
1757  nodelist = subtable->nodelist;
1758  for (j = 0; (unsigned) j < subtable->slots; j++) {
1759  node = nodelist[j];
1760  if (node != sentinel) {
1761  used++;
1762  }
1763  }
1764  }
1765 
1766  /* Scan the ZDD subtables. */
1767  size = dd->sizeZ;
1768 
1769  for (i = 0; i < size; i++) {
1770  subtable = &(dd->subtableZ[i]);
1771  nodelist = subtable->nodelist;
1772  for (j = 0; (unsigned) j < subtable->slots; j++) {
1773  node = nodelist[j];
1774  if (node != NULL) {
1775  used++;
1776  }
1777  }
1778  }
1779 
1780  /* Constant table. */
1781  subtable = &(dd->constants);
1782  nodelist = subtable->nodelist;
1783  for (j = 0; (unsigned) j < subtable->slots; j++) {
1784  node = nodelist[j];
1785  if (node != NULL) {
1786  used++;
1787  }
1788  }
1789 
1790  return((double)used / (double) dd->slots);
1791 
1792 } /* end of Cudd_ReadUsedSlots */
Definition: cudd.h:270
int size
Definition: cuddInt.h:345
unsigned int slots
Definition: cuddInt.h:352
DdSubtable * subtables
Definition: cuddInt.h:349
DdNode sentinel
Definition: cuddInt.h:328
DdNode ** nodelist
Definition: cuddInt.h:311
int sizeZ
Definition: cuddInt.h:346
DdSubtable constants
Definition: cuddInt.h:351
DdSubtable * subtableZ
Definition: cuddInt.h:350

◆ Cudd_ReadVars()

DdNode* Cudd_ReadVars ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the i-th element of the vars array.]

Description [Returns the i-th element of the vars array if it falls within the array bounds; NULL otherwise. If i is the index of an existing variable, this function produces the same result as Cudd_bddIthVar. However, if the i-th var does not exist yet, Cudd_bddIthVar will create it, whereas Cudd_ReadVars will not.]

SideEffects [None]

SeeAlso [Cudd_bddIthVar]

Definition at line 2689 of file cuddAPI.c.

2692 {
2693  if (i < 0 || i > dd->size) return(NULL);
2694  return(dd->vars[i]);
2695 
2696 } /* end of Cudd_ReadVars */
int size
Definition: cuddInt.h:345
DdNode ** vars
Definition: cuddInt.h:373

◆ Cudd_ReadZddOne()

DdNode* Cudd_ReadZddOne ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the ZDD for the constant 1 function.]

Description [Returns the ZDD for the constant 1 function. The representation of the constant 1 function as a ZDD depends on how many variables it (nominally) depends on. The index of the topmost variable in the support is given as argument i.]

SideEffects [None]

SeeAlso [Cudd_ReadOne]

Definition at line 1250 of file cuddAPI.c.

1253 {
1254  if (i < 0)
1255  return(NULL);
1256  return(i < dd->sizeZ ? dd->univ[i] : DD_ONE(dd));
1257 
1258 } /* end of Cudd_ReadZddOne */
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode ** univ
Definition: cuddInt.h:375

◆ Cudd_ReadZddSize()

int Cudd_ReadZddSize ( DdManager dd)

Function********************************************************************

Synopsis [Returns the number of ZDD variables in existance.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadSize]

Definition at line 1701 of file cuddAPI.c.

1703 {
1704  return(dd->sizeZ);
1705 
1706 } /* end of Cudd_ReadZddSize */
int sizeZ
Definition: cuddInt.h:346

◆ Cudd_ReadZddTree()

MtrNode* Cudd_ReadZddTree ( DdManager dd)

Function********************************************************************

Synopsis [Returns the variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_SetZddTree Cudd_FreeZddTree Cudd_ReadTree]

Definition at line 2486 of file cuddAPI.c.

2488 {
2489  return(dd->treeZ);
2490 
2491 } /* end of Cudd_ReadZddTree */
MtrNode * treeZ
Definition: cuddInt.h:409

◆ Cudd_ReadZero()

DdNode* Cudd_ReadZero ( DdManager dd)

Function********************************************************************

Synopsis [Returns the zero constant of the manager.]

Description [Returns the zero constant of the manager. The zero constant is the arithmetic zero, rather than the logic zero. The latter is the complement of the one constant.]

SideEffects [None]

SeeAlso [Cudd_ReadOne Cudd_ReadLogicZero]

Definition at line 1276 of file cuddAPI.c.

1278 {
1279  return(DD_ZERO(dd));
1280 
1281 } /* end of Cudd_ReadZero */
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_RecursiveDeref()

void Cudd_RecursiveDeref ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of node n.]

Description [Decreases the reference count of node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a DD that is no longer needed.]

SideEffects [None]

SeeAlso [Cudd_Deref Cudd_Ref Cudd_RecursiveDerefZdd]

Definition at line 150 of file cuddRef.c.

153 {
154  DdNode *N;
155  int ord;
156  DdNodePtr *stack = table->stack;
157  int SP = 1;
158 
159  unsigned int live = table->keys - table->dead;
160  if (live > table->peakLiveNodes) {
161  table->peakLiveNodes = live;
162  }
163 
164  N = Cudd_Regular(n);
165 
166  do {
167 #ifdef DD_DEBUG
168  assert(N->ref != 0);
169 #endif
170 
171  if (N->ref == 1) {
172  N->ref = 0;
173  table->dead++;
174 #ifdef DD_STATS
175  table->nodesDropped++;
176 #endif
177  if (cuddIsConstant(N)) {
178  table->constants.dead++;
179  N = stack[--SP];
180  } else {
181  ord = table->perm[N->index];
182  stack[SP++] = Cudd_Regular(cuddE(N));
183  table->subtables[ord].dead++;
184  N = cuddT(N);
185  }
186  } else {
187  cuddSatDec(N->ref);
188  N = stack[--SP];
189  }
190  } while (SP != 0);
191 
192 } /* end of Cudd_RecursiveDeref */
DdHalfWord ref
Definition: cudd.h:272
unsigned int peakLiveNodes
Definition: cuddInt.h:445
Definition: cudd.h:270
#define assert(ex)
Definition: util.h:141
#define Cudd_Regular(node)
Definition: cudd.h:384
DdSubtable * subtables
Definition: cuddInt.h:349
DdNode ** stack
Definition: cuddInt.h:364
unsigned int dead
Definition: cuddInt.h:355
unsigned int keys
Definition: cuddInt.h:353
unsigned int dead
Definition: cuddInt.h:316
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define cuddSatDec(x)
Definition: cuddInt.h:849
DdSubtable constants
Definition: cuddInt.h:351
int * perm
Definition: cuddInt.h:369

◆ Cudd_RecursiveDerefZdd()

void Cudd_RecursiveDerefZdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of ZDD node n.]

Description [Decreases the reference count of ZDD node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a ZDD that is no longer needed.]

SideEffects [None]

SeeAlso [Cudd_Deref Cudd_Ref Cudd_RecursiveDeref]

Definition at line 381 of file cuddRef.c.

384 {
385  DdNode *N;
386  int ord;
387  DdNodePtr *stack = table->stack;
388  int SP = 1;
389 
390  N = n;
391 
392  do {
393 #ifdef DD_DEBUG
394  assert(N->ref != 0);
395 #endif
396 
397  cuddSatDec(N->ref);
398 
399  if (N->ref == 0) {
400  table->deadZ++;
401 #ifdef DD_STATS
402  table->nodesDropped++;
403 #endif
404 #ifdef DD_DEBUG
405  assert(!cuddIsConstant(N));
406 #endif
407  ord = table->permZ[N->index];
408  stack[SP++] = cuddE(N);
409  table->subtableZ[ord].dead++;
410  N = cuddT(N);
411  } else {
412  N = stack[--SP];
413  }
414  } while (SP != 0);
415 
416 } /* end of Cudd_RecursiveDerefZdd */
DdHalfWord ref
Definition: cudd.h:272
Definition: cudd.h:270
unsigned int deadZ
Definition: cuddInt.h:356
#define assert(ex)
Definition: util.h:141
int * permZ
Definition: cuddInt.h:370
DdNode ** stack
Definition: cuddInt.h:364
unsigned int dead
Definition: cuddInt.h:316
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
#define cuddSatDec(x)
Definition: cuddInt.h:849
DdSubtable * subtableZ
Definition: cuddInt.h:350

◆ Cudd_ReduceHeap()

int Cudd_ReduceHeap ( DdManager table,
Cudd_ReorderingType  heuristic,
int  minsize 
)

AutomaticEnd Function********************************************************************

Synopsis [Main dynamic reordering routine.]

Description [Main dynamic reordering routine. Calls one of the possible reordering procedures:

  • Swapping
  • Sifting
  • Symmetric Sifting
  • Group Sifting
  • Window Permutation
  • Simulated Annealing
  • Genetic Algorithm
  • Dynamic Programming (exact)

For sifting, symmetric sifting, group sifting, and window permutation it is possible to request reordering to convergence.

The core of all methods is the reordering procedure cuddSwapInPlace() which swaps two adjacent variables and is based on Rudell's paper. Returns 1 in case of success; 0 otherwise. In the case of symmetric sifting (with and without convergence) returns 1 plus the number of symmetric variables, in case of success.]

SideEffects [Changes the variable order for all diagrams and clears the cache.]

Definition at line 172 of file cuddReorder.c.

176 {
177  DdHook *hook;
178  int result;
179  unsigned int nextDyn;
180 #ifdef DD_STATS
181  unsigned int initialSize;
182  unsigned int finalSize;
183 #endif
184  unsigned long localTime;
185 
186  /* Don't reorder if there are too many dead nodes. */
187  if (table->keys - table->dead < (unsigned) minsize)
188  return(1);
189 
190  if (heuristic == CUDD_REORDER_SAME) {
191  heuristic = table->autoMethod;
192  }
193  if (heuristic == CUDD_REORDER_NONE) {
194  return(1);
195  }
196 
197  /* This call to Cudd_ReduceHeap does initiate reordering. Therefore
198  ** we count it.
199  */
200  table->reorderings++;
201 
202  localTime = util_cpu_time();
203 
204  /* Run the hook functions. */
205  hook = table->preReorderingHook;
206  while (hook != NULL) {
207  int res = (hook->f)(table, "BDD", (void *)heuristic);
208  if (res == 0) return(0);
209  hook = hook->next;
210  }
211 
212  if (!ddReorderPreprocess(table)) return(0);
214 
215  if (table->keys > table->peakLiveNodes) {
216  table->peakLiveNodes = table->keys;
217  }
218 #ifdef DD_STATS
219  initialSize = table->keys - table->isolated;
220  ddTotalNISwaps = 0;
221 
222  switch(heuristic) {
223  case CUDD_REORDER_RANDOM:
225  (void) fprintf(table->out,"#:I_RANDOM ");
226  break;
227  case CUDD_REORDER_SIFT:
233  (void) fprintf(table->out,"#:I_SIFTING ");
234  break;
241  (void) fprintf(table->out,"#:I_WINDOW ");
242  break;
244  (void) fprintf(table->out,"#:I_ANNEAL ");
245  break;
247  (void) fprintf(table->out,"#:I_GENETIC ");
248  break;
249  case CUDD_REORDER_LINEAR:
251  (void) fprintf(table->out,"#:I_LINSIFT ");
252  break;
253  case CUDD_REORDER_EXACT:
254  (void) fprintf(table->out,"#:I_EXACT ");
255  break;
256  default:
257  return(0);
258  }
259  (void) fprintf(table->out,"%8d: initial size",initialSize);
260 #endif
261 
262  /* See if we should use alternate threshold for maximum growth. */
263  if (table->reordCycle && table->reorderings % table->reordCycle == 0) {
264  double saveGrowth = table->maxGrowth;
265  table->maxGrowth = table->maxGrowthAlt;
266  result = cuddTreeSifting(table,heuristic);
267  table->maxGrowth = saveGrowth;
268  } else {
269  result = cuddTreeSifting(table,heuristic);
270  }
271 
272 #ifdef DD_STATS
273  (void) fprintf(table->out,"\n");
274  finalSize = table->keys - table->isolated;
275  (void) fprintf(table->out,"#:F_REORDER %8d: final size\n",finalSize);
276  (void) fprintf(table->out,"#:T_REORDER %8g: total time (sec)\n",
277  ((double)(util_cpu_time() - localTime)/1000.0));
278  (void) fprintf(table->out,"#:N_REORDER %8d: total swaps\n",
280  (void) fprintf(table->out,"#:M_REORDER %8d: NI swaps\n",ddTotalNISwaps);
281 #endif
282 
283  if (result == 0)
284  return(0);
285 
286  if (!ddReorderPostprocess(table))
287  return(0);
288 
289  if (table->realign) {
290  if (!cuddZddAlignToBdd(table))
291  return(0);
292  }
293 
294  nextDyn = (table->keys - table->constants.keys + 1) *
295  DD_DYN_RATIO + table->constants.keys;
296  if (table->reorderings < 20 || nextDyn > table->nextDyn)
297  table->nextDyn = nextDyn;
298  else
299  table->nextDyn += 20;
300  if (table->randomizeOrder != 0) {
301  table->nextDyn += Cudd_Random() & table->randomizeOrder;
302  }
303  table->reordered = 1;
304 
305  /* Run hook functions. */
306  hook = table->postReorderingHook;
307  while (hook != NULL) {
308  int res = (hook->f)(table, "BDD", (void *)localTime);
309  if (res == 0) return(0);
310  hook = hook->next;
311  }
312  /* Update cumulative reordering time. */
313  table->reordTime += util_cpu_time() - localTime;
314 
315  return(result);
316 
317 } /* end of Cudd_ReduceHeap */
unsigned int keys
Definition: cuddInt.h:314
unsigned long reordTime
Definition: cuddInt.h:434
Cudd_ReorderingType autoMethod
Definition: cuddInt.h:402
unsigned int peakLiveNodes
Definition: cuddInt.h:445
DdHook * preReorderingHook
Definition: cuddInt.h:421
int reordCycle
Definition: cuddInt.h:399
double maxGrowthAlt
Definition: cuddInt.h:398
int realign
Definition: cuddInt.h:404
double maxGrowth
Definition: cuddInt.h:397
#define DD_DYN_RATIO
Definition: cuddInt.h:153
int cuddTreeSifting(DdManager *table, Cudd_ReorderingType method)
Definition: cuddGroup.c:271
DD_HFP f
Definition: cuddInt.h:241
int ddTotalNumberSwapping
Definition: cuddReorder.c:103
unsigned int randomizeOrder
Definition: cuddInt.h:416
int reordered
Definition: cuddInt.h:392
unsigned int nextDyn
Definition: cuddInt.h:406
unsigned int dead
Definition: cuddInt.h:355
long Cudd_Random(void)
Definition: cuddUtil.c:2710
DdHook * postReorderingHook
Definition: cuddInt.h:422
unsigned int keys
Definition: cuddInt.h:353
static int ddReorderPostprocess(DdManager *table)
Definition: cuddReorder.c:1863
FILE * out
Definition: cuddInt.h:423
long util_cpu_time(void)
Definition: cpu_time.c:34
static int ddReorderPreprocess(DdManager *table)
Definition: cuddReorder.c:1825
struct DdHook * next
Definition: cuddInt.h:242
unsigned int reorderings
Definition: cuddInt.h:393
int cuddZddAlignToBdd(DdManager *table)
Definition: cuddZddReord.c:348
DdSubtable constants
Definition: cuddInt.h:351
static int result
Definition: cuddGenetic.c:121
int isolated
Definition: cuddInt.h:368
if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool(dvf dda.cpp) else() add_executable(dvf dda.cpp) target_link_libraries(dvf Svf Cudd $
Definition: CMakeLists.txt:2

◆ Cudd_Ref()

void Cudd_Ref ( DdNode n)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Increases the reference count of a node, if it is not saturated.]

Description []

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_Deref]

Definition at line 125 of file cuddRef.c.

127 {
128 
129  n = Cudd_Regular(n);
130 
131  cuddSatInc(n->ref);
132 
133 } /* end of Cudd_Ref */
DdHalfWord ref
Definition: cudd.h:272
#define Cudd_Regular(node)
Definition: cudd.h:384
#define cuddSatInc(x)
Definition: cuddInt.h:831

◆ Cudd_RemapOverApprox()

DdNode* Cudd_RemapOverApprox ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
double  quality 
)

◆ Cudd_RemapUnderApprox()

DdNode* Cudd_RemapUnderApprox ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
double  quality 
)

◆ Cudd_RemoveHook()

int Cudd_RemoveHook ( DdManager dd,
DD_HFP  f,
Cudd_HookType  where 
)

Function********************************************************************

Synopsis [Removes a function from a hook.]

Description [Removes a function from a hook. A hook is a list of application-provided functions called on certain occasions by the package. Returns 1 if successful; 0 the function was not in the list.]

SideEffects [None]

SeeAlso [Cudd_AddHook]

Definition at line 3631 of file cuddAPI.c.

3635 {
3636  DdHook **hook, *nextHook;
3637 
3638  switch (where) {
3639  case CUDD_PRE_GC_HOOK:
3640  hook = &(dd->preGCHook);
3641  break;
3642  case CUDD_POST_GC_HOOK:
3643  hook = &(dd->postGCHook);
3644  break;
3646  hook = &(dd->preReorderingHook);
3647  break;
3649  hook = &(dd->postReorderingHook);
3650  break;
3651  default:
3652  return(0);
3653  }
3654  nextHook = *hook;
3655  while (nextHook != NULL) {
3656  if (nextHook->f == f) {
3657  *hook = nextHook->next;
3658  FREE(nextHook);
3659  return(1);
3660  }
3661  hook = &(nextHook->next);
3662  nextHook = nextHook->next;
3663  }
3664 
3665  return(0);
3666 
3667 } /* end of Cudd_RemoveHook */
#define FREE(obj)
Definition: util.h:80
DdHook * preReorderingHook
Definition: cuddInt.h:421
DD_HFP f
Definition: cuddInt.h:241
DdHook * postReorderingHook
Definition: cuddInt.h:422
struct DdHook * next
Definition: cuddInt.h:242
DdHook * postGCHook
Definition: cuddInt.h:420
DdHook * preGCHook
Definition: cuddInt.h:419

◆ Cudd_ReorderingReporting()

int Cudd_ReorderingReporting ( DdManager dd)

Function********************************************************************

Synopsis [Returns 1 if reporting of reordering stats is enabled.]

Description [Returns 1 if reporting of reordering stats is enabled; 0 otherwise.]

SideEffects [none]

SeeAlso [Cudd_EnableReorderingReporting Cudd_DisableReorderingReporting]

Definition at line 3916 of file cuddAPI.c.

3918 {
3920 
3921 } /* end of Cudd_ReorderingReporting */
int Cudd_StdPreReordHook(DdManager *dd, const char *str, void *data)
Definition: cuddAPI.c:3733
int Cudd_IsInHook(DdManager *dd, DD_HFP f, Cudd_HookType where)
Definition: cuddAPI.c:3684

◆ Cudd_ReorderingStatus()

int Cudd_ReorderingStatus ( DdManager unique,
Cudd_ReorderingType method 
)

Function********************************************************************

Synopsis [Reports the status of automatic dynamic reordering of BDDs and ADDs.]

Description [Reports the status of automatic dynamic reordering of BDDs and ADDs. Parameter method is set to the reordering method currently selected. Returns 1 if automatic reordering is enabled; 0 otherwise.]

SideEffects [Parameter method is set to the reordering method currently selected.]

SeeAlso [Cudd_AutodynEnable Cudd_AutodynDisable Cudd_ReorderingStatusZdd]

Definition at line 975 of file cuddAPI.c.

978 {
979  *method = unique->autoMethod;
980  return(unique->autoDyn);
981 
982 } /* end of Cudd_ReorderingStatus */
Cudd_ReorderingType autoMethod
Definition: cuddInt.h:402
int autoDyn
Definition: cuddInt.h:400

◆ Cudd_ReorderingStatusZdd()

int Cudd_ReorderingStatusZdd ( DdManager unique,
Cudd_ReorderingType method 
)

Function********************************************************************

Synopsis [Reports the status of automatic dynamic reordering of ZDDs.]

Description [Reports the status of automatic dynamic reordering of ZDDs. Parameter method is set to the ZDD reordering method currently selected. Returns 1 if automatic reordering is enabled; 0 otherwise.]

SideEffects [Parameter method is set to the ZDD reordering method currently selected.]

SeeAlso [Cudd_AutodynEnableZdd Cudd_AutodynDisableZdd Cudd_ReorderingStatus]

Definition at line 1052 of file cuddAPI.c.

1055 {
1056  *method = unique->autoMethodZ;
1057  return(unique->autoDynZ);
1058 
1059 } /* end of Cudd_ReorderingStatusZdd */
Cudd_ReorderingType autoMethodZ
Definition: cuddInt.h:403
int autoDynZ
Definition: cuddInt.h:401

◆ Cudd_Reserve()

int Cudd_Reserve ( DdManager manager,
int  amount 
)

Function********************************************************************

Synopsis [Expand manager without creating variables.]

Description [Expand a manager by a specified number of subtables without actually creating new variables. This function can be used to reduce the frequency of resizing when an estimate of the number of variables is available. One would call this function instead of passing the number of variables to Cudd_Init if variables should not be created right away of if the estimate on their number became available only after the manager has been created. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_Init]

Definition at line 230 of file cuddTable.c.

233 {
234  int currentSize = manager->size;
235  if (amount < 0)
236  return(0);
237  if (currentSize + amount < currentSize) /* overflow */
238  return(0);
239  if (amount <= manager->maxSize - manager->size)
240  return(1);
241  return ddResizeTable(manager, -1, amount);
242 
243 } /* end of Cudd_Reserve */
static int ddResizeTable(DdManager *unique, int index, int amount)
Definition: cuddTable.c:2555
int size
Definition: cuddInt.h:345

◆ Cudd_ResetStartTime()

void Cudd_ResetStartTime ( DdManager unique)

Function********************************************************************

Synopsis [Resets the start time of the manager.]

Description [Resets the start time of the manager.]

SideEffects [None]

SeeAlso [Cudd_ReadStartTime Cudd_SetStartTime Cudd_SetTimeLimit]

Definition at line 743 of file cuddAPI.c.

745 {
746  unique->startTime = util_cpu_time();
747 
748 } /* end of Cudd_ResetStartTime */
unsigned long startTime
Definition: cuddInt.h:426
long util_cpu_time(void)
Definition: cpu_time.c:34

◆ Cudd_SetArcviolation()

void Cudd_SetArcviolation ( DdManager dd,
int  arcviolation 
)

Function********************************************************************

Synopsis [Sets the value of the arcviolation parameter used in group sifting.]

Description [Sets the value of the arcviolation parameter. This parameter is used in group sifting to decide how many arcs into y not coming from x are tolerable when checking for aggregation due to extended symmetry. The value should be between 0 and 100. A small value causes fewer variables to be aggregated. The default value is 0.]

SideEffects [None]

SeeAlso [Cudd_ReadArcviolation]

Definition at line 3072 of file cuddAPI.c.

3075 {
3076  dd->arcviolation = arcviolation;
3077 
3078 } /* end of Cudd_SetArcviolation */
int arcviolation
Definition: cuddInt.h:413

◆ Cudd_SetBackground()

void Cudd_SetBackground ( DdManager dd,
DdNode bck 
)

Function********************************************************************

Synopsis [Sets the background constant of the manager.]

Description [Sets the background constant of the manager. It assumes that the DdNode pointer bck is already referenced.]

SideEffects [None]

Definition at line 1371 of file cuddAPI.c.

1374 {
1375  dd->background = bck;
1376 
1377 } /* end of Cudd_SetBackground */
DdNode * background
Definition: cuddInt.h:333

◆ Cudd_SetEpsilon()

void Cudd_SetEpsilon ( DdManager dd,
CUDD_VALUE_TYPE  ep 
)

Function********************************************************************

Synopsis [Sets the epsilon parameter of the manager to ep.]

Description [Sets the epsilon parameter of the manager to ep. The epsilon parameter control the comparison between floating point numbers.]

SideEffects [None]

SeeAlso [Cudd_ReadEpsilon]

Definition at line 2733 of file cuddAPI.c.

2736 {
2737  dd->epsilon = ep;
2738 
2739 } /* end of Cudd_SetEpsilon */
CUDD_VALUE_TYPE epsilon
Definition: cuddInt.h:390

◆ Cudd_SetGroupcheck()

void Cudd_SetGroupcheck ( DdManager dd,
Cudd_AggregationType  gc 
)

Function********************************************************************

Synopsis [Sets the parameter groupcheck of the manager to gc.]

Description [Sets the parameter groupcheck of the manager to gc. The groupcheck parameter determines the aggregation criterion in group sifting.]

SideEffects [None]

SeeAlso [Cudd_ReadGroupCheck]

Definition at line 2778 of file cuddAPI.c.

2781 {
2782  dd->groupcheck = gc;
2783 
2784 } /* end of Cudd_SetGroupcheck */
Cudd_AggregationType groupcheck
Definition: cuddInt.h:410

◆ Cudd_SetLooseUpTo()

void Cudd_SetLooseUpTo ( DdManager dd,
unsigned int  lut 
)

Function********************************************************************

Synopsis [Sets the looseUpTo parameter of the manager.]

Description [Sets the looseUpTo parameter of the manager. This parameter of the manager controls the threshold beyond which no fast growth of the unique table is allowed. The threshold is given as a number of slots. If the value passed to this function is 0, the function determines a suitable value based on the available memory.]

SideEffects [None]

SeeAlso [Cudd_ReadLooseUpTo Cudd_SetMinHit]

Definition at line 1585 of file cuddAPI.c.

1588 {
1589  if (lut == 0) {
1590  unsigned long datalimit = getSoftDataLimit();
1591  lut = (unsigned int) (datalimit / (sizeof(DdNode) *
1593  }
1594  dd->looseUpTo = lut;
1595 
1596 } /* end of Cudd_SetLooseUpTo */
Definition: cudd.h:270
#define DD_MAX_LOOSE_FRACTION
Definition: cuddInt.h:139
unsigned long getSoftDataLimit(void)
Definition: datalimit.c:35
unsigned int looseUpTo
Definition: cuddInt.h:361

◆ Cudd_SetMaxCacheHard()

void Cudd_SetMaxCacheHard ( DdManager dd,
unsigned int  mc 
)

Function********************************************************************

Synopsis [Sets the maxCacheHard parameter of the manager.]

Description [Sets the maxCacheHard parameter of the manager. The cache cannot grow larger than maxCacheHard entries. This parameter allows an application to control the trade-off of memory versus speed. If the value passed to this function is 0, the function determines a suitable maximum cache size based on the available memory.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxCacheHard Cudd_SetMaxCache]

Definition at line 1655 of file cuddAPI.c.

1658 {
1659  if (mc == 0) {
1660  unsigned long datalimit = getSoftDataLimit();
1661  mc = (unsigned int) (datalimit / (sizeof(DdCache) *
1663  }
1664  dd->maxCacheHard = mc;
1665 
1666 } /* end of Cudd_SetMaxCacheHard */
#define DD_MAX_CACHE_FRACTION
Definition: cuddInt.h:141
unsigned int maxCacheHard
Definition: cuddInt.h:343
unsigned long getSoftDataLimit(void)
Definition: datalimit.c:35

◆ Cudd_SetMaxGrowth()

void Cudd_SetMaxGrowth ( DdManager dd,
double  mg 
)

Function********************************************************************

Synopsis [Sets the maxGrowth parameter of the manager.]

Description [Sets the maxGrowth parameter of the manager. This parameter determines how much the number of nodes can grow during sifting of a variable. Overall, sifting never increases the size of the decision diagrams. This parameter only refers to intermediate results. A lower value will speed up sifting, possibly at the expense of quality.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxGrowth Cudd_SetMaxGrowthAlternate]

Definition at line 2295 of file cuddAPI.c.

2298 {
2299  dd->maxGrowth = mg;
2300 
2301 } /* end of Cudd_SetMaxGrowth */
double maxGrowth
Definition: cuddInt.h:397

◆ Cudd_SetMaxGrowthAlternate()

void Cudd_SetMaxGrowthAlternate ( DdManager dd,
double  mg 
)

Function********************************************************************

Synopsis [Sets the maxGrowthAlt parameter of the manager.]

Description [Sets the maxGrowthAlt parameter of the manager. This parameter is analogous to the maxGrowth paramter, and is used every given number of reorderings instead of maxGrowth. The number of reorderings is set with Cudd_SetReorderingCycle. If the number of reorderings is 0 (default) maxGrowthAlt is never used.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxGrowthAlternate Cudd_SetMaxGrowth Cudd_SetReorderingCycle Cudd_ReadReorderingCycle]

Definition at line 2346 of file cuddAPI.c.

2349 {
2350  dd->maxGrowthAlt = mg;
2351 
2352 } /* end of Cudd_SetMaxGrowthAlternate */
double maxGrowthAlt
Definition: cuddInt.h:398

◆ Cudd_SetMaxLive()

void Cudd_SetMaxLive ( DdManager dd,
unsigned int  maxLive 
)

Function********************************************************************

Synopsis [Sets the maximum allowed number of live nodes.]

Description [Sets the maximum allowed number of live nodes. When this number is exceeded, the package returns NULL.]

SideEffects [none]

SeeAlso [Cudd_ReadMaxLive]

Definition at line 4286 of file cuddAPI.c.

4289 {
4290  dd->maxLive = maxLive;
4291 
4292 } /* end of Cudd_SetMaxLive */
unsigned int maxLive
Definition: cuddInt.h:357

◆ Cudd_SetMaxMemory()

void Cudd_SetMaxMemory ( DdManager dd,
unsigned long  maxMemory 
)

Function********************************************************************

Synopsis [Sets the maximum allowed memory.]

Description [Sets the maximum allowed memory. When this number is exceeded, the package returns NULL.]

SideEffects [none]

SeeAlso [Cudd_ReadMaxMemory]

Definition at line 4329 of file cuddAPI.c.

4332 {
4333  dd->maxmemhard = maxMemory;
4334 
4335 } /* end of Cudd_SetMaxMemory */
unsigned long maxmemhard
Definition: cuddInt.h:431

◆ Cudd_SetMaxReorderings()

void Cudd_SetMaxReorderings ( DdManager dd,
unsigned int  mr 
)

Function********************************************************************

Synopsis [Sets the maximum number of times reordering may be invoked.]

Description [Sets the maximum number of times reordering may be invoked in this manager. The default value is (practically) infinite.]

SideEffects [None]

SeeAlso [Cudd_ReadReorderings Cudd_ReadMaxReorderings Cudd_ReduceHeap]

Definition at line 1978 of file cuddAPI.c.

1980 {
1981  dd->maxReorderings = mr;
1982 
1983 } /* end of Cudd_SetMaxReorderings */
unsigned int maxReorderings
Definition: cuddInt.h:394

◆ Cudd_SetMinHit()

void Cudd_SetMinHit ( DdManager dd,
unsigned int  hr 
)

Function********************************************************************

Synopsis [Sets the hit rate that causes resizinig of the computed table.]

Description [Sets the minHit parameter of the manager. This parameter controls the resizing of the computed table. If the hit rate is larger than the specified value, and the cache is not already too large, then its size is doubled.]

SideEffects [None]

SeeAlso [Cudd_ReadMinHit]

Definition at line 1538 of file cuddAPI.c.

1541 {
1542  /* Internally, the package manipulates the ratio of hits to
1543  ** misses instead of the ratio of hits to accesses. */
1544  dd->minHit = (double) hr / (100.0 - (double) hr);
1545 
1546 } /* end of Cudd_SetMinHit */
double minHit
Definition: cuddInt.h:341

◆ Cudd_SetNextReordering()

void Cudd_SetNextReordering ( DdManager dd,
unsigned int  next 
)

Function********************************************************************

Synopsis [Sets the threshold for the next dynamic reordering.]

Description [Sets the threshold for the next dynamic reordering. The threshold is in terms of number of nodes and is in effect only if reordering is enabled. The count does not include the dead nodes, unless the countDead parameter of the manager has been changed from its default setting.]

SideEffects [None]

SeeAlso [Cudd_ReadNextReordering]

Definition at line 4219 of file cuddAPI.c.

4222 {
4223  dd->nextDyn = next;
4224 
4225 } /* end of Cudd_SetNextReordering */
unsigned int nextDyn
Definition: cuddInt.h:406

◆ Cudd_SetNumberXovers()

void Cudd_SetNumberXovers ( DdManager dd,
int  numberXovers 
)

Function********************************************************************

Synopsis [Sets the number of crossovers used by the genetic algorithm for reordering.]

Description [Sets the number of crossovers used by the genetic algorithm for variable reordering. A larger number of crossovers will cause the genetic algorithm to take more time, but will generally produce better results. The default value is 0, in which case the package uses three times the number of variables as number of crossovers, with a maximum of 60.]

SideEffects [None]

SeeAlso [Cudd_ReadNumberXovers]

Definition at line 3178 of file cuddAPI.c.

3181 {
3182  dd->numberXovers = numberXovers;
3183 
3184 } /* end of Cudd_SetNumberXovers */
int numberXovers
Definition: cuddInt.h:415

◆ Cudd_SetOrderRandomization()

void Cudd_SetOrderRandomization ( DdManager dd,
unsigned int  factor 
)

Function********************************************************************

Synopsis [Sets the order randomization factor.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadOrderRandomization]

Definition at line 3221 of file cuddAPI.c.

3224 {
3225  dd->randomizeOrder = factor;
3226 
3227 } /* end of Cudd_SetOrderRandomization */
unsigned int randomizeOrder
Definition: cuddInt.h:416

◆ Cudd_SetPopulationSize()

void Cudd_SetPopulationSize ( DdManager dd,
int  populationSize 
)

Function********************************************************************

Synopsis [Sets the size of the population used by the genetic algorithm for reordering.]

Description [Sets the size of the population used by the genetic algorithm for variable reordering. A larger population size will cause the genetic algorithm to take more time, but will generally produce better results. The default value is 0, in which case the package uses three times the number of variables as population size, with a maximum of 120.]

SideEffects [Changes the manager.]

SeeAlso [Cudd_ReadPopulationSize]

Definition at line 3125 of file cuddAPI.c.

3128 {
3129  dd->populationSize = populationSize;
3130 
3131 } /* end of Cudd_SetPopulationSize */
int populationSize
Definition: cuddInt.h:414

◆ Cudd_SetRecomb()

void Cudd_SetRecomb ( DdManager dd,
int  recomb 
)

Function********************************************************************

Synopsis [Sets the value of the recombination parameter used in group sifting.]

Description [Sets the value of the recombination parameter used in group sifting. A larger (positive) value makes the aggregation of variables due to the second difference criterion more likely. A smaller (negative) value makes aggregation less likely. The default value is 0.]

SideEffects [Changes the manager.]

SeeAlso [Cudd_ReadRecomb]

Definition at line 2964 of file cuddAPI.c.

2967 {
2968  dd->recomb = recomb;
2969 
2970 } /* end of Cudd_SetRecomb */
int recomb
Definition: cuddInt.h:411

◆ Cudd_SetReorderingCycle()

void Cudd_SetReorderingCycle ( DdManager dd,
int  cycle 
)

Function********************************************************************

Synopsis [Sets the reordCycle parameter of the manager.]

Description [Sets the reordCycle parameter of the manager. This parameter determines how often the alternate threshold on maximum growth is used in reordering.]

SideEffects [None]

SeeAlso [Cudd_ReadMaxGrowthAlternate Cudd_SetMaxGrowthAlternate Cudd_ReadReorderingCycle]

Definition at line 2393 of file cuddAPI.c.

2396 {
2397  dd->reordCycle = cycle;
2398 
2399 } /* end of Cudd_SetReorderingCycle */
int reordCycle
Definition: cuddInt.h:399

◆ Cudd_SetSiftMaxSwap()

void Cudd_SetSiftMaxSwap ( DdManager dd,
int  sms 
)

Function********************************************************************

Synopsis [Sets the siftMaxSwap parameter of the manager.]

Description [Sets the siftMaxSwap parameter of the manager. This parameter gives the maximum number of swaps that will be attempted for each invocation of sifting. The real number of swaps may exceed the set limit because the package will always complete the sifting of the variable that causes the limit to be reached.]

SideEffects [None]

SeeAlso [Cudd_SetSiftMaxVar Cudd_ReadSiftMaxSwap]

Definition at line 2244 of file cuddAPI.c.

2247 {
2248  dd->siftMaxSwap = sms;
2249 
2250 } /* end of Cudd_SetSiftMaxSwap */
int siftMaxSwap
Definition: cuddInt.h:396

◆ Cudd_SetSiftMaxVar()

void Cudd_SetSiftMaxVar ( DdManager dd,
int  smv 
)

Function********************************************************************

Synopsis [Sets the siftMaxVar parameter of the manager.]

Description [Sets the siftMaxVar parameter of the manager. This parameter gives the maximum number of variables that will be sifted for each invocation of sifting.]

SideEffects [None]

SeeAlso [Cudd_SetSiftMaxSwap Cudd_ReadSiftMaxVar]

Definition at line 2195 of file cuddAPI.c.

2198 {
2199  dd->siftMaxVar = smv;
2200 
2201 } /* end of Cudd_SetSiftMaxVar */
int siftMaxVar
Definition: cuddInt.h:395

◆ Cudd_SetStartTime()

void Cudd_SetStartTime ( DdManager unique,
unsigned long  st 
)

Function********************************************************************

Synopsis [Sets the start time of the manager.]

Description [Sets the start time of the manager.]

SideEffects [None]

SeeAlso [Cudd_ReadStartTime Cudd_ResetStartTime Cudd_ReadElapsedTime Cudd_SetTimeLimit]

Definition at line 722 of file cuddAPI.c.

725 {
726  unique->startTime = st;
727 
728 } /* end of Cudd_SetStartTime */
unsigned long startTime
Definition: cuddInt.h:426

◆ Cudd_SetStderr()

void Cudd_SetStderr ( DdManager dd,
FILE *  fp 
)

Function********************************************************************

Synopsis [Sets the stderr of a manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadStderr Cudd_SetStdout]

Definition at line 4170 of file cuddAPI.c.

4173 {
4174  dd->err = fp;
4175 
4176 } /* end of Cudd_SetStderr */
FILE * err
Definition: cuddInt.h:424

◆ Cudd_SetStdout()

void Cudd_SetStdout ( DdManager dd,
FILE *  fp 
)

Function********************************************************************

Synopsis [Sets the stdout of a manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_ReadStdout Cudd_SetStderr]

Definition at line 4127 of file cuddAPI.c.

4130 {
4131  dd->out = fp;
4132 
4133 } /* end of Cudd_SetStdout */
FILE * out
Definition: cuddInt.h:423

◆ Cudd_SetSymmviolation()

void Cudd_SetSymmviolation ( DdManager dd,
int  symmviolation 
)

Function********************************************************************

Synopsis [Sets the value of the symmviolation parameter used in group sifting.]

Description [Sets the value of the symmviolation parameter. This parameter is used in group sifting to decide how many violations to the symmetry conditions f10 = f01 or f11 = f00 are tolerable when checking for aggregation due to extended symmetry. The value should be between 0 and 100. A small value causes fewer variables to be aggregated. The default value is 0.]

SideEffects [Changes the manager.]

SeeAlso [Cudd_ReadSymmviolation]

Definition at line 3019 of file cuddAPI.c.

3022 {
3023  dd->symmviolation = symmviolation;
3024 
3025 } /* end of Cudd_SetSymmviolation */
int symmviolation
Definition: cuddInt.h:412

◆ Cudd_SetTimeLimit()

void Cudd_SetTimeLimit ( DdManager unique,
unsigned long  tl 
)

Function********************************************************************

Synopsis [Sets the time limit for the manager.]

Description [Sets the time limit for the manager.]

SideEffects [None]

SeeAlso [Cudd_ReadTimeLimit Cudd_UnsetTimeLimit Cudd_UpdateTimeLimit Cudd_IncreaseTimeLimit Cudd_TimeLimited Cudd_SetStartTime]

Definition at line 786 of file cuddAPI.c.

789 {
790  unique->timeLimit = tl;
791 
792 } /* end of Cudd_SetTimeLimit */
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_SetTree()

void Cudd_SetTree ( DdManager dd,
MtrNode tree 
)

Function********************************************************************

Synopsis [Sets the variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_FreeTree Cudd_ReadTree Cudd_SetZddTree]

Definition at line 2434 of file cuddAPI.c.

2437 {
2438  if (dd->tree != NULL) {
2439  Mtr_FreeTree(dd->tree);
2440  }
2441  dd->tree = tree;
2442  if (tree == NULL) return;
2443 
2444  fixVarTree(tree, dd->perm, dd->size);
2445  return;
2446 
2447 } /* end of Cudd_SetTree */
int size
Definition: cuddInt.h:345
void Mtr_FreeTree(MtrNode *node)
Definition: mtrBasic.c:187
MtrNode * tree
Definition: cuddInt.h:408
static void fixVarTree(MtrNode *treenode, int *perm, int size)
Definition: cuddAPI.c:4812
int * perm
Definition: cuddInt.h:369

◆ Cudd_SetVarMap()

int Cudd_SetVarMap ( DdManager manager,
DdNode **  x,
DdNode **  y,
int  n 
)

◆ Cudd_SetZddTree()

void Cudd_SetZddTree ( DdManager dd,
MtrNode tree 
)

Function********************************************************************

Synopsis [Sets the ZDD variable group tree of the manager.]

Description []

SideEffects [None]

SeeAlso [Cudd_FreeZddTree Cudd_ReadZddTree Cudd_SetTree]

Definition at line 2506 of file cuddAPI.c.

2509 {
2510  if (dd->treeZ != NULL) {
2511  Mtr_FreeTree(dd->treeZ);
2512  }
2513  dd->treeZ = tree;
2514  if (tree == NULL) return;
2515 
2516  fixVarTree(tree, dd->permZ, dd->sizeZ);
2517  return;
2518 
2519 } /* end of Cudd_SetZddTree */
void Mtr_FreeTree(MtrNode *node)
Definition: mtrBasic.c:187
int * permZ
Definition: cuddInt.h:370
int sizeZ
Definition: cuddInt.h:346
MtrNode * treeZ
Definition: cuddInt.h:409
static void fixVarTree(MtrNode *treenode, int *perm, int size)
Definition: cuddAPI.c:4812

◆ Cudd_SharingSize()

int Cudd_SharingSize ( DdNode **  nodeArray,
int  n 
)

Function********************************************************************

Synopsis [Counts the number of nodes in an array of DDs.]

Description [Counts the number of nodes in an array of DDs. Shared nodes are counted only once. Returns the total number of nodes.]

SideEffects [None]

SeeAlso [Cudd_DagSize]

Definition at line 548 of file cuddUtil.c.

551 {
552  int i,j;
553 
554  i = 0;
555  for (j = 0; j < n; j++) {
556  i += ddDagInt(Cudd_Regular(nodeArray[j]));
557  }
558  for (j = 0; j < n; j++) {
559  ddClearFlag(Cudd_Regular(nodeArray[j]));
560  }
561  return(i);
562 
563 } /* end of Cudd_SharingSize */
#define Cudd_Regular(node)
Definition: cudd.h:384
static int ddDagInt(DdNode *n)
Definition: cuddUtil.c:3173
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741

◆ Cudd_ShortestLength()

int Cudd_ShortestLength ( DdManager manager,
DdNode f,
int *  weight 
)

Function********************************************************************

Synopsis [Find the length of the shortest path(s) in a DD.]

Description [Find the length of the shortest path(s) in a DD. f is the DD we want to get the shortest path for; weight[i] is the weight of the THEN edge coming from the node whose index is i. All ELSE edges have 0 weight. Returns the length of the shortest path(s) if such a path is found; a large number if the function is identically 0, and CUDD_OUT_OF_MEM in case of failure.]

SideEffects [None]

SeeAlso [Cudd_ShortestPath]

Definition at line 364 of file cuddSat.c.

368 {
369  register DdNode *F;
370  st_table *visited;
371  cuddPathPair *my_pair;
372  int complement, cost;
373 
374  one = DD_ONE(manager);
375  zero = DD_ZERO(manager);
376 
377  if (f == Cudd_Not(one) || f == zero) {
378  return(DD_BIGGY);
379  }
380 
381  /* From this point on, a path exists. */
382  /* Initialize visited table and support. */
383  visited = st_init_table(st_ptrcmp, st_ptrhash);
384 
385  /* Now get the length of the shortest path(s) from f to 1. */
386  (void) getShortest(f, weight, NULL, visited);
387 
388  complement = Cudd_IsComplement(f);
389 
390  F = Cudd_Regular(f);
391 
392  if (!st_lookup(visited, F, &my_pair)) return(CUDD_OUT_OF_MEM);
393 
394  if (complement) {
395  cost = my_pair->neg;
396  } else {
397  cost = my_pair->pos;
398  }
399 
400  st_foreach(visited, freePathPair, NULL);
401  st_free_table(visited);
402 
403  return(cost);
404 
405 } /* end of Cudd_ShortestLength */
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
int st_lookup(st_table *, void *, void *)
Definition: st.c:286
Definition: st.h:60
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
static enum st_retval freePathPair(char *key, char *value, char *arg)
Definition: cuddSat.c:1060
static DdNode * one
Definition: cuddSat.c:105
static cuddPathPair getShortest(DdNode *root, int *cost, int *support, st_table *visited)
Definition: cuddSat.c:1093
#define Cudd_IsComplement(node)
Definition: cudd.h:412
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
static DdNode * zero
Definition: cuddSat.c:105
int st_ptrhash(char *, int)
Definition: st.c:811
#define DD_BIGGY
Definition: cuddSat.c:82
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_ShortestPath()

DdNode* Cudd_ShortestPath ( DdManager manager,
DdNode f,
int *  weight,
int *  support,
int *  length 
)

Function********************************************************************

Synopsis [Finds a shortest path in a DD.]

Description [Finds a shortest path in a DD. f is the DD we want to get the shortest path for; weight[i] is the weight of the THEN arc coming from the node whose index is i. If weight is NULL, then unit weights are assumed for all THEN arcs. All ELSE arcs have 0 weight. If non-NULL, both weight and support should point to arrays with at least as many entries as there are variables in the manager. Returns the shortest path as the BDD of a cube.]

SideEffects [support contains on return the true support of f. If support is NULL on entry, then Cudd_ShortestPath does not compute the true support info. length contains the length of the path.]

SeeAlso [Cudd_ShortestLength Cudd_LargestCube]

Definition at line 203 of file cuddSat.c.

209 {
210  DdNode *F;
211  st_table *visited;
212  DdNode *sol;
213  cuddPathPair *rootPair;
214  int complement, cost;
215  int i;
216 
217  one = DD_ONE(manager);
218  zero = DD_ZERO(manager);
219 
220  /* Initialize support. Support does not depend on variable order.
221  ** Hence, it does not need to be reinitialized if reordering occurs.
222  */
223  if (support) {
224  for (i = 0; i < manager->size; i++) {
225  support[i] = 0;
226  }
227  }
228 
229  if (f == Cudd_Not(one) || f == zero) {
230  *length = DD_BIGGY;
231  return(Cudd_Not(one));
232  }
233  /* From this point on, a path exists. */
234 
235  do {
236  manager->reordered = 0;
237 
238  /* Initialize visited table. */
239  visited = st_init_table(st_ptrcmp, st_ptrhash);
240 
241  /* Now get the length of the shortest path(s) from f to 1. */
242  (void) getShortest(f, weight, support, visited);
243 
244  complement = Cudd_IsComplement(f);
245 
246  F = Cudd_Regular(f);
247 
248  if (!st_lookup(visited, F, &rootPair)) return(NULL);
249 
250  if (complement) {
251  cost = rootPair->neg;
252  } else {
253  cost = rootPair->pos;
254  }
255 
256  /* Recover an actual shortest path. */
257  sol = getPath(manager,visited,f,weight,cost);
258 
259  st_foreach(visited, freePathPair, NULL);
260  st_free_table(visited);
261 
262  } while (manager->reordered == 1);
263 
264  *length = cost;
265  return(sol);
266 
267 } /* end of Cudd_ShortestPath */
int st_lookup(st_table *, void *, void *)
Definition: st.c:286
Definition: st.h:60
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
int st_foreach(st_table *, ST_PFSR, char *)
Definition: st.c:725
int size
Definition: cuddInt.h:345
void st_free_table(st_table *)
Definition: st.c:252
#define Cudd_Regular(node)
Definition: cudd.h:384
static enum st_retval freePathPair(char *key, char *value, char *arg)
Definition: cuddSat.c:1060
int reordered
Definition: cuddInt.h:392
static DdNode * one
Definition: cuddSat.c:105
static cuddPathPair getShortest(DdNode *root, int *cost, int *support, st_table *visited)
Definition: cuddSat.c:1093
#define Cudd_IsComplement(node)
Definition: cudd.h:412
static DdNode * getPath(DdManager *manager, st_table *visited, DdNode *f, int *weight, int cost)
Definition: cuddSat.c:1189
int st_ptrcmp(const char *, const char *)
Definition: st.c:849
st_table * st_init_table(ST_PFICPCP, ST_PFICPI)
Definition: st.c:163
static DdNode * zero
Definition: cuddSat.c:105
int st_ptrhash(char *, int)
Definition: st.c:811
#define DD_BIGGY
Definition: cuddSat.c:82
#define DD_ONE(dd)
Definition: cuddInt.h:864
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_ShuffleHeap()

int Cudd_ShuffleHeap ( DdManager table,
int *  permutation 
)

Function********************************************************************

Synopsis [Reorders variables according to given permutation.]

Description [Reorders variables according to given permutation. The i-th entry of the permutation array contains the index of the variable that should be brought to the i-th level. The size of the array should be equal or greater to the number of variables currently in use. Returns 1 in case of success; 0 otherwise.]

SideEffects [Changes the variable order for all diagrams and clears the cache.]

SeeAlso [Cudd_ReduceHeap]

Definition at line 337 of file cuddReorder.c.

340 {
341 
342  int result;
343  int i;
344  int identity = 1;
345  int *perm;
346 
347  /* Don't waste time in case of identity permutation. */
348  for (i = 0; i < table->size; i++) {
349  if (permutation[i] != table->invperm[i]) {
350  identity = 0;
351  break;
352  }
353  }
354  if (identity == 1) {
355  return(1);
356  }
357  if (!ddReorderPreprocess(table)) return(0);
358  if (table->keys > table->peakLiveNodes) {
359  table->peakLiveNodes = table->keys;
360  }
361 
362  perm = ALLOC(int, table->size);
363  for (i = 0; i < table->size; i++)
364  perm[permutation[i]] = i;
365  if (!ddCheckPermuation(table,table->tree,perm,permutation)) {
366  FREE(perm);
367  return(0);
368  }
369  if (!ddUpdateMtrTree(table,table->tree,perm,permutation)) {
370  FREE(perm);
371  return(0);
372  }
373  FREE(perm);
374 
375  result = ddShuffle(table,permutation);
376 
377  if (!ddReorderPostprocess(table)) return(0);
378 
379  return(result);
380 
381 } /* end of Cudd_ShuffleHeap */
static int ddCheckPermuation(DdManager *table, MtrNode *treenode, int *perm, int *invperm)
Definition: cuddReorder.c:2102
unsigned int peakLiveNodes
Definition: cuddInt.h:445
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
MtrNode * tree
Definition: cuddInt.h:408
unsigned int keys
Definition: cuddInt.h:353
#define ALLOC(type, num)
Definition: util.h:76
static int ddReorderPostprocess(DdManager *table)
Definition: cuddReorder.c:1863
static int ddUpdateMtrTree(DdManager *table, MtrNode *treenode, int *perm, int *invperm)
Definition: cuddReorder.c:2043
static int ddReorderPreprocess(DdManager *table)
Definition: cuddReorder.c:1825
static int ddShuffle(DdManager *table, int *permutation)
Definition: cuddReorder.c:1896
int * invperm
Definition: cuddInt.h:371
static int result
Definition: cuddGenetic.c:121

◆ Cudd_SolveEqn()

DdNode* Cudd_SolveEqn ( DdManager bdd,
DdNode F,
DdNode Y,
DdNode **  G,
int **  yIndex,
int  n 
)

◆ Cudd_SplitSet()

DdNode* Cudd_SplitSet ( DdManager manager,
DdNode S,
DdNode **  xVars,
int  n,
double  m 
)

◆ Cudd_Srandom()

void Cudd_Srandom ( long  seed)

Function********************************************************************

Synopsis [Initializer for the portable random number generator.]

Description [Initializer for the portable number generator based on ran2 in "Numerical Recipes in C." The input is the seed for the generator. If it is negative, its absolute value is taken as seed. If it is 0, then 1 is taken as seed. The initialized sets up the two recurrences used to generate a long-period stream, and sets up the shuffle table.]

SideEffects [None]

SeeAlso [Cudd_Random]

Definition at line 2772 of file cuddUtil.c.

2774 {
2775  int i;
2776 
2777  if (seed < 0) cuddRand = -seed;
2778  else if (seed == 0) cuddRand = 1;
2779  else cuddRand = seed;
2780  cuddRand2 = cuddRand;
2781  /* Load the shuffle table (after 11 warm-ups). */
2782  for (i = 0; i < STAB_SIZE + 11; i++) {
2783  long int w;
2784  w = cuddRand / LEQQ1;
2785  cuddRand = LEQA1 * (cuddRand - w * LEQQ1) - w * LEQR1;
2786  cuddRand += (cuddRand < 0) * MODULUS1;
2788  }
2790 
2791 } /* end of Cudd_Srandom */
#define LEQQ1
Definition: cuddUtil.c:123
#define MODULUS1
Definition: cuddUtil.c:121
static long shuffleSelect
Definition: cuddUtil.c:153
static long shuffleTable[STAB_SIZE]
Definition: cuddUtil.c:154
static long cuddRand
Definition: cuddUtil.c:151
#define STAB_SIZE
Definition: cuddUtil.c:129
#define LEQR1
Definition: cuddUtil.c:124
static long cuddRand2
Definition: cuddUtil.c:152
#define LEQA1
Definition: cuddUtil.c:122

◆ Cudd_StdPostReordHook()

int Cudd_StdPostReordHook ( DdManager dd,
const char *  str,
void *  data 
)

Function********************************************************************

Synopsis [Sample hook function to call after reordering.]

Description [Sample hook function to call after reordering. Prints on the manager's stdout final size and reordering time. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_StdPreReordHook]

Definition at line 3826 of file cuddAPI.c.

3830 {
3831  unsigned long initialTime = (long) data;
3832  int retval;
3833  unsigned long finalTime = util_cpu_time();
3834  double totalTimeSec = (double)(finalTime - initialTime) / 1000.0;
3835 
3836  retval = fprintf(dd->out,"%ld nodes in %g sec\n", strcmp(str, "BDD") == 0 ?
3838  totalTimeSec);
3839  if (retval == EOF) return(0);
3840  retval = fflush(dd->out);
3841  if (retval == EOF) return(0);
3842  return(1);
3843 
3844 } /* end of Cudd_StdPostReordHook */
long Cudd_ReadNodeCount(DdManager *dd)
Definition: cuddAPI.c:3504
int strcmp()
FILE * out
Definition: cuddInt.h:423
long Cudd_zddReadNodeCount(DdManager *dd)
Definition: cuddAPI.c:3546
long util_cpu_time(void)
Definition: cpu_time.c:34

◆ Cudd_StdPreReordHook()

int Cudd_StdPreReordHook ( DdManager dd,
const char *  str,
void *  data 
)

Function********************************************************************

Synopsis [Sample hook function to call before reordering.]

Description [Sample hook function to call before reordering. Prints on the manager's stdout reordering method and initial size. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_StdPostReordHook]

Definition at line 3733 of file cuddAPI.c.

3737 {
3739  int retval;
3740 
3741  retval = fprintf(dd->out,"%s reordering with ", str);
3742  if (retval == EOF) return(0);
3743  switch (method) {
3751  retval = fprintf(dd->out,"converging ");
3752  if (retval == EOF) return(0);
3753  break;
3754  default:
3755  break;
3756  }
3757  switch (method) {
3758  case CUDD_REORDER_RANDOM:
3760  retval = fprintf(dd->out,"random");
3761  break;
3762  case CUDD_REORDER_SIFT:
3764  retval = fprintf(dd->out,"sifting");
3765  break;
3768  retval = fprintf(dd->out,"symmetric sifting");
3769  break;
3771  retval = fprintf(dd->out,"lazy sifting");
3772  break;
3775  retval = fprintf(dd->out,"group sifting");
3776  break;
3777  case CUDD_REORDER_WINDOW2:
3778  case CUDD_REORDER_WINDOW3:
3779  case CUDD_REORDER_WINDOW4:
3783  retval = fprintf(dd->out,"window");
3784  break;
3786  retval = fprintf(dd->out,"annealing");
3787  break;
3788  case CUDD_REORDER_GENETIC:
3789  retval = fprintf(dd->out,"genetic");
3790  break;
3791  case CUDD_REORDER_LINEAR:
3793  retval = fprintf(dd->out,"linear sifting");
3794  break;
3795  case CUDD_REORDER_EXACT:
3796  retval = fprintf(dd->out,"exact");
3797  break;
3798  default:
3799  return(0);
3800  }
3801  if (retval == EOF) return(0);
3802 
3803  retval = fprintf(dd->out,": from %ld to ... ", strcmp(str, "BDD") == 0 ?
3805  if (retval == EOF) return(0);
3806  fflush(dd->out);
3807  return(1);
3808 
3809 } /* end of Cudd_StdPreReordHook */
long Cudd_ReadNodeCount(DdManager *dd)
Definition: cuddAPI.c:3504
int strcmp()
FILE * out
Definition: cuddInt.h:423
long Cudd_zddReadNodeCount(DdManager *dd)
Definition: cuddAPI.c:3546
unsigned int ptruint
Definition: cuddInt.h:250
Cudd_ReorderingType
Definition: cudd.h:147

◆ Cudd_SubsetCompress()

DdNode* Cudd_SubsetCompress ( DdManager dd,
DdNode f,
int  nvars,
int  threshold 
)

◆ Cudd_SubsetHeavyBranch()

DdNode* Cudd_SubsetHeavyBranch ( DdManager dd,
DdNode f,
int  numVars,
int  threshold 
)

◆ Cudd_SubsetShortPaths()

DdNode* Cudd_SubsetShortPaths ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
int  hardlimit 
)

◆ Cudd_SubsetWithMaskVars()

DdNode* Cudd_SubsetWithMaskVars ( DdManager dd,
DdNode f,
DdNode **  vars,
int  nvars,
DdNode **  maskVars,
int  mvars 
)

Function********************************************************************

Synopsis [Extracts a subset from a BDD.]

Description [Extracts a subset from a BDD in the following procedure.

  1. Compute the weight for each mask variable by counting the number of minterms for both positive and negative cofactors of the BDD with respect to each mask variable. (weight = #positive - #negative)
  2. Find a representative cube of the BDD by using the weight. From the top variable of the BDD, for each variable, if the weight is greater than 0.0, choose THEN branch, othereise ELSE branch, until meeting the constant 1.
  3. Quantify out the variables not in maskVars from the representative cube and if a variable in maskVars is don't care, replace the variable with a constant(1 or 0) depending on the weight.
  4. Make a subset of the BDD by multiplying with the modified cube.]

SideEffects [None]

SeeAlso []

Definition at line 1610 of file cuddUtil.c.

1617 {
1618  double *weight;
1619  char *string;
1620  int i, size;
1621  int *indices, *mask;
1622  int result;
1623  DdNode *zero, *cube, *newCube, *subset;
1624  DdNode *cof;
1625 
1626  DdNode *support;
1627  support = Cudd_Support(dd,f);
1628  cuddRef(support);
1629  Cudd_RecursiveDeref(dd,support);
1630 
1631  zero = Cudd_Not(dd->one);
1632  size = dd->size;
1633 
1634  weight = ALLOC(double,size);
1635  if (weight == NULL) {
1636  dd->errorCode = CUDD_MEMORY_OUT;
1637  return(NULL);
1638  }
1639  for (i = 0; i < size; i++) {
1640  weight[i] = 0.0;
1641  }
1642  for (i = 0; i < mvars; i++) {
1643  cof = Cudd_Cofactor(dd, f, maskVars[i]);
1644  cuddRef(cof);
1645  weight[i] = Cudd_CountMinterm(dd, cof, nvars);
1646  Cudd_RecursiveDeref(dd,cof);
1647 
1648  cof = Cudd_Cofactor(dd, f, Cudd_Not(maskVars[i]));
1649  cuddRef(cof);
1650  weight[i] -= Cudd_CountMinterm(dd, cof, nvars);
1651  Cudd_RecursiveDeref(dd,cof);
1652  }
1653 
1654  string = ALLOC(char, size + 1);
1655  if (string == NULL) {
1656  dd->errorCode = CUDD_MEMORY_OUT;
1657  FREE(weight);
1658  return(NULL);
1659  }
1660  mask = ALLOC(int, size);
1661  if (mask == NULL) {
1662  dd->errorCode = CUDD_MEMORY_OUT;
1663  FREE(weight);
1664  FREE(string);
1665  return(NULL);
1666  }
1667  for (i = 0; i < size; i++) {
1668  string[i] = '2';
1669  mask[i] = 0;
1670  }
1671  string[size] = '\0';
1672  indices = ALLOC(int,nvars);
1673  if (indices == NULL) {
1674  dd->errorCode = CUDD_MEMORY_OUT;
1675  FREE(weight);
1676  FREE(string);
1677  FREE(mask);
1678  return(NULL);
1679  }
1680  for (i = 0; i < nvars; i++) {
1681  indices[i] = vars[i]->index;
1682  }
1683 
1684  result = ddPickRepresentativeCube(dd,f,weight,string);
1685  if (result == 0) {
1686  FREE(weight);
1687  FREE(string);
1688  FREE(mask);
1689  FREE(indices);
1690  return(NULL);
1691  }
1692 
1693  cube = Cudd_ReadOne(dd);
1694  cuddRef(cube);
1695  zero = Cudd_Not(Cudd_ReadOne(dd));
1696  for (i = 0; i < nvars; i++) {
1697  if (string[indices[i]] == '0') {
1698  newCube = Cudd_bddIte(dd,cube,Cudd_Not(vars[i]),zero);
1699  } else if (string[indices[i]] == '1') {
1700  newCube = Cudd_bddIte(dd,cube,vars[i],zero);
1701  } else
1702  continue;
1703  if (newCube == NULL) {
1704  FREE(weight);
1705  FREE(string);
1706  FREE(mask);
1707  FREE(indices);
1708  Cudd_RecursiveDeref(dd,cube);
1709  return(NULL);
1710  }
1711  cuddRef(newCube);
1712  Cudd_RecursiveDeref(dd,cube);
1713  cube = newCube;
1714  }
1715  Cudd_RecursiveDeref(dd,cube);
1716 
1717  for (i = 0; i < mvars; i++) {
1718  mask[maskVars[i]->index] = 1;
1719  }
1720  for (i = 0; i < nvars; i++) {
1721  if (mask[indices[i]]) {
1722  if (string[indices[i]] == '2') {
1723  if (weight[indices[i]] >= 0.0)
1724  string[indices[i]] = '1';
1725  else
1726  string[indices[i]] = '0';
1727  }
1728  } else {
1729  string[indices[i]] = '2';
1730  }
1731  }
1732 
1733  cube = Cudd_ReadOne(dd);
1734  cuddRef(cube);
1735  zero = Cudd_Not(Cudd_ReadOne(dd));
1736 
1737  /* Build result BDD. */
1738  for (i = 0; i < nvars; i++) {
1739  if (string[indices[i]] == '0') {
1740  newCube = Cudd_bddIte(dd,cube,Cudd_Not(vars[i]),zero);
1741  } else if (string[indices[i]] == '1') {
1742  newCube = Cudd_bddIte(dd,cube,vars[i],zero);
1743  } else
1744  continue;
1745  if (newCube == NULL) {
1746  FREE(weight);
1747  FREE(string);
1748  FREE(mask);
1749  FREE(indices);
1750  Cudd_RecursiveDeref(dd,cube);
1751  return(NULL);
1752  }
1753  cuddRef(newCube);
1754  Cudd_RecursiveDeref(dd,cube);
1755  cube = newCube;
1756  }
1757 
1758  subset = Cudd_bddAnd(dd,f,cube);
1759  cuddRef(subset);
1760  Cudd_RecursiveDeref(dd,cube);
1761 
1762  /* Test. */
1763  if (Cudd_bddLeq(dd,subset,f)) {
1764  cuddDeref(subset);
1765  } else {
1766  Cudd_RecursiveDeref(dd,subset);
1767  subset = NULL;
1768  }
1769 
1770  FREE(weight);
1771  FREE(string);
1772  FREE(mask);
1773  FREE(indices);
1774  return(subset);
1775 
1776 } /* end of Cudd_SubsetWithMaskVars */
#define cuddRef(n)
Definition: cuddInt.h:557
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
#define FREE(obj)
Definition: util.h:80
int size
Definition: cuddInt.h:345
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:142
static int ddPickRepresentativeCube(DdManager *dd, DdNode *node, double *weight, char *string)
Definition: cuddUtil.c:3865
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
Definition: cuddUtil.c:582
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:119
#define ALLOC(type, num)
Definition: util.h:76
static DdNode * zero
Definition: cuddUtil.c:149
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:1227
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:645
DdHalfWord index
Definition: cudd.h:271
DdNode * one
Definition: cuddInt.h:329
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
static int result
Definition: cuddGenetic.c:121
DdNode * Cudd_Support(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:789
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_SupersetCompress()

DdNode* Cudd_SupersetCompress ( DdManager dd,
DdNode f,
int  nvars,
int  threshold 
)

◆ Cudd_SupersetHeavyBranch()

DdNode* Cudd_SupersetHeavyBranch ( DdManager dd,
DdNode f,
int  numVars,
int  threshold 
)

◆ Cudd_SupersetShortPaths()

DdNode* Cudd_SupersetShortPaths ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
int  hardlimit 
)

◆ Cudd_Support()

DdNode* Cudd_Support ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Finds the variables on which a DD depends.]

Description [Finds the variables on which a DD depends. Returns a BDD consisting of the product of the variables if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_VectorSupport Cudd_ClassifySupport]

Definition at line 789 of file cuddUtil.c.

792 {
793  int *support;
794  DdNode *res;
795  int j;
796 
797  int size = Cudd_SupportIndices(dd, f, &support);
798  if (size == CUDD_OUT_OF_MEM)
799  return(NULL);
800 
801  /* Transform support from array of indices to cube. */
802  res = DD_ONE(dd);
803  cuddRef(res);
804 
805  for (j = size - 1; j >= 0; j--) { /* for each index bottom-up (almost) */
806  int index = support[j];
807  DdNode *var = dd->vars[index];
808  DdNode *tmp = Cudd_bddAnd(dd,res,var);
809  if (tmp == NULL) {
810  Cudd_RecursiveDeref(dd,res);
811  FREE(support);
812  return(NULL);
813  }
814  cuddRef(tmp);
815  Cudd_RecursiveDeref(dd,res);
816  res = tmp;
817  }
818 
819  FREE(support);
820  cuddDeref(res);
821  return(res);
822 
823 } /* end of Cudd_Support */
#define cuddRef(n)
Definition: cuddInt.h:557
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
#define cuddDeref(n)
Definition: cuddInt.h:577
int Cudd_SupportIndices(DdManager *dd, DdNode *f, int **indices)
Definition: cuddUtil.c:744
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define FREE(obj)
Definition: util.h:80
DdNode ** vars
Definition: cuddInt.h:373
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_SupportIndex()

int* Cudd_SupportIndex ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Finds the variables on which a DD depends.]

Description [Finds the variables on which a DD depends. Returns an index array of the variables if successful; NULL otherwise. The size of the array equals the number of variables in the manager. Each entry of the array is 1 if the corresponding variable is in the support of the DD and 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_Support Cudd_SupportIndices Cudd_ClassifySupport]

Definition at line 842 of file cuddUtil.c.

845 {
846  int *support;
847  int i;
848  int size;
849 
850  /* Allocate and initialize support array for ddSupportStep. */
851  size = ddMax(dd->size, dd->sizeZ);
852  support = ALLOC(int,size);
853  if (support == NULL) {
855  return(NULL);
856  }
857  for (i = 0; i < size; i++) {
858  support[i] = 0;
859  }
860 
861  /* Compute support and clean up markers. */
862  ddSupportStep(Cudd_Regular(f),support);
864 
865  return(support);
866 
867 } /* end of Cudd_SupportIndex */
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
#define ALLOC(type, num)
Definition: util.h:76
static void ddSupportStep(DdNode *f, int *support)
Definition: cuddUtil.c:3712
#define ddMax(x, y)
Definition: cuddInt.h:785
int sizeZ
Definition: cuddInt.h:346
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_SupportIndices()

int Cudd_SupportIndices ( DdManager dd,
DdNode f,
int **  indices 
)

Function********************************************************************

Synopsis [Finds the variables on which a DD depends.]

Description [Finds the variables on which a DD depends. Returns the number of variables if successful; CUDD_OUT_OF_MEM otherwise.]

SideEffects [The indices of the support variables are returned as side effects. If the function is constant, no array is allocated.]

SeeAlso [Cudd_Support Cudd_SupportIndex Cudd_VectorSupportIndices]

Definition at line 744 of file cuddUtil.c.

748 {
749  int SP = 0;
750 
751  ddFindSupport(dd, Cudd_Regular(f), &SP);
753  ddClearVars(dd, SP);
754  if (SP > 0) {
755  int i;
756  *indices = ALLOC(int, SP);
757  if (*indices == NULL) {
759  return(CUDD_OUT_OF_MEM);
760  }
761 
762  for (i = 0; i < SP; i++)
763  (*indices)[i] = (int) (ptrint) dd->stack[i];
764 
765  qsort(*indices, SP, sizeof(int), indexCompare);
766  } else {
767  *indices = NULL;
768  }
769 
770  return(SP);
771 
772 } /* end of Cudd_SupportIndices */
int ptrint
Definition: cuddInt.h:249
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
static void ddFindSupport(DdManager *dd, DdNode *f, int *SP)
Definition: cuddUtil.c:3957
#define Cudd_Regular(node)
Definition: cudd.h:384
DdNode ** stack
Definition: cuddInt.h:364
#define ALLOC(type, num)
Definition: util.h:76
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
static int indexCompare(const void *a, const void *b)
Definition: cuddUtil.c:4024
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
static void ddClearVars(DdManager *dd, int SP)
Definition: cuddUtil.c:3998

◆ Cudd_SupportSize()

int Cudd_SupportSize ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Counts the variables on which a DD depends.]

Description [Returns the variables on which a DD depends.]

SideEffects [None]

SeeAlso [Cudd_Support Cudd_SupportIndices]

Definition at line 882 of file cuddUtil.c.

885 {
886  int SP = 0;
887 
888  ddFindSupport(dd, Cudd_Regular(f), &SP);
890  ddClearVars(dd, SP);
891 
892  return(SP);
893 
894 } /* end of Cudd_SupportSize */
static void ddFindSupport(DdManager *dd, DdNode *f, int *SP)
Definition: cuddUtil.c:3957
#define Cudd_Regular(node)
Definition: cudd.h:384
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
static void ddClearVars(DdManager *dd, int SP)
Definition: cuddUtil.c:3998

◆ Cudd_SymmProfile()

void Cudd_SymmProfile ( DdManager table,
int  lower,
int  upper 
)

AutomaticEnd Function********************************************************************

Synopsis [Prints statistics on symmetric variables.]

Description []

SideEffects [None]

Definition at line 138 of file cuddSymmetry.c.

142 {
143  int i,x,gbot;
144  int TotalSymm = 0;
145  int TotalSymmGroups = 0;
146 
147  for (i = lower; i <= upper; i++) {
148  if (table->subtables[i].next != (unsigned) i) {
149  x = i;
150  (void) fprintf(table->out,"Group:");
151  do {
152  (void) fprintf(table->out," %d",table->invperm[x]);
153  TotalSymm++;
154  gbot = x;
155  x = table->subtables[x].next;
156  } while (x != i);
157  TotalSymmGroups++;
158 #ifdef DD_DEBUG
159  assert(table->subtables[gbot].next == (unsigned) i);
160 #endif
161  i = gbot;
162  (void) fprintf(table->out,"\n");
163  }
164  }
165  (void) fprintf(table->out,"Total Symmetric = %d\n",TotalSymm);
166  (void) fprintf(table->out,"Total Groups = %d\n",TotalSymmGroups);
167 
168 } /* end of Cudd_SymmProfile */
#define assert(ex)
Definition: util.h:141
DdSubtable * subtables
Definition: cuddInt.h:349
FILE * out
Definition: cuddInt.h:423
unsigned int next
Definition: cuddInt.h:317
int * invperm
Definition: cuddInt.h:371

◆ Cudd_TimeLimited()

int Cudd_TimeLimited ( DdManager unique)

Function********************************************************************

Synopsis [Returns true if the time limit for the manager is set.]

Description [Returns true if the time limit for the manager is set.]

SideEffects [None]

SeeAlso [Cudd_ReadTimeLimit Cudd_SetTimeLimit Cudd_UpdateTimeLimit Cudd_UnsetTimeLimit Cudd_IncreaseTimeLimit]

Definition at line 885 of file cuddAPI.c.

887 {
888  return unique->timeLimit != ~0UL;
889 
890 } /* end of Cudd_TimeLimited */
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_tlcInfoFree()

void Cudd_tlcInfoFree ( DdTlcInfo t)

◆ Cudd_TurnOffCountDead()

void Cudd_TurnOffCountDead ( DdManager dd)

Function********************************************************************

Synopsis [Causes the dead nodes not to be counted towards triggering reordering.]

Description [Causes the dead nodes not to be counted towards triggering reordering. This causes less frequent reorderings. By default dead nodes are not counted. Therefore there is no need to call this function unless Cudd_TurnOnCountDead has been previously called.]

SideEffects [Changes the manager.]

SeeAlso [Cudd_TurnOnCountDead Cudd_DeadAreCounted]

Definition at line 2915 of file cuddAPI.c.

2917 {
2918  dd->countDead = ~0;
2919 
2920 } /* end of Cudd_TurnOffCountDead */
unsigned int countDead
Definition: cuddInt.h:407

◆ Cudd_TurnOnCountDead()

void Cudd_TurnOnCountDead ( DdManager dd)

Function********************************************************************

Synopsis [Causes the dead nodes to be counted towards triggering reordering.]

Description [Causes the dead nodes to be counted towards triggering reordering. This causes more frequent reorderings. By default dead nodes are not counted.]

SideEffects [Changes the manager.]

SeeAlso [Cudd_TurnOffCountDead Cudd_DeadAreCounted]

Definition at line 2890 of file cuddAPI.c.

2892 {
2893  dd->countDead = 0;
2894 
2895 } /* end of Cudd_TurnOnCountDead */
unsigned int countDead
Definition: cuddInt.h:407

◆ Cudd_UnderApprox()

DdNode* Cudd_UnderApprox ( DdManager dd,
DdNode f,
int  numVars,
int  threshold,
int  safe,
double  quality 
)

◆ Cudd_UnsetTimeLimit()

void Cudd_UnsetTimeLimit ( DdManager unique)

Function********************************************************************

Synopsis [Unsets the time limit for the manager.]

Description [Unsets the time limit for the manager. Actually, sets it to a very large value.]

SideEffects [None]

SeeAlso [Cudd_ReadTimeLimit Cudd_SetTimeLimit Cudd_UpdateTimeLimit Cudd_IncreaseTimeLimit Cudd_TimeLimited Cudd_SetStartTime]

Definition at line 864 of file cuddAPI.c.

866 {
867  unique->timeLimit = ~0UL;
868 
869 } /* end of Cudd_UnsetTimeLimit */
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_UpdateTimeLimit()

void Cudd_UpdateTimeLimit ( DdManager unique)

Function********************************************************************

Synopsis [Updates the time limit for the manager.]

Description [Updates the time limit for the manager by subtracting the elapsed time from it.]

SideEffects [None]

SeeAlso [Cudd_ReadTimeLimit Cudd_SetTimeLimit Cudd_UnsetTimeLimit Cudd_IncreaseTimeLimit Cudd_TimeLimited Cudd_SetStartTime]

Definition at line 809 of file cuddAPI.c.

811 {
812  unsigned long elapsed;
813  if (unique->timeLimit == ~0UL)
814  return;
815  elapsed = util_cpu_time() - unique->startTime;
816  if (unique->timeLimit >= elapsed) {
817  unique->timeLimit -= elapsed;
818  } else {
819  unique->timeLimit = 0;
820  }
821 
822 } /* end of Cudd_UpdateTimeLimit */
unsigned long startTime
Definition: cuddInt.h:426
long util_cpu_time(void)
Definition: cpu_time.c:34
unsigned long timeLimit
Definition: cuddInt.h:427

◆ Cudd_VectorSupport()

DdNode* Cudd_VectorSupport ( DdManager dd,
DdNode **  F,
int  n 
)

Function********************************************************************

Synopsis [Finds the variables on which a set of DDs depends.]

Description [Finds the variables on which a set of DDs depends. The set must contain either BDDs and ADDs, or ZDDs. Returns a BDD consisting of the product of the variables if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_Support Cudd_ClassifySupport]

Definition at line 966 of file cuddUtil.c.

970 {
971  int *support;
972  DdNode *res;
973  int j;
974  int size = Cudd_VectorSupportIndices(dd, F, n, &support);
975  if (size == CUDD_OUT_OF_MEM)
976  return(NULL);
977 
978  /* Transform support from array of indices to cube. */
979  res = DD_ONE(dd);
980  cuddRef(res);
981 
982  for (j = size - 1; j >= 0; j--) { /* for each index bottom-up (almost) */
983  int index = support[j];
984  DdNode *var = dd->vars[index];
985  DdNode *tmp = Cudd_bddAnd(dd,res,var);
986  if (tmp == NULL) {
987  Cudd_RecursiveDeref(dd,res);
988  FREE(support);
989  return(NULL);
990  }
991  cuddRef(tmp);
992  Cudd_RecursiveDeref(dd,res);
993  res = tmp;
994  }
995 
996  FREE(support);
997  cuddDeref(res);
998  return(res);
999 
1000 } /* end of Cudd_VectorSupport */
#define cuddRef(n)
Definition: cuddInt.h:557
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
#define cuddDeref(n)
Definition: cuddInt.h:577
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define FREE(obj)
Definition: util.h:80
int Cudd_VectorSupportIndices(DdManager *dd, DdNode **F, int n, int **indices)
Definition: cuddUtil.c:912
DdNode ** vars
Definition: cuddInt.h:373
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:350
#define DD_ONE(dd)
Definition: cuddInt.h:864

◆ Cudd_VectorSupportIndex()

int* Cudd_VectorSupportIndex ( DdManager dd,
DdNode **  F,
int  n 
)

Function********************************************************************

Synopsis [Finds the variables on which a set of DDs depends.]

Description [Finds the variables on which a set of DDs depends. The set must contain either BDDs and ADDs, or ZDDs. Returns an index array of the variables if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_SupportIndex Cudd_VectorSupport Cudd_VectorSupportIndices]

Definition at line 1017 of file cuddUtil.c.

1021 {
1022  int *support;
1023  int i;
1024  int size;
1025 
1026  /* Allocate and initialize support array for ddSupportStep. */
1027  size = ddMax(dd->size, dd->sizeZ);
1028  support = ALLOC(int,size);
1029  if (support == NULL) {
1030  dd->errorCode = CUDD_MEMORY_OUT;
1031  return(NULL);
1032  }
1033  for (i = 0; i < size; i++) {
1034  support[i] = 0;
1035  }
1036 
1037  /* Compute support and clean up markers. */
1038  for (i = 0; i < n; i++) {
1039  ddSupportStep(Cudd_Regular(F[i]),support);
1040  }
1041  for (i = 0; i < n; i++) {
1042  ddClearFlag(Cudd_Regular(F[i]));
1043  }
1044 
1045  return(support);
1046 
1047 } /* end of Cudd_VectorSupportIndex */
int size
Definition: cuddInt.h:345
#define Cudd_Regular(node)
Definition: cudd.h:384
#define ALLOC(type, num)
Definition: util.h:76
static void ddSupportStep(DdNode *f, int *support)
Definition: cuddUtil.c:3712
#define ddMax(x, y)
Definition: cuddInt.h:785
int sizeZ
Definition: cuddInt.h:346
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
Cudd_ErrorType errorCode
Definition: cuddInt.h:425

◆ Cudd_VectorSupportIndices()

int Cudd_VectorSupportIndices ( DdManager dd,
DdNode **  F,
int  n,
int **  indices 
)

Function********************************************************************

Synopsis [Finds the variables on which a set of DDs depends.]

Description [Finds the variables on which a set of DDs depends. The set must contain either BDDs and ADDs, or ZDDs. Returns the number of variables if successful; CUDD_OUT_OF_MEM otherwise.]

SideEffects [The indices of the support variables are returned as side effects. If the function is constant, no array is allocated.]

SeeAlso [Cudd_Support Cudd_SupportIndex Cudd_VectorSupportIndices]

Definition at line 912 of file cuddUtil.c.

917 {
918  int i;
919  int SP = 0;
920 
921  /* Compute support and clean up markers. */
922  for (i = 0; i < n; i++) {
923  ddFindSupport(dd, Cudd_Regular(F[i]), &SP);
924  }
925  for (i = 0; i < n; i++) {
926  ddClearFlag(Cudd_Regular(F[i]));
927  }
928  ddClearVars(dd, SP);
929 
930  if (SP > 0) {
931  int i;
932  *indices = ALLOC(int, SP);
933  if (*indices == NULL) {
935  return(CUDD_OUT_OF_MEM);
936  }
937 
938  for (i = 0; i < SP; i++)
939  (*indices)[i] = (int) (ptrint) dd->stack[i];
940 
941  qsort(*indices, SP, sizeof(int), indexCompare);
942  } else {
943  *indices = NULL;
944  }
945 
946  return(SP);
947 
948 } /* end of Cudd_VectorSupportIndices */
int ptrint
Definition: cuddInt.h:249
#define CUDD_OUT_OF_MEM
Definition: cudd.h:91
static void ddFindSupport(DdManager *dd, DdNode *f, int *SP)
Definition: cuddUtil.c:3957
#define Cudd_Regular(node)
Definition: cudd.h:384
DdNode ** stack
Definition: cuddInt.h:364
#define ALLOC(type, num)
Definition: util.h:76
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
static int indexCompare(const void *a, const void *b)
Definition: cuddUtil.c:4024
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
static void ddClearVars(DdManager *dd, int SP)
Definition: cuddUtil.c:3998

◆ Cudd_VectorSupportSize()

int Cudd_VectorSupportSize ( DdManager dd,
DdNode **  F,
int  n 
)

Function********************************************************************

Synopsis [Counts the variables on which a set of DDs depends.]

Description [Returns the variables on which a set of DDs depends. The set must contain either BDDs and ADDs, or ZDDs.]

SideEffects [None]

SeeAlso [Cudd_VectorSupport Cudd_SupportSize]

Definition at line 1063 of file cuddUtil.c.

1067 {
1068  int i;
1069  int SP = 0;
1070 
1071  /* Compute support and clean up markers. */
1072  for (i = 0; i < n; i++) {
1073  ddFindSupport(dd, Cudd_Regular(F[i]), &SP);
1074  }
1075  for (i = 0; i < n; i++) {
1076  ddClearFlag(Cudd_Regular(F[i]));
1077  }
1078  ddClearVars(dd, SP);
1079 
1080  return(SP);
1081 
1082 } /* end of Cudd_VectorSupportSize */
static void ddFindSupport(DdManager *dd, DdNode *f, int *SP)
Definition: cuddUtil.c:3957
#define Cudd_Regular(node)
Definition: cudd.h:384
static void ddClearFlag(DdNode *f)
Definition: cuddUtil.c:3741
static void ddClearVars(DdManager *dd, int SP)
Definition: cuddUtil.c:3998

◆ Cudd_VerifySol()

DdNode* Cudd_VerifySol ( DdManager bdd,
DdNode F,
DdNode **  G,
int *  yIndex,
int  n 
)

◆ Cudd_Xeqy()

DdNode* Cudd_Xeqy ( DdManager dd,
int  N,
DdNode **  x,
DdNode **  y 
)

◆ Cudd_Xgty()

DdNode* Cudd_Xgty ( DdManager dd,
int  N,
DdNode **  z,
DdNode **  x,
DdNode **  y 
)

◆ Cudd_zddChange()

DdNode* Cudd_zddChange ( DdManager dd,
DdNode P,
int  var 
)

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.]

SideEffects [None]

SeeAlso []

Definition at line 388 of file cuddZddSetop.c.

392 {
393  DdNode *res;
394 
395  if ((unsigned int) var >= CUDD_MAXINDEX - 1) return(NULL);
396 
397  do {
398  dd->reordered = 0;
399  res = cuddZddChange(dd, P, var);
400  } while (dd->reordered == 1);
401  return(res);
402 
403 } /* end of Cudd_zddChange */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddChange(DdManager *dd, DdNode *P, int var)
Definition: cuddZddSetop.c:967
#define CUDD_MAXINDEX
Definition: cudd.h:108

◆ Cudd_zddComplement()

DdNode* Cudd_zddComplement ( DdManager dd,
DdNode node 
)

Function********************************************************************

Synopsis [Computes a complement cover for a ZDD node.]

Description [Computes a complement cover for a ZDD node. For lack of a better method, we first extract the function BDD from the ZDD cover, then make the complement of the ZDD cover from the complement of the BDD node by using ISOP. Returns a pointer to the resulting cover if successful; NULL otherwise. The result depends on current variable order.]

SideEffects [The result depends on current variable order.]

SeeAlso []

Definition at line 328 of file cuddZddFuncs.c.

331 {
332  DdNode *b, *isop, *zdd_I;
333 
334  /* Check cache */
335  zdd_I = cuddCacheLookup1Zdd(dd, cuddZddComplement, node);
336  if (zdd_I)
337  return(zdd_I);
338 
339  b = Cudd_MakeBddFromZddCover(dd, node);
340  if (!b)
341  return(NULL);
342  Cudd_Ref(b);
343  isop = Cudd_zddIsop(dd, Cudd_Not(b), Cudd_Not(b), &zdd_I);
344  if (!isop) {
345  Cudd_RecursiveDeref(dd, b);
346  return(NULL);
347  }
348  Cudd_Ref(isop);
349  Cudd_Ref(zdd_I);
350  Cudd_RecursiveDeref(dd, b);
351  Cudd_RecursiveDeref(dd, isop);
352 
353  cuddCacheInsert1(dd, cuddZddComplement, node, zdd_I);
354  Cudd_Deref(zdd_I);
355  return(zdd_I);
356 } /* end of Cudd_zddComplement */
DdNode * cuddCacheLookup1Zdd(DdManager *table, DdNode *(*)(DdManager *, DdNode *), DdNode *f)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:150
Definition: cudd.h:270
#define Cudd_Not(node)
Definition: cudd.h:354
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:434
void cuddCacheInsert1(DdManager *table, DdNode *(*)(DdManager *, DdNode *), DdNode *f, DdNode *data)
DdNode * Cudd_MakeBddFromZddCover(DdManager *dd, DdNode *node)
Definition: cuddZddIsop.c:200
DdNode * Cudd_zddIsop(DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I)
Definition: cuddZddIsop.c:132
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:125
DdNode * cuddZddComplement(DdManager *dd, DdNode *node)

◆ Cudd_zddCount()

int Cudd_zddCount ( DdManager zdd,
DdNode P 
)

◆ Cudd_zddCountDouble()

double Cudd_zddCountDouble ( DdManager zdd,
DdNode P 
)

◆ Cudd_zddCountMinterm()

double Cudd_zddCountMinterm ( DdManager zdd,
DdNode node,
int  path 
)

◆ Cudd_zddCoverPathToString()

char* Cudd_zddCoverPathToString ( DdManager zdd,
int *  path,
char *  str 
)

◆ Cudd_zddDagSize()

int Cudd_zddDagSize ( DdNode p_node)

◆ Cudd_zddDiff()

DdNode* Cudd_zddDiff ( DdManager dd,
DdNode P,
DdNode Q 
)

Function********************************************************************

Synopsis [Computes the difference of two ZDDs.]

Description [Computes the difference of two ZDDs. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddDiffConst]

Definition at line 232 of file cuddZddSetop.c.

236 {
237  DdNode *res;
238 
239  do {
240  dd->reordered = 0;
241  res = cuddZddDiff(dd, P, Q);
242  } while (dd->reordered == 1);
243  return(res);
244 
245 } /* end of Cudd_zddDiff */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddDiff(DdManager *zdd, DdNode *P, DdNode *Q)
Definition: cuddZddSetop.c:713

◆ Cudd_zddDiffConst()

DdNode* Cudd_zddDiffConst ( DdManager zdd,
DdNode P,
DdNode Q 
)

Function********************************************************************

Synopsis [Performs the inclusion test for ZDDs (P implies Q).]

Description [Inclusion test for ZDDs (P implies Q). No new nodes are generated by this procedure. Returns empty if true; a valid pointer different from empty or DD_NON_CONSTANT otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddDiff]

Definition at line 262 of file cuddZddSetop.c.

266 {
267  int p_top, q_top;
268  DdNode *empty = DD_ZERO(zdd), *t, *res;
269  DdManager *table = zdd;
270 
271  statLine(zdd);
272  if (P == empty)
273  return(empty);
274  if (Q == empty)
275  return(P);
276  if (P == Q)
277  return(empty);
278 
279  /* Check cache. The cache is shared by cuddZddDiff(). */
280  res = cuddCacheLookup2Zdd(table, cuddZddDiff, P, Q);
281  if (res != NULL)
282  return(res);
283 
284  if (cuddIsConstant(P))
285  p_top = P->index;
286  else
287  p_top = zdd->permZ[P->index];
288  if (cuddIsConstant(Q))
289  q_top = Q->index;
290  else
291  q_top = zdd->permZ[Q->index];
292  if (p_top < q_top) {
293  res = DD_NON_CONSTANT;
294  } else if (p_top > q_top) {
295  res = Cudd_zddDiffConst(zdd, P, cuddE(Q));
296  } else {
297  t = Cudd_zddDiffConst(zdd, cuddT(P), cuddT(Q));
298  if (t != empty)
299  res = DD_NON_CONSTANT;
300  else
301  res = Cudd_zddDiffConst(zdd, cuddE(P), cuddE(Q));
302  }
303 
304  cuddCacheInsert2(table, cuddZddDiff, P, Q, res);
305 
306  return(res);
307 
308 } /* end of Cudd_zddDiffConst */
Definition: cudd.h:270
int * permZ
Definition: cuddInt.h:370
#define statLine(dd)
Definition: cuddInt.h:990
#define cuddIsConstant(node)
Definition: cuddInt.h:593
#define cuddT(node)
Definition: cuddInt.h:609
DdNode * Cudd_zddDiffConst(DdManager *zdd, DdNode *P, DdNode *Q)
Definition: cuddZddSetop.c:262
DdNode * cuddCacheLookup2Zdd(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g)
DdNode * cuddZddDiff(DdManager *zdd, DdNode *P, DdNode *Q)
Definition: cuddZddSetop.c:713
void cuddCacheInsert2(DdManager *table, DdNode *(*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data)
DdHalfWord index
Definition: cudd.h:271
#define cuddE(node)
Definition: cuddInt.h:625
static DdNode * empty
Definition: cuddZddLin.c:94
#define DD_NON_CONSTANT
Definition: cuddInt.h:124
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_zddDivide()

DdNode* Cudd_zddDivide ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Computes the quotient of two unate covers.]

Description [Computes the quotient of two unate covers represented by ZDDs. Unate covers use one ZDD variable for each BDD variable. Returns a pointer to the resulting ZDD if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddWeakDiv]

Definition at line 237 of file cuddZddFuncs.c.

241 {
242  DdNode *res;
243 
244  do {
245  dd->reordered = 0;
246  res = cuddZddDivide(dd, f, g);
247  } while (dd->reordered == 1);
248  return(res);
249 
250 } /* end of Cudd_zddDivide */
DdNode * cuddZddDivide(DdManager *dd, DdNode *f, DdNode *g)
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddDivideF()

DdNode* Cudd_zddDivideF ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Modified version of Cudd_zddDivide.]

Description [Modified version of Cudd_zddDivide. This function may disappear in future releases.]

SideEffects [None]

SeeAlso []

Definition at line 295 of file cuddZddFuncs.c.

299 {
300  DdNode *res;
301 
302  do {
303  dd->reordered = 0;
304  res = cuddZddDivideF(dd, f, g);
305  } while (dd->reordered == 1);
306  return(res);
307 
308 } /* end of Cudd_zddDivideF */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddDivideF(DdManager *dd, DdNode *f, DdNode *g)

◆ Cudd_zddDumpDot()

int Cudd_zddDumpDot ( DdManager dd,
int  n,
DdNode **  f,
char **  inames,
char **  onames,
FILE *  fp 
)

◆ Cudd_zddFirstPath()

DdGen* Cudd_zddFirstPath ( DdManager zdd,
DdNode f,
int **  path 
)

◆ Cudd_zddIntersect()

DdNode* Cudd_zddIntersect ( DdManager dd,
DdNode P,
DdNode Q 
)

Function********************************************************************

Synopsis [Computes the intersection of two ZDDs.]

Description [Computes the intersection of two ZDDs. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 203 of file cuddZddSetop.c.

207 {
208  DdNode *res;
209 
210  do {
211  dd->reordered = 0;
212  res = cuddZddIntersect(dd, P, Q);
213  } while (dd->reordered == 1);
214  return(res);
215 
216 } /* end of Cudd_zddIntersect */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddIntersect(DdManager *zdd, DdNode *P, DdNode *Q)
Definition: cuddZddSetop.c:638

◆ Cudd_zddIsop()

DdNode* Cudd_zddIsop ( DdManager dd,
DdNode L,
DdNode U,
DdNode **  zdd_I 
)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Computes an ISOP in ZDD form from BDDs.]

Description [Computes an irredundant sum of products (ISOP) in ZDD form from BDDs. The two BDDs L and U represent the lower bound and the upper bound, respectively, of the function. The ISOP uses two ZDD variables for each BDD variable: One for the positive literal, and one for the negative literal. These two variables should be adjacent in the ZDD order. The two ZDD variables corresponding to BDD variable i should have indices 2i and 2i+1. The result of this procedure depends on the variable order. If successful, Cudd_zddIsop returns the BDD for the function chosen from the interval. The ZDD representing the irredundant cover is returned as a side effect in zdd_I. In case of failure, NULL is returned.]

SideEffects [zdd_I holds the pointer to the ZDD for the ISOP on successful return.]

SeeAlso [Cudd_bddIsop Cudd_zddVarsFromBddVars]

Definition at line 132 of file cuddZddIsop.c.

137 {
138  DdNode *res;
139  int autoDynZ;
140 
141  autoDynZ = dd->autoDynZ;
142  dd->autoDynZ = 0;
143 
144  do {
145  dd->reordered = 0;
146  res = cuddZddIsop(dd, L, U, zdd_I);
147  } while (dd->reordered == 1);
148  dd->autoDynZ = autoDynZ;
149  return(res);
150 
151 } /* end of Cudd_zddIsop */
Definition: cudd.h:270
DdNode * cuddZddIsop(DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I)
Definition: cuddZddIsop.c:231
int reordered
Definition: cuddInt.h:392
int autoDynZ
Definition: cuddInt.h:401

◆ Cudd_zddIte()

DdNode* Cudd_zddIte ( DdManager dd,
DdNode f,
DdNode g,
DdNode h 
)

AutomaticEnd Function********************************************************************

Synopsis [Computes the ITE of three ZDDs.]

Description [Computes the ITE of three ZDDs. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 144 of file cuddZddSetop.c.

149 {
150  DdNode *res;
151 
152  do {
153  dd->reordered = 0;
154  res = cuddZddIte(dd, f, g, h);
155  } while (dd->reordered == 1);
156  return(res);
157 
158 } /* end of Cudd_zddIte */
DdNode * cuddZddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddZddSetop.c:423
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddIthVar()

DdNode* Cudd_zddIthVar ( DdManager dd,
int  i 
)

Function********************************************************************

Synopsis [Returns the ZDD variable with index i.]

Description [Retrieves the ZDD variable with index i if it already exists, or creates a new ZDD variable. Returns a pointer to the variable if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddIthVar Cudd_addIthVar]

Definition at line 462 of file cuddAPI.c.

465 {
466  DdNode *res;
467  DdNode *zvar;
468  DdNode *lower;
469  int j;
470 
471  if ((unsigned int) i >= CUDD_MAXINDEX - 1) return(NULL);
472 
473  /* The i-th variable function has the following structure:
474  ** at the level corresponding to index i there is a node whose "then"
475  ** child points to the universe, and whose "else" child points to zero.
476  ** Above that level there are nodes with identical children.
477  */
478 
479  /* First we build the node at the level of index i. */
480  lower = (i < dd->sizeZ - 1) ? dd->univ[dd->permZ[i]+1] : DD_ONE(dd);
481  do {
482  dd->reordered = 0;
483  zvar = cuddUniqueInterZdd(dd, i, lower, DD_ZERO(dd));
484  } while (dd->reordered == 1);
485 
486  if (zvar == NULL)
487  return(NULL);
488  cuddRef(zvar);
489 
490  /* Now we add the "filler" nodes above the level of index i. */
491  for (j = dd->permZ[i] - 1; j >= 0; j--) {
492  do {
493  dd->reordered = 0;
494  res = cuddUniqueInterZdd(dd, dd->invpermZ[j], zvar, zvar);
495  } while (dd->reordered == 1);
496  if (res == NULL) {
497  Cudd_RecursiveDerefZdd(dd,zvar);
498  return(NULL);
499  }
500  cuddRef(res);
501  Cudd_RecursiveDerefZdd(dd,zvar);
502  zvar = res;
503  }
504  cuddDeref(zvar);
505  return(zvar);
506 
507 } /* end of Cudd_zddIthVar */
#define cuddRef(n)
Definition: cuddInt.h:557
void Cudd_RecursiveDerefZdd(DdManager *table, DdNode *n)
Definition: cuddRef.c:381
#define cuddDeref(n)
Definition: cuddInt.h:577
Definition: cudd.h:270
int * invpermZ
Definition: cuddInt.h:372
int * permZ
Definition: cuddInt.h:370
int reordered
Definition: cuddInt.h:392
DdNode * cuddUniqueInterZdd(DdManager *unique, int index, DdNode *T, DdNode *E)
Definition: cuddTable.c:1372
int sizeZ
Definition: cuddInt.h:346
#define CUDD_MAXINDEX
Definition: cudd.h:108
#define DD_ONE(dd)
Definition: cuddInt.h:864
DdNode ** univ
Definition: cuddInt.h:375
#define DD_ZERO(dd)
Definition: cuddInt.h:880

◆ Cudd_zddNextPath()

int Cudd_zddNextPath ( DdGen gen,
int **  path 
)

◆ Cudd_zddPortFromBdd()

DdNode* Cudd_zddPortFromBdd ( DdManager dd,
DdNode B 
)

◆ Cudd_zddPortToBdd()

DdNode* Cudd_zddPortToBdd ( DdManager dd,
DdNode f 
)

◆ Cudd_zddPrintCover()

int Cudd_zddPrintCover ( DdManager zdd,
DdNode node 
)

◆ Cudd_zddPrintDebug()

int Cudd_zddPrintDebug ( DdManager zdd,
DdNode f,
int  n,
int  pr 
)

◆ Cudd_zddPrintMinterm()

int Cudd_zddPrintMinterm ( DdManager zdd,
DdNode node 
)

◆ Cudd_zddPrintSubtable()

void Cudd_zddPrintSubtable ( DdManager table)

◆ Cudd_zddProduct()

DdNode* Cudd_zddProduct ( DdManager dd,
DdNode f,
DdNode g 
)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Computes the product of two covers represented by ZDDs.]

Description [Computes the product of two covers represented by ZDDs. The result is also a ZDD. Returns a pointer to the result if successful; NULL otherwise. The covers on which Cudd_zddProduct operates use two ZDD variables for each function variable (one ZDD variable for each literal of the variable). Those two ZDD variables should be adjacent in the order.]

SideEffects [None]

SeeAlso [Cudd_zddUnateProduct]

Definition at line 141 of file cuddZddFuncs.c.

145 {
146  DdNode *res;
147 
148  do {
149  dd->reordered = 0;
150  res = cuddZddProduct(dd, f, g);
151  } while (dd->reordered == 1);
152  return(res);
153 
154 } /* end of Cudd_zddProduct */
Definition: cudd.h:270
DdNode * cuddZddProduct(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddZddFuncs.c:376
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddReadNodeCount()

long Cudd_zddReadNodeCount ( DdManager dd)

Function********************************************************************

Synopsis [Reports the number of nodes in ZDDs.]

Description [Reports the number of nodes in ZDDs. This number always includes the two constants 1 and 0.]

SideEffects [None]

SeeAlso [Cudd_ReadPeakNodeCount Cudd_ReadNodeCount]

Definition at line 3546 of file cuddAPI.c.

3548 {
3549  return((long)(dd->keysZ - dd->deadZ + 2));
3550 
3551 } /* end of Cudd_zddReadNodeCount */
unsigned int deadZ
Definition: cuddInt.h:356
unsigned int keysZ
Definition: cuddInt.h:354

◆ Cudd_zddRealignDisable()

void Cudd_zddRealignDisable ( DdManager unique)

Function********************************************************************

Synopsis [Disables realignment of ZDD order to BDD order.]

Description []

SideEffects [None]

SeeAlso [Cudd_zddRealignEnable Cudd_zddRealignmentEnabled Cudd_bddRealignEnable Cudd_bddRealignmentEnabled]

Definition at line 1129 of file cuddAPI.c.

1131 {
1132  unique->realign = 0;
1133  return;
1134 
1135 } /* end of Cudd_zddRealignDisable */
int realign
Definition: cuddInt.h:404

◆ Cudd_zddRealignEnable()

void Cudd_zddRealignEnable ( DdManager unique)

Function********************************************************************

Synopsis [Enables realignment of ZDD order to BDD order.]

Description [Enables realignment of the ZDD variable order to the BDD variable order after the BDDs and ADDs have been reordered. The number of ZDD variables must be a multiple of the number of BDD variables for realignment to make sense. If this condition is not met, Cudd_ReduceHeap will return 0. Let M be the ratio of the two numbers. For the purpose of realignment, the ZDD variables from M*i to (M+1)*i-1 are reagarded as corresponding to BDD variable i. Realignment is initially disabled.]

SideEffects [None]

SeeAlso [Cudd_ReduceHeap Cudd_zddRealignDisable Cudd_zddRealignmentEnabled Cudd_bddRealignDisable Cudd_bddRealignmentEnabled]

Definition at line 1107 of file cuddAPI.c.

1109 {
1110  unique->realign = 1;
1111  return;
1112 
1113 } /* end of Cudd_zddRealignEnable */
int realign
Definition: cuddInt.h:404

◆ Cudd_zddRealignmentEnabled()

int Cudd_zddRealignmentEnabled ( DdManager unique)

Function********************************************************************

Synopsis [Tells whether the realignment of ZDD order to BDD order is enabled.]

Description [Returns 1 if the realignment of ZDD order to BDD order is enabled; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddRealignEnable Cudd_zddRealignDisable Cudd_bddRealignEnable Cudd_bddRealignDisable]

Definition at line 1077 of file cuddAPI.c.

1079 {
1080  return(unique->realign);
1081 
1082 } /* end of Cudd_zddRealignmentEnabled */
int realign
Definition: cuddInt.h:404

◆ Cudd_zddReduceHeap()

int Cudd_zddReduceHeap ( DdManager table,
Cudd_ReorderingType  heuristic,
int  minsize 
)

AutomaticEnd Function********************************************************************

Synopsis [Main dynamic reordering routine for ZDDs.]

Description [Main dynamic reordering routine for ZDDs. Calls one of the possible reordering procedures:

  • Swapping
  • Sifting
  • Symmetric Sifting

For sifting and symmetric sifting it is possible to request reordering to convergence.

The core of all methods is the reordering procedure cuddZddSwapInPlace() which swaps two adjacent variables. Returns 1 in case of success; 0 otherwise. In the case of symmetric sifting (with and without convergence) returns 1 plus the number of symmetric variables, in case of success.]

SideEffects [Changes the variable order for all ZDDs and clears the cache.]

Definition at line 167 of file cuddZddReord.c.

171 {
172  DdHook *hook;
173  int result;
174  unsigned int nextDyn;
175 #ifdef DD_STATS
176  unsigned int initialSize;
177  unsigned int finalSize;
178 #endif
179  unsigned long localTime;
180 
181  /* Don't reorder if there are too many dead nodes. */
182  if (table->keysZ - table->deadZ < (unsigned) minsize)
183  return(1);
184 
185  if (heuristic == CUDD_REORDER_SAME) {
186  heuristic = table->autoMethodZ;
187  }
188  if (heuristic == CUDD_REORDER_NONE) {
189  return(1);
190  }
191 
192  /* This call to Cudd_zddReduceHeap does initiate reordering. Therefore
193  ** we count it.
194  */
195  table->reorderings++;
196  empty = table->zero;
197 
198  localTime = util_cpu_time();
199 
200  /* Run the hook functions. */
201  hook = table->preReorderingHook;
202  while (hook != NULL) {
203  int res = (hook->f)(table, "ZDD", (void *)heuristic);
204  if (res == 0) return(0);
205  hook = hook->next;
206  }
207 
208  /* Clear the cache and collect garbage. */
209  zddReorderPreprocess(table);
211 
212 #ifdef DD_STATS
213  initialSize = table->keysZ;
214 
215  switch(heuristic) {
216  case CUDD_REORDER_RANDOM:
218  (void) fprintf(table->out,"#:I_RANDOM ");
219  break;
220  case CUDD_REORDER_SIFT:
224  (void) fprintf(table->out,"#:I_SIFTING ");
225  break;
226  case CUDD_REORDER_LINEAR:
228  (void) fprintf(table->out,"#:I_LINSIFT ");
229  break;
230  default:
231  (void) fprintf(table->err,"Unsupported ZDD reordering method\n");
232  return(0);
233  }
234  (void) fprintf(table->out,"%8d: initial size",initialSize);
235 #endif
236 
237  result = cuddZddTreeSifting(table,heuristic);
238 
239 #ifdef DD_STATS
240  (void) fprintf(table->out,"\n");
241  finalSize = table->keysZ;
242  (void) fprintf(table->out,"#:F_REORDER %8d: final size\n",finalSize);
243  (void) fprintf(table->out,"#:T_REORDER %8g: total time (sec)\n",
244  ((double)(util_cpu_time() - localTime)/1000.0));
245  (void) fprintf(table->out,"#:N_REORDER %8d: total swaps\n",
247 #endif
248 
249  if (result == 0)
250  return(0);
251 
252  if (!zddReorderPostprocess(table))
253  return(0);
254 
255  if (table->realignZ) {
256  if (!cuddBddAlignToZdd(table))
257  return(0);
258  }
259 
260  nextDyn = table->keysZ * DD_DYN_RATIO;
261  if (table->reorderings < 20 || nextDyn > table->nextDyn)
262  table->nextDyn = nextDyn;
263  else
264  table->nextDyn += 20;
265 
266  table->reordered = 1;
267 
268  /* Run hook functions. */
269  hook = table->postReorderingHook;
270  while (hook != NULL) {
271  int res = (hook->f)(table, "ZDD", (void *)localTime);
272  if (res == 0) return(0);
273  hook = hook->next;
274  }
275  /* Update cumulative reordering time. */
276  table->reordTime += util_cpu_time() - localTime;
277 
278  return(result);
279 
280 } /* end of Cudd_zddReduceHeap */
unsigned long reordTime
Definition: cuddInt.h:434
unsigned int deadZ
Definition: cuddInt.h:356
DdHook * preReorderingHook
Definition: cuddInt.h:421
static void zddReorderPreprocess(DdManager *table)
DdNode * zero
Definition: cuddInt.h:330
FILE * err
Definition: cuddInt.h:424
Cudd_ReorderingType autoMethodZ
Definition: cuddInt.h:403
#define DD_DYN_RATIO
Definition: cuddInt.h:153
DD_HFP f
Definition: cuddInt.h:241
static DdNode * empty
Definition: cuddZddReord.c:108
int reordered
Definition: cuddInt.h:392
unsigned int nextDyn
Definition: cuddInt.h:406
DdHook * postReorderingHook
Definition: cuddInt.h:422
int zddTotalNumberSwapping
Definition: cuddZddReord.c:106
FILE * out
Definition: cuddInt.h:423
int realignZ
Definition: cuddInt.h:405
static int zddReorderPostprocess(DdManager *table)
long util_cpu_time(void)
Definition: cpu_time.c:34
struct DdHook * next
Definition: cuddInt.h:242
unsigned int reorderings
Definition: cuddInt.h:393
int cuddZddTreeSifting(DdManager *table, Cudd_ReorderingType method)
Definition: cuddZddGroup.c:228
static int result
Definition: cuddGenetic.c:121
int cuddBddAlignToZdd(DdManager *table)
Definition: cuddReorder.c:1250
unsigned int keysZ
Definition: cuddInt.h:354

◆ Cudd_zddShuffleHeap()

int Cudd_zddShuffleHeap ( DdManager table,
int *  permutation 
)

Function********************************************************************

Synopsis [Reorders ZDD variables according to given permutation.]

Description [Reorders ZDD variables according to given permutation. The i-th entry of the permutation array contains the index of the variable that should be brought to the i-th level. The size of the array should be equal or greater to the number of variables currently in use. Returns 1 in case of success; 0 otherwise.]

SideEffects [Changes the ZDD variable order for all diagrams and clears the cache.]

SeeAlso [Cudd_zddReduceHeap]

Definition at line 300 of file cuddZddReord.c.

303 {
304 
305  int result;
306 
307  empty = table->zero;
308  zddReorderPreprocess(table);
309 
310  result = zddShuffle(table,permutation);
311 
312  if (!zddReorderPostprocess(table)) return(0);
313 
314  return(result);
315 
316 } /* end of Cudd_zddShuffleHeap */
static void zddReorderPreprocess(DdManager *table)
DdNode * zero
Definition: cuddInt.h:330
static DdNode * empty
Definition: cuddZddReord.c:108
static int zddReorderPostprocess(DdManager *table)
static int result
Definition: cuddGenetic.c:121
static int zddShuffle(DdManager *table, int *permutation)

◆ Cudd_zddSubset0()

DdNode* Cudd_zddSubset0 ( DdManager dd,
DdNode P,
int  var 
)

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.]

SideEffects [None]

SeeAlso [Cudd_zddSubset1]

Definition at line 358 of file cuddZddSetop.c.

362 {
363  DdNode *r;
364 
365  do {
366  dd->reordered = 0;
367  r = cuddZddSubset0(dd, P, var);
368  } while (dd->reordered == 1);
369 
370  return(r);
371 
372 } /* end of Cudd_zddSubset0 */
Definition: cudd.h:270
DdNode * cuddZddSubset0(DdManager *dd, DdNode *P, int var)
Definition: cuddZddSetop.c:919
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddSubset1()

DdNode* Cudd_zddSubset1 ( DdManager dd,
DdNode P,
int  var 
)

Function********************************************************************

Synopsis [Computes the positive cofactor of a ZDD w.r.t. a variable.]

Description [Computes the positive 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 asserted. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddSubset0]

Definition at line 326 of file cuddZddSetop.c.

330 {
331  DdNode *r;
332 
333  do {
334  dd->reordered = 0;
335  r = cuddZddSubset1(dd, P, var);
336  } while (dd->reordered == 1);
337 
338  return(r);
339 
340 } /* end of Cudd_zddSubset1 */
Definition: cudd.h:270
DdNode * cuddZddSubset1(DdManager *dd, DdNode *P, int var)
Definition: cuddZddSetop.c:870
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddSupport()

DdNode* Cudd_zddSupport ( DdManager dd,
DdNode f 
)

◆ Cudd_zddSymmProfile()

void Cudd_zddSymmProfile ( DdManager table,
int  lower,
int  upper 
)

AutomaticEnd Function********************************************************************

Synopsis [Prints statistics on symmetric ZDD variables.]

Description []

SideEffects [None]

SeeAlso []

Definition at line 141 of file cuddZddSymm.c.

145 {
146  int i, x, gbot;
147  int TotalSymm = 0;
148  int TotalSymmGroups = 0;
149 
150  for (i = lower; i < upper; i++) {
151  if (table->subtableZ[i].next != (unsigned) i) {
152  x = i;
153  (void) fprintf(table->out,"Group:");
154  do {
155  (void) fprintf(table->out," %d", table->invpermZ[x]);
156  TotalSymm++;
157  gbot = x;
158  x = table->subtableZ[x].next;
159  } while (x != i);
160  TotalSymmGroups++;
161 #ifdef DD_DEBUG
162  assert(table->subtableZ[gbot].next == (unsigned) i);
163 #endif
164  i = gbot;
165  (void) fprintf(table->out,"\n");
166  }
167  }
168  (void) fprintf(table->out,"Total Symmetric = %d\n", TotalSymm);
169  (void) fprintf(table->out,"Total Groups = %d\n", TotalSymmGroups);
170 
171 } /* end of Cudd_zddSymmProfile */
int * invpermZ
Definition: cuddInt.h:372
#define assert(ex)
Definition: util.h:141
FILE * out
Definition: cuddInt.h:423
unsigned int next
Definition: cuddInt.h:317
DdSubtable * subtableZ
Definition: cuddInt.h:350

◆ Cudd_zddUnateProduct()

DdNode* Cudd_zddUnateProduct ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Computes the product of two unate covers.]

Description [Computes the product of two unate covers represented as ZDDs. Unate covers use one ZDD variable for each BDD variable. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso [Cudd_zddProduct]

Definition at line 172 of file cuddZddFuncs.c.

176 {
177  DdNode *res;
178 
179  do {
180  dd->reordered = 0;
181  res = cuddZddUnateProduct(dd, f, g);
182  } while (dd->reordered == 1);
183  return(res);
184 
185 } /* end of Cudd_zddUnateProduct */
Definition: cudd.h:270
DdNode * cuddZddUnateProduct(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddZddFuncs.c:613
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddUnion()

DdNode* Cudd_zddUnion ( DdManager dd,
DdNode P,
DdNode Q 
)

Function********************************************************************

Synopsis [Computes the union of two ZDDs.]

Description [Computes the union of two ZDDs. Returns a pointer to the result if successful; NULL otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 174 of file cuddZddSetop.c.

178 {
179  DdNode *res;
180 
181  do {
182  dd->reordered = 0;
183  res = cuddZddUnion(dd, P, Q);
184  } while (dd->reordered == 1);
185  return(res);
186 
187 } /* end of Cudd_zddUnion */
Definition: cudd.h:270
DdNode * cuddZddUnion(DdManager *zdd, DdNode *P, DdNode *Q)
Definition: cuddZddSetop.c:549
int reordered
Definition: cuddInt.h:392

◆ Cudd_zddVarsFromBddVars()

int Cudd_zddVarsFromBddVars ( DdManager dd,
int  multiplicity 
)

Function********************************************************************

Synopsis [Creates one or more ZDD variables for each BDD variable.]

Description [Creates one or more ZDD variables for each BDD variable. If some ZDD variables already exist, only the missing variables are created. Parameter multiplicity allows the caller to control how many variables are created for each BDD variable in existence. For instance, if ZDDs are used to represent covers, two ZDD variables are required for each BDD variable. The order of the BDD variables is transferred to the ZDD variables. If a variable group tree exists for the BDD variables, a corresponding ZDD variable group tree is created by expanding the BDD variable tree. In any case, the ZDD variables derived from the same BDD variable are merged in a ZDD variable group. If a ZDD variable group tree exists, it is freed. Returns 1 if successful; 0 otherwise.]

SideEffects [None]

SeeAlso [Cudd_bddNewVar Cudd_bddIthVar Cudd_bddNewVarAtLevel]

Definition at line 533 of file cuddAPI.c.

536 {
537  int res;
538  int i, j;
539  int allnew;
540  int *permutation;
541 
542  if (multiplicity < 1) return(0);
543  allnew = dd->sizeZ == 0;
544  if (dd->size * multiplicity > dd->sizeZ) {
545  res = cuddResizeTableZdd(dd,dd->size * multiplicity - 1);
546  if (res == 0) return(0);
547  }
548  /* Impose the order of the BDD variables to the ZDD variables. */
549  if (allnew) {
550  for (i = 0; i < dd->size; i++) {
551  for (j = 0; j < multiplicity; j++) {
552  dd->permZ[i * multiplicity + j] =
553  dd->perm[i] * multiplicity + j;
554  dd->invpermZ[dd->permZ[i * multiplicity + j]] =
555  i * multiplicity + j;
556  }
557  }
558  for (i = 0; i < dd->sizeZ; i++) {
559  dd->univ[i]->index = dd->invpermZ[i];
560  }
561  } else {
562  permutation = ALLOC(int,dd->sizeZ);
563  if (permutation == NULL) {
565  return(0);
566  }
567  for (i = 0; i < dd->size; i++) {
568  for (j = 0; j < multiplicity; j++) {
569  permutation[i * multiplicity + j] =
570  dd->invperm[i] * multiplicity + j;
571  }
572  }
573  for (i = dd->size * multiplicity; i < dd->sizeZ; i++) {
574  permutation[i] = i;
575  }
576  res = Cudd_zddShuffleHeap(dd, permutation);
577  FREE(permutation);
578  if (res == 0) return(0);
579  }
580  /* Copy and expand the variable group tree if it exists. */
581  if (dd->treeZ != NULL) {
582  Cudd_FreeZddTree(dd);
583  }
584  if (dd->tree != NULL) {
585  dd->treeZ = Mtr_CopyTree(dd->tree, multiplicity);
586  if (dd->treeZ == NULL) return(0);
587  } else if (multiplicity > 1) {
588  dd->treeZ = Mtr_InitGroupTree(0, dd->sizeZ);
589  if (dd->treeZ == NULL) return(0);
590  dd->treeZ->index = dd->invpermZ[0];
591  }
592  /* Create groups for the ZDD variables derived from the same BDD variable.
593  */
594  if (multiplicity > 1) {
595  char *vmask, *lmask;
596 
597  vmask = ALLOC(char, dd->size);
598  if (vmask == NULL) {
600  return(0);
601  }
602  lmask = ALLOC(char, dd->size);
603  if (lmask == NULL) {
605  return(0);
606  }
607  for (i = 0; i < dd->size; i++) {
608  vmask[i] = lmask[i] = 0;
609  }
610  res = addMultiplicityGroups(dd,dd->treeZ,multiplicity,vmask,lmask);
611  FREE(vmask);
612  FREE(lmask);
613  if (res == 0) return(0);
614  }
615  return(1);
616 
617 } /* end of Cudd_zddVarsFromBddVars */
#define FREE(obj)
Definition: util.h:80
int * invpermZ
Definition: cuddInt.h:372
int size
Definition: cuddInt.h:345
void Cudd_FreeZddTree(DdManager *dd)
Definition: cuddAPI.c:2534
int * permZ
Definition: cuddInt.h:370
MtrNode * tree
Definition: cuddInt.h:408
MtrHalfWord index
Definition: mtr.h:130
int Cudd_zddShuffleHeap(DdManager *table, int *permutation)
Definition: cuddZddReord.c:300
#define ALLOC(type, num)
Definition: util.h:76
int cuddResizeTableZdd(DdManager *unique, int index)
Definition: cuddTable.c:2270
static int addMultiplicityGroups(DdManager *dd, MtrNode *treenode, int multiplicity, char *vmask, char *lmask)
Definition: cuddAPI.c:4855
MtrNode * Mtr_InitGroupTree(int lower, int size)
Definition: mtrGroup.c:120
int sizeZ
Definition: cuddInt.h:346
DdHalfWord index
Definition: cudd.h:271
MtrNode * treeZ
Definition: cuddInt.h:409
int * invperm
Definition: cuddInt.h:371
MtrNode * Mtr_CopyTree(MtrNode *node, int expansion)
Definition: mtrBasic.c:214
int * perm
Definition: cuddInt.h:369
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdNode ** univ
Definition: cuddInt.h:375

◆ Cudd_zddWeakDiv()

DdNode* Cudd_zddWeakDiv ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Applies weak division to two covers.]

Description [Applies weak division to two ZDDs representing two covers. Returns a pointer to the ZDD representing the result if successful; NULL otherwise. The result of weak division depends on the variable order. The covers on which Cudd_zddWeakDiv operates use two ZDD variables for each function variable (one ZDD variable for each literal of the variable). Those two ZDD variables should be adjacent in the order.]

SideEffects [None]

SeeAlso [Cudd_zddDivide]

Definition at line 206 of file cuddZddFuncs.c.

210 {
211  DdNode *res;
212 
213  do {
214  dd->reordered = 0;
215  res = cuddZddWeakDiv(dd, f, g);
216  } while (dd->reordered == 1);
217  return(res);
218 
219 } /* end of Cudd_zddWeakDiv */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddWeakDiv(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddZddFuncs.c:757

◆ Cudd_zddWeakDivF()

DdNode* Cudd_zddWeakDivF ( DdManager dd,
DdNode f,
DdNode g 
)

Function********************************************************************

Synopsis [Modified version of Cudd_zddWeakDiv.]

Description [Modified version of Cudd_zddWeakDiv. This function may disappear in future releases.]

SideEffects [None]

SeeAlso [Cudd_zddWeakDiv]

Definition at line 266 of file cuddZddFuncs.c.

270 {
271  DdNode *res;
272 
273  do {
274  dd->reordered = 0;
275  res = cuddZddWeakDivF(dd, f, g);
276  } while (dd->reordered == 1);
277  return(res);
278 
279 } /* end of Cudd_zddWeakDivF */
Definition: cudd.h:270
int reordered
Definition: cuddInt.h:392
DdNode * cuddZddWeakDivF(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddZddFuncs.c:918