abc/src/map/if/ifDsd.c
// checks if there is a way to package some fanins 
checks if there is a way to package some fanins
checks if there is a way to package some fanins
unsigned If_DsdManCheckMux( If_DsdMan_t * p, int iFirst, unsigned uMaskNot, If_DsdObj_t * pObj, int nSuppAll, int LutSize, int fDerive, int fVerbose )
{
    int LimitOut, SizeIn, SizeOut, pSSizes[DAU_MAX_VAR], pFirsts[DAU_MAX_VAR];
    unsigned uRes;
    assert( If_DsdObjFaninNum(pObj) == 3 );
    assert( If_DsdObjSuppSize(pObj) > LutSize );
    If_DsdManGetSuppSizes( p, pObj, pSSizes );
    LimitOut = LutSize - (nSuppAll - If_DsdObjSuppSize(pObj) + 1);
    assert( LimitOut < LutSize );
    SizeIn = pSSizes[0] + pSSizes[1];
    SizeOut = pSSizes[0] + pSSizes[2] + 1;
    if ( SizeIn <= LutSize && SizeOut <= LimitOut )
    {
        if ( !fDerive )
            return ~0;
        If_DsdManComputeFirst( p, pObj, pFirsts );
        uRes = If_DsdSign(p, pObj, 0, iFirst + pFirsts[0], 1) | If_DsdSign(p, pObj, 1, iFirst + pFirsts[1], 0);
        if ( (uRes & uMaskNot) == 0 )
            return uRes;
    }
    SizeIn = pSSizes[0] + pSSizes[2];
    SizeOut = pSSizes[0] + pSSizes[1] + 1;
    if ( SizeIn <= LutSize && SizeOut <= LimitOut )
    {
        if ( !fDerive )
            return ~0;
        If_DsdManComputeFirst( p, pObj, pFirsts );
        uRes = If_DsdSign(p, pObj, 0, iFirst + pFirsts[0], 1) | If_DsdSign(p, pObj, 2, iFirst + pFirsts[2], 0);
        if ( (uRes & uMaskNot) == 0 )
            return uRes;
    }
    return 0;
}
unsigned If_DsdManCheckMux ( If_DsdMan_t * p , int iFirst , unsigned uMaskNot , If_DsdObj_t * pObj , int nSuppAll , int LutSize , int fDerive , int fVerbose ) { int LimitOut , SizeIn , SizeOut , pSSizes [ DAU_MAX_VAR ] , pFirsts [ DAU_MAX_VAR ] ; unsigned uRes ; assert ( If_DsdObjFaninNum ( pObj ) == 3 ) ; assert ( If_DsdObjSuppSize ( pObj ) > LutSize ) ; If_DsdManGetSuppSizes ( p , pObj , pSSizes ) ; LimitOut = LutSize - ( nSuppAll - If_DsdObjSuppSize ( pObj ) + 1 ) ; assert ( LimitOut < LutSize ) ; SizeIn = pSSizes [ 0 ] + pSSizes [ 1 ] ; SizeOut = pSSizes [ 0 ] + pSSizes [ 2 ] + 1 ; if ( SizeIn <= LutSize && SizeOut <= LimitOut ) { if ( ! fDerive ) return ~ 0 ; If_DsdManComputeFirst ( p , pObj , pFirsts ) ; uRes = If_DsdSign ( p , pObj , 0 , iFirst + pFirsts [ 0 ] , 1 ) | If_DsdSign ( p , pObj , 1 , iFirst + pFirsts [ 1 ] , 0 ) ; if ( ( uRes & uMaskNot ) == 0 ) return uRes ; } SizeIn = pSSizes [ 0 ] + pSSizes [ 2 ] ; SizeOut = pSSizes [ 0 ] + pSSizes [ 1 ] + 1 ; if ( SizeIn <= LutSize && SizeOut <= LimitOut ) { if ( ! fDerive ) return ~ 0 ; If_DsdManComputeFirst ( p , pObj , pFirsts ) ; uRes = If_DsdSign ( p , pObj , 0 , iFirst + pFirsts [ 0 ] , 1 ) | If_DsdSign ( p , pObj , 2 , iFirst + pFirsts [ 2 ] , 0 ) ; if ( ( uRes & uMaskNot ) == 0 ) return uRes ; } return 0 ; }
checks if there is a way to package some fanins
checks if there is a way to package some fanins
// first input // second input