Exemplo n.º 1
0
/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Sat_ProofResolve( Vec_Vec_t * vClauses, int Result, int Clause1, int Clause2 )
{
    Vec_Int_t * vResult  = Vec_VecEntry( vClauses, Result );
    Vec_Int_t * vClause1 = Vec_VecEntry( vClauses, Clause1 );
    Vec_Int_t * vClause2 = Vec_VecEntry( vClauses, Clause2 );
    int Entry1, Entry2, ResVar;
    int i, j, Counter = 0;

    Vec_IntForEachEntry( vClause1, Entry1, i )
    Vec_IntForEachEntry( vClause2, Entry2, j )
    if ( Entry1 == -Entry2 )
    {
        ResVar = Entry1;
        Counter++;
    }
    if ( Counter != 1 )
    {
        printf( "Error: Clause %d = Resolve(%d, %d): The number of pivot vars is %d.\n", 
            Result, Clause1, Clause2, Counter );
        Sat_PrintClause( vClauses, Clause1 );
        Sat_PrintClause( vClauses, Clause2 );
        return 0;
    }
    // create new clause
    assert( Vec_IntSize(vResult) == 0 );
    Vec_IntForEachEntry( vClause1, Entry1, i )
        if ( Entry1 != ResVar && Entry1 != -ResVar )
            Vec_IntPushUnique( vResult, Entry1 );
    assert( Vec_IntSize(vResult) + 1 == Vec_IntSize(vClause1) );
    Vec_IntForEachEntry( vClause2, Entry2, i )
        if ( Entry2 != ResVar && Entry2 != -ResVar )
            Vec_IntPushUnique( vResult, Entry2 );
    return 1;
}
Exemplo n.º 2
0
/**Function*************************************************************

  Synopsis    [Collects the supergate.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Gia_CollectSuper( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vSuper )
{
    assert( !Gia_IsComplement(pObj) );
    Vec_IntClear( vSuper );
//    Gia_CollectSuper_rec( p, pObj, vSuper );
    if ( Gia_ObjIsAnd(pObj) )
    {
        Vec_IntPushUnique( vSuper, Gia_ObjId(p, Gia_ObjFanin0(pObj)) );
        Vec_IntPushUnique( vSuper, Gia_ObjId(p, Gia_ObjFanin1(pObj)) );
    }
    else
        Vec_IntPushUnique( vSuper, Gia_ObjId(p, Gia_Regular(pObj)) );

}
Exemplo n.º 3
0
ABC_NAMESPACE_IMPL_START


////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    [Collects the supergate.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Gia_CollectSuper_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vSuper )
{
    // if the new node is complemented or a PI, another gate begins
    if ( Gia_IsComplement(pObj) || Gia_ObjIsCi(pObj) )
    {
        Vec_IntPushUnique( vSuper, Gia_ObjId(p, Gia_Regular(pObj)) );
        return;
    }
    assert( Gia_ObjIsAnd(pObj) );
    // go through the branches
    Gia_CollectSuper_rec( p, Gia_ObjChild0(pObj), vSuper );
    Gia_CollectSuper_rec( p, Gia_ObjChild1(pObj), vSuper );
}