You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1188 lines
46 KiB

  1. /**CHeaderFile*****************************************************************
  2. FileName [cuddInt.h]
  3. PackageName [cudd]
  4. Synopsis [Internal data structures of the CUDD package.]
  5. Description []
  6. SeeAlso []
  7. Author [Fabio Somenzi]
  8. Copyright [Copyright (c) 1995-2012, Regents of the University of Colorado
  9. All rights reserved.
  10. Redistribution and use in source and binary forms, with or without
  11. modification, are permitted provided that the following conditions
  12. are met:
  13. Redistributions of source code must retain the above copyright
  14. notice, this list of conditions and the following disclaimer.
  15. Redistributions in binary form must reproduce the above copyright
  16. notice, this list of conditions and the following disclaimer in the
  17. documentation and/or other materials provided with the distribution.
  18. Neither the name of the University of Colorado nor the names of its
  19. contributors may be used to endorse or promote products derived from
  20. this software without specific prior written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. POSSIBILITY OF SUCH DAMAGE.]
  33. Revision [$Id: cuddInt.h,v 1.142 2012/02/05 01:07:19 fabio Exp $]
  34. ******************************************************************************/
  35. #ifndef _CUDDINT
  36. #define _CUDDINT
  37. /*---------------------------------------------------------------------------*/
  38. /* Nested includes */
  39. /*---------------------------------------------------------------------------*/
  40. #ifdef DD_MIS
  41. #include "array.h"
  42. #include "list.h"
  43. #include "st.h"
  44. #include "espresso.h"
  45. #include "node.h"
  46. #ifdef SIS
  47. #include "graph.h"
  48. #include "astg.h"
  49. #endif
  50. #include "network.h"
  51. #endif
  52. #include <math.h>
  53. #include "cudd.h"
  54. #include "st.h"
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. #if defined(__GNUC__)
  59. # define DD_INLINE __inline__
  60. # if (__GNUC__ >2 || __GNUC_MINOR__ >=7)
  61. # define DD_UNUSED __attribute__ ((__unused__))
  62. # else
  63. # define DD_UNUSED
  64. # endif
  65. #else
  66. # if defined(__cplusplus)
  67. # define DD_INLINE inline
  68. # else
  69. # define DD_INLINE
  70. # endif
  71. # define DD_UNUSED
  72. #endif
  73. /*---------------------------------------------------------------------------*/
  74. /* Constant declarations */
  75. /*---------------------------------------------------------------------------*/
  76. #define DD_MAXREF ((DdHalfWord) ~0)
  77. #define DD_DEFAULT_RESIZE 10 /* how many extra variables */
  78. /* should be added when resizing */
  79. #define DD_MEM_CHUNK 1022
  80. /* These definitions work for CUDD_VALUE_TYPE == double */
  81. #define DD_ONE_VAL (1.0)
  82. #define DD_ZERO_VAL (0.0)
  83. #define DD_EPSILON (1.0e-12)
  84. /* The definitions of +/- infinity in terms of HUGE_VAL work on
  85. ** the DECstations and on many other combinations of OS/compiler.
  86. */
  87. #ifdef HAVE_IEEE_754
  88. # define DD_PLUS_INF_VAL (HUGE_VAL)
  89. #else
  90. # define DD_PLUS_INF_VAL (10e301)
  91. # define DD_CRI_HI_MARK (10e150)
  92. # define DD_CRI_LO_MARK (-(DD_CRI_HI_MARK))
  93. #endif
  94. #define DD_MINUS_INF_VAL (-(DD_PLUS_INF_VAL))
  95. #define DD_NON_CONSTANT ((DdNode *) 1) /* for Cudd_bddIteConstant */
  96. /* Unique table and cache management constants. */
  97. #define DD_MAX_SUBTABLE_DENSITY 4 /* tells when to resize a subtable */
  98. /* gc when this percent are dead (measured w.r.t. slots, not keys)
  99. ** The first limit (LO) applies normally. The second limit applies when
  100. ** the package believes more space for the unique table (i.e., more dead
  101. ** nodes) would improve performance, and the unique table is not already
  102. ** too large. The third limit applies when memory is low.
  103. */
  104. #define DD_GC_FRAC_LO DD_MAX_SUBTABLE_DENSITY * 0.25
  105. #define DD_GC_FRAC_HI DD_MAX_SUBTABLE_DENSITY * 1.0
  106. #define DD_GC_FRAC_MIN 0.2
  107. #define DD_MIN_HIT 30 /* resize cache when hit ratio
  108. above this percentage (default) */
  109. #define DD_MAX_LOOSE_FRACTION 5 /* 1 / (max fraction of memory used for
  110. unique table in fast growth mode) */
  111. #define DD_MAX_CACHE_FRACTION 3 /* 1 / (max fraction of memory used for
  112. computed table if resizing enabled) */
  113. #define DD_STASH_FRACTION 64 /* 1 / (fraction of memory set
  114. aside for emergencies) */
  115. #define DD_MAX_CACHE_TO_SLOTS_RATIO 4 /* used to limit the cache size */
  116. /* Variable ordering default parameter values. */
  117. #define DD_SIFT_MAX_VAR 1000
  118. #define DD_SIFT_MAX_SWAPS 2000000
  119. #define DD_DEFAULT_RECOMB 0
  120. #define DD_MAX_REORDER_GROWTH 1.2
  121. #define DD_FIRST_REORDER 4004 /* 4 for the constants */
  122. #define DD_DYN_RATIO 2 /* when to dynamically reorder */
  123. /* Primes for cache hash functions. */
  124. #define DD_P1 12582917
  125. #define DD_P2 4256249
  126. #define DD_P3 741457
  127. #define DD_P4 1618033999
  128. /* Cache tags for 3-operand operators. These tags are stored in the
  129. ** least significant bits of the cache operand pointers according to
  130. ** the following scheme. The tag consists of two hex digits. Both digits
  131. ** must be even, so that they do not interfere with complementation bits.
  132. ** The least significant one is stored in Bits 3:1 of the f operand in the
  133. ** cache entry. Bit 1 is always 1, so that we can differentiate
  134. ** three-operand operations from one- and two-operand operations.
  135. ** Therefore, the least significant digit is one of {2,6,a,e}. The most
  136. ** significant digit occupies Bits 3:1 of the g operand in the cache
  137. ** entry. It can by any even digit between 0 and e. This gives a total
  138. ** of 5 bits for the tag proper, which means a maximum of 32 three-operand
  139. ** operations. */
  140. #define DD_ADD_ITE_TAG 0x02
  141. #define DD_BDD_AND_ABSTRACT_TAG 0x06
  142. #define DD_BDD_XOR_EXIST_ABSTRACT_TAG 0x0a
  143. #define DD_BDD_ITE_TAG 0x0e
  144. #define DD_ADD_BDD_DO_INTERVAL_TAG 0x22
  145. #define DD_BDD_CLIPPING_AND_ABSTRACT_UP_TAG 0x26
  146. #define DD_BDD_CLIPPING_AND_ABSTRACT_DOWN_TAG 0x2a
  147. #define DD_BDD_COMPOSE_RECUR_TAG 0x2e
  148. #define DD_ADD_COMPOSE_RECUR_TAG 0x42
  149. #define DD_ADD_NON_SIM_COMPOSE_TAG 0x46
  150. #define DD_EQUIV_DC_TAG 0x4a
  151. #define DD_ZDD_ITE_TAG 0x4e
  152. #define DD_ADD_ITE_CONSTANT_TAG 0x62
  153. #define DD_ADD_EVAL_CONST_TAG 0x66
  154. #define DD_BDD_ITE_CONSTANT_TAG 0x6a
  155. #define DD_ADD_OUT_SUM_TAG 0x6e
  156. #define DD_BDD_LEQ_UNLESS_TAG 0x82
  157. #define DD_ADD_TRIANGLE_TAG 0x86
  158. #define DD_BDD_MAX_EXP_TAG 0x8a
  159. /* Generator constants. */
  160. #define CUDD_GEN_CUBES 0
  161. #define CUDD_GEN_PRIMES 1
  162. #define CUDD_GEN_NODES 2
  163. #define CUDD_GEN_ZDD_PATHS 3
  164. #define CUDD_GEN_EMPTY 0
  165. #define CUDD_GEN_NONEMPTY 1
  166. /*---------------------------------------------------------------------------*/
  167. /* Stucture declarations */
  168. /*---------------------------------------------------------------------------*/
  169. struct DdGen {
  170. DdManager *manager;
  171. int type;
  172. int status;
  173. union {
  174. struct {
  175. int *cube;
  176. CUDD_VALUE_TYPE value;
  177. } cubes;
  178. struct {
  179. int *cube;
  180. DdNode *ub;
  181. } primes;
  182. struct {
  183. int size;
  184. } nodes;
  185. } gen;
  186. struct {
  187. int sp;
  188. DdNode **stack;
  189. } stack;
  190. DdNode *node;
  191. };
  192. /*---------------------------------------------------------------------------*/
  193. /* Type declarations */
  194. /*---------------------------------------------------------------------------*/
  195. /* Hooks in CUDD are functions that the application registers with the
  196. ** manager so that they are called at appropriate times. The functions
  197. ** are passed the manager as argument; they should return 1 if
  198. ** successful and 0 otherwise.
  199. */
  200. typedef struct DdHook { /* hook list element */
  201. DD_HFP f; /* function to be called */
  202. struct DdHook *next; /* next element in the list */
  203. } DdHook;
  204. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  205. typedef long ptrint;
  206. typedef unsigned long ptruint;
  207. #else
  208. typedef int ptrint;
  209. typedef unsigned int ptruint;
  210. #endif
  211. typedef DdNode *DdNodePtr;
  212. /* Generic local cache item. */
  213. typedef struct DdLocalCacheItem {
  214. DdNode *value;
  215. #ifdef DD_CACHE_PROFILE
  216. ptrint count;
  217. #endif
  218. DdNode *key[1];
  219. } DdLocalCacheItem;
  220. /* Local cache. */
  221. typedef struct DdLocalCache {
  222. DdLocalCacheItem *item;
  223. unsigned int itemsize;
  224. unsigned int keysize;
  225. unsigned int slots;
  226. int shift;
  227. double lookUps;
  228. double minHit;
  229. double hits;
  230. unsigned int maxslots;
  231. DdManager *manager;
  232. struct DdLocalCache *next;
  233. } DdLocalCache;
  234. /* Generic hash item. */
  235. typedef struct DdHashItem {
  236. struct DdHashItem *next;
  237. ptrint count;
  238. DdNode *value;
  239. DdNode *key[1];
  240. } DdHashItem;
  241. /* Local hash table */
  242. typedef struct DdHashTable {
  243. unsigned int keysize;
  244. unsigned int itemsize;
  245. DdHashItem **bucket;
  246. DdHashItem *nextFree;
  247. DdHashItem **memoryList;
  248. unsigned int numBuckets;
  249. int shift;
  250. unsigned int size;
  251. unsigned int maxsize;
  252. DdManager *manager;
  253. } DdHashTable;
  254. typedef struct DdCache {
  255. DdNode *f,*g; /* DDs */
  256. ptruint h; /* either operator or DD */
  257. DdNode *data; /* already constructed DD */
  258. #ifdef DD_CACHE_PROFILE
  259. ptrint count;
  260. #endif
  261. } DdCache;
  262. typedef struct DdSubtable { /* subtable for one index */
  263. DdNode **nodelist; /* hash table */
  264. int shift; /* shift for hash function */
  265. unsigned int slots; /* size of the hash table */
  266. unsigned int keys; /* number of nodes stored in this table */
  267. unsigned int maxKeys; /* slots * DD_MAX_SUBTABLE_DENSITY */
  268. unsigned int dead; /* number of dead nodes in this table */
  269. unsigned int next; /* index of next variable in group */
  270. int bindVar; /* flag to bind this variable to its level */
  271. /* Fields for lazy sifting. */
  272. Cudd_VariableType varType; /* variable type (ps, ns, pi) */
  273. int pairIndex; /* corresponding variable index (ps <-> ns) */
  274. int varHandled; /* flag: 1 means variable is already handled */
  275. Cudd_LazyGroupType varToBeGrouped; /* tells what grouping to apply */
  276. } DdSubtable;
  277. struct DdManager { /* specialized DD symbol table */
  278. /* Constants */
  279. DdNode sentinel; /* for collision lists */
  280. DdNode *one; /* constant 1 */
  281. DdNode *zero; /* constant 0 */
  282. DdNode *plusinfinity; /* plus infinity */
  283. DdNode *minusinfinity; /* minus infinity */
  284. DdNode *background; /* background value */
  285. /* Computed Table */
  286. DdCache *acache; /* address of allocated memory for cache */
  287. DdCache *cache; /* the cache-based computed table */
  288. unsigned int cacheSlots; /* total number of cache entries */
  289. int cacheShift; /* shift value for cache hash function */
  290. double cacheMisses; /* number of cache misses (since resizing) */
  291. double cacheHits; /* number of cache hits (since resizing) */
  292. double minHit; /* hit percentage above which to resize */
  293. int cacheSlack; /* slots still available for resizing */
  294. unsigned int maxCacheHard; /* hard limit for cache size */
  295. /* Unique Table */
  296. int size; /* number of unique subtables */
  297. int sizeZ; /* for ZDD */
  298. int maxSize; /* max number of subtables before resizing */
  299. int maxSizeZ; /* for ZDD */
  300. DdSubtable *subtables; /* array of unique subtables */
  301. DdSubtable *subtableZ; /* for ZDD */
  302. DdSubtable constants; /* unique subtable for the constants */
  303. unsigned int slots; /* total number of hash buckets */
  304. unsigned int keys; /* total number of BDD and ADD nodes */
  305. unsigned int keysZ; /* total number of ZDD nodes */
  306. unsigned int dead; /* total number of dead BDD and ADD nodes */
  307. unsigned int deadZ; /* total number of dead ZDD nodes */
  308. unsigned int maxLive; /* maximum number of live nodes */
  309. unsigned int minDead; /* do not GC if fewer than these dead */
  310. double gcFrac; /* gc when this fraction is dead */
  311. int gcEnabled; /* gc is enabled */
  312. unsigned int looseUpTo; /* slow growth beyond this limit */
  313. /* (measured w.r.t. slots, not keys) */
  314. unsigned int initSlots; /* initial size of a subtable */
  315. DdNode **stack; /* stack for iterative procedures */
  316. double allocated; /* number of nodes allocated */
  317. /* (not during reordering) */
  318. double reclaimed; /* number of nodes brought back from the dead */
  319. int isolated; /* isolated projection functions */
  320. int *perm; /* current variable perm. (index to level) */
  321. int *permZ; /* for ZDD */
  322. int *invperm; /* current inv. var. perm. (level to index) */
  323. int *invpermZ; /* for ZDD */
  324. DdNode **vars; /* projection functions */
  325. int *map; /* variable map for fast swap */
  326. DdNode **univ; /* ZDD 1 for each variable */
  327. int linearSize; /* number of rows and columns of linear */
  328. long *interact; /* interacting variable matrix */
  329. long *linear; /* linear transform matrix */
  330. /* Memory Management */
  331. DdNode **memoryList; /* memory manager for symbol table */
  332. DdNode *nextFree; /* list of free nodes */
  333. char *stash; /* memory reserve */
  334. #ifndef DD_NO_DEATH_ROW
  335. DdNode **deathRow; /* queue for dereferencing */
  336. int deathRowDepth; /* number of slots in the queue */
  337. int nextDead; /* index in the queue */
  338. unsigned deadMask; /* mask for circular index update */
  339. #endif
  340. /* General Parameters */
  341. CUDD_VALUE_TYPE epsilon; /* tolerance on comparisons */
  342. /* Dynamic Reordering Parameters */
  343. int reordered; /* flag set at the end of reordering */
  344. unsigned int reorderings; /* number of calls to Cudd_ReduceHeap */
  345. unsigned int maxReorderings;/* maximum number of calls to Cudd_ReduceHeap */
  346. int siftMaxVar; /* maximum number of vars sifted */
  347. int siftMaxSwap; /* maximum number of swaps per sifting */
  348. double maxGrowth; /* maximum growth during reordering */
  349. double maxGrowthAlt; /* alternate maximum growth for reordering */
  350. int reordCycle; /* how often to apply alternate threshold */
  351. int autoDyn; /* automatic dynamic reordering flag (BDD) */
  352. int autoDynZ; /* automatic dynamic reordering flag (ZDD) */
  353. Cudd_ReorderingType autoMethod; /* default reordering method */
  354. Cudd_ReorderingType autoMethodZ; /* default reordering method (ZDD) */
  355. int realign; /* realign ZDD order after BDD reordering */
  356. int realignZ; /* realign BDD order after ZDD reordering */
  357. unsigned int nextDyn; /* reorder if this size is reached */
  358. unsigned int countDead; /* if 0, count deads to trigger reordering */
  359. MtrNode *tree; /* variable group tree (BDD) */
  360. MtrNode *treeZ; /* variable group tree (ZDD) */
  361. Cudd_AggregationType groupcheck; /* used during group sifting */
  362. int recomb; /* used during group sifting */
  363. int symmviolation; /* used during group sifting */
  364. int arcviolation; /* used during group sifting */
  365. int populationSize; /* population size for GA */
  366. int numberXovers; /* number of crossovers for GA */
  367. unsigned int randomizeOrder; /* perturb the next reordering threshold */
  368. DdLocalCache *localCaches; /* local caches currently in existence */
  369. char *hooks; /* application-specific field (used by vis) */
  370. DdHook *preGCHook; /* hooks to be called before GC */
  371. DdHook *postGCHook; /* hooks to be called after GC */
  372. DdHook *preReorderingHook; /* hooks to be called before reordering */
  373. DdHook *postReorderingHook; /* hooks to be called after reordering */
  374. FILE *out; /* stdout for this manager */
  375. FILE *err; /* stderr for this manager */
  376. Cudd_ErrorType errorCode; /* info on last error */
  377. unsigned long startTime; /* start time in milliseconds */
  378. unsigned long timeLimit; /* CPU time limit */
  379. /* Statistical counters. */
  380. unsigned long memused; /* total memory allocated for the manager */
  381. unsigned long maxmem; /* target maximum memory */
  382. unsigned long maxmemhard; /* hard limit for maximum memory */
  383. int garbageCollections; /* number of garbage collections */
  384. unsigned long GCTime; /* total time spent in garbage collection */
  385. unsigned long reordTime; /* total time spent in reordering */
  386. double totCachehits; /* total number of cache hits */
  387. double totCacheMisses; /* total number of cache misses */
  388. double cachecollisions; /* number of cache collisions */
  389. double cacheinserts; /* number of cache insertions */
  390. double cacheLastInserts; /* insertions at the last cache resizing */
  391. double cachedeletions; /* number of deletions during garbage coll. */
  392. #ifdef DD_STATS
  393. double nodesFreed; /* number of nodes returned to the free list */
  394. double nodesDropped; /* number of nodes killed by dereferencing */
  395. #endif
  396. unsigned int peakLiveNodes; /* maximum number of live nodes */
  397. #ifdef DD_UNIQUE_PROFILE
  398. double uniqueLookUps; /* number of unique table lookups */
  399. double uniqueLinks; /* total distance traveled in coll. chains */
  400. #endif
  401. #ifdef DD_COUNT
  402. double recursiveCalls; /* number of recursive calls */
  403. #ifdef DD_STATS
  404. double nextSample; /* when to write next line of stats */
  405. #endif
  406. double swapSteps; /* number of elementary reordering steps */
  407. #endif
  408. #ifdef DD_MIS
  409. /* mis/verif compatibility fields */
  410. array_t *iton; /* maps ids in ddNode to node_t */
  411. array_t *order; /* copy of order_list */
  412. lsHandle handle; /* where it is in network BDD list */
  413. network_t *network;
  414. st_table *local_order; /* for local BDDs */
  415. int nvars; /* variables used so far */
  416. int threshold; /* for pseudo var threshold value*/
  417. #endif
  418. };
  419. typedef struct Move {
  420. DdHalfWord x;
  421. DdHalfWord y;
  422. unsigned int flags;
  423. int size;
  424. struct Move *next;
  425. } Move;
  426. /* Generic level queue item. */
  427. typedef struct DdQueueItem {
  428. struct DdQueueItem *next;
  429. struct DdQueueItem *cnext;
  430. void *key;
  431. } DdQueueItem;
  432. /* Level queue. */
  433. typedef struct DdLevelQueue {
  434. void *first;
  435. DdQueueItem **last;
  436. DdQueueItem *freelist;
  437. DdQueueItem **buckets;
  438. int levels;
  439. int itemsize;
  440. int size;
  441. int maxsize;
  442. int numBuckets;
  443. int shift;
  444. } DdLevelQueue;
  445. /*---------------------------------------------------------------------------*/
  446. /* Variable declarations */
  447. /*---------------------------------------------------------------------------*/
  448. /*---------------------------------------------------------------------------*/
  449. /* Macro declarations */
  450. /*---------------------------------------------------------------------------*/
  451. /**Macro***********************************************************************
  452. Synopsis [Adds node to the head of the free list.]
  453. Description [Adds node to the head of the free list. Does not
  454. deallocate memory chunks that become free. This function is also
  455. used by the dynamic reordering functions.]
  456. SideEffects [None]
  457. SeeAlso [cuddAllocNode cuddDynamicAllocNode cuddDeallocMove]
  458. ******************************************************************************/
  459. #define cuddDeallocNode(unique,node) \
  460. (node)->next = (unique)->nextFree; \
  461. (unique)->nextFree = node;
  462. /**Macro***********************************************************************
  463. Synopsis [Adds node to the head of the free list.]
  464. Description [Adds node to the head of the free list. Does not
  465. deallocate memory chunks that become free. This function is also
  466. used by the dynamic reordering functions.]
  467. SideEffects [None]
  468. SeeAlso [cuddDeallocNode cuddDynamicAllocNode]
  469. ******************************************************************************/
  470. #define cuddDeallocMove(unique,node) \
  471. ((DdNode *)(node))->ref = 0; \
  472. ((DdNode *)(node))->next = (unique)->nextFree; \
  473. (unique)->nextFree = (DdNode *)(node);
  474. /**Macro***********************************************************************
  475. Synopsis [Increases the reference count of a node, if it is not
  476. saturated.]
  477. Description [Increases the reference count of a node, if it is not
  478. saturated. This being a macro, it is faster than Cudd_Ref, but it
  479. cannot be used in constructs like cuddRef(a = b()).]
  480. SideEffects [none]
  481. SeeAlso [Cudd_Ref]
  482. ******************************************************************************/
  483. #define cuddRef(n) cuddSatInc(Cudd_Regular(n)->ref)
  484. /**Macro***********************************************************************
  485. Synopsis [Decreases the reference count of a node, if it is not
  486. saturated.]
  487. Description [Decreases the reference count of node. It is primarily
  488. used in recursive procedures to decrease the ref count of a result
  489. node before returning it. This accomplishes the goal of removing the
  490. protection applied by a previous cuddRef. This being a macro, it is
  491. faster than Cudd_Deref, but it cannot be used in constructs like
  492. cuddDeref(a = b()).]
  493. SideEffects [none]
  494. SeeAlso [Cudd_Deref]
  495. ******************************************************************************/
  496. #define cuddDeref(n) cuddSatDec(Cudd_Regular(n)->ref)
  497. /**Macro***********************************************************************
  498. Synopsis [Returns 1 if the node is a constant node.]
  499. Description [Returns 1 if the node is a constant node (rather than an
  500. internal node). All constant nodes have the same index
  501. (CUDD_CONST_INDEX). The pointer passed to cuddIsConstant must be regular.]
  502. SideEffects [none]
  503. SeeAlso [Cudd_IsConstant]
  504. ******************************************************************************/
  505. #define cuddIsConstant(node) ((node)->index == CUDD_CONST_INDEX)
  506. /**Macro***********************************************************************
  507. Synopsis [Returns the then child of an internal node.]
  508. Description [Returns the then child of an internal node. If
  509. <code>node</code> is a constant node, the result is unpredictable.
  510. The pointer passed to cuddT must be regular.]
  511. SideEffects [none]
  512. SeeAlso [Cudd_T]
  513. ******************************************************************************/
  514. #define cuddT(node) ((node)->type.kids.T)
  515. /**Macro***********************************************************************
  516. Synopsis [Returns the else child of an internal node.]
  517. Description [Returns the else child of an internal node. If
  518. <code>node</code> is a constant node, the result is unpredictable.
  519. The pointer passed to cuddE must be regular.]
  520. SideEffects [none]
  521. SeeAlso [Cudd_E]
  522. ******************************************************************************/
  523. #define cuddE(node) ((node)->type.kids.E)
  524. /**Macro***********************************************************************
  525. Synopsis [Returns the value of a constant node.]
  526. Description [Returns the value of a constant node. If
  527. <code>node</code> is an internal node, the result is unpredictable.
  528. The pointer passed to cuddV must be regular.]
  529. SideEffects [none]
  530. SeeAlso [Cudd_V]
  531. ******************************************************************************/
  532. #define cuddV(node) ((node)->type.value)
  533. /**Macro***********************************************************************
  534. Synopsis [Finds the current position of variable index in the
  535. order.]
  536. Description [Finds the current position of variable index in the
  537. order. This macro duplicates the functionality of Cudd_ReadPerm,
  538. but it does not check for out-of-bounds indices and it is more
  539. efficient.]
  540. SideEffects [none]
  541. SeeAlso [Cudd_ReadPerm]
  542. ******************************************************************************/
  543. #define cuddI(dd,index) (((index)==CUDD_CONST_INDEX)?(int)(index):(dd)->perm[(index)])
  544. /**Macro***********************************************************************
  545. Synopsis [Finds the current position of ZDD variable index in the
  546. order.]
  547. Description [Finds the current position of ZDD variable index in the
  548. order. This macro duplicates the functionality of Cudd_ReadPermZdd,
  549. but it does not check for out-of-bounds indices and it is more
  550. efficient.]
  551. SideEffects [none]
  552. SeeAlso [Cudd_ReadPermZdd]
  553. ******************************************************************************/
  554. #define cuddIZ(dd,index) (((index)==CUDD_CONST_INDEX)?(int)(index):(dd)->permZ[(index)])
  555. /**Macro***********************************************************************
  556. Synopsis [Hash function for the unique table.]
  557. Description []
  558. SideEffects [none]
  559. SeeAlso [ddCHash ddCHash2]
  560. ******************************************************************************/
  561. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  562. #define ddHash(f,g,s) \
  563. ((((unsigned)(ptruint)(f) * DD_P1 + \
  564. (unsigned)(ptruint)(g)) * DD_P2) >> (s))
  565. #else
  566. #define ddHash(f,g,s) \
  567. ((((unsigned)(f) * DD_P1 + (unsigned)(g)) * DD_P2) >> (s))
  568. #endif
  569. /**Macro***********************************************************************
  570. Synopsis [Hash function for the cache.]
  571. Description []
  572. SideEffects [none]
  573. SeeAlso [ddHash ddCHash2]
  574. ******************************************************************************/
  575. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  576. #define ddCHash(o,f,g,h,s) \
  577. ((((((unsigned)(ptruint)(f) + (unsigned)(ptruint)(o)) * DD_P1 + \
  578. (unsigned)(ptruint)(g)) * DD_P2 + \
  579. (unsigned)(ptruint)(h)) * DD_P3) >> (s))
  580. #else
  581. #define ddCHash(o,f,g,h,s) \
  582. ((((((unsigned)(f) + (unsigned)(o)) * DD_P1 + (unsigned)(g)) * DD_P2 + \
  583. (unsigned)(h)) * DD_P3) >> (s))
  584. #endif
  585. /**Macro***********************************************************************
  586. Synopsis [Hash function for the cache for functions with two
  587. operands.]
  588. Description []
  589. SideEffects [none]
  590. SeeAlso [ddHash ddCHash]
  591. ******************************************************************************/
  592. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  593. #define ddCHash2(o,f,g,s) \
  594. (((((unsigned)(ptruint)(f) + (unsigned)(ptruint)(o)) * DD_P1 + \
  595. (unsigned)(ptruint)(g)) * DD_P2) >> (s))
  596. #else
  597. #define ddCHash2(o,f,g,s) \
  598. (((((unsigned)(f) + (unsigned)(o)) * DD_P1 + (unsigned)(g)) * DD_P2) >> (s))
  599. #endif
  600. /**Macro***********************************************************************
  601. Synopsis [Clears the 4 least significant bits of a pointer.]
  602. Description []
  603. SideEffects [none]
  604. SeeAlso []
  605. ******************************************************************************/
  606. #define cuddClean(p) ((DdNode *)((ptruint)(p) & ~0xf))
  607. /**Macro***********************************************************************
  608. Synopsis [Computes the minimum of two numbers.]
  609. Description []
  610. SideEffects [none]
  611. SeeAlso [ddMax]
  612. ******************************************************************************/
  613. #define ddMin(x,y) (((y) < (x)) ? (y) : (x))
  614. /**Macro***********************************************************************
  615. Synopsis [Computes the maximum of two numbers.]
  616. Description []
  617. SideEffects [none]
  618. SeeAlso [ddMin]
  619. ******************************************************************************/
  620. #define ddMax(x,y) (((y) > (x)) ? (y) : (x))
  621. /**Macro***********************************************************************
  622. Synopsis [Computes the absolute value of a number.]
  623. Description []
  624. SideEffects [none]
  625. SeeAlso []
  626. ******************************************************************************/
  627. #define ddAbs(x) (((x)<0) ? -(x) : (x))
  628. /**Macro***********************************************************************
  629. Synopsis [Returns 1 if the absolute value of the difference of the two
  630. arguments x and y is less than e.]
  631. Description []
  632. SideEffects [none]
  633. SeeAlso []
  634. ******************************************************************************/
  635. #define ddEqualVal(x,y,e) (ddAbs((x)-(y))<(e))
  636. /**Macro***********************************************************************
  637. Synopsis [Saturating increment operator.]
  638. Description []
  639. SideEffects [none]
  640. SeeAlso [cuddSatDec]
  641. ******************************************************************************/
  642. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  643. #define cuddSatInc(x) ((x)++)
  644. #else
  645. #define cuddSatInc(x) ((x) += (x) != (DdHalfWord)DD_MAXREF)
  646. #endif
  647. /**Macro***********************************************************************
  648. Synopsis [Saturating decrement operator.]
  649. Description []
  650. SideEffects [none]
  651. SeeAlso [cuddSatInc]
  652. ******************************************************************************/
  653. #if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
  654. #define cuddSatDec(x) ((x)--)
  655. #else
  656. #define cuddSatDec(x) ((x) -= (x) != (DdHalfWord)DD_MAXREF)
  657. #endif
  658. /**Macro***********************************************************************
  659. Synopsis [Returns the constant 1 node.]
  660. Description []
  661. SideEffects [none]
  662. SeeAlso [DD_ZERO DD_PLUS_INFINITY DD_MINUS_INFINITY]
  663. ******************************************************************************/
  664. #define DD_ONE(dd) ((dd)->one)
  665. /**Macro***********************************************************************
  666. Synopsis [Returns the arithmetic 0 constant node.]
  667. Description [Returns the arithmetic 0 constant node. This is different
  668. from the logical zero. The latter is obtained by
  669. Cudd_Not(DD_ONE(dd)).]
  670. SideEffects [none]
  671. SeeAlso [DD_ONE Cudd_Not DD_PLUS_INFINITY DD_MINUS_INFINITY]
  672. ******************************************************************************/
  673. #define DD_ZERO(dd) ((dd)->zero)
  674. /**Macro***********************************************************************
  675. Synopsis [Returns the plus infinity constant node.]
  676. Description []
  677. SideEffects [none]
  678. SeeAlso [DD_ONE DD_ZERO DD_MINUS_INFINITY]
  679. ******************************************************************************/
  680. #define DD_PLUS_INFINITY(dd) ((dd)->plusinfinity)
  681. /**Macro***********************************************************************
  682. Synopsis [Returns the minus infinity constant node.]
  683. Description []
  684. SideEffects [none]
  685. SeeAlso [DD_ONE DD_ZERO DD_PLUS_INFINITY]
  686. ******************************************************************************/
  687. #define DD_MINUS_INFINITY(dd) ((dd)->minusinfinity)
  688. /**Macro***********************************************************************
  689. Synopsis [Enforces DD_MINUS_INF_VAL <= x <= DD_PLUS_INF_VAL.]
  690. Description [Enforces DD_MINUS_INF_VAL <= x <= DD_PLUS_INF_VAL.
  691. Furthermore, if x <= DD_MINUS_INF_VAL/2, x is set to
  692. DD_MINUS_INF_VAL. Similarly, if DD_PLUS_INF_VAL/2 <= x, x is set to
  693. DD_PLUS_INF_VAL. Normally this macro is a NOOP. However, if
  694. HAVE_IEEE_754 is not defined, it makes sure that a value does not
  695. get larger than infinity in absolute value, and once it gets to
  696. infinity, stays there. If the value overflows before this macro is
  697. applied, no recovery is possible.]
  698. SideEffects [none]
  699. SeeAlso []
  700. ******************************************************************************/
  701. #ifdef HAVE_IEEE_754
  702. #define cuddAdjust(x)
  703. #else
  704. #define cuddAdjust(x) ((x) = ((x) >= DD_CRI_HI_MARK) ? DD_PLUS_INF_VAL : (((x) <= DD_CRI_LO_MARK) ? DD_MINUS_INF_VAL : (x)))
  705. #endif
  706. /**Macro***********************************************************************
  707. Synopsis [Extract the least significant digit of a double digit.]
  708. Description [Extract the least significant digit of a double digit. Used
  709. in the manipulation of arbitrary precision integers.]
  710. SideEffects [None]
  711. SeeAlso [DD_MSDIGIT]
  712. ******************************************************************************/
  713. #define DD_LSDIGIT(x) ((x) & DD_APA_MASK)
  714. /**Macro***********************************************************************
  715. Synopsis [Extract the most significant digit of a double digit.]
  716. Description [Extract the most significant digit of a double digit. Used
  717. in the manipulation of arbitrary precision integers.]
  718. SideEffects [None]
  719. SeeAlso [DD_LSDIGIT]
  720. ******************************************************************************/
  721. #define DD_MSDIGIT(x) ((x) >> DD_APA_BITS)
  722. /**Macro***********************************************************************
  723. Synopsis [Outputs a line of stats.]
  724. Description [Outputs a line of stats if DD_COUNT and DD_STATS are
  725. defined. Increments the number of recursive calls if DD_COUNT is
  726. defined.]
  727. SideEffects [None]
  728. SeeAlso []
  729. ******************************************************************************/
  730. #ifdef DD_COUNT
  731. #ifdef DD_STATS
  732. #define statLine(dd) dd->recursiveCalls++; \
  733. if (dd->recursiveCalls == dd->nextSample) {(void) fprintf(dd->err, \
  734. "@%.0f: %u nodes %u live %.0f dropped %.0f reclaimed\n", dd->recursiveCalls, \
  735. dd->keys, dd->keys - dd->dead, dd->nodesDropped, dd->reclaimed); \
  736. dd->nextSample += 250000;}
  737. #else
  738. #define statLine(dd) dd->recursiveCalls++;
  739. #endif
  740. #else
  741. #define statLine(dd)
  742. #endif
  743. /**AutomaticStart*************************************************************/
  744. /*---------------------------------------------------------------------------*/
  745. /* Function prototypes */
  746. /*---------------------------------------------------------------------------*/
  747. extern DdNode * cuddAddExistAbstractRecur (DdManager *manager, DdNode *f, DdNode *cube);
  748. extern DdNode * cuddAddUnivAbstractRecur (DdManager *manager, DdNode *f, DdNode *cube);
  749. extern DdNode * cuddAddOrAbstractRecur (DdManager *manager, DdNode *f, DdNode *cube);
  750. extern DdNode * cuddAddApplyRecur (DdManager *dd, DdNode * (*)(DdManager *, DdNode **, DdNode **), DdNode *f, DdNode *g);
  751. extern DdNode * cuddAddMonadicApplyRecur (DdManager * dd, DdNode * (*op)(DdManager *, DdNode *), DdNode * f);
  752. extern DdNode * cuddAddScalarInverseRecur (DdManager *dd, DdNode *f, DdNode *epsilon);
  753. extern DdNode * cuddAddIteRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
  754. extern DdNode * cuddAddCmplRecur (DdManager *dd, DdNode *f);
  755. extern DdNode * cuddAddNegateRecur (DdManager *dd, DdNode *f);
  756. extern DdNode * cuddAddRoundOffRecur (DdManager *dd, DdNode *f, double trunc);
  757. extern DdNode * cuddUnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, int safe, double quality);
  758. extern DdNode * cuddRemapUnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, double quality);
  759. extern DdNode * cuddBiasedUnderApprox (DdManager *dd, DdNode *f, DdNode *b, int numVars, int threshold, double quality1, double quality0);
  760. extern DdNode * cuddBddAndAbstractRecur (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube);
  761. extern int cuddAnnealing (DdManager *table, int lower, int upper);
  762. extern DdNode * cuddBddExistAbstractRecur (DdManager *manager, DdNode *f, DdNode *cube);
  763. extern DdNode * cuddBddXorExistAbstractRecur (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube);
  764. extern DdNode * cuddBddBooleanDiffRecur (DdManager *manager, DdNode *f, DdNode *var);
  765. extern DdNode * cuddBddIteRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
  766. extern DdNode * cuddBddIntersectRecur (DdManager *dd, DdNode *f, DdNode *g);
  767. extern DdNode * cuddBddAndRecur (DdManager *manager, DdNode *f, DdNode *g);
  768. extern DdNode * cuddBddXorRecur (DdManager *manager, DdNode *f, DdNode *g);
  769. extern DdNode * cuddBddTransfer (DdManager *ddS, DdManager *ddD, DdNode *f);
  770. extern DdNode * cuddAddBddDoPattern (DdManager *dd, DdNode *f);
  771. extern int cuddInitCache (DdManager *unique, unsigned int cacheSize, unsigned int maxCacheSize);
  772. extern void cuddCacheInsert (DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data);
  773. extern void cuddCacheInsert2 (DdManager *table, DdNode * (*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g, DdNode *data);
  774. extern void cuddCacheInsert1 (DdManager *table, DdNode * (*)(DdManager *, DdNode *), DdNode *f, DdNode *data);
  775. extern DdNode * cuddCacheLookup (DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h);
  776. extern DdNode * cuddCacheLookupZdd (DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h);
  777. extern DdNode * cuddCacheLookup2 (DdManager *table, DdNode * (*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g);
  778. extern DdNode * cuddCacheLookup1 (DdManager *table, DdNode * (*)(DdManager *, DdNode *), DdNode *f);
  779. extern DdNode * cuddCacheLookup2Zdd (DdManager *table, DdNode * (*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g);
  780. extern DdNode * cuddCacheLookup1Zdd (DdManager *table, DdNode * (*)(DdManager *, DdNode *), DdNode *f);
  781. extern DdNode * cuddConstantLookup (DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h);
  782. extern int cuddCacheProfile (DdManager *table, FILE *fp);
  783. extern void cuddCacheResize (DdManager *table);
  784. extern void cuddCacheFlush (DdManager *table);
  785. extern int cuddComputeFloorLog2 (unsigned int value);
  786. extern int cuddHeapProfile (DdManager *dd);
  787. extern void cuddPrintNode (DdNode *f, FILE *fp);
  788. extern void cuddPrintVarGroups (DdManager * dd, MtrNode * root, int zdd, int silent);
  789. extern DdNode * cuddBddClippingAnd (DdManager *dd, DdNode *f, DdNode *g, int maxDepth, int direction);
  790. extern DdNode * cuddBddClippingAndAbstract (DdManager *dd, DdNode *f, DdNode *g, DdNode *cube, int maxDepth, int direction);
  791. extern void cuddGetBranches (DdNode *g, DdNode **g1, DdNode **g0);
  792. extern DdNode * cuddCofactorRecur (DdManager *dd, DdNode *f, DdNode *g);
  793. extern DdNode * cuddBddComposeRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *proj);
  794. extern DdNode * cuddAddComposeRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *proj);
  795. extern int cuddExact (DdManager *table, int lower, int upper);
  796. extern DdNode * cuddBddConstrainRecur (DdManager *dd, DdNode *f, DdNode *c);
  797. extern DdNode * cuddBddRestrictRecur (DdManager *dd, DdNode *f, DdNode *c);
  798. extern DdNode * cuddBddNPAndRecur (DdManager *dd, DdNode *f, DdNode *c);
  799. extern DdNode * cuddAddConstrainRecur (DdManager *dd, DdNode *f, DdNode *c);
  800. extern DdNode * cuddAddRestrictRecur (DdManager *dd, DdNode *f, DdNode *c);
  801. extern DdNode * cuddBddLICompaction (DdManager *dd, DdNode *f, DdNode *c);
  802. extern int cuddGa (DdManager *table, int lower, int upper);
  803. extern int cuddTreeSifting (DdManager *table, Cudd_ReorderingType method);
  804. extern int cuddZddInitUniv (DdManager *zdd);
  805. extern void cuddZddFreeUniv (DdManager *zdd);
  806. extern void cuddSetInteract (DdManager *table, int x, int y);
  807. extern int cuddTestInteract (DdManager *table, int x, int y);
  808. extern int cuddInitInteract (DdManager *table);
  809. extern DdLocalCache * cuddLocalCacheInit (DdManager *manager, unsigned int keySize, unsigned int cacheSize, unsigned int maxCacheSize);
  810. extern void cuddLocalCacheQuit (DdLocalCache *cache);
  811. extern void cuddLocalCacheInsert (DdLocalCache *cache, DdNodePtr *key, DdNode *value);
  812. extern DdNode * cuddLocalCacheLookup (DdLocalCache *cache, DdNodePtr *key);
  813. extern void cuddLocalCacheClearDead (DdManager *manager);
  814. extern int cuddIsInDeathRow (DdManager *dd, DdNode *f);
  815. extern int cuddTimesInDeathRow (DdManager *dd, DdNode *f);
  816. extern void cuddLocalCacheClearAll (DdManager *manager);
  817. #ifdef DD_CACHE_PROFILE
  818. extern int cuddLocalCacheProfile (DdLocalCache *cache);
  819. #endif
  820. extern DdHashTable * cuddHashTableInit (DdManager *manager, unsigned int keySize, unsigned int initSize);
  821. extern void cuddHashTableQuit (DdHashTable *hash);
  822. extern void cuddHashTableGenericQuit (DdHashTable *hash);
  823. extern int cuddHashTableInsert (DdHashTable *hash, DdNodePtr *key, DdNode *value, ptrint count);
  824. extern DdNode * cuddHashTableLookup (DdHashTable *hash, DdNodePtr *key);
  825. extern int cuddHashTableInsert1 (DdHashTable *hash, DdNode *f, DdNode *value, ptrint count);
  826. extern DdNode * cuddHashTableLookup1 (DdHashTable *hash, DdNode *f);
  827. extern int cuddHashTableInsert2 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *value, ptrint count);
  828. extern DdNode * cuddHashTableLookup2 (DdHashTable *hash, DdNode *f, DdNode *g);
  829. extern int cuddHashTableInsert3 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *h, DdNode *value, ptrint count);
  830. extern DdNode * cuddHashTableLookup3 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *h);
  831. extern int cuddHashTableGenericInsert(DdHashTable * hash, DdNode * f, void * value);
  832. extern void * cuddHashTableGenericLookup(DdHashTable * hash, DdNode * f);
  833. extern DdLevelQueue * cuddLevelQueueInit (int levels, int itemSize, int numBuckets);
  834. extern void cuddLevelQueueQuit (DdLevelQueue *queue);
  835. extern void * cuddLevelQueueFirst(DdLevelQueue * queue, void * key, int level);
  836. extern void * cuddLevelQueueEnqueue (DdLevelQueue *queue, void *key, int level);
  837. extern void cuddLevelQueueDequeue (DdLevelQueue *queue, int level);
  838. extern int cuddLinearAndSifting (DdManager *table, int lower, int upper);
  839. extern int cuddLinearInPlace (DdManager * table, int x, int y);
  840. extern void cuddUpdateInteractionMatrix (DdManager * table, int xindex, int yindex);
  841. extern int cuddInitLinear (DdManager *table);
  842. extern int cuddResizeLinear (DdManager *table);
  843. extern DdNode * cuddBddLiteralSetIntersectionRecur (DdManager *dd, DdNode *f, DdNode *g);
  844. extern DdNode * cuddCProjectionRecur (DdManager *dd, DdNode *R, DdNode *Y, DdNode *Ysupp);
  845. extern DdNode * cuddBddClosestCube (DdManager *dd, DdNode *f, DdNode *g, CUDD_VALUE_TYPE bound);
  846. extern void cuddReclaim (DdManager *table, DdNode *n);
  847. extern void cuddReclaimZdd (DdManager *table, DdNode *n);
  848. extern void cuddClearDeathRow (DdManager *table);
  849. extern void cuddShrinkDeathRow (DdManager *table);
  850. extern DdNode * cuddDynamicAllocNode (DdManager *table);
  851. extern int cuddSifting (DdManager *table, int lower, int upper);
  852. extern int cuddSwapping (DdManager *table, int lower, int upper, Cudd_ReorderingType heuristic);
  853. extern int cuddNextHigh (DdManager *table, int x);
  854. extern int cuddNextLow (DdManager *table, int x);
  855. extern int cuddSwapInPlace (DdManager *table, int x, int y);
  856. extern int cuddBddAlignToZdd (DdManager *table);
  857. extern DdNode * cuddBddMakePrime (DdManager *dd, DdNode *cube, DdNode *f);
  858. extern DdNode * cuddSolveEqnRecur (DdManager *bdd, DdNode *F, DdNode *Y, DdNode **G, int n, int *yIndex, int i);
  859. extern DdNode * cuddVerifySol (DdManager *bdd, DdNode *F, DdNode **G, int *yIndex, int n);
  860. #ifdef ST_INCLUDED
  861. extern DdNode* cuddSplitSetRecur (DdManager *manager, st_table *mtable, int *varSeen, DdNode *p, double n, double max, int index);
  862. #endif
  863. extern DdNode * cuddSubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold);
  864. extern DdNode * cuddSubsetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit);
  865. extern int cuddSymmCheck (DdManager *table, int x, int y);
  866. extern int cuddSymmSifting (DdManager *table, int lower, int upper);
  867. extern int cuddSymmSiftingConv (DdManager *table, int lower, int upper);
  868. extern DdNode * cuddAllocNode (DdManager *unique);
  869. extern DdManager * cuddInitTable (unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int looseUpTo);
  870. extern void cuddFreeTable (DdManager *unique);
  871. extern int cuddGarbageCollect (DdManager *unique, int clearCache);
  872. extern DdNode * cuddZddGetNode (DdManager *zdd, int id, DdNode *T, DdNode *E);
  873. extern DdNode * cuddZddGetNodeIVO (DdManager *dd, int index, DdNode *g, DdNode *h);
  874. extern DdNode * cuddUniqueInter (DdManager *unique, int index, DdNode *T, DdNode *E);
  875. extern DdNode * cuddUniqueInterIVO (DdManager *unique, int index, DdNode *T, DdNode *E);
  876. extern DdNode * cuddUniqueInterZdd (DdManager *unique, int index, DdNode *T, DdNode *E);
  877. extern DdNode * cuddUniqueConst (DdManager *unique, CUDD_VALUE_TYPE value);
  878. extern void cuddRehash (DdManager *unique, int i);
  879. extern void cuddShrinkSubtable (DdManager *unique, int i);
  880. extern int cuddInsertSubtables (DdManager *unique, int n, int level);
  881. extern int cuddDestroySubtables (DdManager *unique, int n);
  882. extern int cuddResizeTableZdd (DdManager *unique, int index);
  883. extern void cuddSlowTableGrowth (DdManager *unique);
  884. extern int cuddP (DdManager *dd, DdNode *f);
  885. #ifdef ST_INCLUDED
  886. extern enum st_retval cuddStCountfree (char *key, char *value, char *arg);
  887. extern int cuddCollectNodes (DdNode *f, st_table *visited);
  888. #endif
  889. extern DdNodePtr * cuddNodeArray (DdNode *f, int *n);
  890. extern int cuddWindowReorder (DdManager *table, int low, int high, Cudd_ReorderingType submethod);
  891. extern DdNode * cuddZddProduct (DdManager *dd, DdNode *f, DdNode *g);
  892. extern DdNode * cuddZddUnateProduct (DdManager *dd, DdNode *f, DdNode *g);
  893. extern DdNode * cuddZddWeakDiv (DdManager *dd, DdNode *f, DdNode *g);
  894. extern DdNode * cuddZddWeakDivF (DdManager *dd, DdNode *f, DdNode *g);
  895. extern DdNode * cuddZddDivide (DdManager *dd, DdNode *f, DdNode *g);
  896. extern DdNode * cuddZddDivideF (DdManager *dd, DdNode *f, DdNode *g);
  897. extern int cuddZddGetCofactors3 (DdManager *dd, DdNode *f, int v, DdNode **f1, DdNode **f0, DdNode **fd);
  898. extern int cuddZddGetCofactors2 (DdManager *dd, DdNode *f, int v, DdNode **f1, DdNode **f0);
  899. extern DdNode * cuddZddComplement (DdManager *dd, DdNode *node);
  900. extern int cuddZddGetPosVarIndex(DdManager * dd, int index);
  901. extern int cuddZddGetNegVarIndex(DdManager * dd, int index);
  902. extern int cuddZddGetPosVarLevel(DdManager * dd, int index);
  903. extern int cuddZddGetNegVarLevel(DdManager * dd, int index);
  904. extern int cuddZddTreeSifting (DdManager *table, Cudd_ReorderingType method);
  905. extern DdNode * cuddZddIsop (DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I);
  906. extern DdNode * cuddBddIsop (DdManager *dd, DdNode *L, DdNode *U);
  907. extern DdNode * cuddMakeBddFromZddCover (DdManager *dd, DdNode *node);
  908. extern int cuddZddLinearSifting (DdManager *table, int lower, int upper);
  909. extern int cuddZddAlignToBdd (DdManager *table);
  910. extern int cuddZddNextHigh (DdManager *table, int x);
  911. extern int cuddZddNextLow (DdManager *table, int x);
  912. extern int cuddZddUniqueCompare (int *ptr_x, int *ptr_y);
  913. extern int cuddZddSwapInPlace (DdManager *table, int x, int y);
  914. extern int cuddZddSwapping (DdManager *table, int lower, int upper, Cudd_ReorderingType heuristic);
  915. extern int cuddZddSifting (DdManager *table, int lower, int upper);
  916. extern DdNode * cuddZddIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
  917. extern DdNode * cuddZddUnion (DdManager *zdd, DdNode *P, DdNode *Q);
  918. extern DdNode * cuddZddIntersect (DdManager *zdd, DdNode *P, DdNode *Q);
  919. extern DdNode * cuddZddDiff (DdManager *zdd, DdNode *P, DdNode *Q);
  920. extern DdNode * cuddZddChangeAux (DdManager *zdd, DdNode *P, DdNode *zvar);
  921. extern DdNode * cuddZddSubset1 (DdManager *dd, DdNode *P, int var);
  922. extern DdNode * cuddZddSubset0 (DdManager *dd, DdNode *P, int var);
  923. extern DdNode * cuddZddChange (DdManager *dd, DdNode *P, int var);
  924. extern int cuddZddSymmCheck (DdManager *table, int x, int y);
  925. extern int cuddZddSymmSifting (DdManager *table, int lower, int upper);
  926. extern int cuddZddSymmSiftingConv (DdManager *table, int lower, int upper);
  927. extern int cuddZddP (DdManager *zdd, DdNode *f);
  928. /**AutomaticEnd***************************************************************/
  929. #ifdef __cplusplus
  930. } /* end of extern "C" */
  931. #endif
  932. #endif /* _CUDDINT */