abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
llb1Pivot.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [llb1Pivot.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [BDD based reachability.]
8 
9  Synopsis [Determining pivot variables.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: llb1Pivot.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 * pFanout;
48  int k, iFan = -1;
49  if ( Aig_ObjIsTravIdPrevious(p, pObj) )
50  return 0;
51  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
52  return 1;
53  if ( Saig_ObjIsLi(p, pObj) )
54  return 0;
55  if ( Saig_ObjIsPo(p, pObj) )
56  return 0;
57  if ( pObj == pPivot )
58  return 1;
59  assert( Aig_ObjIsCand(pObj) );
60  Aig_ObjForEachFanout( p, pObj, pFanout, iFan, k )
61  if ( !Llb_ManTracePaths_rec( p, pFanout, pPivot ) )
62  {
63  Aig_ObjSetTravIdPrevious(p, pObj);
64  return 0;
65  }
66  Aig_ObjSetTravIdCurrent(p, pObj);
67  return 1;
68 }
69 
70 /**Function*************************************************************
71 
72  Synopsis []
73 
74  Description []
75 
76  SideEffects []
77 
78  SeeAlso []
79 
80 ***********************************************************************/
82 {
83  Aig_Obj_t * pObj;
84  int i, Counter = 0;
85  Aig_ManIncrementTravId( p ); // prev = visited with path to LI (value 0)
86  Aig_ManIncrementTravId( p ); // cur = visited w/o path to LI (value 1)
87  Saig_ManForEachLo( p, pObj, i )
88  Counter += Llb_ManTracePaths_rec( p, pObj, pPivot );
89  return Counter;
90 }
91 
92 /**Function*************************************************************
93 
94  Synopsis []
95 
96  Description []
97 
98  SideEffects []
99 
100  SeeAlso []
101 
102 ***********************************************************************/
104 {
105  Aig_Obj_t * pObj;
106  int i, Count;
107  Aig_ManFanoutStart( p );
108  Aig_ManForEachNode( p, pObj, i )
109  {
110  if ( Aig_ObjRefs(pObj) <= 1 )
111  continue;
112  Count = Llb_ManTracePaths( p, pObj );
113  printf( "Obj =%5d. Lev =%3d. Fanout =%5d. Count = %3d.\n",
114  i, Aig_ObjLevel(pObj), Aig_ObjRefs(pObj), Count );
115  }
116  Aig_ManFanoutStop( p );
117 }
118 
119 /**Function*************************************************************
120 
121  Synopsis []
122 
123  Description []
124 
125  SideEffects []
126 
127  SeeAlso []
128 
129 ***********************************************************************/
131 {
132  if ( pObj->fMarkB )
133  return;
134  pObj->fMarkB = 1;
135  assert( Aig_ObjIsNode(pObj) );
138 }
139 
140 /**Function*************************************************************
141 
142  Synopsis [Determine starting cut-points.]
143 
144  Description []
145 
146  SideEffects []
147 
148  SeeAlso []
149 
150 ***********************************************************************/
152 {
153  Aig_Obj_t * pObj;
154  int i;
155  // mark const and PIs
156  Aig_ManConst1(p)->fMarkB = 1;
157  Aig_ManForEachCi( p, pObj, i )
158  pObj->fMarkB = 1;
159  // mark cones
160  Saig_ManForEachLi( p, pObj, i )
162 }
163 
164 /**Function*************************************************************
165 
166  Synopsis [Determine starting cut-points.]
167 
168  Description []
169 
170  SideEffects []
171 
172  SeeAlso []
173 
174 ***********************************************************************/
176 {
177  Vec_Ptr_t * vMuxes;
178  Aig_Obj_t * pObj;
179  int i, Counter = 0;
180 
181  // remove refs due to MUXes
182  vMuxes = Aig_ManMuxesCollect( p );
183  Aig_ManMuxesDeref( p, vMuxes );
184 
185  // mark nodes feeding into LIs
186  Aig_ManCleanMarkB( p );
187  Llb_ManLabelLiCones( p );
188 
189  // mark internal nodes
190  Aig_ManFanoutStart( p );
191  Aig_ManForEachNode( p, pObj, i )
192  if ( pObj->fMarkB && pObj->nRefs > 1 )
193  {
194  if ( Llb_ManTracePaths(p, pObj) > 0 )
195  pObj->fMarkA = 1;
196  Counter++;
197  }
198  Aig_ManFanoutStop( p );
199 // printf( "TracePath tried = %d.\n", Counter );
200 
201  // mark nodes feeding into LIs
202  Aig_ManCleanMarkB( p );
203 
204  // add refs due to MUXes
205  Aig_ManMuxesRef( p, vMuxes );
206  Vec_PtrFree( vMuxes );
207 }
208 
209 /**Function*************************************************************
210 
211  Synopsis [Determine starting cut-points.]
212 
213  Description []
214 
215  SideEffects []
216 
217  SeeAlso []
218 
219 ***********************************************************************/
220 Vec_Int_t * Llb_ManMarkPivotNodes( Aig_Man_t * p, int fUseInternal )
221 {
222  Vec_Int_t * vVar2Obj;
223  Aig_Obj_t * pObj;
224  int i;
225  // mark inputs/outputs
226  Aig_ManForEachCi( p, pObj, i )
227  pObj->fMarkA = 1;
228  Saig_ManForEachLi( p, pObj, i )
229  pObj->fMarkA = 1;
230 
231  // mark internal pivot nodes
232  if ( fUseInternal )
234 
235  // assign variable numbers
236  Aig_ManConst1(p)->fMarkA = 0;
237  vVar2Obj = Vec_IntAlloc( 100 );
238  Aig_ManForEachCi( p, pObj, i )
239  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
240  Aig_ManForEachNode( p, pObj, i )
241  if ( pObj->fMarkA )
242  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
243  Saig_ManForEachLi( p, pObj, i )
244  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
245  return vVar2Obj;
246 }
247 
248 ////////////////////////////////////////////////////////////////////////
249 /// END OF FILE ///
250 ////////////////////////////////////////////////////////////////////////
251 
252 
254 
static int Aig_ObjIsTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:296
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
int Llb_ManTracePaths(Aig_Man_t *p, Aig_Obj_t *pPivot)
Definition: llb1Pivot.c:81
Vec_Ptr_t * Aig_ManMuxesCollect(Aig_Man_t *pAig)
Definition: aigUtil.c:1460
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition: aigUtil.c:167
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
unsigned int fMarkA
Definition: aig.h:79
Vec_Int_t * Llb_ManMarkPivotNodes(Aig_Man_t *p, int fUseInternal)
Definition: llb1Pivot.c:220
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Saig_ObjIsLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:85
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Llb_ManLabelLiCones(Aig_Man_t *p)
Definition: llb1Pivot.c:151
void Aig_ManMuxesRef(Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
Definition: aigUtil.c:1513
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
ABC_NAMESPACE_IMPL_START int Llb_ManTracePaths_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pPivot)
DECLARATIONS ///.
Definition: llb1Pivot.c:45
static int Saig_ObjIsPo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:83
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
void Aig_ManMuxesDeref(Aig_Man_t *pAig, Vec_Ptr_t *vMuxes)
Definition: aigUtil.c:1483
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
void Llb_ManMarkInternalPivots(Aig_Man_t *p)
Definition: llb1Pivot.c:175
static void Aig_ObjSetTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:294
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static int Aig_ObjIsCand(Aig_Obj_t *pObj)
Definition: aig.h:284
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
void Llb_ManTestCuts(Aig_Man_t *p)
Definition: llb1Pivot.c:103
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
unsigned int nRefs
Definition: aig.h:81
void Llb_ManLabelLiCones_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: llb1Pivot.c:130
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223