abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
lpkMan.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [lpkMan.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Fast Boolean matching for LUT structures.]
8 
9  Synopsis []
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - April 28, 2007.]
16 
17  Revision [$Id: lpkMan.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "lpkInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis []
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
46 {
47  Lpk_Man_t * p;
48  int i, nWords;
49  assert( pPars->nLutsMax <= 16 );
50  assert( pPars->nVarsMax > 0 && pPars->nVarsMax <= 16 );
51  p = ABC_ALLOC( Lpk_Man_t, 1 );
52  memset( p, 0, sizeof(Lpk_Man_t) );
53  p->pPars = pPars;
55  p->vTtElems = Vec_PtrAllocTruthTables( pPars->nVarsMax );
56  p->vTtNodes = Vec_PtrAllocSimInfo( 1024, Abc_TruthWordNum(pPars->nVarsMax) );
57  p->vCover = Vec_IntAlloc( 1 << 12 );
58  p->vLeaves = Vec_PtrAlloc( 32 );
59  for ( i = 0; i < 8; i++ )
60  p->vSets[i] = Vec_IntAlloc(100);
61  p->pDsdMan = Kit_DsdManAlloc( pPars->nVarsMax, 64 );
62  p->vMemory = Vec_IntAlloc( 1024 * 32 );
63  p->vBddDir = Vec_IntAlloc( 256 );
64  p->vBddInv = Vec_IntAlloc( 256 );
65  // allocate temporary storage for truth tables
66  nWords = Kit_TruthWordNum(pPars->nVarsMax);
67  p->ppTruths[0][0] = ABC_ALLOC( unsigned, 32 * nWords );
68  p->ppTruths[1][0] = p->ppTruths[0][0] + 1 * nWords;
69  for ( i = 1; i < 2; i++ )
70  p->ppTruths[1][i] = p->ppTruths[1][0] + i * nWords;
71  p->ppTruths[2][0] = p->ppTruths[1][0] + 2 * nWords;
72  for ( i = 1; i < 4; i++ )
73  p->ppTruths[2][i] = p->ppTruths[2][0] + i * nWords;
74  p->ppTruths[3][0] = p->ppTruths[2][0] + 4 * nWords;
75  for ( i = 1; i < 8; i++ )
76  p->ppTruths[3][i] = p->ppTruths[3][0] + i * nWords;
77  p->ppTruths[4][0] = p->ppTruths[3][0] + 8 * nWords;
78  for ( i = 1; i < 16; i++ )
79  p->ppTruths[4][i] = p->ppTruths[4][0] + i * nWords;
80  return p;
81 }
82 
83 /**Function*************************************************************
84 
85  Synopsis []
86 
87  Description []
88 
89  SideEffects []
90 
91  SeeAlso []
92 
93 ***********************************************************************/
95 {
96  int i;
97  ABC_FREE( p->ppTruths[0][0] );
98  Vec_IntFree( p->vBddDir );
99  Vec_IntFree( p->vBddInv );
100  Vec_IntFree( p->vMemory );
101  Kit_DsdManFree( p->pDsdMan );
102  for ( i = 0; i < 8; i++ )
103  Vec_IntFree(p->vSets[i]);
104  if ( p->pIfMan )
105  {
106  void * pPars = p->pIfMan->pPars;
107  If_ManStop( p->pIfMan );
108  ABC_FREE( pPars );
109  }
110  if ( p->vLevels )
111  Vec_VecFree( p->vLevels );
112  if ( p->vVisited )
113  Vec_VecFree( p->vVisited );
114  Vec_PtrFree( p->vLeaves );
115  Vec_IntFree( p->vCover );
116  Vec_PtrFree( p->vTtElems );
117  Vec_PtrFree( p->vTtNodes );
118  ABC_FREE( p );
119 }
120 
121 ////////////////////////////////////////////////////////////////////////
122 /// END OF FILE ///
123 ////////////////////////////////////////////////////////////////////////
124 
125 
127 
char * memset()
Lpk_Par_t * pPars
Definition: lpkInt.h:72
static int Kit_TruthWordNum(int nVars)
Definition: kit.h:224
Vec_Vec_t * vVisited
Definition: lpkInt.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Int_t * vBddDir
Definition: lpkInt.h:100
Vec_Int_t * vSets[8]
Definition: lpkInt.h:105
Vec_Int_t * vCover
Definition: lpkInt.h:87
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Kit_DsdMan_t * Kit_DsdManAlloc(int nVars, int nNodes)
DECLARATIONS ///.
Definition: kitDsd.c:45
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
int nWords
Definition: abcNpn.c:127
Vec_Ptr_t * vTtNodes
Definition: lpkInt.h:98
for(p=first;p->value< newval;p=p->next)
void Lpk_ManStop(Lpk_Man_t *p)
Definition: lpkMan.c:94
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
ABC_NAMESPACE_IMPL_START Lpk_Man_t * Lpk_ManStart(Lpk_Par_t *pPars)
DECLARATIONS ///.
Definition: lpkMan.c:45
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
unsigned * ppTruths[5][16]
Definition: lpkInt.h:103
Vec_Vec_t * vLevels
Definition: lpkInt.h:88
int nCutsMax
Definition: lpkInt.h:79
Vec_Ptr_t * vTtElems
Definition: lpkInt.h:97
Vec_Int_t * vBddInv
Definition: lpkInt.h:101
If_Man_t * pIfMan
Definition: lpkInt.h:86
Vec_Int_t * vMemory
Definition: lpkInt.h:99
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Vec_Ptr_t * vLeaves
Definition: lpkInt.h:95
Kit_DsdMan_t * pDsdMan
Definition: lpkInt.h:106
If_Par_t * pPars
Definition: if.h:184
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
typedefABC_NAMESPACE_HEADER_START struct Lpk_Par_t_ Lpk_Par_t
INCLUDES ///.
Definition: lpk.h:42
void Kit_DsdManFree(Kit_DsdMan_t *p)
Definition: kitDsd.c:71
#define assert(ex)
Definition: util_old.h:213
#define LPK_CUTS_MAX
Definition: lpkInt.h:48
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223