From 27c3ff1f9bc425f2592b3a2992156d16cc4fd6b3 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 28 Jun 2012 10:41:15 -0700 Subject: New computation of tents for GIA package. --- src/aig/gia/giaMan.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c index 0e08341c..385f43d9 100644 --- a/src/aig/gia/giaMan.c +++ b/src/aig/gia/giaMan.c @@ -352,6 +352,64 @@ void Gia_ManPrintPlacement( Gia_Man_t * p ) printf( "Placement: Objects = %8d. Fixed = %8d. Undef = %8d.\n", Gia_ManObjNum(p), nFixed, nUndef ); } + +/**Function************************************************************* + + Synopsis [Duplicates AIG for unrolling.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Gia_ManPrintTents_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vObjs ) +{ + if ( Gia_ObjIsTravIdCurrent(p, pObj) ) + return; + Gia_ObjSetTravIdCurrent(p, pObj); + Vec_IntPush( vObjs, Gia_ObjId(p, pObj) ); + if ( Gia_ObjIsCi(pObj) ) + return; + Gia_ManPrintTents_rec( p, Gia_ObjFanin0(pObj), vObjs ); + if ( Gia_ObjIsAnd(pObj) ) + Gia_ManPrintTents_rec( p, Gia_ObjFanin1(pObj), vObjs ); +} +void Gia_ManPrintTents( Gia_Man_t * p ) +{ + Vec_Int_t * vObjs; + Gia_Obj_t * pObj; + int t, i, iObjId, nSizePrev, nSizeCurr; + assert( Gia_ManPoNum(p) > 0 ); + vObjs = Vec_IntAlloc( 100 ); + // save constant class + Gia_ManIncrementTravId( p ); + Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) ); + Vec_IntPush( vObjs, 0 ); + // create starting root + nSizePrev = Vec_IntSize(vObjs); + Gia_ManForEachPo( p, pObj, i ) + Gia_ManPrintTents_rec( p, pObj, vObjs ); + // build tents + printf( "Tents: " ); + for ( t = 1; nSizePrev < Vec_IntSize(vObjs); t++ ) + { + nSizeCurr = Vec_IntSize(vObjs); + Vec_IntForEachEntryStartStop( vObjs, iObjId, i, nSizePrev, nSizeCurr ) + if ( Gia_ObjIsRo(p, Gia_ManObj(p, iObjId)) ) + Gia_ManPrintTents_rec( p, Gia_ObjRoToRi(p, Gia_ManObj(p, iObjId)), vObjs ); + printf( "%d=%d ", t, nSizeCurr - nSizePrev ); + nSizePrev = nSizeCurr; + } + printf( " Unused=%d\n", Gia_ManObjNum(p) - Vec_IntSize(vObjs) ); + Vec_IntFree( vObjs ); + // the remaining objects are PIs without fanout +// Gia_ManForEachObj( p, pObj, i ) +// if ( !Gia_ObjIsTravIdCurrent(p, pObj) ) +// Gia_ObjPrint( p, pObj ); +} + /**Function************************************************************* Synopsis [Prints stats for the AIG.] @@ -406,11 +464,12 @@ void Gia_ManPrintStats( Gia_Man_t * p, int fTents, int fSwitch ) Gia_Man_t * pNew = Gia_ManUnrollDup( p, vLimit ); printf( "Tents: " ); Vec_IntForEachEntryStart( vLimit, Entry, k, 1 ) - printf( "%d = %d ", k, Entry-Prev ), Prev = Entry; - printf( " Unused = %d.", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) ); + printf( "%d=%d ", k, Entry-Prev ), Prev = Entry; + printf( " Unused=%d.", Gia_ManObjNum(p) - Gia_ManObjNum(pNew) ); printf( "\n" ); Vec_IntFree( vLimit ); Gia_ManStop( pNew ); + Gia_ManPrintTents( p ); } } -- cgit v1.2.3