00001 00021 #include "lpkInt.h" 00022 00026 00030 00042 Lpk_Man_t * Lpk_ManStart( Lpk_Par_t * pPars ) 00043 { 00044 Lpk_Man_t * p; 00045 int i, nWords; 00046 assert( pPars->nLutsMax <= 16 ); 00047 assert( pPars->nVarsMax > 0 && pPars->nVarsMax <= 16 ); 00048 p = ALLOC( Lpk_Man_t, 1 ); 00049 memset( p, 0, sizeof(Lpk_Man_t) ); 00050 p->pPars = pPars; 00051 p->nCutsMax = LPK_CUTS_MAX; 00052 p->vTtElems = Vec_PtrAllocTruthTables( pPars->nVarsMax ); 00053 p->vTtNodes = Vec_PtrAllocSimInfo( 1024, Abc_TruthWordNum(pPars->nVarsMax) ); 00054 p->vCover = Vec_IntAlloc( 1 << 12 ); 00055 p->vLeaves = Vec_PtrAlloc( 32 ); 00056 for ( i = 0; i < 8; i++ ) 00057 p->vSets[i] = Vec_IntAlloc(100); 00058 p->pDsdMan = Kit_DsdManAlloc( pPars->nVarsMax, 64 ); 00059 p->vMemory = Vec_IntAlloc( 1024 * 32 ); 00060 p->vBddDir = Vec_IntAlloc( 256 ); 00061 p->vBddInv = Vec_IntAlloc( 256 ); 00062 // allocate temporary storage for truth tables 00063 nWords = Kit_TruthWordNum(pPars->nVarsMax); 00064 p->ppTruths[0][0] = ALLOC( unsigned, 32 * nWords ); 00065 p->ppTruths[1][0] = p->ppTruths[0][0] + 1 * nWords; 00066 for ( i = 1; i < 2; i++ ) 00067 p->ppTruths[1][i] = p->ppTruths[1][0] + i * nWords; 00068 p->ppTruths[2][0] = p->ppTruths[1][0] + 2 * nWords; 00069 for ( i = 1; i < 4; i++ ) 00070 p->ppTruths[2][i] = p->ppTruths[2][0] + i * nWords; 00071 p->ppTruths[3][0] = p->ppTruths[2][0] + 4 * nWords; 00072 for ( i = 1; i < 8; i++ ) 00073 p->ppTruths[3][i] = p->ppTruths[3][0] + i * nWords; 00074 p->ppTruths[4][0] = p->ppTruths[3][0] + 8 * nWords; 00075 for ( i = 1; i < 16; i++ ) 00076 p->ppTruths[4][i] = p->ppTruths[4][0] + i * nWords; 00077 return p; 00078 } 00079 00091 void Lpk_ManStop( Lpk_Man_t * p ) 00092 { 00093 int i; 00094 free( p->ppTruths[0][0] ); 00095 Vec_IntFree( p->vBddDir ); 00096 Vec_IntFree( p->vBddInv ); 00097 Vec_IntFree( p->vMemory ); 00098 Kit_DsdManFree( p->pDsdMan ); 00099 for ( i = 0; i < 8; i++ ) 00100 Vec_IntFree(p->vSets[i]); 00101 if ( p->pIfMan ) 00102 { 00103 void * pPars = p->pIfMan->pPars; 00104 If_ManStop( p->pIfMan ); 00105 free( pPars ); 00106 } 00107 if ( p->vLevels ) 00108 Vec_VecFree( p->vLevels ); 00109 if ( p->vVisited ) 00110 Vec_VecFree( p->vVisited ); 00111 Vec_PtrFree( p->vLeaves ); 00112 Vec_IntFree( p->vCover ); 00113 Vec_PtrFree( p->vTtElems ); 00114 Vec_PtrFree( p->vTtNodes ); 00115 free( p ); 00116 } 00117 00121 00122