abc/src/opt/sfm/sfmWin.c
/**Function*************************************************************

  Synopsis    [Collects used internal nodes in a topological order.]

  Description [Additionally considers objects in groups as a single object
  and collects them in a topological order together as single entity.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Collects used internal nodes in a topological order.]

Description [Additionally considers objects in groups as a single object
and collects them in a topological order together as single entity.]




Function Synopsis [ Collects used internal nodes in a topological order . ] Description [ Additionally considers objects in groups as a single object and collects them in a topological order together as single entity . ]
void Sfm_NtkDfs_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft )
{
    int i, iFanin;
    if ( Sfm_ObjIsPi(p, iNode) )
        return;
    if ( Sfm_ObjIsTravIdCurrent(p, iNode) )
        return;
    if ( Vec_IntEntry(vGroupMap, iNode) >= 0 )
    {
        int k, iGroup = Abc_Lit2Var( Vec_IntEntry(vGroupMap, iNode) );
        Vec_Int_t * vGroup = Vec_WecEntry( vGroups, iGroup );
        Vec_IntForEachEntry( vGroup, iNode, i )
            assert( Sfm_ObjIsNode(p, iNode) );
        Vec_IntForEachEntry( vGroup, iNode, i )
            Sfm_ObjSetTravIdCurrent( p, iNode );
        Vec_IntForEachEntry( vGroup, iNode, i )
            Sfm_ObjForEachFanin( p, iNode, iFanin, k )
                Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
        Vec_IntForEachEntry( vGroup, iNode, i )
            Vec_IntPush( vNodes, iNode );
        Vec_IntPush( vBoxesLeft, iGroup );
    }
    else
    {
        Sfm_ObjSetTravIdCurrent(p, iNode);
        Sfm_ObjForEachFanin( p, iNode, iFanin, i )
            Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
        Vec_IntPush( vNodes, iNode );
    }
}
void Sfm_NtkDfs_rec ( Sfm_Ntk_t * p , int iNode , Vec_Int_t * vNodes , Vec_Wec_t * vGroups , Vec_Int_t * vGroupMap , Vec_Int_t * vBoxesLeft ) { int i , iFanin ; if ( Sfm_ObjIsPi ( p , iNode ) ) return ; if ( Sfm_ObjIsTravIdCurrent ( p , iNode ) ) return ; if ( Vec_IntEntry ( vGroupMap , iNode ) >= 0 ) { int k , iGroup = Abc_Lit2Var ( Vec_IntEntry ( vGroupMap , iNode ) ) ; Vec_Int_t * vGroup = Vec_WecEntry ( vGroups , iGroup ) ; Vec_IntForEachEntry ( vGroup , iNode , i ) assert ( Sfm_ObjIsNode ( p , iNode ) ) ; Vec_IntForEachEntry ( vGroup , iNode , i ) Sfm_ObjSetTravIdCurrent ( p , iNode ) ; Vec_IntForEachEntry ( vGroup , iNode , i ) Sfm_ObjForEachFanin ( p , iNode , iFanin , k ) Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft ) ; Vec_IntForEachEntry ( vGroup , iNode , i ) Vec_IntPush ( vNodes , iNode ) ; Vec_IntPush ( vBoxesLeft , iGroup ) ; } else { Sfm_ObjSetTravIdCurrent ( p , iNode ) ; Sfm_ObjForEachFanin ( p , iNode , iFanin , i ) Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft ) ; Vec_IntPush ( vNodes , iNode ) ; } }
Function
Synopsis    [Collects used internal nodes in a topological order.]
Function Synopsis [ Collects used internal nodes in a topological order . ]