abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aigDup.c File Reference
#include "aig/saig/saig.h"
#include "misc/tim/tim.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Aig_ManDupSimple (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
Aig_Man_tAig_ManDupSimpleWithHints (Aig_Man_t *p, Vec_Int_t *vHints)
 
Aig_Obj_tAig_ManDupSimpleDfs_rec (Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupSimpleDfs (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupSimpleDfsPart (Aig_Man_t *p, Vec_Ptr_t *vPis, Vec_Ptr_t *vPos)
 
Aig_Man_tAig_ManDupOrdered (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupCof (Aig_Man_t *p, int iInput, int Value)
 
Aig_Man_tAig_ManDupTrim (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupExor (Aig_Man_t *p)
 
Aig_Obj_tAig_ManDupDfs_rec (Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupDfs (Aig_Man_t *p)
 
Vec_Ptr_tAig_ManOrderPios (Aig_Man_t *p, Aig_Man_t *pOrder)
 
Aig_Obj_tAig_ManDupDfsGuided_rec (Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupDfsGuided (Aig_Man_t *p, Vec_Ptr_t *vPios)
 
Aig_Man_tAig_ManDupLevelized (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupWithoutPos (Aig_Man_t *p)
 
Aig_Man_tAig_ManDupFlopsOnly (Aig_Man_t *p)
 
static Aig_Obj_tAig_ObjGetRepres (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild0Repres (Aig_Man_t *p, Aig_Obj_t *pObj)
 
static Aig_Obj_tAig_ObjChild1Repres (Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupRepres (Aig_Man_t *p)
 
Aig_Obj_tAig_ManDupRepres_rec (Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
 
Aig_Man_tAig_ManDupRepresDfs (Aig_Man_t *p)
 
Aig_Man_tAig_ManCreateMiter (Aig_Man_t *p1, Aig_Man_t *p2, int Oper)
 
Aig_Man_tAig_ManDupOrpos (Aig_Man_t *p, int fAddRegs)
 
Aig_Man_tAig_ManDupOneOutput (Aig_Man_t *p, int iPoNum, int fAddRegs)
 
Aig_Man_tAig_ManDupUnsolvedOutputs (Aig_Man_t *p, int fAddRegs)
 
Aig_Man_tAig_ManDupArray (Vec_Ptr_t *vArray)
 
Aig_Man_tAig_ManDupNodes (Aig_Man_t *pMan, Vec_Ptr_t *vArray)
 

Function Documentation

Aig_Man_t* Aig_ManCreateMiter ( Aig_Man_t p1,
Aig_Man_t p2,
int  Oper 
)

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

Synopsis [Creates the miter of the two AIG managers.]

Description [Oper is the operation to perform on the outputs of the miter. Oper == 0 is XOR Oper == 1 is complemented implication (p1 => p2) Oper == 2 is OR Oper == 3 is AND ]

SideEffects []

SeeAlso []

Definition at line 1049 of file aigDup.c.

1050 {
1051  Aig_Man_t * pNew;
1052  Aig_Obj_t * pObj;
1053  int i;
1054  assert( Aig_ManRegNum(p1) == 0 );
1055  assert( Aig_ManRegNum(p2) == 0 );
1056  assert( Aig_ManCoNum(p1) == 1 );
1057  assert( Aig_ManCoNum(p2) == 1 );
1058  assert( Aig_ManCiNum(p1) == Aig_ManCiNum(p2) );
1059  pNew = Aig_ManStart( Aig_ManObjNumMax(p1) + Aig_ManObjNumMax(p2) );
1060  // add first AIG
1061  Aig_ManConst1(p1)->pData = Aig_ManConst1(pNew);
1062  Aig_ManForEachCi( p1, pObj, i )
1063  pObj->pData = Aig_ObjCreateCi( pNew );
1064  Aig_ManForEachNode( p1, pObj, i )
1065  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1066  // add second AIG
1067  Aig_ManConst1(p2)->pData = Aig_ManConst1(pNew);
1068  Aig_ManForEachCi( p2, pObj, i )
1069  pObj->pData = Aig_ManCi( pNew, i );
1070  Aig_ManForEachNode( p2, pObj, i )
1071  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1072  // add the output
1073  if ( Oper == 0 ) // XOR
1074  pObj = Aig_Exor( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1075  else if ( Oper == 1 ) // implication is PO(p1) -> PO(p2) ... complement is PO(p1) & !PO(p2)
1076  pObj = Aig_And( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_Not(Aig_ObjChild0Copy(Aig_ManCo(p2,0))) );
1077  else if ( Oper == 2 ) // OR
1078  pObj = Aig_Or( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1079  else if ( Oper == 3 ) // AND
1080  pObj = Aig_And( pNew, Aig_ObjChild0Copy(Aig_ManCo(p1,0)), Aig_ObjChild0Copy(Aig_ManCo(p2,0)) );
1081  else
1082  assert( 0 );
1083  Aig_ObjCreateCo( pNew, pObj );
1084  Aig_ManCleanup( pNew );
1085  return pNew;
1086 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
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_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
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 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 Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupArray ( Vec_Ptr_t vArray)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1255 of file aigDup.c.

1256 {
1257  Aig_Man_t * p, * pNew;
1258  Aig_Obj_t * pObj;
1259  int i, k;
1260  if ( Vec_PtrSize(vArray) == 0 )
1261  return NULL;
1262  p = (Aig_Man_t *)Vec_PtrEntry( vArray, 0 );
1263  Vec_PtrForEachEntry( Aig_Man_t *, vArray, pNew, k )
1264  {
1265  assert( Aig_ManRegNum(pNew) == 0 );
1266  assert( Aig_ManCiNum(pNew) == Aig_ManCiNum(p) );
1267  }
1268  // create the new manager
1269  pNew = Aig_ManStart( 10000 );
1270  pNew->pName = Abc_UtilStrsav( p->pName );
1271  Aig_ManForEachCi( p, pObj, i )
1272  Aig_ObjCreateCi(pNew);
1273  // create the PIs
1274  Vec_PtrForEachEntry( Aig_Man_t *, vArray, p, k )
1275  {
1276  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1277  Aig_ManForEachCi( p, pObj, i )
1278  pObj->pData = Aig_ManCi( pNew, i );
1279  Aig_ManForEachNode( p, pObj, i )
1280  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1281  Aig_ManForEachCo( p, pObj, i )
1282  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1283  }
1284  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
1285  // check the resulting network
1286  if ( !Aig_ManCheck(pNew) )
1287  printf( "Aig_ManDupSimple(): The check has failed.\n" );
1288  return pNew;
1289 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
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 * pData
Definition: aig.h:87
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
ABC_NAMESPACE_IMPL_START Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
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 int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#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
Aig_Man_t* Aig_ManDupCof ( Aig_Man_t p,
int  iInput,
int  Value 
)

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 345 of file aigDup.c.

346 {
347  Aig_Man_t * pNew;
348  Aig_Obj_t * pObj, * pObjNew;
349  int i;
350  assert( p->pManTime == NULL );
351  // create the new manager
352  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
353  pNew->pName = Abc_UtilStrsav( p->pName );
354  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
355  pNew->nAsserts = p->nAsserts;
356  pNew->nConstrs = p->nConstrs;
357  pNew->nBarBufs = p->nBarBufs;
358  if ( p->vFlopNums )
359  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
360  // create the PIs
361  Aig_ManCleanData( p );
363  Aig_ManForEachCi( p, pObj, i )
364  {
365  if ( i == iInput )
366  pObjNew = Value ? Aig_ManConst1(pNew) : Aig_ManConst0(pNew);
367  else
368  {
369  pObjNew = Aig_ObjCreateCi( pNew );
370  pObjNew->Level = pObj->Level;
371  }
372  pObj->pData = pObjNew;
373  }
374  // duplicate internal nodes
375  Aig_ManForEachObj( p, pObj, i )
376  if ( Aig_ObjIsBuf(pObj) )
377  {
378  pObjNew = Aig_ObjChild0Copy(pObj);
379  pObj->pData = pObjNew;
380  }
381  else if ( Aig_ObjIsNode(pObj) )
382  {
383  pObjNew = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
384  pObj->pData = pObjNew;
385  }
386  // add the POs
387  Aig_ManForEachCo( p, pObj, i )
388  {
389  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
390  pObj->pData = pObjNew;
391  }
392 // assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
393  Aig_ManCleanup( pNew );
394  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
395  // check the resulting network
396  if ( !Aig_ManCheck(pNew) )
397  printf( "Aig_ManDupSimple(): The check has failed.\n" );
398  return pNew;
399 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
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 int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
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
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupDfs ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 563 of file aigDup.c.

564 {
565  Aig_Man_t * pNew;
566  Aig_Obj_t * pObj, * pObjNew;
567  int i, nNodes;
568  // create the new manager
569  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
570  pNew->pName = Abc_UtilStrsav( p->pName );
571  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
572  pNew->nAsserts = p->nAsserts;
573  pNew->nConstrs = p->nConstrs;
574  pNew->nBarBufs = p->nBarBufs;
575  if ( p->vFlopNums )
576  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
577  // duplicate representation of choice nodes
578  if ( p->pEquivs )
579  pNew->pEquivs = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
580  if ( p->pReprs )
581  pNew->pReprs = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
582  // create the PIs
583  Aig_ManCleanData( p );
584  // duplicate internal nodes
586  Aig_ManForEachObj( p, pObj, i )
587  {
588  if ( Aig_ObjIsCi(pObj) )
589  {
590  pObjNew = Aig_ObjCreateCi( pNew );
591  pObjNew->Level = pObj->Level;
592  pObj->pData = pObjNew;
593  }
594  else if ( Aig_ObjIsCo(pObj) )
595  {
596  Aig_ManDupDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
597 // assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
598  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
599  pObj->pData = pObjNew;
600  }
601  }
602  assert( p->pEquivs != NULL || Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
603  if ( p->pEquivs == NULL && p->pReprs == NULL && (nNodes = Aig_ManCleanup( pNew )) )
604  printf( "Aig_ManDupDfs(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
605  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
606  // duplicate the timing manager
607  if ( p->pManTime )
608  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
609  // check the resulting network
610  if ( !Aig_ManCheck(pNew) )
611  printf( "Aig_ManDupDfs(): The check has failed.\n" );
612  return pNew;
613 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * 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
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Aig_Obj_t * Aig_ManDupDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:529
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Obj_t* Aig_ManDupDfs_rec ( Aig_Man_t pNew,
Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 529 of file aigDup.c.

530 {
531  Aig_Obj_t * pObjNew, * pEquivNew = NULL;
532  if ( pObj->pData )
533  return (Aig_Obj_t *)pObj->pData;
534  if ( p->pEquivs && Aig_ObjEquiv(p, pObj) )
535  pEquivNew = Aig_ManDupDfs_rec( pNew, p, Aig_ObjEquiv(p, pObj) );
536  Aig_ManDupDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
537  if ( Aig_ObjIsBuf(pObj) )
538  return (Aig_Obj_t *)(pObj->pData = Aig_ObjChild0Copy(pObj));
539  Aig_ManDupDfs_rec( pNew, p, Aig_ObjFanin1(pObj) );
540  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
541  if ( pEquivNew )
542  {
543  assert( Aig_Regular(pEquivNew)->Id < Aig_Regular(pObjNew)->Id );
544  if ( pNew->pEquivs )
545  pNew->pEquivs[Aig_Regular(pObjNew)->Id] = Aig_Regular(pEquivNew);
546  if ( pNew->pReprs )
547  pNew->pReprs[Aig_Regular(pEquivNew)->Id] = Aig_Regular(pObjNew);
548  }
549  return (Aig_Obj_t *)(pObj->pData = pObjNew);
550 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
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
Aig_Obj_t * Aig_ManDupDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:529
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
Aig_Man_t* Aig_ManDupDfsGuided ( Aig_Man_t p,
Vec_Ptr_t vPios 
)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 694 of file aigDup.c.

695 {
696  Aig_Man_t * pNew;
697  Aig_Obj_t * pObj, * pObjNew;
698  int i, nNodes;
699  // create the new manager
700  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
701  pNew->pName = Abc_UtilStrsav( p->pName );
702  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
703  pNew->nAsserts = p->nAsserts;
704  pNew->nConstrs = p->nConstrs;
705  pNew->nBarBufs = p->nBarBufs;
706  if ( p->vFlopNums )
707  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
708  // duplicate representation of choice nodes
709  if ( p->pEquivs )
710  {
711  pNew->pEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
712  memset( pNew->pEquivs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
713  }
714  if ( p->pReprs )
715  {
716  pNew->pReprs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
717  memset( pNew->pReprs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
718  }
719  // create the PIs
720  Aig_ManCleanData( p );
721  // duplicate internal nodes
723  Vec_PtrForEachEntry( Aig_Obj_t *, vPios, pObj, i )
724  {
725  if ( Aig_ObjIsCi(pObj) )
726  {
727  pObjNew = Aig_ObjCreateCi( pNew );
728  pObjNew->Level = pObj->Level;
729  pObj->pData = pObjNew;
730  }
731  else if ( Aig_ObjIsCo(pObj) )
732  {
733  Aig_ManDupDfsGuided_rec( pNew, p, Aig_ObjFanin0(pObj) );
734 // assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
735  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
736  pObj->pData = pObjNew;
737  }
738  }
739 // assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
740  if ( p->pEquivs == NULL && p->pReprs == NULL && (nNodes = Aig_ManCleanup( pNew )) )
741  printf( "Aig_ManDupDfs(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
742  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
743  // duplicate the timing manager
744  if ( p->pManTime )
745  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
746  // check the resulting network
747  if ( !Aig_ManCheck(pNew) )
748  printf( "Aig_ManDupDfs(): The check has failed.\n" );
749  return pNew;
750 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * 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
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
Aig_Obj_t * Aig_ManDupDfsGuided_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:657
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
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
#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
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Obj_t* Aig_ManDupDfsGuided_rec ( Aig_Man_t pNew,
Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 657 of file aigDup.c.

658 {
659  Aig_Obj_t * pObjNew, * pEquivNew = NULL;
660  if ( pObj->pData )
661  return (Aig_Obj_t *)pObj->pData;
662  if ( Aig_ObjIsCi(pObj) )
663  return NULL;
664  if ( p->pEquivs && Aig_ObjEquiv(p, pObj) )
665  pEquivNew = Aig_ManDupDfsGuided_rec( pNew, p, Aig_ObjEquiv(p, pObj) );
666  if ( !Aig_ManDupDfsGuided_rec( pNew, p, Aig_ObjFanin0(pObj) ) )
667  return NULL;
668  if ( Aig_ObjIsBuf(pObj) )
669  return (Aig_Obj_t *)(pObj->pData = Aig_ObjChild0Copy(pObj));
670  if ( !Aig_ManDupDfsGuided_rec( pNew, p, Aig_ObjFanin1(pObj) ) )
671  return NULL;
672  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
673  if ( pEquivNew )
674  {
675  if ( pNew->pEquivs )
676  pNew->pEquivs[Aig_Regular(pObjNew)->Id] = Aig_Regular(pEquivNew);
677  if ( pNew->pReprs )
678  pNew->pReprs[Aig_Regular(pEquivNew)->Id] = Aig_Regular(pObjNew);
679  }
680  return (Aig_Obj_t *)(pObj->pData = pObjNew);
681 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
Aig_Obj_t * Aig_ManDupDfsGuided_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:657
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
int Id
Definition: aig.h:85
Aig_Man_t* Aig_ManDupExor ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager to have EXOR gates.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 462 of file aigDup.c.

463 {
464  Aig_Man_t * pNew;
465  Aig_Obj_t * pObj, * pObjNew;
466  int i;
467  // create the new manager
468  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
469  pNew->fCatchExor = 1;
470  pNew->pName = Abc_UtilStrsav( p->pName );
471  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
472  pNew->nAsserts = p->nAsserts;
473  pNew->nConstrs = p->nConstrs;
474  pNew->nBarBufs = p->nBarBufs;
475  if ( p->vFlopNums )
476  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
477  // create the PIs
478  Aig_ManCleanData( p );
479  // duplicate internal nodes
480  Aig_ManForEachObj( p, pObj, i )
481  {
482  if ( Aig_ObjIsBuf(pObj) )
483  {
484  pObjNew = Aig_ObjChild0Copy(pObj);
485  }
486  else if ( Aig_ObjIsNode(pObj) )
487  {
488  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
489  }
490  else if ( Aig_ObjIsCi(pObj) )
491  {
492  pObjNew = Aig_ObjCreateCi( pNew );
493  pObjNew->Level = pObj->Level;
494  }
495  else if ( Aig_ObjIsCo(pObj) )
496  {
497  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
498  }
499  else if ( Aig_ObjIsConst1(pObj) )
500  {
501  pObjNew = Aig_ManConst1(pNew);
502  }
503  else
504  assert( 0 );
505  pObj->pData = pObjNew;
506  }
507  Aig_ManCleanup( pNew );
508  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
509  // duplicate the timing manager
510  if ( p->pManTime )
511  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
512  // check the resulting network
513  if ( !Aig_ManCheck(pNew) )
514  printf( "Aig_ManDupExor(): The check has failed.\n" );
515  return pNew;
516 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupFlopsOnly ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 871 of file aigDup.c.

872 {
873  Aig_Man_t * pNew;
874  Aig_Obj_t * pObj;
875  int i;
876  pNew = Aig_ManDupWithoutPos( p );
877  Saig_ManForEachLi( p, pObj, i )
878  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
879  Aig_ManCleanup( pNew );
880  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
881  if ( !Aig_ManCheck(pNew) )
882  printf( "Aig_ManDupFlopsOnly(): The check has failed.\n" );
883  return pNew;
884 
885 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
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
static void check(int expr)
Definition: satSolver.c:46
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Aig_Man_t * Aig_ManDupWithoutPos(Aig_Man_t *p)
Definition: aigDup.c:835
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 int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_Man_t * Aig_ManDupFlopsOnly(Aig_Man_t *p)
Definition: aigDup.c:871
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupLevelized ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 763 of file aigDup.c.

764 {
765  Vec_Vec_t * vLevels;
766  Aig_Man_t * pNew;
767  Aig_Obj_t * pObj, * pObjNew;
768  int i, k;
769  // create the new manager
770  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
771  pNew->pName = Abc_UtilStrsav( p->pName );
772  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
773  pNew->nAsserts = p->nAsserts;
774  pNew->nConstrs = p->nConstrs;
775  pNew->nBarBufs = p->nBarBufs;
776  if ( p->vFlopNums )
777  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
778  // duplicate representation of choice nodes
779  if ( p->pEquivs )
780  {
781  pNew->pEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
782  memset( pNew->pEquivs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
783  }
784  if ( p->pReprs )
785  {
786  pNew->pReprs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p) );
787  memset( pNew->pReprs, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p) );
788  }
789  // create the PIs
791  Aig_ManForEachCi( p, pObj, i )
792  {
793  pObjNew = Aig_ObjCreateCi( pNew );
794  pObjNew->Level = pObj->Level;
795  pObj->pData = pObjNew;
796  }
797  // duplicate internal nodes
798  vLevels = Aig_ManLevelize( p );
799  Vec_VecForEachEntry( Aig_Obj_t *, vLevels, pObj, i, k )
800  {
801  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
802  pObj->pData = pObjNew;
803  }
804  Vec_VecFree( vLevels );
805  // duplicate POs
806  Aig_ManForEachCo( p, pObj, i )
807  {
808  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
809  pObj->pData = pObjNew;
810  }
811  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
812 // if ( (nNodes = Aig_ManCleanup( pNew )) )
813 // printf( "Aig_ManDupLevelized(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
814  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
815  // duplicate the timing manager
816  if ( p->pManTime )
817  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
818  // check the resulting network
819  if ( !Aig_ManCheck(pNew) )
820  printf( "Aig_ManDupLevelized(): The check has failed.\n" );
821  return pNew;
822 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.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
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
#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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Vec_Vec_t * Aig_ManLevelize(Aig_Man_t *p)
Definition: aigDfs.c:307
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
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
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Aig_Man_t* Aig_ManDupNodes ( Aig_Man_t pMan,
Vec_Ptr_t vArray 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1302 of file aigDup.c.

1303 {
1304  Aig_Man_t * pNew;
1305  Vec_Ptr_t * vObjs;
1306  Aig_Obj_t * pObj;
1307  int i;
1308  if ( Vec_PtrSize(vArray) == 0 )
1309  return NULL;
1310  vObjs = Aig_ManDfsNodes( pMan, (Aig_Obj_t **)Vec_PtrArray(vArray), Vec_PtrSize(vArray) );
1311  // create the new manager
1312  pNew = Aig_ManStart( 10000 );
1313  pNew->pName = Abc_UtilStrsav( pMan->pName );
1314  Aig_ManConst1(pMan)->pData = Aig_ManConst1(pNew);
1315  Vec_PtrForEachEntry( Aig_Obj_t *, vObjs, pObj, i )
1316  if ( Aig_ObjIsCi(pObj) )
1317  pObj->pData = Aig_ObjCreateCi(pNew);
1318  Vec_PtrForEachEntry( Aig_Obj_t *, vObjs, pObj, i )
1319  if ( Aig_ObjIsNode(pObj) )
1320  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1321  Vec_PtrForEachEntry( Aig_Obj_t *, vArray, pObj, i )
1322  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)pObj->pData );
1323  Aig_ManSetRegNum( pNew, 0 );
1324  Vec_PtrFree( vObjs );
1325  return pNew;
1326 }
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
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
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
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
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
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#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
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* Aig_ManDupOneOutput ( Aig_Man_t p,
int  iPoNum,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1152 of file aigDup.c.

1153 {
1154  Aig_Man_t * pNew;
1155  Aig_Obj_t * pObj;
1156  int i;
1157  assert( Aig_ManRegNum(p) > 0 );
1158  assert( iPoNum < Aig_ManCoNum(p)-Aig_ManRegNum(p) );
1159  // create the new manager
1160  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1161  pNew->pName = Abc_UtilStrsav( p->pName );
1162  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1163  // create the PIs
1164  Aig_ManCleanData( p );
1165  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1166  Aig_ManForEachCi( p, pObj, i )
1167  pObj->pData = Aig_ObjCreateCi( pNew );
1168  // set registers
1169  pNew->nRegs = fAddRegs? p->nRegs : 0;
1170  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1171  pNew->nTruePos = 1;
1172  // duplicate internal nodes
1173  Aig_ManForEachNode( p, pObj, i )
1174  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1175  // create the PO
1176  pObj = Aig_ManCo( p, iPoNum );
1177  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1178  // create register inputs with MUXes
1179  if ( fAddRegs )
1180  {
1181  Aig_ManForEachLiSeq( p, pObj, i )
1182  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1183  }
1184  Aig_ManCleanup( pNew );
1185  return pNew;
1186 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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 * pData
Definition: aig.h:87
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
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
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
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 Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupOrdered ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 277 of file aigDup.c.

278 {
279  Aig_Man_t * pNew;
280  Aig_Obj_t * pObj, * pObjNew;
281  int i, nNodes;
282  // create the new manager
283  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
284  pNew->pName = Abc_UtilStrsav( p->pName );
285  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
286  pNew->nAsserts = p->nAsserts;
287  pNew->nConstrs = p->nConstrs;
288  pNew->nBarBufs = p->nBarBufs;
289  if ( p->vFlopNums )
290  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
291  // create the PIs
292  Aig_ManCleanData( p );
293  // duplicate internal nodes
294  Aig_ManForEachObj( p, pObj, i )
295  {
296  if ( Aig_ObjIsBuf(pObj) )
297  {
298  pObjNew = Aig_ObjChild0Copy(pObj);
299  }
300  else if ( Aig_ObjIsNode(pObj) )
301  {
302  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
303  }
304  else if ( Aig_ObjIsCi(pObj) )
305  {
306  pObjNew = Aig_ObjCreateCi( pNew );
307  pObjNew->Level = pObj->Level;
308  }
309  else if ( Aig_ObjIsCo(pObj) )
310  {
311  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
312  }
313  else if ( Aig_ObjIsConst1(pObj) )
314  {
315  pObjNew = Aig_ManConst1(pNew);
316  }
317  else
318  assert( 0 );
319  pObj->pData = pObjNew;
320  }
321  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
322  if ( (nNodes = Aig_ManCleanup( pNew )) )
323  printf( "Aig_ManDupOrdered(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
324  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
325  // duplicate the timing manager
326  if ( p->pManTime )
327  pNew->pManTime = Tim_ManDup( (Tim_Man_t *)p->pManTime, 0 );
328  // check the resulting network
329  if ( !Aig_ManCheck(pNew) )
330  printf( "Aig_ManDupOrdered(): The check has failed.\n" );
331  return pNew;
332 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupOrpos ( Aig_Man_t p,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1099 of file aigDup.c.

1100 {
1101  Aig_Man_t * pNew;
1102  Aig_Obj_t * pObj, * pMiter;
1103  int i;
1104  assert( Aig_ManRegNum(p) > 0 );
1105  if ( p->nConstrs > 0 )
1106  {
1107  printf( "The AIG manager should have no constraints.\n" );
1108  return NULL;
1109  }
1110  // create the new manager
1111  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1112  pNew->pName = Abc_UtilStrsav( p->pName );
1113  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1114  // create the PIs
1115  Aig_ManCleanData( p );
1116  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1117  Aig_ManForEachCi( p, pObj, i )
1118  pObj->pData = Aig_ObjCreateCi( pNew );
1119  // set registers
1120  pNew->nRegs = fAddRegs? p->nRegs : 0;
1121  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1122  pNew->nTruePos = 1;
1123  // duplicate internal nodes
1124  Aig_ManForEachNode( p, pObj, i )
1125  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1126  // create the PO
1127  pMiter = Aig_ManConst0(pNew);
1128  Aig_ManForEachPoSeq( p, pObj, i )
1129  pMiter = Aig_Or( pNew, pMiter, Aig_ObjChild0Copy(pObj) );
1130  Aig_ObjCreateCo( pNew, pMiter );
1131  // create register inputs with MUXes
1132  if ( fAddRegs )
1133  {
1134  Aig_ManForEachLiSeq( p, pObj, i )
1135  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1136  }
1137  Aig_ManCleanup( pNew );
1138  return pNew;
1139 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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 * pData
Definition: aig.h:87
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
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
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 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
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupRepres ( Aig_Man_t p)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file aigDup.c.

921 {
922  Aig_Man_t * pNew;
923  Aig_Obj_t * pObj;
924  int i;
925  // start the HOP package
926  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
927  pNew->pName = Abc_UtilStrsav( p->pName );
928  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
929  pNew->nConstrs = p->nConstrs;
930  pNew->nBarBufs = p->nBarBufs;
931  if ( p->vFlopNums )
932  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
933  // map the const and primary inputs
934  Aig_ManCleanData( p );
935  Aig_ManForEachObj( p, pObj, i )
936  {
937  if ( Aig_ObjIsNode(pObj) )
938  pObj->pData = Aig_And( pNew, Aig_ObjChild0Repres(p, pObj), Aig_ObjChild1Repres(p, pObj) );
939  else if ( Aig_ObjIsCi(pObj) )
940  {
941  pObj->pData = Aig_ObjCreateCi(pNew);
942  pObj->pData = Aig_ObjGetRepres( p, pObj );
943  }
944  else if ( Aig_ObjIsCo(pObj) )
945  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Repres(p, pObj) );
946  else if ( Aig_ObjIsConst1(pObj) )
947  pObj->pData = Aig_ManConst1(pNew);
948  else
949  assert( 0 );
950  }
951  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
952  // check the new manager
953  if ( !Aig_ManCheck(pNew) )
954  printf( "Aig_ManDupRepres: Check has failed.\n" );
955  return pNew;
956 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
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
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:906
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 Aig_Obj_t * Aig_ObjGetRepres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:899
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Aig_Obj_t * Aig_ObjChild1Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:907
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Obj_t* Aig_ManDupRepres_rec ( Aig_Man_t pNew,
Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 969 of file aigDup.c.

970 {
971  Aig_Obj_t * pRepr;
972  if ( pObj->pData )
973  return (Aig_Obj_t *)pObj->pData;
974  if ( (pRepr = Aig_ObjRepr(p, pObj)) )
975  {
976  Aig_ManDupRepres_rec( pNew, p, pRepr );
977  return (Aig_Obj_t *)(pObj->pData = Aig_NotCond( (Aig_Obj_t *)pRepr->pData, pRepr->fPhase ^ pObj->fPhase ));
978  }
979  Aig_ManDupRepres_rec( pNew, p, Aig_ObjFanin0(pObj) );
980  Aig_ManDupRepres_rec( pNew, p, Aig_ObjFanin1(pObj) );
981  return (Aig_Obj_t *)(pObj->pData = Aig_And( pNew, Aig_ObjChild0Repres(p, pObj), Aig_ObjChild1Repres(p, pObj) ));
982 }
Aig_Obj_t * Aig_ManDupRepres_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:969
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
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 Aig_Obj_t * Aig_ObjChild0Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:906
unsigned int fPhase
Definition: aig.h:78
static Aig_Obj_t * Aig_ObjChild1Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:907
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Man_t* Aig_ManDupRepresDfs ( Aig_Man_t p)

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

Synopsis [Duplicates AIG while substituting representatives.]

Description []

SideEffects []

SeeAlso []

Definition at line 995 of file aigDup.c.

996 {
997  Aig_Man_t * pNew;
998  Aig_Obj_t * pObj;
999  int i;
1000  // start the HOP package
1001  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1002  pNew->pName = Abc_UtilStrsav( p->pName );
1003  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1004  pNew->nConstrs = p->nConstrs;
1005  pNew->nBarBufs = p->nBarBufs;
1006  if ( p->vFlopNums )
1007  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
1008  // map the const and primary inputs
1009  Aig_ManCleanData( p );
1010  Aig_ManForEachObj( p, pObj, i )
1011  {
1012  if ( Aig_ObjIsNode(pObj) )
1013  continue;
1014  if ( Aig_ObjIsCi(pObj) )
1015  pObj->pData = Aig_ObjCreateCi(pNew);
1016  else if ( Aig_ObjIsCo(pObj) )
1017  {
1018  Aig_ManDupRepres_rec( pNew, p, Aig_ObjFanin0(pObj) );
1019  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Repres(p, pObj) );
1020  }
1021  else if ( Aig_ObjIsConst1(pObj) )
1022  pObj->pData = Aig_ManConst1(pNew);
1023  else
1024  assert( 0 );
1025  }
1026  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
1027  // check the new manager
1028  if ( !Aig_ManCheck(pNew) )
1029  printf( "Aig_ManDupRepresDfs: Check has failed.\n" );
1030  return pNew;
1031 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Obj_t * Aig_ManDupRepres_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:969
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * 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
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Repres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:906
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
ABC_NAMESPACE_IMPL_START Aig_Man_t* Aig_ManDupSimple ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [aigDup.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [AIG duplication (re-strashing).]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
aigDup.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 46 of file aigDup.c.

47 {
48  Aig_Man_t * pNew;
49  Aig_Obj_t * pObj, * pObjNew;
50  int i;
51  assert( p->pManTime == NULL );
52  // create the new manager
53  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
54  pNew->pName = Abc_UtilStrsav( p->pName );
55  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
56  pNew->nAsserts = p->nAsserts;
57  pNew->nConstrs = p->nConstrs;
58  pNew->nBarBufs = p->nBarBufs;
59  if ( p->vFlopNums )
60  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
61  // create the PIs
64  Aig_ManForEachCi( p, pObj, i )
65  {
66  pObjNew = Aig_ObjCreateCi( pNew );
67  pObjNew->Level = pObj->Level;
68  pObj->pData = pObjNew;
69  }
70  // duplicate internal nodes
71  Aig_ManForEachObj( p, pObj, i )
72  if ( Aig_ObjIsBuf(pObj) )
73  {
74  pObjNew = Aig_ObjChild0Copy(pObj);
75  pObj->pData = pObjNew;
76  }
77  else if ( Aig_ObjIsNode(pObj) )
78  {
79  pObjNew = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
80  pObj->pData = pObjNew;
81  }
82  // add the POs
83  Aig_ManForEachCo( p, pObj, i )
84  {
85  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
86  pObj->pData = pObjNew;
87  }
88  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
90  // check the resulting network
91  if ( !Aig_ManCheck(pNew) )
92  printf( "Aig_ManDupSimple(): The check has failed.\n" );
93  return pNew;
94 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
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
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
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
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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Aig_Man_t* Aig_ManDupSimpleDfs ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects [This procedure assumes that buffers are not used during HAIG recording. This way, each HAIG node is in one-to-one correspondence with old HAIG node. There is no need to create new nodes, just reassign the pointers. If it were not the case, we would need to create HAIG nodes for each new node duplicated. ]

SeeAlso []

Definition at line 184 of file aigDup.c.

185 {
186  Aig_Man_t * pNew;
187  Aig_Obj_t * pObj, * pObjNew;
188  int i;
189  assert( p->pManTime == NULL );
190  // create the new manager
191  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
192  pNew->pName = Abc_UtilStrsav( p->pName );
193  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
194  pNew->nAsserts = p->nAsserts;
195  pNew->nConstrs = p->nConstrs;
196  pNew->nBarBufs = p->nBarBufs;
197  if ( p->vFlopNums )
198  pNew->vFlopNums = Vec_IntDup( p->vFlopNums );
199  // create the PIs
200  Aig_ManCleanData( p );
202  Aig_ManForEachCi( p, pObj, i )
203  {
204  pObjNew = Aig_ObjCreateCi( pNew );
205  pObjNew->Level = pObj->Level;
206  pObj->pData = pObjNew;
207  }
208  // duplicate internal nodes
209  Aig_ManForEachObj( p, pObj, i )
210  if ( !Aig_ObjIsCo(pObj) )
211  {
212  Aig_ManDupSimpleDfs_rec( pNew, p, pObj );
213  assert( pObj->Level == ((Aig_Obj_t*)pObj->pData)->Level );
214  }
215  // add the POs
216  Aig_ManForEachCo( p, pObj, i )
217  {
218  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
219  pObj->pData = pObjNew;
220  }
221  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
222  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
223  // check the resulting network
224  if ( !Aig_ManCheck(pNew) )
225  printf( "Aig_ManDupSimple(): The check has failed.\n" );
226  return pNew;
227 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
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 * pData
Definition: aig.h:87
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
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 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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Obj_t* Aig_ManDupSimpleDfs_rec ( Aig_Man_t pNew,
Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG manager recursively.]

Description []

SideEffects []

SeeAlso []

Definition at line 157 of file aigDup.c.

158 {
159  if ( pObj->pData )
160  return (Aig_Obj_t *)pObj->pData;
161  Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
162  if ( Aig_ObjIsBuf(pObj) )
163  return (Aig_Obj_t *)(pObj->pData = Aig_ObjChild0Copy(pObj));
164  Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin1(pObj) );
165  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
166  return (Aig_Obj_t *)pObj->pData;
167 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
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
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
Aig_Man_t* Aig_ManDupSimpleDfsPart ( Aig_Man_t p,
Vec_Ptr_t vPis,
Vec_Ptr_t vPos 
)

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

Synopsis [Duplicates part of the AIG manager.]

Description [Orders nodes as follows: PIs, ANDs, POs.]

SideEffects []

SeeAlso []

Definition at line 240 of file aigDup.c.

241 {
242  Aig_Man_t * pNew;
243  Aig_Obj_t * pObj, * pObjNew;
244  int i;
245  // create the new manager
246  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
247  // create the PIs
248  Aig_ManCleanData( p );
249  Aig_ManConst1(p)->pData = Aig_ManConst1( pNew );
250  Vec_PtrForEachEntry( Aig_Obj_t *, vPis, pObj, i )
251  pObj->pData = Aig_ObjCreateCi( pNew );
252  // duplicate internal nodes
253  Vec_PtrForEachEntry( Aig_Obj_t *, vPos, pObj, i )
254  {
255  pObjNew = Aig_ManDupSimpleDfs_rec( pNew, p, Aig_ObjFanin0(pObj) );
256  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObj) );
257  Aig_ObjCreateCo( pNew, pObjNew );
258  }
259  Aig_ManSetRegNum( pNew, 0 );
260  // check the resulting network
261  if ( !Aig_ManCheck(pNew) )
262  printf( "Aig_ManDupSimple(): The check has failed.\n" );
263  return pNew;
264 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
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 * 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
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
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
Aig_Obj_t * Aig_ManDupSimpleDfs_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:157
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 Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Aig_Man_t* Aig_ManDupSimpleWithHints ( Aig_Man_t p,
Vec_Int_t vHints 
)

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

Synopsis [Derives AIG with hints.]

Description []

SideEffects []

SeeAlso []

Definition at line 107 of file aigDup.c.

108 {
109  Aig_Man_t * pNew;
110  Aig_Obj_t * pObj;
111  int i, Entry;
112  assert( p->nAsserts == 0 || p->nConstrs == 0 );
113  // create the new manager
114  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
115  pNew->pName = Abc_UtilStrsav( p->pName );
116  // create the PIs
117  Aig_ManCleanData( p );
119  Aig_ManForEachCi( p, pObj, i )
120  {
121  pObj->pData = Aig_ObjCreateCi( pNew );
122  Entry = Vec_IntEntry( vHints, Aig_ObjId(pObj) );
123  if ( Entry == 0 || Entry == 1 )
124  pObj->pData = Aig_NotCond( Aig_ManConst1(pNew), Entry ); // restrict to the complement of constraint!!!
125  }
126  // duplicate internal nodes
127  Aig_ManForEachNode( p, pObj, i )
128  {
129  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
130  Entry = Vec_IntEntry( vHints, Aig_ObjId(pObj) );
131  if ( Entry == 0 || Entry == 1 )
132  pObj->pData = Aig_NotCond( Aig_ManConst1(pNew), Entry ); // restrict to the complement of constraint!!!
133  }
134  // add the POs
135  Aig_ManForEachCo( p, pObj, i )
136  pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
137  Aig_ManCleanup( pNew );
138  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
139  // check the resulting network
140  if ( !Aig_ManCheck(pNew) )
141  printf( "Llb_ManDeriveAigWithHints(): The check has failed.\n" );
142  return pNew;
143 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
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 * pData
Definition: aig.h:87
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static void check(int expr)
Definition: satSolver.c:46
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
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
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
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupTrim ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of the nodes.]

SideEffects []

SeeAlso []

Definition at line 413 of file aigDup.c.

414 {
415  Aig_Man_t * pNew;
416  Aig_Obj_t * pObj, * pObjNew;
417  int i, nNodes;
418  // create the new manager
419  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
420  pNew->pName = Abc_UtilStrsav( p->pName );
421  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
422  pNew->nConstrs = p->nConstrs;
423  pNew->nBarBufs = p->nBarBufs;
424  // create the PIs
425  Aig_ManCleanData( p );
426  // duplicate internal nodes
427  Aig_ManForEachObj( p, pObj, i )
428  {
429  if ( Aig_ObjIsNode(pObj) )
430  pObjNew = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
431  else if ( Aig_ObjIsCi(pObj) )
432  pObjNew = (Aig_ObjRefs(pObj) > 0 || Saig_ObjIsLo(p, pObj)) ? Aig_ObjCreateCi(pNew) : NULL;
433  else if ( Aig_ObjIsCo(pObj) )
434  pObjNew = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
435  else if ( Aig_ObjIsConst1(pObj) )
436  pObjNew = Aig_ManConst1(pNew);
437  else
438  assert( 0 );
439  pObj->pData = pObjNew;
440  }
441  assert( Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
442  if ( (nNodes = Aig_ManCleanup( pNew )) )
443  printf( "Aig_ManDupTrim(): Cleanup after AIG duplication removed %d nodes.\n", nNodes );
444  Aig_ManSetRegNum( pNew, Aig_ManRegNum(p) );
445  // check the resulting network
446  if ( !Aig_ManCheck(pNew) )
447  printf( "Aig_ManDupTrim(): The check has failed.\n" );
448  return pNew;
449 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
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 * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
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_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
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
Aig_Man_t* Aig_ManDupUnsolvedOutputs ( Aig_Man_t p,
int  fAddRegs 
)

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

Synopsis [Duplicates AIG with only one primary output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1199 of file aigDup.c.

1200 {
1201  Aig_Man_t * pNew;
1202  Aig_Obj_t * pObj;
1203  int i, nOuts = 0;
1204  assert( Aig_ManRegNum(p) > 0 );
1205  if ( p->nConstrs > 0 )
1206  {
1207  printf( "The AIG manager should have no constraints.\n" );
1208  return NULL;
1209  }
1210  // create the new manager
1211  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
1212  pNew->pName = Abc_UtilStrsav( p->pName );
1213  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1214  // create the PIs
1215  Aig_ManCleanData( p );
1216  Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
1217  Aig_ManForEachCi( p, pObj, i )
1218  pObj->pData = Aig_ObjCreateCi( pNew );
1219  // create the POs
1220  nOuts = 0;
1221  Aig_ManForEachPoSeq( p, pObj, i )
1222  nOuts += ( Aig_ObjFanin0(pObj) != Aig_ManConst1(p) );
1223  // set registers
1224  pNew->nRegs = fAddRegs? p->nRegs : 0;
1225  pNew->nTruePis = fAddRegs? p->nTruePis : p->nTruePis + p->nRegs;
1226  pNew->nTruePos = nOuts;
1227  // duplicate internal nodes
1228  Aig_ManForEachNode( p, pObj, i )
1229  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
1230  // create the PO
1231  Aig_ManForEachPoSeq( p, pObj, i )
1232  if ( Aig_ObjFanin0(pObj) != Aig_ManConst1(p) )
1233  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1234  // create register inputs with MUXes
1235  if ( fAddRegs )
1236  {
1237  Aig_ManForEachLiSeq( p, pObj, i )
1238  Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
1239  }
1240  Aig_ManCleanup( pNew );
1241  return pNew;
1242 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
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 * 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
#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
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
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
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
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t* Aig_ManDupWithoutPos ( Aig_Man_t p)

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

Synopsis [Duplicates the AIG manager.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 835 of file aigDup.c.

836 {
837  Aig_Man_t * pNew;
838  Aig_Obj_t * pObj;
839  int i;
840  // create the new manager
841  pNew = Aig_ManStart( Aig_ManObjNumMax(p) );
842  pNew->pName = Abc_UtilStrsav( p->pName );
843  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
844  // create the PIs
845  Aig_ManCleanData( p );
847  Aig_ManForEachCi( p, pObj, i )
848  pObj->pData = Aig_ObjCreateCi( pNew );
849  // duplicate internal nodes
850  Aig_ManForEachObj( p, pObj, i )
851  {
852  assert( !Aig_ObjIsBuf(pObj) );
853  if ( Aig_ObjIsNode(pObj) )
854  pObj->pData = Aig_Oper( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj), Aig_ObjType(pObj) );
855  }
856  assert( Aig_ManBufNum(p) != 0 || Aig_ManNodeNum(p) == Aig_ManNodeNum(pNew) );
857  return pNew;
858 }
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
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 * pData
Definition: aig.h:87
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
Aig_Obj_t * Aig_Oper(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1, Aig_Type_t Type)
Definition: aigOper.c:83
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ManBufNum(Aig_Man_t *p)
Definition: aig.h:253
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
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_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Vec_Ptr_t* Aig_ManOrderPios ( Aig_Man_t p,
Aig_Man_t pOrder 
)

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

Synopsis [Duplicates the AIG manager.]

Description [This duplicator works for AIGs with choices.]

SideEffects []

SeeAlso []

Definition at line 626 of file aigDup.c.

627 {
628  Vec_Ptr_t * vPios;
629  Aig_Obj_t * pObj;
630  int i;
631  assert( Aig_ManCiNum(p) == Aig_ManCiNum(pOrder) );
632  assert( Aig_ManCoNum(p) == Aig_ManCoNum(pOrder) );
633  Aig_ManSetCioIds( pOrder );
634  vPios = Vec_PtrAlloc( Aig_ManCiNum(p) + Aig_ManCoNum(p) );
635  Aig_ManForEachObj( pOrder, pObj, i )
636  {
637  if ( Aig_ObjIsCi(pObj) )
638  Vec_PtrPush( vPios, Aig_ManCi(p, Aig_ObjCioId(pObj)) );
639  else if ( Aig_ObjIsCo(pObj) )
640  Vec_PtrPush( vPios, Aig_ManCo(p, Aig_ObjCioId(pObj)) );
641  }
642  Aig_ManCleanCioIds( pOrder );
643  return vPios;
644 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Aig_Obj_t * Aig_ManCi(Aig_Man_t *p, int i)
Definition: aig.h:266
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static int Aig_ObjIsCo(Aig_Obj_t *pObj)
Definition: aig.h:276
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static Aig_Obj_t* Aig_ObjChild0Repres ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 906 of file aigDup.c.

906 { return Aig_NotCond( Aig_ObjGetRepres(p, Aig_ObjFanin0(pObj)), Aig_ObjFaninC0(pObj) ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ObjGetRepres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:899
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Aig_ObjChild1Repres ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

Definition at line 907 of file aigDup.c.

907 { return Aig_NotCond( Aig_ObjGetRepres(p, Aig_ObjFanin1(pObj)), Aig_ObjFaninC1(pObj) ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Aig_ObjGetRepres(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigDup.c:899
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 Aig_Obj_t* Aig_ObjGetRepres ( Aig_Man_t p,
Aig_Obj_t pObj 
)
inlinestatic

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

Synopsis [Returns representatives of fanin in approapriate polarity.]

Description []

SideEffects []

SeeAlso []

Definition at line 899 of file aigDup.c.

900 {
901  Aig_Obj_t * pRepr;
902  if ( (pRepr = Aig_ObjRepr(p, pObj)) )
903  return Aig_NotCond( (Aig_Obj_t *)pRepr->pData, pObj->fPhase ^ pRepr->fPhase );
904  return (Aig_Obj_t *)pObj->pData;
905 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
Definition: aig.h:69
unsigned int fPhase
Definition: aig.h:78
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248