ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mpmMig.c
Go to the documentation of this file.
1
20
21#include "mpmInt.h"
22
24
25
29
33
46{
47 Mig_Man_t * p;
48 assert( sizeof(Mig_Obj_t) >= 16 );
49 assert( (1 << MIG_BASE) == MIG_MASK + 1 );
50 p = ABC_CALLOC( Mig_Man_t, 1 );
51 Vec_IntGrow( &p->vCis, 1024 );
52 Vec_IntGrow( &p->vCos, 1024 );
53 Mig_ManAppendObj( p ); // const0
54 return p;
55}
57{
58 if ( 0 )
59 printf( "Subject graph uses %d pages of %d objects with %d entries. Total memory = %.2f MB.\n",
60 Vec_PtrSize(&p->vPages), MIG_MASK + 1, p->nObjs,
61 1.0 * Vec_PtrSize(&p->vPages) * (MIG_MASK + 1) * 16 / (1 << 20) );
62 // attributes
63 ABC_FREE( p->vTravIds.pArray );
64 ABC_FREE( p->vCopies.pArray );
65 ABC_FREE( p->vLevels.pArray );
66 ABC_FREE( p->vRefs.pArray );
67 ABC_FREE( p->vSibls.pArray );
68 // pages
69 Vec_PtrForEachEntry( Mig_Obj_t *, &p->vPages, p->pPage, p->iPage )
70 --p->pPage, ABC_FREE( p->pPage );
71 // objects
72 ABC_FREE( p->vPages.pArray );
73 ABC_FREE( p->vCis.pArray );
74 ABC_FREE( p->vCos.pArray );
75 ABC_FREE( p->pName );
76 ABC_FREE( p );
77}
78
90int Mig_ManTypeNum( Mig_Man_t * p, int Type )
91{
92 Mig_Obj_t * pObj;
93 int Counter = 0;
94 Mig_ManForEachNode( p, pObj )
95 Counter += (Mig_ObjNodeType(pObj) == Type);
96 return Counter;
97}
99{
100 return Mig_ManTypeNum(p, 1);
101}
103{
104 return Mig_ManTypeNum(p, 2);
105}
107{
108 return Mig_ManTypeNum(p, 3);
109}
110
111
124{
125 Mig_Obj_t * pObj;
126 int i, iFanin;
127 // increment references
128 Vec_IntFill( &p->vRefs, Mig_ManObjNum(p), 0 );
129 Mig_ManForEachObj( p, pObj )
130 {
131 Mig_ObjForEachFaninId( pObj, iFanin, i )
132 Vec_IntAddToEntry( &p->vRefs, iFanin, 1 );
133 if ( Mig_ObjSiblId(pObj) )
134 Vec_IntAddToEntry( &p->vRefs, Mig_ObjSiblId(pObj), 1 );
135 }
136}
137
150{
151 if ( pObj == NULL )
152 return 0;
153 if ( Mig_ObjIsTravIdCurrent(pObj) )
154 return 0;
155 Mig_ObjSetTravIdCurrent(pObj);
156 if ( Mig_ObjIsCi(pObj) )
157 return 1;
158 assert( Mig_ObjIsNode(pObj) );
159 return Mig_ManSuppSize_rec( Mig_ObjFanin0(pObj) ) +
160 Mig_ManSuppSize_rec( Mig_ObjFanin1(pObj) ) +
161 Mig_ManSuppSize_rec( Mig_ObjFanin2(pObj) );
162}
164{
165 Mig_Obj_t * pObj;
166 if ( iObj == MIG_NONE )
167 return 0;
168 if ( Mig_ObjIsTravIdCurrentId(p, iObj) )
169 return 0;
170 Mig_ObjSetTravIdCurrentId(p, iObj);
171 pObj = Mig_ManObj( p, iObj );
172 if ( Mig_ObjIsCi(pObj) )
173 return 1;
174 assert( Mig_ObjIsNode(pObj) );
175 return Mig_ManSuppSize2_rec( p, Mig_ObjFaninId0(pObj) ) +
176 Mig_ManSuppSize2_rec( p, Mig_ObjFaninId1(pObj) ) +
177 Mig_ManSuppSize2_rec( p, Mig_ObjFaninId2(pObj) );
178}
180{
181 Mig_ObjIncrementTravId( pObj );
182// return Mig_ManSuppSize_rec( pObj );
183 return Mig_ManSuppSize2_rec( Mig_ObjMan(pObj), Mig_ObjId(pObj) );
184}
186{
187 Mig_Obj_t * pObj;
188 int Counter = 0;
189 abctime clk = Abc_Clock();
190 Mig_ManForEachObj( p, pObj )
191 if ( Mig_ObjIsNode(pObj) )
192 Counter += (Mig_ManSuppSizeOne(pObj) <= 16);
193 printf( "Nodes with small support %d (out of %d)\n", Counter, Mig_ManNodeNum(p) );
194 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
195 return Counter;
196}
197
201
202
204
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
int Mig_ManTypeNum(Mig_Man_t *p, int Type)
Definition mpmMig.c:90
int Mig_ManSuppSize2_rec(Mig_Man_t *p, int iObj)
Definition mpmMig.c:163
void Mig_ManSetRefs(Mig_Man_t *p)
Definition mpmMig.c:123
int Mig_ManMuxNum(Mig_Man_t *p)
Definition mpmMig.c:106
void Mig_ManStop(Mig_Man_t *p)
Definition mpmMig.c:56
int Mig_ManAndNum(Mig_Man_t *p)
Definition mpmMig.c:98
ABC_NAMESPACE_IMPL_START Mig_Man_t * Mig_ManStart()
DECLARATIONS ///.
Definition mpmMig.c:45
int Mig_ManSuppSizeOne(Mig_Obj_t *pObj)
Definition mpmMig.c:179
int Mig_ManSuppSizeTest(Mig_Man_t *p)
Definition mpmMig.c:185
int Mig_ManSuppSize_rec(Mig_Obj_t *pObj)
Definition mpmMig.c:149
int Mig_ManXorNum(Mig_Man_t *p)
Definition mpmMig.c:102
struct Mig_Obj_t_ Mig_Obj_t
Definition mpmMig.h:54
#define Mig_ManForEachNode(p, pObj)
Definition mpmMig.h:322
#define Mig_ManForEachObj(p, pObj)
MACRO DEFINITIONS ///.
Definition mpmMig.h:304
#define Mig_ObjForEachFaninId(p, iFanin, i)
Definition mpmMig.h:333
#define MIG_NONE
INCLUDES ///.
Definition mpmMig.h:37
#define MIG_BASE
Definition mpmMig.h:41
struct Mig_Man_t_ Mig_Man_t
Definition mpmMig.h:60
#define MIG_MASK
Definition mpmMig.h:40
#define assert(ex)
Definition util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55