ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
resStrash.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22#include "resInt.h"
23
25
26
30
31extern Abc_Obj_t * Abc_ConvertAigToAig( Abc_Ntk_t * pAig, Abc_Obj_t * pObjOld );
32
36
50{
51 Vec_Ptr_t * vPairs;
52 Abc_Ntk_t * pAig;
53 Abc_Obj_t * pObj, * pMiter;
54 int i;
55 assert( Abc_NtkHasAig(p->pNode->pNtk) );
56// Abc_NtkCleanCopy( p->pNode->pNtk );
57 // create the network
59 pAig->pName = Extra_UtilStrsav( "window" );
60 // create the inputs
61 Vec_PtrForEachEntry( Abc_Obj_t *, p->vLeaves, pObj, i )
62 pObj->pCopy = Abc_NtkCreatePi( pAig );
63 Vec_PtrForEachEntry( Abc_Obj_t *, p->vBranches, pObj, i )
64 pObj->pCopy = Abc_NtkCreatePi( pAig );
65 // go through the nodes in the topological order
66 Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pObj, i )
67 {
68 pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
69 if ( pObj == p->pNode )
70 pObj->pCopy = Abc_ObjNot( pObj->pCopy );
71 }
72 // collect the POs
73 vPairs = Vec_PtrAlloc( 2 * Vec_PtrSize(p->vRoots) );
74 Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
75 {
76 Vec_PtrPush( vPairs, pObj->pCopy );
77 Vec_PtrPush( vPairs, NULL );
78 }
79 // mark the TFO of the node
80 Abc_NtkIncrementTravId( p->pNode->pNtk );
81 Res_WinSweepLeafTfo_rec( p->pNode, (int)p->pNode->Level + p->nWinTfoMax );
82 // update strashing of the node
83 p->pNode->pCopy = Abc_ObjNot( p->pNode->pCopy );
84 Abc_NodeSetTravIdPrevious( p->pNode );
85 // redo strashing in the TFO
86 Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pObj, i )
87 {
88 if ( Abc_NodeIsTravIdCurrent(pObj) )
89 pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
90 }
91 // collect the POs
92 Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
93 Vec_PtrWriteEntry( vPairs, 2 * i + 1, pObj->pCopy );
94 // add the miter
95 pMiter = Abc_AigMiter( (Abc_Aig_t *)pAig->pManFunc, vPairs, 0 );
96 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pMiter );
97 Vec_PtrFree( vPairs );
98 // add the node
99 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), p->pNode->pCopy );
100 // add the fanins
101 Abc_ObjForEachFanin( p->pNode, pObj, i )
102 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
103 // add the divisors
104 Vec_PtrForEachEntry( Abc_Obj_t *, p->vDivs, pObj, i )
105 Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
106 // add the names
109 // check the resulting network
110 if ( !Abc_NtkCheck( pAig ) )
111 fprintf( stdout, "Res_WndStrash(): Network check has failed.\n" );
112 return pAig;
113}
114
115
119
120
122
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
ABC_DLL Abc_Obj_t * Abc_AigMiter(Abc_Aig_t *pMan, Vec_Ptr_t *vPairs, int fImplic)
Definition abcAig.c:789
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
char * Extra_UtilStrsav(const char *s)
void Res_WinSweepLeafTfo_rec(Abc_Obj_t *pObj, int nLevelLimit)
Definition resDivs.c:196
typedefABC_NAMESPACE_HEADER_START struct Res_Win_t_ Res_Win_t
INCLUDES ///.
Definition resInt.h:44
Abc_Ntk_t * Res_WndStrash(Res_Win_t *p)
FUNCTION DEFINITIONS ///.
Definition resStrash.c:49
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_ConvertAigToAig(Abc_Ntk_t *pAig, Abc_Obj_t *pObjOld)
DECLARATIONS ///.
Definition abcFunc.c:1157
char * pName
Definition abc.h:158
void * pManFunc
Definition abc.h:191
Abc_Obj_t * pCopy
Definition abc.h:148
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55