src/bdd/cudd/cuddZddMisc.c File Reference

#include <math.h>
#include "util_hack.h"
#include "cuddInt.h"
Include dependency graph for cuddZddMisc.c:

Go to the source code of this file.

Functions

static int cuddZddDagInt ARGS ((DdNode *n, st_table *tab))
int Cudd_zddDagSize (DdNode *p_node)
double Cudd_zddCountMinterm (DdManager *zdd, DdNode *node, int path)
void Cudd_zddPrintSubtable (DdManager *table)
static int cuddZddDagInt (DdNode *n, st_table *tab)

Variables

static char rcsid[] DD_UNUSED = "$Id: cuddZddMisc.c,v 1.1.1.1 2003/02/24 22:23:54 wjiang Exp $"

Function Documentation

static int cuddZddDagInt ARGS ( (DdNode *n, st_table *tab)   )  [static]

AutomaticStart

double Cudd_zddCountMinterm ( DdManager zdd,
DdNode node,
int  path 
)

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

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

Description [Counts the number of minterms of the ZDD rooted at node. This procedure takes a parameter path that specifies how many variables are in the support of the function. If the procedure runs out of memory, it returns (double) CUDD_OUT_OF_MEM.]

SideEffects [None]

SeeAlso [Cudd_zddCountDouble]

Definition at line 127 of file cuddZddMisc.c.

00131 {
00132     double      dc_var, minterms;       
00133 
00134     dc_var = (double)((double)(zdd->sizeZ) - (double)path);
00135     minterms = Cudd_zddCountDouble(zdd, node) / pow(2.0, dc_var);
00136     return(minterms);
00137 
00138 } /* end of Cudd_zddCountMinterm */

int Cudd_zddDagSize ( DdNode p_node  ) 

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

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

Description [Counts the number of nodes in a ZDD. This function duplicates Cudd_DagSize and is only retained for compatibility.]

SideEffects [None]

SeeAlso [Cudd_DagSize]

Definition at line 96 of file cuddZddMisc.c.

00098 {
00099 
00100     int         i;      
00101     st_table    *table;
00102 
00103     table = st_init_table(st_ptrcmp, st_ptrhash);
00104     i = cuddZddDagInt(p_node, table);
00105     st_free_table(table);
00106     return(i);
00107 
00108 } /* end of Cudd_zddDagSize */

void Cudd_zddPrintSubtable ( DdManager table  ) 

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

Synopsis [Prints the ZDD table.]

Description [Prints the ZDD table for debugging purposes.]

SideEffects [None]

SeeAlso []

Definition at line 153 of file cuddZddMisc.c.

00155 {
00156     int         i, j;
00157     DdNode      *z1, *z1_next, *base;
00158     DdSubtable  *ZSubTable;
00159 
00160     base = table->one;
00161     for (i = table->sizeZ - 1; i >= 0; i--) {
00162         ZSubTable = &(table->subtableZ[i]);
00163         printf("subtable[%d]:\n", i);
00164         for (j = ZSubTable->slots - 1; j >= 0; j--) {
00165             z1 = ZSubTable->nodelist[j];
00166             while (z1 != NIL(DdNode)) {
00167                 (void) fprintf(table->out,
00168 #if SIZEOF_VOID_P == 8
00169                     "ID = 0x%lx\tindex = %d\tr = %d\t",
00170                     (unsigned long) z1 / (unsigned long) sizeof(DdNode),
00171                     z1->index, z1->ref);
00172 #else
00173                     "ID = 0x%x\tindex = %d\tr = %d\t",
00174                     (unsigned) z1 / (unsigned) sizeof(DdNode),
00175                     z1->index, z1->ref);
00176 #endif
00177                 z1_next = cuddT(z1);
00178                 if (Cudd_IsConstant(z1_next)) {
00179                     (void) fprintf(table->out, "T = %d\t\t",
00180                         (z1_next == base));
00181                 }
00182                 else {
00183 #if SIZEOF_VOID_P == 8
00184                     (void) fprintf(table->out, "T = 0x%lx\t",
00185                         (unsigned long) z1_next / (unsigned long) sizeof(DdNode));
00186 #else
00187                     (void) fprintf(table->out, "T = 0x%x\t",
00188                         (unsigned) z1_next / (unsigned) sizeof(DdNode));
00189 #endif
00190                 }
00191                 z1_next = cuddE(z1);
00192                 if (Cudd_IsConstant(z1_next)) {
00193                     (void) fprintf(table->out, "E = %d\n",
00194                         (z1_next == base));
00195                 }
00196                 else {
00197 #if SIZEOF_VOID_P == 8
00198                     (void) fprintf(table->out, "E = 0x%lx\n",
00199                         (unsigned long) z1_next / (unsigned long) sizeof(DdNode));
00200 #else
00201                     (void) fprintf(table->out, "E = 0x%x\n",
00202                         (unsigned) z1_next / (unsigned) sizeof(DdNode));
00203 #endif
00204                 }
00205 
00206                 z1_next = z1->next;
00207                 z1 = z1_next;
00208             }
00209         }
00210     }
00211     putchar('\n');
00212 
00213 } /* Cudd_zddPrintSubtable */

static int cuddZddDagInt ( DdNode n,
st_table tab 
) [static]

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

Synopsis [Performs the recursive step of Cudd_zddDagSize.]

Description [Performs the recursive step of Cudd_zddDagSize. Does not check for out-of-memory conditions.]

SideEffects [None]

SeeAlso []

Definition at line 234 of file cuddZddMisc.c.

00237 {
00238     if (n == NIL(DdNode))
00239         return(0);
00240 
00241     if (st_is_member(tab, (char *)n) == 1)
00242         return(0);
00243 
00244     if (Cudd_IsConstant(n))
00245         return(0);
00246 
00247     (void)st_insert(tab, (char *)n, NIL(char));
00248     return(1 + cuddZddDagInt(cuddT(n), tab) +
00249         cuddZddDagInt(cuddE(n), tab));
00250 
00251 } /* cuddZddDagInt */


Variable Documentation

char rcsid [] DD_UNUSED = "$Id: cuddZddMisc.c,v 1.1.1.1 2003/02/24 22:23:54 wjiang Exp $" [static]

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

FileName [cuddZddMisc.c]

PackageName [cudd]

Synopsis [.]

Description [External procedures included in this module:

Internal procedures included in this module:

procedures included in this module:

]

SeeAlso []

Author [Hyong-Kyoon Shin, In-Ho Moon]

Copyright [ This file was created at the University of Colorado at Boulder. The University of Colorado at Boulder makes no warranty about the suitability of this software for any purpose. It is presented on an AS IS basis.]

Definition at line 59 of file cuddZddMisc.c.


Generated on Tue Jan 5 12:18:57 2010 for abc70930 by  doxygen 1.6.1