diff options
Diffstat (limited to 'src/aig/gia/giaUtil.c')
-rw-r--r-- | src/aig/gia/giaUtil.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c index bec23f8c..99557c7a 100644 --- a/src/aig/gia/giaUtil.c +++ b/src/aig/gia/giaUtil.c @@ -555,6 +555,8 @@ void Gia_ManCreateRefs( Gia_Man_t * p ) { Gia_ObjRefFanin0Inc( p, pObj ); Gia_ObjRefFanin1Inc( p, pObj ); + if ( Gia_ObjIsMux(p, i) ) + Gia_ObjRefFanin2Inc( p, pObj ); } else if ( Gia_ObjIsCo(pObj) ) Gia_ObjRefFanin0Inc( p, pObj ); @@ -1124,7 +1126,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj ) printf( "XOR( %4d%s, %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " "), Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " ") ); - else if ( Gia_ObjIsMux(p, pObj) ) + else if ( Gia_ObjIsMux(p, Gia_ObjId(p, pObj)) ) printf( "MUX( %4d%s, %4d%s, %4d%s )", Gia_ObjFaninId2p(p, pObj), (Gia_ObjFaninC2(p, pObj)? "\'" : " "), Gia_ObjFaninId1p(p, pObj), (Gia_ObjFaninC1(pObj)? "\'" : " "), @@ -1405,6 +1407,42 @@ void Gia_ManLoadValue( Gia_Man_t * p, Vec_Int_t * vValues ) } +/**Function************************************************************* + + Synopsis [Returns the array containing the first fanout of each object.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * Gia_ManFirstFanouts( Gia_Man_t * p ) +{ + Vec_Int_t * vFans = Vec_IntStart( Gia_ManObjNum(p) ); + Gia_Obj_t * pObj; + int i; + Gia_ManForEachObj( p, pObj, i ) + { + if ( Gia_ObjIsAnd(pObj) ) + { + if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 ) + Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i); + if ( Vec_IntEntry(vFans, Gia_ObjFaninId1p(p, pObj)) == 0 ) + Vec_IntWriteEntry(vFans, Gia_ObjFaninId1p(p, pObj), i); + if ( Gia_ObjIsMux(p, i) && Vec_IntEntry(vFans, Gia_ObjFaninId2p(p, pObj)) == 0 ) + Vec_IntWriteEntry(vFans, Gia_ObjFaninId2p(p, pObj), i); + } + else if ( Gia_ObjIsCo(pObj) ) + { + if ( Vec_IntEntry(vFans, Gia_ObjFaninId0p(p, pObj)) == 0 ) + Vec_IntWriteEntry(vFans, Gia_ObjFaninId0p(p, pObj), i); + } + } + return vFans; +} + #include "base/main/mainInt.h" /**Function************************************************************* |