abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
llb1Man.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [llb1Man.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [BDD based reachability.]
8 
9  Synopsis [Reachability manager.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: llb1Man.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "llbInt.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  Aig_Obj_t * pObjLi, * pObjLo;
48  int i, iVarLi, iVarLo;
49  assert( p->vNs2Glo == NULL );
50  assert( p->vCs2Glo == NULL );
51  assert( p->vGlo2Cs == NULL );
52  assert( p->vGlo2Ns == NULL );
53  p->vNs2Glo = Vec_IntStartFull( Vec_IntSize(p->vVar2Obj) );
54  p->vCs2Glo = Vec_IntStartFull( Vec_IntSize(p->vVar2Obj) );
55  p->vGlo2Cs = Vec_IntStartFull( Aig_ManRegNum(p->pAig) );
56  p->vGlo2Ns = Vec_IntStartFull( Aig_ManRegNum(p->pAig) );
57  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
58  {
59  iVarLi = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLi));
60  iVarLo = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLo));
61  assert( iVarLi >= 0 && iVarLi < Vec_IntSize(p->vVar2Obj) );
62  assert( iVarLo >= 0 && iVarLo < Vec_IntSize(p->vVar2Obj) );
63  Vec_IntWriteEntry( p->vNs2Glo, iVarLi, i );
64  Vec_IntWriteEntry( p->vCs2Glo, iVarLo, i );
65  Vec_IntWriteEntry( p->vGlo2Cs, i, iVarLo );
66  Vec_IntWriteEntry( p->vGlo2Ns, i, iVarLi );
67  }
68  // add mapping of the PIs
69  Saig_ManForEachPi( p->pAig, pObjLo, i )
70  {
71  iVarLo = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLo));
72  Vec_IntWriteEntry( p->vCs2Glo, iVarLo, Aig_ManRegNum(p->pAig)+i );
73  Vec_IntWriteEntry( p->vNs2Glo, iVarLo, Aig_ManRegNum(p->pAig)+i );
74  }
75 }
76 
77 /**Function*************************************************************
78 
79  Synopsis []
80 
81  Description []
82 
83  SideEffects []
84 
85  SeeAlso []
86 
87 ***********************************************************************/
89 {
90  Llb_Grp_t * pGroup;
91  Aig_Obj_t * pVar;
92  int i, k;
93  assert( p->vVarBegs == NULL );
94  assert( p->vVarEnds == NULL );
95  p->vVarEnds = Vec_IntStart( Aig_ManObjNumMax(p->pAig) );
96  p->vVarBegs = Vec_IntStart( Aig_ManObjNumMax(p->pAig) );
97  Vec_IntFill( p->vVarBegs, Aig_ManObjNumMax(p->pAig), p->pMatrix->nCols );
98 
99  for ( i = 0; i < p->pMatrix->nCols; i++ )
100  {
101  pGroup = p->pMatrix->pColGrps[i];
102 
103  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vIns, pVar, k )
104  if ( Vec_IntEntry(p->vVarBegs, pVar->Id) > i )
105  Vec_IntWriteEntry( p->vVarBegs, pVar->Id, i );
106  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vOuts, pVar, k )
107  if ( Vec_IntEntry(p->vVarBegs, pVar->Id) > i )
108  Vec_IntWriteEntry( p->vVarBegs, pVar->Id, i );
109 
110  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vIns, pVar, k )
111  if ( Vec_IntEntry(p->vVarEnds, pVar->Id) < i )
112  Vec_IntWriteEntry( p->vVarEnds, pVar->Id, i );
113  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vOuts, pVar, k )
114  if ( Vec_IntEntry(p->vVarEnds, pVar->Id) < i )
115  Vec_IntWriteEntry( p->vVarEnds, pVar->Id, i );
116  }
117 }
118 
119 /**Function*************************************************************
120 
121  Synopsis []
122 
123  Description []
124 
125  SideEffects []
126 
127  SeeAlso []
128 
129 ***********************************************************************/
131 {
132  Llb_Grp_t * pGrp;
133  DdNode * bTemp;
134  int i;
135 
136 // Vec_IntFreeP( &p->vMem );
137 // Vec_PtrFreeP( &p->vTops );
138 // Vec_PtrFreeP( &p->vBots );
139 // Vec_VecFreeP( (Vec_Vec_t **)&p->vCuts );
140 
141  if ( p->pMatrix )
142  Llb_MtrFree( p->pMatrix );
143  Vec_PtrForEachEntry( Llb_Grp_t *, p->vGroups, pGrp, i )
144  Llb_ManGroupStop( pGrp );
145  if ( p->dd )
146  {
147 // printf( "Manager dd\n" );
148  Extra_StopManager( p->dd );
149  }
150  if ( p->ddG )
151  {
152 // printf( "Manager ddG\n" );
153  if ( p->ddG->bFunc )
154  Cudd_RecursiveDeref( p->ddG, p->ddG->bFunc );
155  Extra_StopManager( p->ddG );
156  }
157  if ( p->ddR )
158  {
159 // printf( "Manager ddR\n" );
160  if ( p->ddR->bFunc )
161  Cudd_RecursiveDeref( p->ddR, p->ddR->bFunc );
162  Vec_PtrForEachEntry( DdNode *, p->vRings, bTemp, i )
163  Cudd_RecursiveDeref( p->ddR, bTemp );
164  Extra_StopManager( p->ddR );
165  }
166  Aig_ManStop( p->pAig );
167  Vec_PtrFreeP( &p->vGroups );
168  Vec_IntFreeP( &p->vVar2Obj );
169  Vec_IntFreeP( &p->vObj2Var );
170  Vec_IntFreeP( &p->vVarBegs );
171  Vec_IntFreeP( &p->vVarEnds );
172  Vec_PtrFreeP( &p->vRings );
173  Vec_IntFreeP( &p->vNs2Glo );
174  Vec_IntFreeP( &p->vCs2Glo );
175  Vec_IntFreeP( &p->vGlo2Cs );
176  Vec_IntFreeP( &p->vGlo2Ns );
177 // Vec_IntFreeP( &p->vHints );
178  ABC_FREE( p );
179 }
180 
181 
182 /**Function*************************************************************
183 
184  Synopsis []
185 
186  Description []
187 
188  SideEffects []
189 
190  SeeAlso []
191 
192 ***********************************************************************/
193 Llb_Man_t * Llb_ManStart( Aig_Man_t * pAigGlo, Aig_Man_t * pAig, Gia_ParLlb_t * pPars )
194 {
195  Llb_Man_t * p;
196  Aig_ManCleanMarkA( pAig );
197  p = ABC_CALLOC( Llb_Man_t, 1 );
198  p->pAigGlo = pAigGlo;
199  p->pPars = pPars;
200  p->pAig = pAig;
201  p->vVar2Obj = Llb_ManMarkPivotNodes( p->pAig, pPars->fUsePivots );
202  p->vObj2Var = Vec_IntInvert( p->vVar2Obj, -1 );
203  p->vRings = Vec_PtrAlloc( 100 );
206  Aig_ManCleanMarkA( pAig );
207  p->pMatrix = Llb_MtrCreate( p );
208  p->pMatrix->pMan = p;
209  return p;
210 }
211 
212 ////////////////////////////////////////////////////////////////////////
213 /// END OF FILE ///
214 ////////////////////////////////////////////////////////////////////////
215 
216 
218 
void Llb_ManGroupStop(Llb_Grp_t *p)
Definition: llb1Group.c:68
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
ABC_NAMESPACE_IMPL_START void Llb_ManPrepareVarMap(Llb_Man_t *p)
DECLARATIONS ///.
Definition: llb1Man.c:45
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
typedefABC_NAMESPACE_HEADER_START struct Gia_ParLlb_t_ Gia_ParLlb_t
INCLUDES ///.
Definition: llb.h:41
Vec_Int_t * Llb_ManMarkPivotNodes(Aig_Man_t *p, int fUseInternal)
Definition: llb1Pivot.c:220
void Llb_ManPrepareVarLimits(Llb_Man_t *p)
Definition: llb1Man.c:88
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Definition: aig.h:69
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Llb_Mtr_t * Llb_MtrCreate(Llb_Man_t *p)
Definition: llb1Matrix.c:410
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Llb_ManPrepareGroups(Llb_Man_t *pMan)
Definition: llb1Group.c:356
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Llb_Man_t * Llb_ManStart(Aig_Man_t *pAigGlo, Aig_Man_t *pAig, Gia_ParLlb_t *pPars)
Definition: llb1Man.c:193
int Id
Definition: aig.h:85
typedefABC_NAMESPACE_HEADER_START struct Llb_Man_t_ Llb_Man_t
INCLUDES ///.
Definition: llbInt.h:46
void Llb_MtrFree(Llb_Mtr_t *p)
Definition: llb1Matrix.c:321
Vec_Ptr_t * vOuts
Definition: llbInt.h:98
Vec_Ptr_t * vIns
Definition: llbInt.h:97
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Llb_ManStop(Llb_Man_t *p)
Definition: llb1Man.c:130