abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswSimSat.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [sswSimSat.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Inductive prover with constraints.]
8 
9  Synopsis [Performs resimulation using counter-examples.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - September 1, 2008.]
16 
17  Revision [$Id: sswSimSat.c,v 1.00 2008/09/01 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "sswInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Handle the counter-example.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
45 void Ssw_ManResimulateBit( Ssw_Man_t * p, Aig_Obj_t * pCand, Aig_Obj_t * pRepr )
46 {
47  Aig_Obj_t * pObj;
48  int i, RetValue1, RetValue2;
49  abctime clk = Abc_Clock();
50  // set the PI simulation information
51  Aig_ManConst1(p->pAig)->fMarkB = 1;
52  Aig_ManForEachCi( p->pAig, pObj, i )
53  pObj->fMarkB = Abc_InfoHasBit( p->pPatWords, i );
54  // simulate internal nodes
55  Aig_ManForEachNode( p->pAig, pObj, i )
56  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
57  & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
58  // if repr is given, perform refinement
59  if ( pRepr )
60  {
61  // check equivalence classes
62  RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
63  RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
64  // make sure refinement happened
65  if ( Aig_ObjIsConst1(pRepr) )
66  {
67  assert( RetValue1 );
68  if ( RetValue1 == 0 )
69  Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue1 does not hold.\n" );
70  }
71  else
72  {
73  assert( RetValue2 );
74  if ( RetValue2 == 0 )
75  Abc_Print( 1, "\nSsw_ManResimulateBit() Error: RetValue2 does not hold.\n" );
76  }
77  }
78 p->timeSimSat += Abc_Clock() - clk;
79 }
80 
81 /**Function*************************************************************
82 
83  Synopsis [Handle the counter-example.]
84 
85  Description []
86 
87  SideEffects []
88 
89  SeeAlso []
90 
91 ***********************************************************************/
92 void Ssw_ManResimulateWord( Ssw_Man_t * p, Aig_Obj_t * pCand, Aig_Obj_t * pRepr, int f )
93 {
94  int RetValue1, RetValue2;
95  abctime clk = Abc_Clock();
96  // set the PI simulation information
97  Ssw_SmlAssignDist1Plus( p->pSml, p->pPatWords );
98  // simulate internal nodes
99  Ssw_SmlSimulateOne( p->pSml );
100  // check equivalence classes
101  RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 1 );
102  RetValue2 = Ssw_ClassesRefine( p->ppClasses, 1 );
103  // make sure refinement happened
104  if ( Aig_ObjIsConst1(pRepr) )
105  {
106  assert( RetValue1 );
107  if ( RetValue1 == 0 )
108  Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue1 does not hold.\n" );
109  }
110  else
111  {
112  assert( RetValue2 );
113  if ( RetValue2 == 0 )
114  Abc_Print( 1, "\nSsw_ManResimulateWord() Error: RetValue2 does not hold.\n" );
115  }
116 p->timeSimSat += Abc_Clock() - clk;
117 }
118 
119 ////////////////////////////////////////////////////////////////////////
120 /// END OF FILE ///
121 ////////////////////////////////////////////////////////////////////////
122 
123 
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
Definition: sswInt.h:47
void Ssw_SmlAssignDist1Plus(Ssw_Sml_t *p, unsigned *pPat)
Definition: sswSim.c:674
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition: sswSim.c:1005
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Ssw_ManResimulateWord(Ssw_Man_t *p, Aig_Obj_t *pCand, Aig_Obj_t *pRepr, int f)
Definition: sswSimSat.c:92
ABC_NAMESPACE_IMPL_START void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pCand, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition: sswSimSat.c:45
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119