abc/src/base/abci/abcExact.c
/**Function*************************************************************

  Synopsis    [Compute truth table from a solution.]

***********************************************************************/
Function
Synopsis    [Compute truth table from a solution.]
Function Synopsis [ Compute truth table from a solution . ]
static word * Ses_ManDeriveTruth( Ses_Man_t * pSes, char * pSol, int fInvert )
{
    int i, f, j, k, w, nGates = pSol[ABC_EXACT_SOL_NGATES];
    char * p;
    word * pTruth = NULL, * pTruth0, * pTruth1;
    assert( pSol[ABC_EXACT_SOL_NFUNC] == 1 );
    p = pSol + 3;
    memset( pSes->pTtObjs, 0, sizeof( word ) * 4 * nGates );
    for ( i = 0; i < nGates; ++i )
    {
        f = *p++;
        assert( *p++ == 2 );
        j = *p++;
        k = *p++;
        pTruth0 = j < pSes->nSpecVars ? &s_Truths8[j << 2] : &pSes->pTtObjs[( j - pSes->nSpecVars ) << 2];
        pTruth1 = k < pSes->nSpecVars ? &s_Truths8[k << 2] : &pSes->pTtObjs[( k - pSes->nSpecVars ) << 2];
        pTruth = &pSes->pTtObjs[i << 2];
        if ( f & 1 )
            for ( w = 0; w < pSes->nSpecWords; ++w )
                pTruth[w] |= ~pTruth0[w] & pTruth1[w];
        if ( ( f >> 1 ) & 1 )
            for ( w = 0; w < pSes->nSpecWords; ++w )
                pTruth[w] |= pTruth0[w] & ~pTruth1[w];
        if ( ( f >> 2 ) & 1 )
            for ( w = 0; w < pSes->nSpecWords; ++w )
                pTruth[w] |= pTruth0[w] & pTruth1[w];
    }
    assert( Abc_Lit2Var( *p ) == nGates - 1 );
    if ( fInvert && Abc_LitIsCompl( *p ) )
        Abc_TtNot( pTruth, pSes->nSpecWords );
    return pTruth;
}
static word * Ses_ManDeriveTruth ( Ses_Man_t * pSes , char * pSol , int fInvert ) { int i , f , j , k , w , nGates = pSol [ ABC_EXACT_SOL_NGATES ] ; char * p ; word * pTruth = NULL , * pTruth0 , * pTruth1 ; assert ( pSol [ ABC_EXACT_SOL_NFUNC ] == 1 ) ; p = pSol + 3 ; memset ( pSes -> pTtObjs , 0 , sizeof ( word ) * 4 * nGates ) ; for ( i = 0 ; i < nGates ; ++ i ) { f = * p ++ ; assert ( * p ++ == 2 ) ; j = * p ++ ; k = * p ++ ; pTruth0 = j < pSes -> nSpecVars ? & s_Truths8 [ j << 2 ] : & pSes -> pTtObjs [ ( j - pSes -> nSpecVars ) << 2 ] ; pTruth1 = k < pSes -> nSpecVars ? & s_Truths8 [ k << 2 ] : & pSes -> pTtObjs [ ( k - pSes -> nSpecVars ) << 2 ] ; pTruth = & pSes -> pTtObjs [ i << 2 ] ; if ( f & 1 ) for ( w = 0 ; w < pSes -> nSpecWords ; ++ w ) pTruth [ w ] |= ~ pTruth0 [ w ] & pTruth1 [ w ] ; if ( ( f >> 1 ) & 1 ) for ( w = 0 ; w < pSes -> nSpecWords ; ++ w ) pTruth [ w ] |= pTruth0 [ w ] & ~ pTruth1 [ w ] ; if ( ( f >> 2 ) & 1 ) for ( w = 0 ; w < pSes -> nSpecWords ; ++ w ) pTruth [ w ] |= pTruth0 [ w ] & pTruth1 [ w ] ; } assert ( Abc_Lit2Var ( * p ) == nGates - 1 ) ; if ( fInvert && Abc_LitIsCompl ( * p ) ) Abc_TtNot ( pTruth , pSes -> nSpecWords ) ; return pTruth ; }
Function
Synopsis    [Compute truth table from a solution.]
Function Synopsis [ Compute truth table from a solution . ]