abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswFilter.c File Reference
#include "sswInt.h"
#include "aig/gia/giaAig.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Ssw_ManRefineByFilterSim (Ssw_Man_t *p, int nFrames)
 DECLARATIONS ///. More...
 
void Ssw_ManRollForward (Ssw_Man_t *p, int nFrames)
 
void Ssw_ManFindStartingState (Ssw_Man_t *p, Abc_Cex_t *pCex)
 
int Ssw_ManSweepNodeFilter (Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
 
Aig_Obj_tSsw_ManSweepBmcFilter_rec (Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
 
int Ssw_ManSweepBmcFilter (Ssw_Man_t *p, int TimeLimit)
 
void Ssw_SignalFilter (Aig_Man_t *pAig, int nFramesMax, int nConfMax, int nRounds, int TimeLimit, int TimeLimit2, Abc_Cex_t *pCex, int fLatchOnly, int fVerbose)
 
void Ssw_SignalFilterGia (Gia_Man_t *p, int nFramesMax, int nConfMax, int nRounds, int TimeLimit, int TimeLimit2, Abc_Cex_t *pCex, int fLatchOnly, int fVerbose)
 

Function Documentation

void Ssw_ManFindStartingState ( Ssw_Man_t p,
Abc_Cex_t pCex 
)

Function*************************************************************

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 138 of file sswFilter.c.

139 {
140  Aig_Obj_t * pObj, * pObjLi;
141  int f, i, iBit;
142  // assign register outputs
143  Saig_ManForEachLi( p->pAig, pObj, i )
144  pObj->fMarkB = 0;
145  // simulate the timeframes
146  iBit = pCex->nRegs;
147  for ( f = 0; f <= pCex->iFrame; f++ )
148  {
149  // set the PI simulation information
150  Aig_ManConst1(p->pAig)->fMarkB = 1;
151  Saig_ManForEachPi( p->pAig, pObj, i )
152  pObj->fMarkB = Abc_InfoHasBit( pCex->pData, iBit++ );
153  Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
154  pObj->fMarkB = pObjLi->fMarkB;
155  // simulate internal nodes
156  Aig_ManForEachNode( p->pAig, pObj, i )
157  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
158  & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
159  // assign the COs
160  Aig_ManForEachCo( p->pAig, pObj, i )
161  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
162  }
163  assert( iBit == pCex->nBits );
164  // check that the output failed as expected -- cannot check because it is not an SRM!
165 // pObj = Aig_ManCo( p->pAig, pCex->iPo );
166 // if ( pObj->fMarkB != 1 )
167 // Abc_Print( 1, "The counter-example does not refine the output.\n" );
168  // record the new pattern
169  Saig_ManForEachLo( p->pAig, pObj, i )
170  if ( pObj->fMarkB ^ Abc_InfoHasBit(p->pPatWords, Saig_ManPiNum(p->pAig) + i) )
171  Abc_InfoXorBit( p->pPatWords, Saig_ManPiNum(p->pAig) + i );
172 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
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
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
ABC_NAMESPACE_IMPL_START void Ssw_ManRefineByFilterSim ( Ssw_Man_t p,
int  nFrames 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [sswConstr.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [One round of SAT sweeping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
sswConstr.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 46 of file sswFilter.c.

47 {
48  Aig_Obj_t * pObj, * pObjLi;
49  int f, i, RetValue1, RetValue2;
50  assert( nFrames > 0 );
51  // assign register outputs
52  Saig_ManForEachLi( p->pAig, pObj, i )
53  pObj->fMarkB = Abc_InfoHasBit( p->pPatWords, Saig_ManPiNum(p->pAig) + i );
54  // simulate the timeframes
55  for ( f = 0; f < nFrames; f++ )
56  {
57  // set the PI simulation information
58  Aig_ManConst1(p->pAig)->fMarkB = 1;
59  Saig_ManForEachPi( p->pAig, pObj, i )
60  pObj->fMarkB = 0;
61  Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
62  pObj->fMarkB = pObjLi->fMarkB;
63  // simulate internal nodes
64  Aig_ManForEachNode( p->pAig, pObj, i )
65  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
66  & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
67  // assign the COs
68  Aig_ManForEachCo( p->pAig, pObj, i )
69  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
70  // transfer
71  if ( f == 0 )
72  { // copy markB into phase
73  Aig_ManForEachObj( p->pAig, pObj, i )
74  pObj->fPhase = pObj->fMarkB;
75  }
76  else
77  { // refine classes
78  RetValue1 = Ssw_ClassesRefineConst1( p->ppClasses, 0 );
79  RetValue2 = Ssw_ClassesRefine( p->ppClasses, 0 );
80  }
81  }
82 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1034
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
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 Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
Definition: sswClass.c:1119
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Ssw_ManRollForward ( Ssw_Man_t p,
int  nFrames 
)

Function*************************************************************

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 96 of file sswFilter.c.

97 {
98  Aig_Obj_t * pObj, * pObjLi;
99  int f, i;
100  assert( nFrames > 0 );
101  // assign register outputs
102  Saig_ManForEachLi( p->pAig, pObj, i )
103  pObj->fMarkB = Abc_InfoHasBit( p->pPatWords, Saig_ManPiNum(p->pAig) + i );
104  // simulate the timeframes
105  for ( f = 0; f < nFrames; f++ )
106  {
107  // set the PI simulation information
108  Aig_ManConst1(p->pAig)->fMarkB = 1;
109  Saig_ManForEachPi( p->pAig, pObj, i )
110  pObj->fMarkB = Aig_ManRandom(0) & 1;
111  Saig_ManForEachLiLo( p->pAig, pObjLi, pObj, i )
112  pObj->fMarkB = pObjLi->fMarkB;
113  // simulate internal nodes
114  Aig_ManForEachNode( p->pAig, pObj, i )
115  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
116  & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
117  // assign the COs
118  Aig_ManForEachCo( p->pAig, pObj, i )
119  pObj->fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
120  }
121  // record the new pattern
122  Saig_ManForEachLi( p->pAig, pObj, i )
123  if ( pObj->fMarkB ^ Abc_InfoHasBit(p->pPatWords, Saig_ManPiNum(p->pAig) + i) )
124  Abc_InfoXorBit( p->pPatWords, Saig_ManPiNum(p->pAig) + i );
125 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
unsigned int fMarkB
Definition: aig.h:80
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
for(p=first;p->value< newval;p=p->next)
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
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
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define assert(ex)
Definition: util_old.h:213
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_ManSweepBmcFilter ( Ssw_Man_t p,
int  TimeLimit 
)

Function*************************************************************

Synopsis [Filter equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file sswFilter.c.

279 {
280  Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo;
281  int f, f1, i;
282  abctime clkTotal = Abc_Clock();
283  // start initialized timeframes
284  p->pFrames = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * p->pPars->nFramesK );
285  Saig_ManForEachLo( p->pAig, pObj, i )
286  {
287  if ( Abc_InfoHasBit( p->pPatWords, Saig_ManPiNum(p->pAig) + i ) )
288  {
289  Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst1(p->pFrames) );
290 //Abc_Print( 1, "1" );
291  }
292  else
293  {
294  Ssw_ObjSetFrame( p, pObj, 0, Aig_ManConst0(p->pFrames) );
295 //Abc_Print( 1, "0" );
296  }
297  }
298 //Abc_Print( 1, "\n" );
299 
300  // sweep internal nodes
301  for ( f = 0; f < p->pPars->nFramesK; f++ )
302  {
303  // realloc mapping of timeframes
304  if ( f == p->nFrames-1 )
305  {
306  Aig_Obj_t ** pNodeToFrames;
307  pNodeToFrames = ABC_CALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p->pAig) * 2 * p->nFrames );
308  for ( f1 = 0; f1 < p->nFrames; f1++ )
309  {
310  Aig_ManForEachObj( p->pAig, pObj, i )
311  pNodeToFrames[2*p->nFrames*pObj->Id + f1] = Ssw_ObjFrame( p, pObj, f1 );
312  }
313  ABC_FREE( p->pNodeToFrames );
314  p->pNodeToFrames = pNodeToFrames;
315  p->nFrames *= 2;
316  }
317  // map constants and PIs
318  Ssw_ObjSetFrame( p, Aig_ManConst1(p->pAig), f, Aig_ManConst1(p->pFrames) );
319  Saig_ManForEachPi( p->pAig, pObj, i )
320  {
321  pObjNew = Aig_ObjCreateCi(p->pFrames);
322  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
323  }
324  // sweep internal nodes
325  Aig_ManForEachNode( p->pAig, pObj, i )
326  {
327  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
328  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
329  if ( Ssw_ManSweepNodeFilter( p, pObj, f ) )
330  break;
331  }
332  // printout
333  if ( p->pPars->fVerbose )
334  {
335  Abc_Print( 1, "Frame %4d : ", f );
336  Ssw_ClassesPrint( p->ppClasses, 0 );
337  }
338  if ( i < Vec_PtrSize(p->pAig->vObjs) )
339  {
340  if ( p->pPars->fVerbose )
341  Abc_Print( 1, "Exceeded the resource limits (%d conflicts). Quitting...\n", p->pPars->nBTLimit );
342  break;
343  }
344  // quit if this is the last timeframe
345  if ( f == p->pPars->nFramesK - 1 )
346  {
347  if ( p->pPars->fVerbose )
348  Abc_Print( 1, "Exceeded the time frame limit (%d time frames). Quitting...\n", p->pPars->nFramesK );
349  break;
350  }
351  // check timeout
352  if ( TimeLimit && ((float)TimeLimit <= (float)(Abc_Clock()-clkTotal)/(float)(CLOCKS_PER_SEC)) )
353  break;
354  // transfer latch input to the latch outputs
355  Aig_ManForEachCo( p->pAig, pObj, i )
356  Ssw_ObjSetFrame( p, pObj, f, Ssw_ObjChild0Fra(p, pObj, f) );
357  // build logic cones for register outputs
358  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
359  {
360  pObjNew = Ssw_ObjFrame( p, pObjLi, f );
361  Ssw_ObjSetFrame( p, pObjLo, f+1, pObjNew );
362  Ssw_CnfNodeAddToSolver( p->pMSat, Aig_Regular(pObjNew) );//
363  }
364  }
365  // verify
366 // Ssw_ClassesCheck( p->ppClasses );
367  return 1;
368 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Ssw_ManSweepNodeFilter(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswFilter.c:185
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition: sswClass.c:414
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
Aig_Obj_t* Ssw_ManSweepBmcFilter_rec ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f 
)

Function*************************************************************

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file sswFilter.c.

242 {
243  Aig_Obj_t * pObjNew, * pObjLi;
244  pObjNew = Ssw_ObjFrame( p, pObj, f );
245  if ( pObjNew )
246  return pObjNew;
247  assert( !Saig_ObjIsPi(p->pAig, pObj) );
248  if ( Saig_ObjIsLo(p->pAig, pObj) )
249  {
250  assert( f > 0 );
251  pObjLi = Saig_ObjLoToLi( p->pAig, pObj );
252  pObjNew = Ssw_ManSweepBmcFilter_rec( p, Aig_ObjFanin0(pObjLi), f-1 );
253  pObjNew = Aig_NotCond( pObjNew, Aig_ObjFaninC0(pObjLi) );
254  }
255  else
256  {
257  assert( Aig_ObjIsNode(pObj) );
260  pObjNew = Aig_And( p->pFrames, Ssw_ObjChild0Fra(p, pObj, f), Ssw_ObjChild1Fra(p, pObj, f) );
261  }
262  Ssw_ObjSetFrame( p, pObj, f, pObjNew );
263  assert( pObjNew != NULL );
264  return pObjNew;
265 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Aig_Obj_t * Ssw_ObjChild0Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:185
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Saig_ObjLoToLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:86
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static Aig_Obj_t * Ssw_ObjChild1Fra(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:186
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
Aig_Obj_t * Ssw_ManSweepBmcFilter_rec(Ssw_Man_t *p, Aig_Obj_t *pObj, int f)
Definition: sswFilter.c:241
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
int Ssw_ManSweepNodeFilter ( Ssw_Man_t p,
Aig_Obj_t pObj,
int  f 
)

Function*************************************************************

Synopsis [Performs fraiging for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 185 of file sswFilter.c.

186 {
187  Aig_Obj_t * pObjRepr, * pObjFraig, * pObjFraig2, * pObjReprFraig;
188  int RetValue;
189  // get representative of this class
190  pObjRepr = Aig_ObjRepr( p->pAig, pObj );
191  if ( pObjRepr == NULL )
192  return 0;
193  // get the fraiged node
194  pObjFraig = Ssw_ObjFrame( p, pObj, f );
195  // get the fraiged representative
196  pObjReprFraig = Ssw_ObjFrame( p, pObjRepr, f );
197  // check if constant 0 pattern distinquishes these nodes
198  assert( pObjFraig != NULL && pObjReprFraig != NULL );
199  assert( (pObj->fPhase == pObjRepr->fPhase) == (Aig_ObjPhaseReal(pObjFraig) == Aig_ObjPhaseReal(pObjReprFraig)) );
200  // if the fraiged nodes are the same, return
201  if ( Aig_Regular(pObjFraig) == Aig_Regular(pObjReprFraig) )
202  return 0;
203  // call equivalence checking
204  if ( Aig_Regular(pObjFraig) != Aig_ManConst1(p->pFrames) )
205  RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjReprFraig), Aig_Regular(pObjFraig) );
206  else
207  RetValue = Ssw_NodesAreEquiv( p, Aig_Regular(pObjFraig), Aig_Regular(pObjReprFraig) );
208  if ( RetValue == 1 ) // proved equivalent
209  {
210  pObjFraig2 = Aig_NotCond( pObjReprFraig, pObj->fPhase ^ pObjRepr->fPhase );
211  Ssw_ObjSetFrame( p, pObj, f, pObjFraig2 );
212  return 0;
213  }
214  if ( RetValue == -1 ) // timed out
215  {
216 // Ssw_ClassesRemoveNode( p->ppClasses, pObj );
217  return 1;
218  }
219  // disproved equivalence
220  Ssw_SmlSavePatternAig( p, f );
221  Ssw_ManResimulateBit( p, pObj, pObjRepr );
222  assert( Aig_ObjRepr( p->pAig, pObj ) != pObjRepr );
223  if ( Aig_ObjRepr( p->pAig, pObj ) == pObjRepr )
224  {
225  Abc_Print( 1, "Ssw_ManSweepNodeFilter(): Failed to refine representative.\n" );
226  }
227  return 0;
228 }
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Aig_ObjPhaseReal(Aig_Obj_t *pObj)
Definition: aig.h:299
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
unsigned int fPhase
Definition: aig.h:78
static void Ssw_ObjSetFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: sswInt.h:183
#define assert(ex)
Definition: util_old.h:213
int Ssw_NodesAreEquiv(Ssw_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
DECLARATIONS ///.
Definition: sswSat.c:45
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
void Ssw_ManResimulateBit(Ssw_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pRepr)
DECLARATIONS ///.
Definition: sswSimSat.c:45
void Ssw_SmlSavePatternAig(Ssw_Man_t *p, int f)
Definition: sswSweep.c:136
static Aig_Obj_t * Ssw_ObjFrame(Ssw_Man_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:182
void Ssw_SignalFilter ( Aig_Man_t pAig,
int  nFramesMax,
int  nConfMax,
int  nRounds,
int  TimeLimit,
int  TimeLimit2,
Abc_Cex_t pCex,
int  fLatchOnly,
int  fVerbose 
)

Function*************************************************************

Synopsis [Filter equivalence classes of nodes.]

Description [Unrolls at most nFramesMax frames. Works with nConfMax conflicts until the first undefined SAT call. Verbose prints the message.]

SideEffects []

SeeAlso []

Definition at line 382 of file sswFilter.c.

383 {
384  Ssw_Pars_t Pars, * pPars = &Pars;
385  Ssw_Man_t * p;
386  int r, TimeLimitPart;//, clkTotal = Abc_Clock();
387  abctime nTimeToStop = TimeLimit ? TimeLimit * CLOCKS_PER_SEC + Abc_Clock(): 0;
388  assert( Aig_ManRegNum(pAig) > 0 );
389  assert( Aig_ManConstrNum(pAig) == 0 );
390  // consider the case of empty AIG
391  if ( Aig_ManNodeNum(pAig) == 0 )
392  return;
393  // reset random numbers
394  Aig_ManRandom( 1 );
395  // if parameters are not given, create them
396  Ssw_ManSetDefaultParams( pPars = &Pars );
397  pPars->nFramesK = 3; //nFramesMax;
398  pPars->nBTLimit = nConfMax;
399  pPars->TimeLimit = TimeLimit;
400  pPars->fVerbose = fVerbose;
401  // start the induction manager
402  p = Ssw_ManCreate( pAig, pPars );
403  pPars->nFramesK = nFramesMax;
404  // create trivial equivalence classes with all nodes being candidates for constant 1
405  if ( pAig->pReprs == NULL )
406  p->ppClasses = Ssw_ClassesPrepareSimple( pAig, fLatchOnly, 0 );
407  else
408  p->ppClasses = Ssw_ClassesPrepareFromReprs( pAig );
409  Ssw_ClassesSetData( p->ppClasses, NULL, NULL, Ssw_SmlObjIsConstBit, Ssw_SmlObjsAreEqualBit );
410  assert( p->vInits == NULL );
411  // compute starting state if needed
412  if ( pCex )
413  Ssw_ManFindStartingState( p, pCex );
414  // refine classes using BMC
415  for ( r = 0; r < nRounds; r++ )
416  {
417  if ( p->pPars->fVerbose )
418  Abc_Print( 1, "Round %3d:\n", r );
419  // start filtering equivalence classes
420  Ssw_ManRefineByFilterSim( p, p->pPars->nFramesK );
421  if ( Ssw_ClassesCand1Num(p->ppClasses) == 0 && Ssw_ClassesClassNum(p->ppClasses) == 0 )
422  {
423  Abc_Print( 1, "All equivalences are refined away.\n" );
424  break;
425  }
426  // printout
427  if ( p->pPars->fVerbose )
428  {
429  Abc_Print( 1, "Initial : " );
430  Ssw_ClassesPrint( p->ppClasses, 0 );
431  }
432  p->pMSat = Ssw_SatStart( 0 );
433  TimeLimitPart = TimeLimit ? (nTimeToStop - Abc_Clock()) / CLOCKS_PER_SEC : 0;
434  if ( TimeLimit2 )
435  {
436  if ( TimeLimitPart )
437  TimeLimitPart = Abc_MinInt( TimeLimitPart, TimeLimit2 );
438  else
439  TimeLimitPart = TimeLimit2;
440  }
441  Ssw_ManSweepBmcFilter( p, TimeLimitPart );
442  Ssw_SatStop( p->pMSat );
443  p->pMSat = NULL;
444  Ssw_ManCleanup( p );
445  // simulate pattern forward
446  Ssw_ManRollForward( p, p->pPars->nFramesK );
447  // check timeout
448  if ( TimeLimit && Abc_Clock() > nTimeToStop )
449  {
450  Abc_Print( 1, "Reached timeout (%d seconds).\n", TimeLimit );
451  break;
452  }
453  }
454  // cleanup
455  Aig_ManSetPhase( p->pAig );
456  Aig_ManCleanMarkB( p->pAig );
457  // cleanup
458  pPars->fVerbose = 0;
459  Ssw_ManStop( p );
460 }
void Ssw_ManStop(Ssw_Man_t *p)
Definition: sswMan.c:189
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition: sswClass.c:275
static int Aig_ManConstrNum(Aig_Man_t *p)
Definition: aig.h:261
void Ssw_ManCleanup(Ssw_Man_t *p)
Definition: sswMan.c:158
ABC_NAMESPACE_IMPL_START Ssw_Sat_t * Ssw_SatStart(int fPolarFlip)
DECLARATIONS ///.
Definition: sswCnf.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition: sswClass.c:259
int Ssw_ManSweepBmcFilter(Ssw_Man_t *p, int TimeLimit)
Definition: sswFilter.c:278
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition: aigUtil.c:167
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
typedefABC_NAMESPACE_HEADER_START struct Ssw_Man_t_ Ssw_Man_t
INCLUDES ///.
Definition: sswInt.h:47
void Ssw_ManFindStartingState(Ssw_Man_t *p, Abc_Cex_t *pCex)
Definition: sswFilter.c:138
static abctime Abc_Clock()
Definition: abc_global.h:279
ABC_NAMESPACE_IMPL_START void Ssw_ManRefineByFilterSim(Ssw_Man_t *p, int nFrames)
DECLARATIONS ///.
Definition: sswFilter.c:46
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManSetPhase(Aig_Man_t *pAig)
Definition: aigUtil.c:1431
int Ssw_SmlObjsAreEqualBit(void *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition: sswSim.c:163
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
Ssw_Man_t * Ssw_ManCreate(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
DECLARATIONS ///.
Definition: sswMan.c:45
void Ssw_ClassesSetData(Ssw_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
Definition: sswClass.c:167
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition: sswClass.c:414
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition: sswCore.c:45
void Ssw_ManRollForward(Ssw_Man_t *p, int nFrames)
Definition: sswFilter.c:96
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Ssw_Cla_t * Ssw_ClassesPrepareFromReprs(Aig_Man_t *pAig)
Definition: sswClass.c:768
Ssw_Cla_t * Ssw_ClassesPrepareSimple(Aig_Man_t *pAig, int fLatchCorr, int nMaxLevs)
Definition: sswClass.c:724
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Ssw_SmlObjIsConstBit(void *p, Aig_Obj_t *pObj)
Definition: sswSim.c:147
#define assert(ex)
Definition: util_old.h:213
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
ABC_INT64_T abctime
Definition: abc_global.h:278
void Ssw_SignalFilterGia ( Gia_Man_t p,
int  nFramesMax,
int  nConfMax,
int  nRounds,
int  TimeLimit,
int  TimeLimit2,
Abc_Cex_t pCex,
int  fLatchOnly,
int  fVerbose 
)

Function*************************************************************

Synopsis [Filter equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 473 of file sswFilter.c.

474 {
475  Aig_Man_t * pAig;
476  pAig = Gia_ManToAigSimple( p );
477  if ( p->pReprs != NULL )
478  {
479  Gia_ManReprToAigRepr2( pAig, p );
480  ABC_FREE( p->pReprs );
481  ABC_FREE( p->pNexts );
482  }
483  Ssw_SignalFilter( pAig, nFramesMax, nConfMax, nRounds, TimeLimit, TimeLimit2, pCex, fLatchOnly, fVerbose );
484  Gia_ManReprFromAigRepr( pAig, p );
485  Aig_ManStop( pAig );
486 }
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition: giaAig.c:367
void Gia_ManReprFromAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition: giaAig.c:487
int * pNexts
Definition: gia.h:122
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Gia_ManReprToAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition: giaAig.c:459
void Ssw_SignalFilter(Aig_Man_t *pAig, int nFramesMax, int nConfMax, int nRounds, int TimeLimit, int TimeLimit2, Abc_Cex_t *pCex, int fLatchOnly, int fVerbose)
Definition: sswFilter.c:382
#define ABC_FREE(obj)
Definition: abc_global.h:232
Gia_Rpr_t * pReprs
Definition: gia.h:121