From 416ffc117ab7d0ea2ec3b8aaeb4724f25031db7a Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 27 Mar 2008 08:01:00 -0700 Subject: Version abc80327 --- src/map/if/ifUtil.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/map/if/ifUtil.c') diff --git a/src/map/if/ifUtil.c b/src/map/if/ifUtil.c index c114236d..74880409 100644 --- a/src/map/if/ifUtil.c +++ b/src/map/if/ifUtil.c @@ -651,6 +651,40 @@ Vec_Ptr_t * If_ManCollectMappingDirect( If_Man_t * p ) return vOrder; } +/**Function************************************************************* + + Synopsis [Collects nodes used in the mapping in the topological order.] + + Description [Represents mapping as an array of integers.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * If_ManCollectMappingInt( If_Man_t * p ) +{ + Vec_Int_t * vOrder; + If_Cut_t * pCutBest; + If_Obj_t * pObj; + int i, k, nLeaves, * ppLeaves; + If_ManMarkMapping( p ); + vOrder = Vec_IntAlloc( If_ManObjNum(p) ); + If_ManForEachObj( p, pObj, i ) + if ( If_ObjIsAnd(pObj) && pObj->nRefs ) + { + pCutBest = If_ObjCutBest( pObj ); + nLeaves = If_CutLeaveNum( pCutBest ); + ppLeaves = If_CutLeaves( pCutBest ); + // save the number of leaves, the leaves, and finally, the root + Vec_IntPush( vOrder, nLeaves ); + for ( k = 0; k < nLeaves; k++ ) + Vec_IntPush( vOrder, ppLeaves[k] ); + Vec_IntPush( vOrder, pObj->Id ); + } + return vOrder; +} + /**Function************************************************************* Synopsis [Returns the number of POs pointing to the same internal nodes.] -- cgit v1.2.3