abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cgtAig.c File Reference
#include "cgtInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Cgt_ManDetectCandidates_rec (Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
 DECLARATIONS ///. More...
 
void Cgt_ManDetectCandidates (Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
 MACRO DEFINITIONS ///. More...
 
void Cgt_ManDetectFanout_rec (Aig_Man_t *pAig, Aig_Obj_t *pObj, int nOdcMax, Vec_Ptr_t *vFanout)
 
void Cgt_ManDetectFanout (Aig_Man_t *pAig, Aig_Obj_t *pObj, int nOdcMax, Vec_Ptr_t *vFanout)
 
void Cgt_ManCollectVisited_rec (Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vVisited)
 
void Cgt_ManCollectVisited (Aig_Man_t *pAig, Vec_Ptr_t *vFanout, Vec_Ptr_t *vVisited)
 
static Aig_Obj_tAig_ObjChild0CopyVec (Vec_Ptr_t *vCopy, Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild1CopyVec (Vec_Ptr_t *vCopy, Aig_Obj_t *pObj)
 
Aig_Obj_tCgt_ManConstructCareCondition (Cgt_Man_t *p, Aig_Man_t *pNew, Aig_Obj_t *pObjLo, Vec_Ptr_t *vCopy0, Vec_Ptr_t *vCopy1)
 
Aig_Man_tCgt_ManDeriveAigForGating (Cgt_Man_t *p)
 
Aig_Obj_tCgt_ManConstructCare_rec (Aig_Man_t *pCare, Aig_Obj_t *pObj, Aig_Man_t *pNew)
 
void Cgt_ManConstructCare (Aig_Man_t *pNew, Aig_Man_t *pCare, Vec_Vec_t *vSuppsInv, Vec_Ptr_t *vLeaves)
 
Aig_Obj_tCgt_ManDupPartition_rec (Aig_Man_t *pNew, Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vLeaves)
 
Aig_Man_tCgt_ManDupPartition (Aig_Man_t *pFrame, int nVarsMin, int nFlopsMin, int iStart, Aig_Man_t *pCare, Vec_Vec_t *vSuppsInv, int *pnOutputs)
 
Aig_Obj_tCgt_ManBuildClockGate (Aig_Man_t *pNew, Vec_Ptr_t *vGates)
 
Aig_Man_tCgt_ManDeriveGatedAig (Aig_Man_t *pAig, Vec_Vec_t *vGates, int fReduce, int *pnUsedNodes)
 

Function Documentation

static Aig_Obj_t* Aig_ObjChild0CopyVec ( Vec_Ptr_t vCopy,
Aig_Obj_t pObj 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file cgtAig.c.

197 { return Aig_NotCond((Aig_Obj_t *)Vec_PtrEntry(vCopy, Aig_ObjFaninId0(pObj)), Aig_ObjFaninC0(pObj)); }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Aig_ObjChild1CopyVec ( Vec_Ptr_t vCopy,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 198 of file cgtAig.c.

199 { return Aig_NotCond((Aig_Obj_t *)Vec_PtrEntry(vCopy, Aig_ObjFaninId1(pObj)), Aig_ObjFaninC1(pObj)); }
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t* Cgt_ManBuildClockGate ( Aig_Man_t pNew,
Vec_Ptr_t vGates 
)

Function*************************************************************

Synopsis [Implements one clock-gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 496 of file cgtAig.c.

497 {
498  Aig_Obj_t * pGate, * pTotal;
499  int i;
500  assert( Vec_PtrSize(vGates) > 0 );
501  pTotal = Aig_ManConst0(pNew);
502  Vec_PtrForEachEntry( Aig_Obj_t *, vGates, pGate, i )
503  {
504  if ( Aig_Regular(pGate)->pNext )
505  pGate = Aig_NotCond( Aig_Regular(pGate)->pNext, Aig_IsComplement(pGate) );
506  else
507  pGate = Aig_NotCond( (Aig_Obj_t *)Aig_Regular(pGate)->pData, Aig_IsComplement(pGate) );
508  pTotal = Aig_Or( pNew, pTotal, pGate );
509  }
510  return pTotal;
511 }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Cgt_ManCollectVisited ( Aig_Man_t pAig,
Vec_Ptr_t vFanout,
Vec_Ptr_t vVisited 
)

Function*************************************************************

Synopsis [Computes visited nodes in the topological order.]

Description []

SideEffects []

SeeAlso []

Definition at line 175 of file cgtAig.c.

176 {
177  Aig_Obj_t * pObj;
178  int i;
179  Vec_PtrClear( vVisited );
180  Aig_ManIncrementTravId( pAig );
181  Vec_PtrForEachEntry( Aig_Obj_t *, vFanout, pObj, i )
182  Cgt_ManCollectVisited_rec( pAig, pObj, vVisited );
183 }
void Cgt_ManCollectVisited_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vVisited)
Definition: cgtAig.c:151
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Cgt_ManCollectVisited_rec ( Aig_Man_t pAig,
Aig_Obj_t pObj,
Vec_Ptr_t vVisited 
)

Function*************************************************************

Synopsis [Computes visited nodes in the topological order.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file cgtAig.c.

152 {
153  if ( Aig_ObjIsCi(pObj) )
154  return;
155  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
156  return;
157  Aig_ObjSetTravIdCurrent(pAig, pObj);
158  assert( Aig_ObjIsNode(pObj) );
159  Cgt_ManCollectVisited_rec( pAig, Aig_ObjFanin0(pObj), vVisited );
160  Cgt_ManCollectVisited_rec( pAig, Aig_ObjFanin1(pObj), vVisited );
161  Vec_PtrPush( vVisited, pObj );
162 }
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
void Cgt_ManCollectVisited_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vVisited)
Definition: cgtAig.c:151
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
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 Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Cgt_ManConstructCare ( Aig_Man_t pNew,
Aig_Man_t pCare,
Vec_Vec_t vSuppsInv,
Vec_Ptr_t vLeaves 
)

Function*************************************************************

Synopsis [Builds constraints belonging to the given partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 368 of file cgtAig.c.

369 {
370  Vec_Int_t * vOuts;
371  Aig_Obj_t * pLeaf, * pPi, * pPo, * pObjAig;
372  int i, k, iOut;
373  // go through the PIs of the partition
374  // label the corresponding PIs of the care set
375  Aig_ManIncrementTravId( pCare );
376  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pLeaf, i )
377  {
378  pPi = Aig_ManCi( pCare, Aig_ObjCioId(pLeaf) );
379  Aig_ObjSetTravIdCurrent( pCare, pPi );
380  pPi->pData = pLeaf->pData;
381  }
382  // construct the constraints
383  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pLeaf, i )
384  {
385  vOuts = Vec_VecEntryInt( vSuppsInv, Aig_ObjCioId(pLeaf) );
386  Vec_IntForEachEntry( vOuts, iOut, k )
387  {
388  pPo = Aig_ManCo( pCare, iOut );
389  if ( Aig_ObjIsTravIdCurrent( pCare, pPo ) )
390  continue;
391  Aig_ObjSetTravIdCurrent( pCare, pPo );
392  if ( Aig_ObjFanin0(pPo) == Aig_ManConst1(pCare) )
393  continue;
394  pObjAig = Cgt_ManConstructCare_rec( pCare, Aig_ObjFanin0(pPo), pNew );
395  if ( pObjAig == NULL )
396  continue;
397  pObjAig = Aig_NotCond( pObjAig, Aig_ObjFaninC0(pPo) );
398  Aig_ObjCreateCo( pNew, pObjAig );
399  }
400  }
401 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
Definition: vecVec.h:276
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
Aig_Obj_t * Cgt_ManConstructCare_rec(Aig_Man_t *pCare, Aig_Obj_t *pObj, Aig_Man_t *pNew)
Definition: cgtAig.c:338
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
Aig_Obj_t* Cgt_ManConstructCare_rec ( Aig_Man_t pCare,
Aig_Obj_t pObj,
Aig_Man_t pNew 
)

Function*************************************************************

Synopsis [Adds relevant constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 338 of file cgtAig.c.

339 {
340  Aig_Obj_t * pObj0, * pObj1;
341  if ( Aig_ObjIsTravIdCurrent( pCare, pObj ) )
342  return (Aig_Obj_t *)pObj->pData;
343  Aig_ObjSetTravIdCurrent( pCare, pObj );
344  if ( Aig_ObjIsCi(pObj) )
345  return (Aig_Obj_t *)(pObj->pData = NULL);
346  pObj0 = Cgt_ManConstructCare_rec( pCare, Aig_ObjFanin0(pObj), pNew );
347  if ( pObj0 == NULL )
348  return (Aig_Obj_t *)(pObj->pData = NULL);
349  pObj1 = Cgt_ManConstructCare_rec( pCare, Aig_ObjFanin1(pObj), pNew );
350  if ( pObj1 == NULL )
351  return (Aig_Obj_t *)(pObj->pData = NULL);
352  pObj0 = Aig_NotCond( pObj0, Aig_ObjFaninC0(pObj) );
353  pObj1 = Aig_NotCond( pObj1, Aig_ObjFaninC1(pObj) );
354  return (Aig_Obj_t *)(pObj->pData = Aig_And( pNew, pObj0, pObj1 ));
355 }
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
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
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
Aig_Obj_t * Cgt_ManConstructCare_rec(Aig_Man_t *pCare, Aig_Obj_t *pObj, Aig_Man_t *pNew)
Definition: cgtAig.c:338
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t* Cgt_ManConstructCareCondition ( Cgt_Man_t p,
Aig_Man_t pNew,
Aig_Obj_t pObjLo,
Vec_Ptr_t vCopy0,
Vec_Ptr_t vCopy1 
)

Function*************************************************************

Synopsis [Derives miter for clock-gating.]

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file cgtAig.c.

213 {
214  Aig_Obj_t * pMiter, * pObj, * pTemp;
215  int i;
216  assert( Aig_ObjIsCi(pObjLo) );
217  // detect nodes and their cone
218  Cgt_ManDetectFanout( p->pAig, pObjLo, p->pPars->nOdcMax, p->vFanout );
219  Cgt_ManCollectVisited( p->pAig, p->vFanout, p->vVisited );
220  // add new variables if the observability condition depends on PI variables
221  Vec_PtrForEachEntry( Aig_Obj_t *, p->vVisited, pObj, i )
222  {
223  assert( Aig_ObjIsNode(pObj) );
224  if ( Saig_ObjIsPi(p->pAig, Aig_ObjFanin0(pObj)) && Vec_PtrEntry(vCopy0, Aig_ObjFaninId0(pObj)) == NULL )
225  {
226  pTemp = Aig_ObjCreateCi( pNew );
227  Vec_PtrWriteEntry( vCopy0, Aig_ObjFaninId0(pObj), pTemp );
228  Vec_PtrWriteEntry( vCopy1, Aig_ObjFaninId0(pObj), pTemp );
229  }
230  if ( Saig_ObjIsPi(p->pAig, Aig_ObjFanin1(pObj)) && Vec_PtrEntry(vCopy0, Aig_ObjFaninId1(pObj)) == NULL )
231  {
232  pTemp = Aig_ObjCreateCi( pNew );
233  Vec_PtrWriteEntry( vCopy0, Aig_ObjFaninId1(pObj), pTemp );
234  Vec_PtrWriteEntry( vCopy1, Aig_ObjFaninId1(pObj), pTemp );
235  }
236  }
237  // construct AIGs for the nodes
238  Vec_PtrForEachEntry( Aig_Obj_t *, p->vVisited, pObj, i )
239  {
240  pTemp = Aig_And( pNew, Aig_ObjChild0CopyVec(vCopy0, pObj), Aig_ObjChild1CopyVec(vCopy0, pObj) );
241  Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObj), pTemp );
242  pTemp = Aig_And( pNew, Aig_ObjChild0CopyVec(vCopy1, pObj), Aig_ObjChild1CopyVec(vCopy1, pObj) );
243  Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObj), pTemp );
244  }
245  // construct the care miter
246  pMiter = Aig_ManConst0( pNew );
247  Vec_PtrForEachEntry( Aig_Obj_t *, p->vFanout, pObj, i )
248  {
249  pTemp = Aig_Exor( pNew, (Aig_Obj_t *)Vec_PtrEntry(vCopy0, Aig_ObjId(pObj)), (Aig_Obj_t *)Vec_PtrEntry(vCopy1, Aig_ObjId(pObj)) );
250  pMiter = Aig_Or( pNew, pMiter, pTemp );
251  }
252  return pMiter;
253 }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjChild1CopyVec(Vec_Ptr_t *vCopy, Aig_Obj_t *pObj)
Definition: cgtAig.c:198
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
Definition: aig.h:305
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
void Cgt_ManCollectVisited(Aig_Man_t *pAig, Vec_Ptr_t *vFanout, Vec_Ptr_t *vVisited)
Definition: cgtAig.c:175
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static Aig_Obj_t * Aig_ObjChild0CopyVec(Vec_Ptr_t *vCopy, Aig_Obj_t *pObj)
Definition: cgtAig.c:196
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Cgt_ManDetectFanout(Aig_Man_t *pAig, Aig_Obj_t *pObj, int nOdcMax, Vec_Ptr_t *vFanout)
Definition: cgtAig.c:115
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
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
Aig_Man_t* Cgt_ManDeriveAigForGating ( Cgt_Man_t p)

Function*************************************************************

Synopsis [Derives AIG for clock-gating.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file cgtAig.c.

267 {
268  Aig_Man_t * pNew;
269  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pCare, * pMiter;
270  Vec_Ptr_t * vCopy0, * vCopy1;
271  int i;
272  assert( Aig_ManRegNum(p->pAig) );
273  pNew = Aig_ManStart( Aig_ManObjNumMax(p->pAig) );
274  pNew->pName = Abc_UtilStrsav( "CG_miter" );
275  // build the first frame
277  Aig_ManForEachCi( p->pAig, pObj, i )
278  pObj->pData = Aig_ObjCreateCi( pNew );
279  Aig_ManForEachNode( p->pAig, pObj, i )
280  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
281 // Saig_ManForEachPo( p->pAig, pObj, i )
282 // pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
283  if ( p->pPars->nOdcMax > 0 )
284  {
285  // create storage for observability conditions
286  vCopy0 = Vec_PtrStart( Aig_ManObjNumMax(p->pAig) );
287  vCopy1 = Vec_PtrStart( Aig_ManObjNumMax(p->pAig) );
288  // initialize register outputs
289  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
290  {
291  Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
292  Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
293  }
294  // compute observability condition for each latch output
295  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
296  {
297  // set the constants
298  Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ManConst0(pNew) );
299  Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ManConst1(pNew) );
300  // compute condition
301  pCare = Cgt_ManConstructCareCondition( p, pNew, pObjLo, vCopy0, vCopy1 );
302  // restore the values
303  Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
304  Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
305  // compute the miter
306  pMiter = Aig_Exor( pNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
307  pMiter = Aig_And( pNew, pMiter, pCare );
308  pObjLi->pData = Aig_ObjCreateCo( pNew, pMiter );
309  }
310  Vec_PtrFree( vCopy0 );
311  Vec_PtrFree( vCopy1 );
312  }
313  else
314  {
315  // construct clock-gating miters for each register input
316  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
317  {
318  pMiter = Aig_Exor( pNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
319  pObjLi->pData = Aig_ObjCreateCo( pNew, pMiter );
320  }
321  }
322  Aig_ManCleanup( pNew );
323  Aig_ManSetCioIds( pNew );
324  return pNew;
325 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Aig_Man_t * pAig
Definition: llb3Image.c:49
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
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
void * pData
Definition: aig.h:87
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:220
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Aig_Obj_t * Cgt_ManConstructCareCondition(Cgt_Man_t *p, Aig_Man_t *pNew, Aig_Obj_t *pObjLo, Vec_Ptr_t *vCopy0, Vec_Ptr_t *vCopy1)
Definition: cgtAig.c:212
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Cgt_ManDeriveGatedAig ( Aig_Man_t pAig,
Vec_Vec_t vGates,
int  fReduce,
int *  pnUsedNodes 
)

Function*************************************************************

Synopsis [Derives AIG after clock-gating.]

Description [The array contains, for each flop, its gate if present.]

SideEffects []

SeeAlso []

Definition at line 524 of file cgtAig.c.

525 {
526  Aig_Man_t * pNew;
527  Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo, * pGateNew;
528  Vec_Ptr_t * vOne;
529  int i, k;
530  Aig_ManCleanNext( pAig );
531  // label nodes
532  Vec_VecForEachEntry( Aig_Obj_t *, vGates, pObj, i, k )
533  {
534  if ( Aig_IsComplement(pObj) )
535  Aig_Regular(pObj)->fMarkB = 1;
536  else
537  Aig_Regular(pObj)->fMarkA = 1;
538  }
539  // construct AIG
540  assert( Aig_ManRegNum(pAig) );
541  pNew = Aig_ManStart( Aig_ManObjNumMax(pAig) );
542  pNew->pName = Abc_UtilStrsav( pAig->pName );
543  pNew->pSpec = Abc_UtilStrsav( pAig->pSpec );
544  Aig_ManConst1(pAig)->pData = Aig_ManConst1(pNew);
545  Aig_ManForEachCi( pAig, pObj, i )
546  pObj->pData = Aig_ObjCreateCi( pNew );
547  if ( fReduce )
548  {
549  Aig_ManForEachNode( pAig, pObj, i )
550  {
551  assert( !(pObj->fMarkA && pObj->fMarkB) );
552  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
553  if ( pObj->fMarkA )
554  {
555  pObj->pNext = (Aig_Obj_t *)pObj->pData;
556  pObj->pData = Aig_ManConst0(pNew);
557  }
558  else if ( pObj->fMarkB )
559  {
560  pObj->pNext = (Aig_Obj_t *)pObj->pData;
561  pObj->pData = Aig_ManConst1(pNew);
562  }
563  }
564  }
565  else
566  {
567  Aig_ManForEachNode( pAig, pObj, i )
568  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
569  }
570  if ( pnUsedNodes != NULL )
571  *pnUsedNodes = Aig_ManNodeNum(pNew);
572  Saig_ManForEachPo( pAig, pObj, i )
573  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
574  Saig_ManForEachLiLo( pAig, pObjLi, pObjLo, i )
575  {
576  vOne = Vec_VecEntry( vGates, i );
577  if ( Vec_PtrSize(vOne) == 0 )
578  pObjNew = Aig_ObjChild0Copy(pObjLi);
579  else
580  {
581 // pGateNew = Aig_NotCond( Aig_Regular(pGate)->pData, Aig_IsComplement(pGate) );
582  pGateNew = Cgt_ManBuildClockGate( pNew, vOne );
583  pObjNew = Aig_Mux( pNew, pGateNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
584  }
585  pObjLi->pData = Aig_ObjCreateCo( pNew, pObjNew );
586  }
587  Aig_ManCleanup( pNew );
588  Aig_ManSetRegNum( pNew, Aig_ManRegNum(pAig) );
589  // unlabel nodes
590  Aig_ManCleanMarkAB( pAig );
591  Aig_ManCleanNext( pAig );
592  return pNew;
593 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
void * pData
Definition: aig.h:87
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition: vecVec.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Obj_t * Cgt_ManBuildClockGate(Aig_Man_t *pNew, Vec_Ptr_t *vGates)
Definition: cgtAig.c:496
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
Aig_Obj_t * pNext
Definition: aig.h:72
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_Obj_t * Aig_Mux(Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
Definition: aigOper.c:317
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition: aigUtil.c:186
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
void Aig_ManCleanNext(Aig_Man_t *p)
Definition: aigUtil.c:224
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
Definition: vecVec.h:271
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
void Cgt_ManDetectCandidates ( Aig_Man_t pAig,
Vec_Int_t vUseful,
Aig_Obj_t pObj,
int  nLevelMax,
Vec_Ptr_t vCands 
)

MACRO DEFINITIONS ///.

Function*************************************************************

Synopsis [Computes transitive fanout cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file cgtAig.c.

71 {
72  Vec_PtrClear( vCands );
73  if ( !Aig_ObjIsNode(pObj) )
74  return;
75  Aig_ManIncrementTravId( pAig );
76  Cgt_ManDetectCandidates_rec( pAig, vUseful, pObj, nLevelMax, vCands );
77 }
ABC_NAMESPACE_IMPL_START void Cgt_ManDetectCandidates_rec(Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
DECLARATIONS ///.
Definition: cgtAig.c:45
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_NAMESPACE_IMPL_START void Cgt_ManDetectCandidates_rec ( Aig_Man_t pAig,
Vec_Int_t vUseful,
Aig_Obj_t pObj,
int  nLevelMax,
Vec_Ptr_t vCands 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [cgtAig.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Clock gating package.]

Synopsis [Creates AIG to compute clock-gating.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cgtAig.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Computes transitive fanout cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cgtAig.c.

46 {
47  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
48  return;
49  Aig_ObjSetTravIdCurrent(pAig, pObj);
50  if ( Aig_ObjIsNode(pObj) )
51  {
52  Cgt_ManDetectCandidates_rec( pAig, vUseful, Aig_ObjFanin0(pObj), nLevelMax, vCands );
53  Cgt_ManDetectCandidates_rec( pAig, vUseful, Aig_ObjFanin1(pObj), nLevelMax, vCands );
54  }
55  if ( Aig_ObjLevel(pObj) <= nLevelMax && (vUseful == NULL || Vec_IntEntry(vUseful, Aig_ObjId(pObj))) )
56  Vec_PtrPush( vCands, pObj );
57 }
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
ABC_NAMESPACE_IMPL_START void Cgt_ManDetectCandidates_rec(Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
DECLARATIONS ///.
Definition: cgtAig.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
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 Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
void Cgt_ManDetectFanout ( Aig_Man_t pAig,
Aig_Obj_t pObj,
int  nOdcMax,
Vec_Ptr_t vFanout 
)

Function*************************************************************

Synopsis [Computes transitive fanout cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file cgtAig.c.

116 {
117  Aig_Obj_t * pFanout;
118  int i, k, f, iFanout = -1;
119  // collect visited nodes
120  Vec_PtrClear( vFanout );
121  Aig_ManIncrementTravId( pAig );
122  Cgt_ManDetectFanout_rec( pAig, pObj, nOdcMax, vFanout );
123  // remove those nodes whose fanout is included
124  k = 0;
125  Vec_PtrForEachEntry( Aig_Obj_t *, vFanout, pObj, i )
126  {
127  // go through the fanouts of this node
128  Aig_ObjForEachFanout( pAig, pObj, pFanout, iFanout, f )
129  if ( !Aig_ObjIsTravIdCurrent(pAig, pFanout) )
130  break;
131  if ( f == Aig_ObjRefs(pObj) ) // all fanouts are included
132  continue;
133  Vec_PtrWriteEntry( vFanout, k++, pObj );
134  }
135  Vec_PtrShrink( vFanout, k );
136  Vec_PtrSort( vFanout, (int (*)(void))Aig_ObjCompareIdIncrease );
137  assert( Vec_PtrSize(vFanout) > 0 );
138 }
int Aig_ObjCompareIdIncrease(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
Definition: aigUtil.c:496
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Cgt_ManDetectFanout_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, int nOdcMax, Vec_Ptr_t *vFanout)
Definition: cgtAig.c:90
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
void Cgt_ManDetectFanout_rec ( Aig_Man_t pAig,
Aig_Obj_t pObj,
int  nOdcMax,
Vec_Ptr_t vFanout 
)

Function*************************************************************

Synopsis [Computes transitive fanout cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file cgtAig.c.

91 {
92  Aig_Obj_t * pFanout;
93  int f, iFanout = -1;
94  if ( Aig_ObjIsCo(pObj) || Aig_ObjLevel(pObj) > nOdcMax )
95  return;
96  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
97  return;
98  Aig_ObjSetTravIdCurrent(pAig, pObj);
99  Vec_PtrPush( vFanout, pObj );
100  Aig_ObjForEachFanout( pAig, pObj, pFanout, iFanout, f )
101  Cgt_ManDetectFanout_rec( pAig, pFanout, nOdcMax, vFanout );
102 }
#define Aig_ObjForEachFanout(p, pObj, pFanout, iFan, i)
Definition: aig.h:427
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
Definition: aig.h:69
void Cgt_ManDetectFanout_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, int nOdcMax, Vec_Ptr_t *vFanout)
Definition: cgtAig.c:90
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Cgt_ManDupPartition ( Aig_Man_t pFrame,
int  nVarsMin,
int  nFlopsMin,
int  iStart,
Aig_Man_t pCare,
Vec_Vec_t vSuppsInv,
int *  pnOutputs 
)

Function*************************************************************

Synopsis [Duplicates register outputs starting from the given one.]

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file cgtAig.c.

442 {
443  Vec_Ptr_t * vRoots, * vLeaves, * vPos;
444  Aig_Man_t * pNew;
445  Aig_Obj_t * pObj;
446  int i;
447  assert( Aig_ManRegNum(pFrame) == 0 );
448  vRoots = Vec_PtrAlloc( 100 );
449  vLeaves = Vec_PtrAlloc( 100 );
450  vPos = Vec_PtrAlloc( 100 );
451  pNew = Aig_ManStart( nVarsMin );
452  pNew->pName = Abc_UtilStrsav( "partition" );
453  Aig_ManIncrementTravId( pFrame );
454  Aig_ManConst1(pFrame)->pData = Aig_ManConst1(pNew);
455  Aig_ObjSetTravIdCurrent( pFrame, Aig_ManConst1(pFrame) );
456  for ( i = iStart; i < iStart + nFlopsMin && i < Aig_ManCoNum(pFrame); i++ )
457  {
458  pObj = Aig_ManCo( pFrame, i );
459  Cgt_ManDupPartition_rec( pNew, pFrame, Aig_ObjFanin0(pObj), vLeaves );
460  Vec_PtrPush( vRoots, Aig_ObjChild0Copy(pObj) );
461  Vec_PtrPush( vPos, pObj );
462  }
463  for ( ; Aig_ManObjNum(pNew) < nVarsMin && i < Aig_ManCoNum(pFrame); i++ )
464  {
465  pObj = Aig_ManCo( pFrame, i );
466  Cgt_ManDupPartition_rec( pNew, pFrame, Aig_ObjFanin0(pObj), vLeaves );
467  Vec_PtrPush( vRoots, Aig_ObjChild0Copy(pObj) );
468  Vec_PtrPush( vPos, pObj );
469  }
470  assert( nFlopsMin >= Vec_PtrSize(vRoots) || Vec_PtrSize(vRoots) >= nFlopsMin );
471  // create constaints
472  if ( pCare )
473  Cgt_ManConstructCare( pNew, pCare, vSuppsInv, vLeaves );
474  // create POs
475  Vec_PtrForEachEntry( Aig_Obj_t *, vPos, pObj, i )
476  pObj->pData = (Aig_Obj_t *)Aig_ObjCreateCo( pNew, (Aig_Obj_t *)Vec_PtrEntry(vRoots, i) );
477  if ( pnOutputs != NULL )
478  *pnOutputs = Vec_PtrSize( vPos );
479  Vec_PtrFree( vRoots );
480  Vec_PtrFree( vLeaves );
481  Vec_PtrFree( vPos );
482  return pNew;
483 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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
Aig_Obj_t * Cgt_ManDupPartition_rec(Aig_Man_t *pNew, Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vLeaves)
Definition: cgtAig.c:414
static int Aig_ManObjNum(Aig_Man_t *p)
Definition: aig.h:258
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
void Cgt_ManConstructCare(Aig_Man_t *pNew, Aig_Man_t *pCare, Vec_Vec_t *vSuppsInv, Vec_Ptr_t *vLeaves)
Definition: cgtAig.c:368
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Obj_t* Cgt_ManDupPartition_rec ( Aig_Man_t pNew,
Aig_Man_t pAig,
Aig_Obj_t pObj,
Vec_Ptr_t vLeaves 
)

Function*************************************************************

Synopsis [Duplicates the AIG recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file cgtAig.c.

415 {
416  if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
417  return (Aig_Obj_t *)pObj->pData;
418  Aig_ObjSetTravIdCurrent(pAig, pObj);
419  if ( Aig_ObjIsCi(pObj) )
420  {
421  pObj->pData = Aig_ObjCreateCi( pNew );
422  Vec_PtrPush( vLeaves, pObj );
423  return (Aig_Obj_t *)pObj->pData;
424  }
425  Cgt_ManDupPartition_rec( pNew, pAig, Aig_ObjFanin0(pObj), vLeaves );
426  Cgt_ManDupPartition_rec( pNew, pAig, Aig_ObjFanin1(pObj), vLeaves );
427  return (Aig_Obj_t *)(pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) ));
428 }
Aig_Obj_t * Cgt_ManDupPartition_rec(Aig_Man_t *pNew, Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vLeaves)
Definition: cgtAig.c:414
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
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
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275