abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cuddCheck.c File Reference
#include "misc/util/util_hack.h"
#include "cuddInt.h"

Go to the source code of this file.

Functions

static void debugFindParent (DdManager *table, DdNode *node)
 
int Cudd_DebugCheck (DdManager *table)
 
int Cudd_CheckKeys (DdManager *table)
 
int cuddHeapProfile (DdManager *dd)
 
void cuddPrintNode (DdNode *f, FILE *fp)
 
void cuddPrintVarGroups (DdManager *dd, MtrNode *root, int zdd, int silent)
 

Variables

static
ABC_NAMESPACE_IMPL_START char
rcsid[] 
DD_UNUSED = "$Id: cuddCheck.c,v 1.35 2009/03/08 02:49:01 fabio Exp $"
 

Function Documentation

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 458 of file cuddCheck.c.

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

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

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

Synopsis [Prints information about the heap.]

Description [Prints to the manager's stdout the number of live nodes for each level of the DD heap that contains at least one live node. It also prints a summary containing:

  • total number of tables;
  • number of tables with live nodes;
  • table with the largest number of live nodes;
  • number of nodes in that table.

If more than one table contains the maximum number of live nodes, only the one of lowest index is reported. Returns 1 in case of success and 0 otherwise.]

SideEffects [None]

SeeAlso []

Definition at line 639 of file cuddCheck.c.

641 {
642  int ntables = dd->size;
643  DdSubtable *subtables = dd->subtables;
644  int i, /* loop index */
645  nodes, /* live nodes in i-th layer */
646  retval, /* return value of fprintf */
647  largest = -1, /* index of the table with most live nodes */
648  maxnodes = -1, /* maximum number of live nodes in a table */
649  nonempty = 0; /* number of tables with live nodes */
650 
651  /* Print header. */
652 #if SIZEOF_VOID_P == 8
653  retval = fprintf(dd->out,"*** DD heap profile for 0x%lx ***\n",
654  (ptruint) dd);
655 #else
656  retval = fprintf(dd->out,"*** DD heap profile for 0x%x ***\n",
657  (ptruint) dd);
658 #endif
659  if (retval == EOF) return 0;
660 
661  /* Print number of live nodes for each nonempty table. */
662  for (i=0; i<ntables; i++) {
663  nodes = subtables[i].keys - subtables[i].dead;
664  if (nodes) {
665  nonempty++;
666  retval = fprintf(dd->out,"%5d: %5d nodes\n", i, nodes);
667  if (retval == EOF) return 0;
668  if (nodes > maxnodes) {
669  maxnodes = nodes;
670  largest = i;
671  }
672  }
673  }
674 
675  nodes = dd->constants.keys - dd->constants.dead;
676  if (nodes) {
677  nonempty++;
678  retval = fprintf(dd->out,"const: %5d nodes\n", nodes);
679  if (retval == EOF) return 0;
680  if (nodes > maxnodes) {
681  maxnodes = nodes;
682  largest = CUDD_CONST_INDEX;
683  }
684  }
685 
686  /* Print summary. */
687  retval = fprintf(dd->out,"Summary: %d tables, %d non-empty, largest: %d ",
688  ntables+1, nonempty, largest);
689  if (retval == EOF) return 0;
690  retval = fprintf(dd->out,"(with %d nodes)\n", maxnodes);
691  if (retval == EOF) return 0;
692 
693  return(1);
694 
695 } /* end of cuddHeapProfile */
unsigned int keys
Definition: cuddInt.h:330
int size
Definition: cuddInt.h:361
int nodes
Definition: abcSaucy.c:61
DdSubtable * subtables
Definition: cuddInt.h:365
ABC_PTRUINT_T ptruint
Definition: cuddInt.h:261
unsigned int dead
Definition: cuddInt.h:332
FILE * out
Definition: cuddInt.h:441
#define CUDD_CONST_INDEX
Definition: cudd.h:117
static int largest(void)
Definition: cuddGenetic.c:624
DdSubtable constants
Definition: cuddInt.h:367
void cuddPrintNode ( DdNode f,
FILE *  fp 
)

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

Synopsis [Prints out information on a node.]

Description [Prints out information on a node.]

SideEffects [None]

SeeAlso []

Definition at line 710 of file cuddCheck.c.

