48 assert( Gia_ObjIsAnd(pObj) );
73 pNew->
pName = Abc_UtilStrsav(
p->pName );
74 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
76 Gia_ManConst0(
p)->Value = 0;
78 pObj->
Value = Gia_ManAppendCi(pNew);
81 if ( !Vec_IntEntry(vFlopClasses, i) )
82 pObj->
Value = Gia_ManAppendCi(pNew);
85 if ( Vec_IntEntry(vFlopClasses, i) )
86 pObj->
Value = Gia_ManAppendCi(pNew);
92 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
96 if ( Vec_IntEntry(vFlopClasses, i) )
99 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
126 vAssigned = Vec_IntAlloc( 1000 );
132 pObj = Gia_ManObj(
p, i );
133 Vec_IntPush( vAssigned, Gia_ObjId(
p, pObj) );
134 if ( Gia_ObjIsAnd(pObj) )
136 Vec_IntPush( vAssigned, Gia_ObjFaninId0p(
p, pObj) );
137 Vec_IntPush( vAssigned, Gia_ObjFaninId1p(
p, pObj) );
139 else if ( Gia_ObjIsRo(
p, pObj) )
140 Vec_IntPush( vAssigned, Gia_ObjFaninId0p(
p, Gia_ObjRoToRi(
p, pObj)) );
141 else assert( Gia_ObjIsConst0(pObj) );
143 Vec_IntUniqify( vAssigned );
163 assert( Gia_ManPoNum(
p) == 1 );
164 assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(
p) );
168 if ( pvPis ) *pvPis = Vec_IntAlloc( 100 );
169 if ( pvPPis ) *pvPPis = Vec_IntAlloc( 100 );
170 if ( pvFlops ) *pvFlops = Vec_IntAlloc( 100 );
171 if ( pvNodes ) *pvNodes = Vec_IntAlloc( 1000 );
174 if ( Gia_ObjIsPi(
p, pObj) )
175 {
if ( pvPis ) Vec_IntPush( *pvPis, Gia_ObjId(
p,pObj) ); }
176 else if ( !Vec_IntEntry(vGateClasses, Gia_ObjId(
p,pObj)) )
177 {
if ( pvPPis ) Vec_IntPush( *pvPPis, Gia_ObjId(
p,pObj) ); }
178 else if ( Gia_ObjIsRo(
p, pObj) )
179 {
if ( pvFlops ) Vec_IntPush( *pvFlops, Gia_ObjId(
p,pObj) ); }
180 else if ( Gia_ObjIsAnd(pObj) )
181 {
if ( pvNodes ) Vec_IntPush( *pvNodes, Gia_ObjId(
p,pObj) ); }
182 else assert( Gia_ObjIsConst0(pObj) );
184 Vec_IntFree( vAssigned );
202 assert( Gia_ObjIsAnd(pObj) );
205 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
222 Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
226 assert( Gia_ManPoNum(
p) == 1 );
227 assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(
p) );
234 pNew->
pName = Abc_UtilStrsav(
p->pName );
235 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
238 Gia_ManConst0(
p)->Value = 0;
241 pObj->
Value = Gia_ManAppendCi(pNew);
244 pObj->
Value = Gia_ManAppendCi(pNew);
247 pObj->
Value = Gia_ManAppendCi(pNew);
250 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
254 pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
257 Gia_ObjRoToRi(
p, pObj)->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ObjRoToRi(
p, pObj)) );
262 if ( Gia_ManObjNum(pTemp) != Gia_ManObjNum(pNew) )
270 pCopy = Gia_ObjCopy( pTemp, pObj );
271 if ( !~pCopy->
Value )
273 Vec_IntWriteEntry( vGateClasses, i, 0 );
284 Vec_IntFree( vPPis );
285 Vec_IntFree( vFlops );
286 Vec_IntFree( vNodes );
303 int Counter0, Counter1;
304 if (
p->vFlopClasses == NULL )
306 if ( Vec_IntSize(
p->vFlopClasses) != Gia_ManRegNum(
p) )
308 printf(
"Gia_ManPrintFlopClasses(): The number of flop map entries differs from the number of flops.\n" );
311 Counter0 = Vec_IntCountEntry(
p->vFlopClasses, 0 );
312 Counter1 = Vec_IntCountEntry(
p->vFlopClasses, 1 );
313 printf(
"Flop-level abstraction: Excluded FFs = %d Included FFs = %d (%.2f %%) ",
314 Counter0, Counter1, 100.0*Counter1/(Counter0 + Counter1 + 1) );
315 if ( Counter0 + Counter1 < Gia_ManRegNum(
p) )
316 printf(
"and there are other FF classes..." );
333 Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
335 if (
p->vGateClasses == NULL )
337 if ( Vec_IntSize(
p->vGateClasses) != Gia_ManObjNum(
p) )
339 printf(
"Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.\n" );
344 nTotal = 1 + Vec_IntSize(vFlops) + Vec_IntSize(vNodes);
345 printf(
"Gate-level abstraction: PI = %d PPI = %d FF = %d (%.2f %%) AND = %d (%.2f %%) Obj = %d (%.2f %%)\n",
346 Vec_IntSize(vPis), Vec_IntSize(vPPis),
347 Vec_IntSize(vFlops), 100.0*Vec_IntSize(vFlops)/(Gia_ManRegNum(
p)+1),
348 Vec_IntSize(vNodes), 100.0*Vec_IntSize(vNodes)/(Gia_ManAndNum(
p)+1),
351 Vec_IntFree( vPPis );
352 Vec_IntFree( vFlops );
353 Vec_IntFree( vNodes );
371 int i, k, Entry, iStart, iStop = -1, nFrames;
372 int nObjBits, nObjMask, iObj, iFrame,
nWords;
374 int * pCountAll, * pCountUni;
377 nFrames = Vec_IntEntry( vAbs, 0 );
378 assert( Vec_IntEntry(vAbs, nFrames+1) == Vec_IntSize(vAbs) );
379 pCountAll =
ABC_ALLOC(
int, nFrames + 1 );
380 pCountUni =
ABC_ALLOC(
int, nFrames + 1 );
382 nWords = Abc_BitWordNum( nFrames );
383 vSeens = Vec_IntStart( Gia_ManObjNum(
p) *
nWords );
385 nObjBits = Abc_Base2Log( Gia_ManObjNum(
p) );
386 nObjMask = (1 << nObjBits) - 1;
387 assert( Gia_ManObjNum(
p) <= nObjMask );
389 printf(
"Frame Core F0 F1 F2 F3 ...\n" );
390 for ( i = 0; i < nFrames; i++ )
392 iStart = Vec_IntEntry( vAbs, i+1 );
393 iStop = Vec_IntEntry( vAbs, i+2 );
394 memset( pCountAll, 0,
sizeof(
int) * (nFrames + 1) );
395 memset( pCountUni, 0,
sizeof(
int) * (nFrames + 1) );
398 iObj = (Entry & nObjMask);
399 iFrame = (Entry >> nObjBits);
400 pInfo = (
unsigned *)Vec_IntEntryP( vSeens,
nWords * iObj );
401 if ( Abc_InfoHasBit(pInfo, iFrame) == 0 )
403 Abc_InfoSetBit( pInfo, iFrame );
404 pCountUni[iFrame+1]++;
407 pCountAll[iFrame+1]++;
410 assert( pCountAll[0] == (iStop - iStart) );
412 printf(
"%3d :", i );
413 printf(
"%7d", pCountAll[0] );
416 for ( k = 0; k < 4; k++ )
417 printf(
"%5d", pCountAll[k+1] );
419 for ( k = i-4; k <= i; k++ )
420 printf(
"%5d", pCountAll[k+1] );
424 for ( k = 0; k <= i; k++ )
426 printf(
"%5d", pCountAll[k+1] );
433 assert( iStop == Vec_IntSize(vAbs) );
434 Vec_IntFree( vSeens );
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Gia_Man_t * Gia_ManDupAbsGates(Gia_Man_t *p, Vec_Int_t *vGateClasses)
void Gia_ManPrintGateClasses(Gia_Man_t *p)
void Gia_ManPrintObjClasses(Gia_Man_t *p)
void Gia_ManDupAbsGates_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
Gia_Man_t * Gia_ManDupAbsFlops(Gia_Man_t *p, Vec_Int_t *vFlopClasses)
FUNCTION DECLARATIONS ///.
void Gia_ManPrintFlopClasses(Gia_Man_t *p)
void Gia_ManGlaCollect(Gia_Man_t *p, Vec_Int_t *vGateClasses, Vec_Int_t **pvPis, Vec_Int_t **pvPPis, Vec_Int_t **pvFlops, Vec_Int_t **pvNodes)
Vec_Int_t * Gia_GlaCollectAssigned(Gia_Man_t *p, Vec_Int_t *vGateClasses)
ABC_NAMESPACE_IMPL_START void Gia_ManDupAbsFlops_rec(Gia_Man_t *pNew, Gia_Obj_t *pObj)
DECLARATIONS ///.
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
#define Gia_ManForEachPo(p, pObj, i)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
void Gia_ManHashAlloc(Gia_Man_t *p)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
void Gia_ManHashStop(Gia_Man_t *p)
#define Gia_ManForEachRi(p, pObj, i)
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)