1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/**CFile****************************************************************
FileName [dchAig.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Choice computation for tech-mapping.]
Synopsis [AIG manipulation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 29, 2008.]
Revision [$Id: dchAig.c,v 1.00 2008/07/29 00:00:00 alanmi Exp $]
***********************************************************************/
#include "dchInt.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Derives the cumulative AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Dch_DeriveTotalAig_rec( Aig_Man_t * p, Aig_Obj_t * pObj )
{
if ( pObj->pData )
return;
Dch_DeriveTotalAig_rec( p, Aig_ObjFanin0(pObj) );
Dch_DeriveTotalAig_rec( p, Aig_ObjFanin1(pObj) );
pObj->pData = Aig_And( p, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
}
/**Function*************************************************************
Synopsis [Derives the cumulative AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t * Dch_DeriveTotalAig( Vec_Ptr_t * vAigs )
{
Aig_Man_t * pAig, * pAig2, * pAigTotal;
Aig_Obj_t * pObj, * pObjPi, * pObjPo;
int i, k, nNodes;
assert( Vec_PtrSize(vAigs) > 0 );
// make sure they have the same number of PIs/POs
nNodes = 0;
pAig = Vec_PtrEntry( vAigs, 0 );
Vec_PtrForEachEntry( vAigs, pAig2, i )
{
assert( Aig_ManPiNum(pAig) == Aig_ManPiNum(pAig2) );
assert( Aig_ManPoNum(pAig) == Aig_ManPoNum(pAig2) );
nNodes += Aig_ManNodeNum(pAig2);
Aig_ManCleanData( pAig2 );
}
// map constant nodes
pAigTotal = Aig_ManStart( nNodes );
Vec_PtrForEachEntry( vAigs, pAig2, k )
Aig_ManConst1(pAig2)->pData = Aig_ManConst1(pAigTotal);
// map primary inputs
Aig_ManForEachPi( pAig, pObj, i )
{
pObjPi = Aig_ObjCreatePi( pAigTotal );
Vec_PtrForEachEntry( vAigs, pAig2, k )
Aig_ManPi( pAig2, i )->pData = pObjPi;
}
// construct the AIG in the order of POs
Aig_ManForEachPo( pAig, pObj, i )
{
Vec_PtrForEachEntry( vAigs, pAig2, k )
{
pObjPo = Aig_ManPo( pAig2, i );
Dch_DeriveTotalAig_rec( pAigTotal, Aig_ObjFanin0(pObjPo) );
}
Aig_ObjCreatePo( pAigTotal, Aig_ObjChild0Copy(pObj) );
}
/*
// mark the cone of the first AIG
Aig_ManIncrementTravId( pAigTotal );
Aig_ManForEachObj( pAig, pObj, i )
if ( pObj->pData )
Aig_ObjSetTravIdCurrent( pAigTotal, pObj->pData );
*/
// cleanup should not be done
return pAigTotal;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
|