00001
00019 #include "dsdInt.h"
00020
00024
00028
00044 Dsd_Manager_t * Dsd_ManagerStart( DdManager * dd, int nSuppMax, int fVerbose )
00045 {
00046 Dsd_Manager_t * dMan;
00047 Dsd_Node_t * pNode;
00048 int i;
00049
00050 assert( nSuppMax <= dd->size );
00051
00052 dMan = ALLOC( Dsd_Manager_t, 1 );
00053 memset( dMan, 0, sizeof(Dsd_Manager_t) );
00054 dMan->dd = dd;
00055 dMan->nInputs = nSuppMax;
00056 dMan->fVerbose = fVerbose;
00057 dMan->nRoots = 0;
00058 dMan->nRootsAlloc = 50;
00059 dMan->pRoots = (Dsd_Node_t **) malloc( dMan->nRootsAlloc * sizeof(Dsd_Node_t *) );
00060 dMan->pInputs = (Dsd_Node_t **) malloc( dMan->nInputs * sizeof(Dsd_Node_t *) );
00061
00062
00063 dMan->Table = st_init_table(st_ptrcmp, st_ptrhash);
00064 for ( i = 0; i < dMan->nInputs; i++ )
00065 {
00066 pNode = Dsd_TreeNodeCreate( DSD_NODE_BUF, 1, 0 );
00067 pNode->G = dd->vars[i]; Cudd_Ref( pNode->G );
00068 pNode->S = dd->vars[i]; Cudd_Ref( pNode->S );
00069 st_insert( dMan->Table, (char*)dd->vars[i], (char*)pNode );
00070 dMan->pInputs[i] = pNode;
00071 }
00072 pNode = Dsd_TreeNodeCreate( DSD_NODE_CONST1, 0, 0 );
00073 pNode->G = b1; Cudd_Ref( pNode->G );
00074 pNode->S = b1; Cudd_Ref( pNode->S );
00075 st_insert( dMan->Table, (char*)b1, (char*)pNode );
00076 dMan->pConst1 = pNode;
00077
00078 Dsd_CheckCacheAllocate( 5000 );
00079 return dMan;
00080 }
00081
00097 void Dsd_ManagerStop( Dsd_Manager_t * dMan )
00098 {
00099 st_generator * gen;
00100 Dsd_Node_t * pNode;
00101 DdNode * bFunc;
00102
00103 st_foreach_item( dMan->Table, gen, (char**)&bFunc, (char**)&pNode )
00104 Dsd_TreeNodeDelete( dMan->dd, Dsd_Regular(pNode) );
00105 st_free_table(dMan->Table);
00106 free( dMan->pInputs );
00107 free( dMan->pRoots );
00108 free( dMan );
00109 Dsd_CheckCacheDeallocate();
00110 }
00111