blob: f012ab751ad843c92161cf93047e93cb218bb1c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/**CFile****************************************************************
FileName [lpkMan.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Fast Boolean matching for LUT structures.]
Synopsis []
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - April 28, 2007.]
Revision [$Id: lpkMan.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
***********************************************************************/
#include "lpkInt.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Lpk_Man_t * Lpk_ManStart( Lpk_Par_t * pPars )
{
Lpk_Man_t * p;
int i, nWords;
assert( pPars->nLutsMax <= 16 );
assert( pPars->nVarsMax > 0 && pPars->nVarsMax <= 16 );
p = ABC_ALLOC( Lpk_Man_t, 1 );
memset( p, 0, sizeof(Lpk_Man_t) );
p->pPars = pPars;
p->nCutsMax = LPK_CUTS_MAX;
p->vTtElems = Vec_PtrAllocTruthTables( pPars->nVarsMax );
p->vTtNodes = Vec_PtrAllocSimInfo( 1024, Abc_TruthWordNum(pPars->nVarsMax) );
p->vCover = Vec_IntAlloc( 1 << 12 );
p->vLeaves = Vec_PtrAlloc( 32 );
for ( i = 0; i < 8; i++ )
p->vSets[i] = Vec_IntAlloc(100);
p->pDsdMan = Kit_DsdManAlloc( pPars->nVarsMax, 64 );
p->vMemory = Vec_IntAlloc( 1024 * 32 );
p->vBddDir = Vec_IntAlloc( 256 );
p->vBddInv = Vec_IntAlloc( 256 );
// allocate temporary storage for truth tables
nWords = Kit_TruthWordNum(pPars->nVarsMax);
p->ppTruths[0][0] = ABC_ALLOC( unsigned, 32 * nWords );
p->ppTruths[1][0] = p->ppTruths[0][0] + 1 * nWords;
for ( i = 1; i < 2; i++ )
p->ppTruths[1][i] = p->ppTruths[1][0] + i * nWords;
p->ppTruths[2][0] = p->ppTruths[1][0] + 2 * nWords;
for ( i = 1; i < 4; i++ )
p->ppTruths[2][i] = p->ppTruths[2][0] + i * nWords;
p->ppTruths[3][0] = p->ppTruths[2][0] + 4 * nWords;
for ( i = 1; i < 8; i++ )
p->ppTruths[3][i] = p->ppTruths[3][0] + i * nWords;
p->ppTruths[4][0] = p->ppTruths[3][0] + 8 * nWords;
for ( i = 1; i < 16; i++ )
p->ppTruths[4][i] = p->ppTruths[4][0] + i * nWords;
return p;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Lpk_ManStop( Lpk_Man_t * p )
{
int i;
ABC_FREE( p->ppTruths[0][0] );
Vec_IntFree( p->vBddDir );
Vec_IntFree( p->vBddInv );
Vec_IntFree( p->vMemory );
Kit_DsdManFree( p->pDsdMan );
for ( i = 0; i < 8; i++ )
Vec_IntFree(p->vSets[i]);
if ( p->pIfMan )
{
void * pPars = p->pIfMan->pPars;
If_ManStop( p->pIfMan );
ABC_FREE( pPars );
}
if ( p->vLevels )
Vec_VecFree( p->vLevels );
if ( p->vVisited )
Vec_VecFree( p->vVisited );
Vec_PtrFree( p->vLeaves );
Vec_IntFree( p->vCover );
Vec_PtrFree( p->vTtElems );
Vec_PtrFree( p->vTtNodes );
ABC_FREE( p );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
|