ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlcWin.c
Go to the documentation of this file.
1
20
21#include "wlc.h"
22#include "base/abc/abc.h"
23
25
29
33
46{
47 return pObj->Type == WLC_OBJ_CONST ||
48 pObj->Type == WLC_OBJ_BUF || pObj->Type == WLC_OBJ_BIT_NOT ||
49 pObj->Type == WLC_OBJ_BIT_ZEROPAD || pObj->Type == WLC_OBJ_BIT_SIGNEXT ||
50// pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_BIT_CONCAT ||
51 pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB ||
52 pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_MINUS;
53}
55{
56 return pObj->Type == WLC_OBJ_BIT_NOT ||
57 pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB ||
58 pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_MINUS;
59}
61{
62 Wlc_Obj_t * pObj;
63 int i, Counter = 0;
64 Wlc_NtkForEachObjVec( vNodes, p, pObj, i )
65 Counter += Wlc_ObjIsArithmReal( pObj );
66 return Counter;
67}
69{
70 if ( pObj->Type == WLC_OBJ_CONST )
71 return 0;
72 if ( pObj->Type == WLC_OBJ_BUF || pObj->Type == WLC_OBJ_BIT_NOT ||
74 return Wlc_ObjHasArithm_rec( p, Wlc_ObjFanin0(p, pObj) );
75 return pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB ||
76 pObj->Type == WLC_OBJ_ARI_MULTI || pObj->Type == WLC_OBJ_ARI_MINUS;
77}
79{
80 Wlc_Obj_t * pFanin; int i;
81 assert( !Wlc_ObjHasArithm_rec(p, pObj) );
82 Wlc_ObjForEachFaninObj( p, pObj, pFanin, i )
83 if ( Wlc_ObjHasArithm_rec(p, pFanin) )
84 return 1;
85 return 0;
86}
87void Wlc_WinCompute_rec( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
88{
89 Wlc_Obj_t * pFanin; int i;
90 if ( pObj->Mark )
91 return;
92 pObj->Mark = 1;
93 if ( !Wlc_ObjIsArithm(pObj) )
94 {
95 Vec_IntPush( vLeaves, Wlc_ObjId(p, pObj) );
96 return;
97 }
98 Wlc_ObjForEachFaninObj( p, pObj, pFanin, i )
99 Wlc_WinCompute_rec( p, pFanin, vLeaves, vNodes );
100 Vec_IntPush( vNodes, Wlc_ObjId(p, pObj) );
101}
103{
104 Wlc_Obj_t * pFanin; int i;
105 if ( !pObj->Mark )
106 return;
107 pObj->Mark = 0;
108 Wlc_ObjForEachFaninObj( p, pObj, pFanin, i )
109 Wlc_WinCleanMark_rec( p, pFanin );
110}
111void Wlc_WinCompute( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vLeaves, Vec_Int_t * vNodes )
112{
113 Vec_IntClear( vLeaves );
114 Vec_IntClear( vNodes );
115 if ( Wlc_ObjHasArithm_rec(p, pObj) )
116 {
117 Wlc_WinCompute_rec( p, pObj, vLeaves, vNodes );
118 Wlc_WinCleanMark_rec( p, pObj );
119 }
120 else if ( Wlc_ObjHasArithmFanins(p, pObj) )
121 {
122 Wlc_Obj_t * pFanin; int i;
123 Wlc_ObjForEachFaninObj( p, pObj, pFanin, i )
124 if ( Wlc_ObjHasArithm_rec(p, pFanin) )
125 Wlc_WinCompute_rec( p, pFanin, vLeaves, vNodes );
126 Wlc_ObjForEachFaninObj( p, pObj, pFanin, i )
127 if ( Wlc_ObjHasArithm_rec(p, pFanin) )
128 Wlc_WinCleanMark_rec( p, pFanin );
129 }
130 else assert( 0 );
131}
133{
134 Vec_Int_t * vLeaves = Vec_IntAlloc( 1000 );
135 Vec_Int_t * vNodes = Vec_IntAlloc( 1000 );
136 Wlc_Obj_t * pObj; int i, Count = 0;
137 Wlc_NtkForEachObj( p, pObj, i )
138 pObj->Mark = 0;
139 Wlc_NtkForEachObj( p, pObj, i )
140 if ( Wlc_ObjHasArithm_rec(p, pObj) ? Wlc_ObjIsCo(pObj) : Wlc_ObjHasArithmFanins(p, pObj) )
141 {
142 Wlc_WinCompute( p, pObj, vLeaves, vNodes );
143 if ( Wlc_ManCountArithmReal(p, vNodes) < 2 )
144 continue;
145
146 printf( "Arithmetic cone of node %d (%s):\n", Wlc_ObjId(p, pObj), Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
147 Wlc_NtkPrintNode( p, pObj );
148 Vec_IntReverseOrder( vNodes );
149 Wlc_NtkPrintNodeArray( p, vNodes );
150 printf( "\n" );
151 Count++;
152 }
153 Wlc_NtkForEachObj( p, pObj, i )
154 assert( pObj->Mark == 0 );
155 printf( "Finished printing %d arithmetic cones.\n", Count );
156 Vec_IntFree( vLeaves );
157 Vec_IntFree( vNodes );
158}
159
163
164
166
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
unsigned Type
Definition wlc.h:121
unsigned Mark
Definition wlc.h:123
#define assert(ex)
Definition util_old.h:213
void Wlc_WinCompute(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
Definition wlcWin.c:111
void Wlc_WinCleanMark_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcWin.c:102
int Wlc_ObjIsArithmReal(Wlc_Obj_t *pObj)
Definition wlcWin.c:54
int Wlc_ObjHasArithmFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcWin.c:78
void Wlc_WinProfileArith(Wlc_Ntk_t *p)
Definition wlcWin.c:132
int Wlc_ManCountArithmReal(Wlc_Ntk_t *p, Vec_Int_t *vNodes)
Definition wlcWin.c:60
void Wlc_WinCompute_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vNodes)
Definition wlcWin.c:87
ABC_NAMESPACE_IMPL_START int Wlc_ObjIsArithm(Wlc_Obj_t *pObj)
DECLARATIONS ///.
Definition wlcWin.c:45
int Wlc_ObjHasArithm_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcWin.c:68
#define Wlc_ObjForEachFaninObj(p, pObj, pFanin, i)
Definition wlc.h:377
void Wlc_NtkPrintNode(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:703
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition wlc.h:360
void Wlc_NtkPrintNodeArray(Wlc_Ntk_t *p, Vec_Int_t *vArray)
Definition wlcNtk.c:764
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition wlc.h:356
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
@ WLC_OBJ_ARI_MULTI
Definition wlc.h:90
@ WLC_OBJ_BIT_SIGNEXT
Definition wlc.h:70
@ WLC_OBJ_BIT_ZEROPAD
Definition wlc.h:69
@ WLC_OBJ_BUF
Definition wlc.h:52
@ WLC_OBJ_ARI_SUB
Definition wlc.h:89
@ WLC_OBJ_BIT_NOT
Definition wlc.h:60
@ WLC_OBJ_CONST
Definition wlc.h:51
@ WLC_OBJ_ARI_MINUS
Definition wlc.h:95
@ WLC_OBJ_ARI_ADD
Definition wlc.h:88
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition wlc.h:118