713 {
714  f = Cudd_Regular(f);
715 #if SIZEOF_VOID_P == 8
716  (void) fprintf(fp," node 0x%lx, id = %u, ref = %u, then = 0x%lx, else = 0x%lx\n",(ptruint)f,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
717 #else
718  (void) fprintf(fp," node 0x%x, id = %hu, ref = %hu, then = 0x%x, else = 0x%x\n",(ptruint)f,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
719 #endif
720 
721 } /* end of cuddPrintNode */
DdHalfWord ref
Definition: cudd.h:280
#define Cudd_Regular(node)
Definition: cudd.h:397
ABC_PTRUINT_T ptruint
Definition: cuddInt.h:261
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
void cuddPrintVarGroups ( DdManager dd,
MtrNode root,
int  zdd,
int  silent 
)

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

Synopsis [Prints the variable groups as a parenthesized list.]

Description [Prints the variable groups as a parenthesized list. For each group the level range that it represents is printed. After each group, the group's flags are printed, preceded by a `|'. For each flag (except MTR_TERMINAL) a character is printed.

  • F: MTR_FIXED
  • N: MTR_NEWNODE
  • S: MTR_SOFT

The second argument, silent, if different from 0, causes Cudd_PrintVarGroups to only check the syntax of the group tree.]

SideEffects [None]

SeeAlso []

Definition at line 747 of file cuddCheck.c.

752 {
753  MtrNode *node;
754  int level;
755 
756  assert(root != NULL);
757  assert(root->younger == NULL || root->younger->elder == root);
758  assert(root->elder == NULL || root->elder->younger == root);
759  if (zdd) {
760  level = dd->permZ[root->index];
761  } else {
762  level = dd->perm[root->index];
763  }
764  if (!silent) (void) printf("(%d",level);
765  if (MTR_TEST(root,MTR_TERMINAL) || root->child == NULL) {
766  if (!silent) (void) printf(",");
767  } else {
768  node = root->child;
769  while (node != NULL) {
770  assert(node->low >= root->low && (int) (node->low + node->size) <= (int) (root->low + root->size));
771  assert(node->parent == root);
772  cuddPrintVarGroups(dd,node,zdd,silent);
773  node = node->younger;
774  }
775  }
776  if (!silent) {
777  (void) printf("%d", (int) (level + root->size - 1));
778  if (root->flags != MTR_DEFAULT) {
779  (void) printf("|");
780  if (MTR_TEST(root,MTR_FIXED)) (void) printf("F");
781  if (MTR_TEST(root,MTR_NEWNODE)) (void) printf("N");
782  if (MTR_TEST(root,MTR_SOFT)) (void) printf("S");
783  }
784  (void) printf(")");
785  if (root->parent == NULL) (void) printf("\n");
786  }
787  assert((root->flags &~(MTR_TERMINAL | MTR_SOFT | MTR_FIXED | MTR_NEWNODE)) == 0);
788  return;
789 
790 } /* end of cuddPrintVarGroups */
#define MTR_TERMINAL
Definition: mtr.h:100
MtrHalfWord flags
Definition: mtr.h:132
void cuddPrintVarGroups(DdManager *dd, MtrNode *root, int zdd, int silent)
Definition: cuddCheck.c:747
MtrHalfWord size
Definition: mtr.h:134
#define MTR_FIXED
Definition: mtr.h:102
int * permZ
Definition: cuddInt.h:387
struct MtrNode * parent
Definition: mtr.h:136
#define MTR_DEFAULT
Definition: mtr.h:99
struct MtrNode * elder
Definition: mtr.h:138
#define MTR_TEST(node, flag)
Definition: mtr.h:155
struct MtrNode * younger
Definition: mtr.h:139
MtrHalfWord index
Definition: mtr.h:135
#define MTR_NEWNODE
Definition: mtr.h:103
MtrHalfWord low
Definition: mtr.h:133
Definition: mtr.h:131
#define assert(ex)
Definition: util_old.h:213
struct MtrNode * child
Definition: mtr.h:137
int * perm
Definition: cuddInt.h:386
#define MTR_SOFT
Definition: mtr.h:101
static void debugFindParent ( DdManager table,
DdNode node 
)
static

AutomaticStart

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

Synopsis [Searches the subtables above node for its parents.]

Description []

SideEffects [None]

SeeAlso []

Definition at line 810 of file cuddCheck.c.

813 {
814  int i,j;
815  int slots;
816  DdNodePtr *nodelist;
817  DdNode *f;
818 
819  for (i = 0; i < cuddI(table,node->index); i++) {
820  nodelist = table->subtables[i].nodelist;
821  slots = table->subtables[i].slots;
822 
823  for (j=0;j<slots;j++) {
824  f = nodelist[j];
825  while (f != NULL) {
826  if (cuddT(f) == node || Cudd_Regular(cuddE(f)) == node) {
827 #if SIZEOF_VOID_P == 8
828  (void) fprintf(table->out,"parent is at 0x%lx, id = %u, ref = %u, then = 0x%lx, else = 0x%lx\n",
829  (ptruint)f,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
830 #else
831  (void) fprintf(table->out,"parent is at 0x%x, id = %hu, ref = %hu, then = 0x%x, else = 0x%x\n",
832  (ptruint)f,f->index,f->ref,(ptruint)cuddT(f),(ptruint)cuddE(f));
833 #endif
834  }
835  f = f->next;
836  }
837  }
838  }
839 
840 } /* end of debugFindParent */
DdHalfWord ref
Definition: cudd.h:280
Definition: cudd.h:278
#define Cudd_Regular(node)
Definition: cudd.h:397
DdSubtable * subtables
Definition: cuddInt.h:365
ABC_PTRUINT_T ptruint
Definition: cuddInt.h:261
FILE * out
Definition: cuddInt.h:441
DdNode * next
Definition: cudd.h:281
DdNode ** nodelist
Definition: cuddInt.h:327
#define cuddT(node)
Definition: cuddInt.h:636
#define cuddI(dd, index)
Definition: cuddInt.h:686
DdHalfWord index
Definition: cudd.h:279
unsigned int slots
Definition: cuddInt.h:329
#define cuddE(node)
Definition: cuddInt.h:652

Variable Documentation

ABC_NAMESPACE_IMPL_START char rcsid [] DD_UNUSED = "$Id: cuddCheck.c,v 1.35 2009/03/08 02:49:01 fabio Exp $"
static

CFile***********************************************************************

FileName [cuddCheck.c]

PackageName [cudd]

Synopsis [Functions to check consistency of data structures.]

Description [External procedures included in this module:

Internal procedures included in this module:

Static procedures included in this module:

]

SeeAlso []

Author [Fabio Somenzi]

Copyright [Copyright (c) 1995-2004, 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.]

Definition at line 91 of file cuddCheck.c.