abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dchAig.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [dchAig.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Choice computation for tech-mapping.]
8 
9  Synopsis [AIG manipulation.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 29, 2008.]
16 
17  Revision [$Id: dchAig.c,v 1.00 2008/07/29 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "dchInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Derives the cumulative AIG.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
46 {
47  if ( pObj->pData )
48  return;
51  pObj->pData = Aig_And( p, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
52 }
53 
54 /**Function*************************************************************
55 
56  Synopsis [Derives the cumulative AIG.]
57 
58  Description []
59 
60  SideEffects []
61 
62  SeeAlso []
63 
64 ***********************************************************************/
66 {
67  Aig_Man_t * pAig, * pAig2, * pAigTotal;
68  Aig_Obj_t * pObj, * pObjPi, * pObjPo;
69  int i, k, nNodes;
70  assert( Vec_PtrSize(vAigs) > 0 );
71  // make sure they have the same number of PIs/POs
72  nNodes = 0;
73  pAig = (Aig_Man_t *)Vec_PtrEntry( vAigs, 0 );
74  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig2, i )
75  {
76  assert( Aig_ManCiNum(pAig) == Aig_ManCiNum(pAig2) );
77  assert( Aig_ManCoNum(pAig) == Aig_ManCoNum(pAig2) );
78  nNodes += Aig_ManNodeNum(pAig2);
79  Aig_ManCleanData( pAig2 );
80  }
81  // map constant nodes
82  pAigTotal = Aig_ManStart( nNodes );
83  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig2, k )
84  Aig_ManConst1(pAig2)->pData = Aig_ManConst1(pAigTotal);
85  // map primary inputs
86  Aig_ManForEachCi( pAig, pObj, i )
87  {
88  pObjPi = Aig_ObjCreateCi( pAigTotal );
89  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig2, k )
90  Aig_ManCi( pAig2, i )->pData = pObjPi;
91  }
92  // construct the AIG in the order of POs
93  Aig_ManForEachCo( pAig, pObj, i )
94  {
95  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig2, k )
96  {
97  pObjPo = Aig_ManCo( pAig2, i );
98  Dch_DeriveTotalAig_rec( pAigTotal, Aig_ObjFanin0(pObjPo) );
99  }
100  Aig_ObjCreateCo( pAigTotal, Aig_ObjChild0Copy(pObj) );
101  }
102 /*
103  // mark the cone of the first AIG
104  Aig_ManIncrementTravId( pAigTotal );
105  Aig_ManForEachObj( pAig, pObj, i )
106  if ( pObj->pData )
107  Aig_ObjSetTravIdCurrent( pAigTotal, pObj->pData );
108 */
109  // cleanup should not be done
110  return pAigTotal;
111 }
112 
113 ////////////////////////////////////////////////////////////////////////
114 /// END OF FILE ///
115 ////////////////////////////////////////////////////////////////////////
116 
117 
119 
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
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
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
ABC_NAMESPACE_IMPL_START void Dch_DeriveTotalAig_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition: dchAig.c:45
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
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_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
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
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_Man_t * Dch_DeriveTotalAig(Vec_Ptr_t *vAigs)
MACRO DEFINITIONS ///.
Definition: dchAig.c:65
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static 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
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205