sswSimSat.c 3.9 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/**CFile****************************************************************

  FileName    [sswSimSat.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Inductive prover with constraints.]

  Synopsis    [Performs resimulation using counter-examples.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - September 1, 2008.]

  Revision    [$Id: sswSimSat.c,v 1.00 2008/09/01 00:00:00 alanmi Exp $]

***********************************************************************/

#include "sswInt.h"

23 24 25
ABC_NAMESPACE_IMPL_START


Alan Mishchenko committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

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

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

  Synopsis    [Handle the counter-example.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Alan Mishchenko committed
45
void Ssw_ManResimulateBit( Ssw_Man_t * p, Aig_Obj_t * pCand, Aig_Obj_t * pRepr )
Alan Mishchenko committed
46 47
{
    Aig_Obj_t * pObj;
48 49
    int i, RetValue1, RetValue2;
    clock_t clk = clock();
Alan Mishchenko committed
50 51
    // set the PI simulation information
    Aig_ManConst1(p->pAig)->fMarkB = 1;
52
    Aig_ManForEachCi( p->pAig, pObj, i )
53
        pObj->fMarkB = Abc_InfoHasBit( p->pPatWords, i );
Alan Mishchenko committed
54 55 56 57
    // simulate internal nodes
    Aig_ManForEachNode( p->pAig, pObj, i )
        pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
                     & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
58 59
    // if repr is given, perform refinement
    if ( pRepr )
Alan Mishchenko committed
60
    {
61 62 63 64
        // check equivalence classes
        RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
        RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
        // make sure refinement happened
65
        if ( Aig_ObjIsConst1(pRepr) )
66 67 68
        {
            assert( RetValue1 );
            if ( RetValue1 == 0 )
69
                Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue1 does not hold.\n" );
70 71 72 73 74
        }
        else
        {
            assert( RetValue2 );
            if ( RetValue2 == 0 )
75
                Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue2 does not hold.\n" );
76
        }
Alan Mishchenko committed
77
    }
Alan Mishchenko committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91
p->timeSimSat += clock() - clk;
}

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

  Synopsis    [Handle the counter-example.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Alan Mishchenko committed
92
void Ssw_ManResimulateWord( Ssw_Man_t * p, Aig_Obj_t * pCand, Aig_Obj_t * pRepr, int f )
Alan Mishchenko committed
93
{
94 95
    int RetValue1, RetValue2;
    clock_t clk = clock();
Alan Mishchenko committed
96 97 98 99 100 101 102
    // set the PI simulation information
    Ssw_SmlAssignDist1Plus( p->pSml, p->pPatWords );
    // simulate internal nodes
    Ssw_SmlSimulateOne( p->pSml );
    // check equivalence classes
    RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 1 );
    RetValue2 = Ssw_ClassesRefine( p->ppClasses, 1 );
Alan Mishchenko committed
103 104
    // make sure refinement happened
    if ( Aig_ObjIsConst1(pRepr) )
Alan Mishchenko committed
105
    {
Alan Mishchenko committed
106
        assert( RetValue1 );
Alan Mishchenko committed
107
        if ( RetValue1 == 0 )
108
            Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue1 does not hold.\n" );
Alan Mishchenko committed
109
    }
Alan Mishchenko committed
110
    else
Alan Mishchenko committed
111
    {
Alan Mishchenko committed
112
        assert( RetValue2 );
Alan Mishchenko committed
113
        if ( RetValue2 == 0 )
114
            Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue2 does not hold.\n" );
Alan Mishchenko committed
115
    }
Alan Mishchenko committed
116 117 118
p->timeSimSat += clock() - clk;
}

Alan Mishchenko committed
119 120 121 122 123
////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////


124
ABC_NAMESPACE_IMPL_END