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
|
/**CFile****************************************************************
FileName [nwkAig.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Netlist representation.]
Synopsis [Translating of AIG into the network.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: nwkAig.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "nwk.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Converts AIG into the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Nwk_Man_t * Nwk_ManDeriveFromAig( Aig_Man_t * p )
{
Nwk_Man_t * pNtk;
Aig_Obj_t * pObj;
int i;
pNtk = Nwk_ManAlloc();
pNtk->nFanioPlus = 0;
Hop_ManStop( pNtk->pManHop );
pNtk->pManHop = NULL;
pNtk->pName = Aig_UtilStrsav( p->pName );
pNtk->pSpec = Aig_UtilStrsav( p->pSpec );
pObj = Aig_ManConst1(p);
pObj->pData = Nwk_ManCreateNode( pNtk, 0, pObj->nRefs );
Aig_ManForEachPi( p, pObj, i )
pObj->pData = Nwk_ManCreateCi( pNtk, pObj->nRefs );
Aig_ManForEachNode( p, pObj, i )
{
pObj->pData = Nwk_ManCreateNode( pNtk, 2, pObj->nRefs );
Nwk_ObjAddFanin( pObj->pData, Aig_ObjFanin0(pObj)->pData );
Nwk_ObjAddFanin( pObj->pData, Aig_ObjFanin1(pObj)->pData );
}
Aig_ManForEachPo( p, pObj, i )
{
pObj->pData = Nwk_ManCreateCo( pNtk );
Nwk_ObjAddFanin( pObj->pData, Aig_ObjFanin0(pObj)->pData );
}
return pNtk;
}
/**Function*************************************************************
Synopsis [Converts AIG into the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Nwk_ManDeriveRetimingCut( Aig_Man_t * p, int fForward, int fVerbose )
{
Vec_Ptr_t * vNodes;
Nwk_Man_t * pNtk;
Nwk_Obj_t * pNode;
Aig_Obj_t * pObj;
int i;
pNtk = Nwk_ManDeriveFromAig( p );
if ( fForward )
vNodes = Nwk_ManRetimeCutForward( pNtk, Aig_ManRegNum(p), fVerbose );
else
vNodes = Nwk_ManRetimeCutBackward( pNtk, Aig_ManRegNum(p), fVerbose );
Aig_ManForEachObj( p, pObj, i )
((Nwk_Obj_t *)pObj->pData)->pCopy = pObj;
Vec_PtrForEachEntry( vNodes, pNode, i )
Vec_PtrWriteEntry( vNodes, i, pNode->pCopy );
Nwk_ManFree( pNtk );
assert( Vec_PtrSize(vNodes) <= Aig_ManRegNum(p) );
return vNodes;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
|