abc/src/proof/acec/acecFadds.c
// returns mapping of each MAJ into the topmost elements of its chain
returns mapping of each MAJ into the topmost elements of its chain
returns mapping of each MAJ into the topmost elements of its chain
Vec_Wec_t * Gia_ManCollectTopmost( Gia_Man_t * p, Vec_Int_t * vFadds, Vec_Int_t * vMap, int nFaddMin )
{
    int i, j, iFadd;
    Vec_Int_t * vChain  = Vec_IntAlloc( 100 );
    Vec_Wec_t * vChains = Vec_WecAlloc( Vec_IntSize(vFadds)/5 );
    Vec_Bit_t * vMarksTop = Vec_BitStart( Vec_IntSize(vFadds)/5 );
    Dtc_ForEachFadd( vFadds, i )
        if ( (iFadd = Vec_IntEntry(vMap, Vec_IntEntry(vFadds, 5*i+0))) >= 0 )
            Vec_BitWriteEntry( vMarksTop, iFadd, 1 );
    Gia_ManIncrementTravId( p );
    Dtc_ForEachFadd( vFadds, i )
    {
        if ( Vec_BitEntry(vMarksTop, i) )
            continue;
        Gia_ManCollectOneChain( p, vFadds, i, vMap, vChain );
        if ( Vec_IntSize(vChain) < nFaddMin )
            continue;
        Vec_IntAppend( Vec_WecPushLevel(vChains), vChain );
        Vec_IntForEachEntry( vChain, iFadd, j )
        {
            assert( !Gia_ObjIsTravIdCurrentId(p, Vec_IntEntry(vFadds, 5*iFadd+3)) );
            assert( !Gia_ObjIsTravIdCurrentId(p, Vec_IntEntry(vFadds, 5*iFadd+4)) );
            Gia_ManMarkWithTravId_rec( p, Vec_IntEntry(vFadds, 5*iFadd+3) );
            Gia_ManMarkWithTravId_rec( p, Vec_IntEntry(vFadds, 5*iFadd+4) );
        }
    }
    Vec_BitFree( vMarksTop );
    Vec_IntFree( vChain );
    return vChains;
}
Vec_Wec_t * Gia_ManCollectTopmost ( Gia_Man_t * p , Vec_Int_t * vFadds , Vec_Int_t * vMap , int nFaddMin ) { int i , j , iFadd ; Vec_Int_t * vChain = Vec_IntAlloc ( 100 ) ; Vec_Wec_t * vChains = Vec_WecAlloc ( Vec_IntSize ( vFadds ) / 5 ) ; Vec_Bit_t * vMarksTop = Vec_BitStart ( Vec_IntSize ( vFadds ) / 5 ) ; Dtc_ForEachFadd ( vFadds , i ) if ( ( iFadd = Vec_IntEntry ( vMap , Vec_IntEntry ( vFadds , 5 * i + 0 ) ) ) >= 0 ) Vec_BitWriteEntry ( vMarksTop , iFadd , 1 ) ; Gia_ManIncrementTravId ( p ) ; Dtc_ForEachFadd ( vFadds , i ) { if ( Vec_BitEntry ( vMarksTop , i ) ) continue ; Gia_ManCollectOneChain ( p , vFadds , i , vMap , vChain ) ; if ( Vec_IntSize ( vChain ) < nFaddMin ) continue ; Vec_IntAppend ( Vec_WecPushLevel ( vChains ) , vChain ) ; Vec_IntForEachEntry ( vChain , iFadd , j ) { assert ( ! Gia_ObjIsTravIdCurrentId ( p , Vec_IntEntry ( vFadds , 5 * iFadd + 3 ) ) ) ; assert ( ! Gia_ObjIsTravIdCurrentId ( p , Vec_IntEntry ( vFadds , 5 * iFadd + 4 ) ) ) ; Gia_ManMarkWithTravId_rec ( p , Vec_IntEntry ( vFadds , 5 * iFadd + 3 ) ) ; Gia_ManMarkWithTravId_rec ( p , Vec_IntEntry ( vFadds , 5 * iFadd + 4 ) ) ; } } Vec_BitFree ( vMarksTop ) ; Vec_IntFree ( vChain ) ; return vChains ; }
returns mapping of each MAJ into the topmost elements of its chain
returns mapping of each MAJ into the topmost elements of its chain
// erase elements appearing as FADD inputs // compress the remaining ones // cleanup