71 Vec_Wec_t * vMapping = Vec_WecStart( Gia_ManObjNum(
p) );
76 Vec_WecPush( vMapping, Obj, Fanin );
81 Vec_Int_t * vMapping, * vVec;
int i, k, Obj;
82 assert( Gia_ManHasMapping2(
p) );
83 vMapping = Vec_IntAlloc( Gia_ManObjNum(
p) + Vec_WecSizeSize(vMap) + 2*Vec_WecSizeUsed(vMap) );
84 Vec_IntFill( vMapping, Gia_ManObjNum(
p), 0 );
86 if ( Vec_IntSize(vVec) > 0 )
88 Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
89 Vec_IntPush( vMapping, Vec_IntSize(vVec) );
91 Vec_IntPush( vMapping, Obj );
92 Vec_IntPush( vMapping, i );
94 assert( Vec_IntSize(vMapping) < 16 || Vec_IntSize(vMapping) == Vec_IntCap(vMapping) );
116 p->fReverse = fReverse;
118 p->vMarksCIO = Vec_BitStart( Gia_ManObjNum(pGia) );
119 p->vMarksIn = Vec_BitStart( Gia_ManObjNum(pGia) );
120 p->vMarksNo = Vec_BitStart( Gia_ManObjNum(pGia) );
121 p->vMarksAnd = Vec_BitStart( Gia_ManObjNum(pGia) );
122 p->vRoots = Vec_IntAlloc( 100 );
123 p->vNodes = Vec_IntAlloc( 100 );
124 p->vLeaves = Vec_IntAlloc( 100 );
125 p->vAnds = Vec_IntAlloc( 100 );
127 p->vFanouts = Vec_IntAlloc( 100 );
128 p->vCands = Vec_IntAlloc( 100 );
129 p->vInputs = Vec_IntAlloc( 100 );
131 Vec_BitWriteEntry(
p->vMarksCIO, 0, 1 );
133 Vec_BitWriteEntry(
p->vMarksCIO, iObj, 1 );
135 Vec_BitWriteEntry(
p->vMarksCIO, iObj, 1 );
140 assert( Gia_ManHasMapping(pGia) );
141 assert( !Gia_ManHasMapping2(pGia) );
153 assert( !Gia_ManHasMapping(
p->pGia) );
154 assert( Gia_ManHasMapping2(
p->pGia) );
156 Vec_WecFreeP( &
p->pGia->vMapping2 );
158 Vec_BitFree(
p->vMarksCIO );
159 Vec_BitFree(
p->vMarksIn );
160 Vec_BitFree(
p->vMarksNo );
161 Vec_BitFree(
p->vMarksAnd );
162 Vec_IntFree(
p->vRoots );
163 Vec_IntFree(
p->vNodes );
164 Vec_IntFree(
p->vLeaves );
165 Vec_IntFree(
p->vAnds );
167 Vec_IntFree(
p->vFanouts );
168 Vec_IntFree(
p->vCands );
169 Vec_IntFree(
p->vInputs );
187 int iObj, iFan, i, k;
204 Vec_IntClear(
p->vLeaves );
207 Gia_Obj_t * pObj = Gia_ManObj(
p->pGia, iObj );
208 assert( Vec_BitEntry(
p->vMarksAnd, iObj) );
209 iFan = Gia_ObjFaninId0( pObj, iObj );
210 if ( !Vec_BitEntry(
p->vMarksAnd, iFan) )
212 assert( Gia_ObjIsLut2(
p->pGia, iFan) || Vec_BitEntry(
p->vMarksCIO, iFan) );
213 Vec_BitWriteEntry(
p->vMarksAnd, iFan, 1);
214 Vec_IntPush(
p->vLeaves, iFan );
216 iFan = Gia_ObjFaninId1( pObj, iObj );
217 if ( !Vec_BitEntry(
p->vMarksAnd, iFan) )
219 assert( Gia_ObjIsLut2(
p->pGia, iFan) || Vec_BitEntry(
p->vMarksCIO, iFan) );
220 Vec_BitWriteEntry(
p->vMarksAnd, iFan, 1);
221 Vec_IntPush(
p->vLeaves, iFan );
225 Vec_BitWriteEntry(
p->vMarksAnd, iFan, 0);
228 Vec_IntClear(
p->vRoots );
231 Gia_ObjLutRefDecId(
p->pGia, iFan );
233 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) )
234 Vec_IntPush(
p->vRoots, iObj );
237 Gia_ObjLutRefIncId(
p->pGia, iFan );
257 if ( Vec_BitEntry(vMarksNo, iObj) || Vec_BitEntry(vMarksCIO, iObj) )
259 if ( Gia_ObjIsLut2(
p, iObj) )
261 Vec_BitWriteEntry( vMarksCIO, iObj, 1 );
262 Vec_IntPush( vFanouts, iObj );
271 assert( Gia_ObjIsLut2(
p, iObj) );
272 Vec_IntClear( vFanouts );
277 Vec_BitWriteEntry( vMarksCIO, iFanout, 0 );
278 return Vec_IntSize(vFanouts);
295 int i, iFan, Count = 0;
296 Vec_Int_t * vFanins = Gia_ObjLutFanins2(
p, iObj);
298 if ( Vec_BitEntry(vMarks, iFan) )
305 int Res = 0, InCount, InCountMax = -1;
308 Vec_BitWriteEntry(
p->vMarksIn, iObj, 1 );
313 if ( InCountMax < InCount )
315 InCountMax = InCount;
321 Vec_BitWriteEntry(
p->vMarksIn, iObj, 0 );
339 int nFanouts, iObj, iFan, i, k;
345 Gia_ObjLutRefDecId(
p->pGia, iFan );
348 if (
p->fReverse && (Vec_IntSize(
p->vNodes) & 1) )
352 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) == 0 )
354 assert( Gia_ObjLutRefNumId(
p->pGia, iObj) > 0 );
355 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) >= 5 )
358 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) == 1 && nFanouts == 1 )
360 Res = Vec_IntEntry(
p->vFanouts, 0);
368 Vec_IntClear(
p->vCands );
369 Vec_IntClear(
p->vInputs );
372 if ( !Vec_BitEntry(
p->vMarksNo, iFan) && !Vec_BitEntry(
p->vMarksCIO, iFan) && !Gia_ObjLutRefNumId(
p->pGia, iFan) )
374 Vec_IntPush(
p->vCands, iFan );
375 Vec_IntPush(
p->vInputs, iFan );
382 Vec_IntClear(
p->vCands );
383 Vec_IntClear(
p->vInputs );
386 if ( !Vec_BitEntry(
p->vMarksNo, iFan) && !Vec_BitEntry(
p->vMarksCIO, iFan) )
388 Vec_IntPush(
p->vCands, iFan );
389 Vec_IntPush(
p->vInputs, iFan );
395 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) == 0 )
397 assert( Gia_ObjLutRefNumId(
p->pGia, iObj) > 0 );
398 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) >= 5 )
401 if ( Gia_ObjLutRefNumId(
p->pGia, iObj) == 1 && nFanouts == 1 )
403 Res = Vec_IntEntry(
p->vFanouts, 0);
406 Vec_IntAppend(
p->vCands,
p->vFanouts );
415 if ( Res == 0 && Vec_IntSize(
p->vCands) > 0 )
416 Res = Vec_IntEntry(
p->vCands, 0 );
422 Gia_ObjLutRefIncId(
p->pGia, iFan );
442 assert( Gia_ObjIsLut2(
p, iObj) );
447 if ( !Vec_BitEntry(vMarksAnd, iTemp) )
448 Vec_IntWriteEntry( vTemp, k++, iTemp );
449 Vec_IntShrink( vTemp, k );
455 Vec_IntPush(
p->vNodes, iPivot );
456 Vec_BitWriteEntry(
p->vMarksNo, iPivot, 1 );
457 Vec_IntAppend(
p->vAnds, vCands );
459 Vec_BitWriteEntry(
p->vMarksAnd, iObj, 1 );
463 int CountAdd, iObj, i;
464 assert( Gia_ObjIsLut2(
p->pGia, iPivot) );
468 Vec_BitWriteEntry(
p->vMarksNo, iObj, 0 );
470 Vec_BitWriteEntry(
p->vMarksAnd, iObj, 0 );
477 Vec_IntClear(
p->vNodes );
478 Vec_IntClear(
p->vAnds );
482 if ( Vec_IntSize(
p->vAnds) >
p->Limit )
488 assert( Gia_ObjIsLut2(
p->pGia, iObj) );
489 assert( !Vec_BitEntry(
p->vMarksNo, iObj) );
491 if ( Vec_IntSize(
p->vAnds) + CountAdd >
p->Limit )
497 Vec_IntSort(
p->vNodes, 0 );
498 Vec_IntSort(
p->vAnds, 0 );
500 Vec_IntSort(
p->vLeaves, 0 );
501 Vec_IntSort(
p->vRoots, 0 );
534 *pvRoots =
p->vRoots;
535 *pvNodes =
p->vNodes;
536 *pvLeaves =
p->vLeaves;
539 return Vec_IntSize(
p->vAnds);
564 Vec_Int_t * vRoots, * vNodes, * vLeaves, * vAnds;
566 printf(
"Obj = %6d : Leaf = %2d. Node = %2d. Root = %2d. AND = %3d.\n",
567 iLut, Vec_IntSize(vLeaves), Vec_IntSize(vNodes), Vec_IntSize(vRoots), Count );
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Spl_ManLutMffcSize(Gia_Man_t *p, int iObj, Vec_Int_t *vTemp, Vec_Bit_t *vMarksAnd)
void Spl_ManWinFindLeavesRoots(Spl_Man_t *p)
typedefABC_NAMESPACE_IMPL_START struct Spl_Man_t_ Spl_Man_t
DECLARATIONS ///.
void Spl_ManComputeOneTest(Gia_Man_t *pGia)
void Spl_ManAddNode(Spl_Man_t *p, int iPivot, Vec_Int_t *vCands)
int Spl_ManComputeOne(Spl_Man_t *p, int iPivot)
Vec_Wec_t * Spl_ManToWecMapping(Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
int Spl_ManFindGoodCand(Spl_Man_t *p)
int Spl_ManLutFanouts(Gia_Man_t *p, int iObj, Vec_Int_t *vFanouts, Vec_Bit_t *vMarksNo, Vec_Bit_t *vMarksCIO)
Vec_Int_t * Spl_ManFromWecMapping(Gia_Man_t *p, Vec_Wec_t *vMap)
void Gia_ManComputeOneWinStart(Gia_Man_t *pGia, int nAnds, int fReverse)
int Spl_ManFindOne(Spl_Man_t *p)
int Spl_ManCountMarkedFanins(Gia_Man_t *p, int iObj, Vec_Bit_t *vMarks)
Spl_Man_t * Spl_ManAlloc(Gia_Man_t *pGia, int Limit, int fReverse)
void Spl_ManLutFanouts_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vFanouts, Vec_Bit_t *vMarksNo, Vec_Bit_t *vMarksCIO)
void Spl_ManStop(Spl_Man_t *p)
int Gia_ManComputeOneWin(Gia_Man_t *pGia, int iPivot, Vec_Int_t **pvRoots, Vec_Int_t **pvNodes, Vec_Int_t **pvLeaves, Vec_Int_t **pvAnds)
void Gia_ManStaticFanoutStart(Gia_Man_t *p)
void Gia_ManStaticFanoutStop(Gia_Man_t *p)
#define Gia_ManForEachLut2(p, i)
#define Gia_ManForEachCoId(p, Id, i)
#define Gia_ManForEachLut(p, i)
#define Gia_ManForEachLut2Vec(vIds, p, vVec, iObj, i)
struct Gia_Obj_t_ Gia_Obj_t
#define Gia_LutForEachFanin(p, i, iFan, k)
struct Gia_Man_t_ Gia_Man_t
void Gia_ManCreateRefs(Gia_Man_t *p)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ObjForEachFanoutStaticId(p, Id, FanId, i)
void Gia_ManSetLutRefs(Gia_Man_t *p)
#define Gia_ManForEachCiId(p, Id, i)
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.