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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Ssw_ManSetDefaultParams (Ssw_Pars_t *p)
 DECLARATIONS ///. More...
 
void Ssw_ManSetDefaultParamsLcorr (Ssw_Pars_t *p)
 
void Ssw_ReportConeReductions (Ssw_Man_t *p, Aig_Man_t *pAigInit, Aig_Man_t *pAigStop)
 
void Ssw_ReportOneOutput (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Ssw_ReportOutputs (Aig_Man_t *pAig)
 
void Ssw_ManUpdateEquivs (Ssw_Man_t *p, Aig_Man_t *pAig, int fVerbose)
 
Aig_Man_tSsw_SignalCorrespondenceRefine (Ssw_Man_t *p)
 
Aig_Man_tSsw_SignalCorrespondence (Aig_Man_t *pAig, Ssw_Pars_t *pPars)
 
Aig_Man_tSsw_LatchCorrespondence (Aig_Man_t *pAig, Ssw_Pars_t *pPars)
 

Function Documentation

Aig_Man_t* Ssw_LatchCorrespondence ( Aig_Man_t pAig,
Ssw_Pars_t pPars 
)

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

Synopsis [Performs computation of latch correspondence.]

Description []

SideEffects []

SeeAlso []

Definition at line 521 of file sswCore.c.

522 {
523  Aig_Man_t * pRes;
524  Ssw_Pars_t Pars;
525  if ( pPars == NULL )
526  Ssw_ManSetDefaultParamsLcorr( pPars = &Pars );
527  pRes = Ssw_SignalCorrespondence( pAig, pPars );
528 // if ( pPars->fConstrs && pPars->fVerbose )
529 // Ssw_ReportConeReductions( pAig, pRes );
530  return pRes;
531 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
void Ssw_ManSetDefaultParamsLcorr(Ssw_Pars_t *p)
Definition: sswCore.c:92
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
ABC_NAMESPACE_IMPL_START void Ssw_ManSetDefaultParams ( Ssw_Pars_t p)

DECLARATIONS ///.

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

FileName [sswCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [The core procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswCore.c.

46 {
47  memset( p, 0, sizeof(Ssw_Pars_t) );
48  p->nPartSize = 0; // size of the partition
49  p->nOverSize = 0; // size of the overlap between partitions
50  p->nFramesK = 1; // the induction depth
51  p->nFramesAddSim = 2; // additional frames to simulate
52  p->fConstrs = 0; // treat the last nConstrs POs as seq constraints
53  p->fMergeFull = 0; // enables full merge when constraints are used
54  p->nBTLimit = 1000; // conflict limit at a node
55  p->nBTLimitGlobal = 5000000; // conflict limit for all runs
56  p->nMinDomSize = 100; // min clock domain considered for optimization
57  p->nItersStop = -1; // stop after the given number of iterations
58  p->nResimDelta = 1000; // the internal of nodes to resimulate
59  p->nStepsMax = -1; // (scorr only) the max number of induction steps
60  p->fPolarFlip = 0; // uses polarity adjustment
61  p->fLatchCorr = 0; // performs register correspondence
62  p->fConstCorr = 0; // performs constant correspondence
63  p->fOutputCorr = 0; // perform 'PO correspondence'
64  p->fSemiFormal = 0; // enable semiformal filtering
65  p->fDynamic = 0; // dynamic partitioning
66  p->fLocalSim = 0; // local simulation
67  p->fVerbose = 0; // verbose stats
68  p->fEquivDump = 0; // enables dumping equivalences
69 
70  // latch correspondence
71  p->fLatchCorrOpt = 0; // performs optimized register correspondence
72  p->nSatVarMax = 1000; // the max number of SAT variables
73  p->nRecycleCalls = 50; // calls to perform before recycling SAT solver
74  // signal correspondence
75  p->nSatVarMax2 = 5000; // the max number of SAT variables
76  p->nRecycleCalls2 = 250; // calls to perform before recycling SAT solver
77  // return values
78  p->nIters = 0; // the number of iterations performed
79 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
void Ssw_ManSetDefaultParamsLcorr ( Ssw_Pars_t p)

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file sswCore.c.

93 {
95  p->fLatchCorrOpt = 1;
96  p->nBTLimit = 10000;
97 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition: sswCore.c:45
void Ssw_ManUpdateEquivs ( Ssw_Man_t p,
Aig_Man_t pAig,
int  fVerbose 
)

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

Synopsis [Remove from-equivs that are in the cone of constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file sswCore.c.

188 {
189  Vec_Ptr_t * vCones;
190  Aig_Obj_t ** pArray;
191  Aig_Obj_t * pObj;
192  int i, nTotal = 0, nRemoved = 0;
193  // collect the nodes in the cone of constraints
194  pArray = (Aig_Obj_t **)Vec_PtrArray(pAig->vCos);
195  pArray += Saig_ManPoNum(pAig) - Saig_ManConstrNum(pAig);
196  vCones = Aig_ManDfsNodes( pAig, pArray, Saig_ManConstrNum(pAig) );
197  // remove all the node that are equiv to something and are in the cones
198  Aig_ManForEachObj( pAig, pObj, i )
199  {
200  if ( !Aig_ObjIsCi(pObj) && !Aig_ObjIsNode(pObj) )
201  continue;
202  if ( pAig->pReprs[i] != NULL )
203  nTotal++;
204  if ( !Aig_ObjIsTravIdCurrent(pAig, pObj) )
205  continue;
206  if ( pAig->pReprs[i] )
207  {
208  if ( p->pPars->fConstrs && !p->pPars->fMergeFull )
209  {
210  pAig->pReprs[i] = NULL;
211  nRemoved++;
212  }
213  }
214  }
215  // collect statistics
216  p->nConesTotal = Aig_ManCiNum(pAig) + Aig_ManNodeNum(pAig);
217  p->nConesConstr = Vec_PtrSize(vCones);
218  p->nEquivsTotal = nTotal;
219  p->nEquivsConstr = nRemoved;
220  Vec_PtrFree( vCones );
221 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Ssw_ReportConeReductions ( Ssw_Man_t p,
Aig_Man_t pAigInit,
Aig_Man_t pAigStop 
)

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

Synopsis [Reports improvements for property cones.]

Description []

SideEffects []

SeeAlso []

Definition at line 110 of file sswCore.c.

111 {
112  Aig_Man_t * pAig1, * pAig2, * pAux;
113  pAig1 = Aig_ManDupOneOutput( pAigInit, 0, 1 );
114  pAig1 = Aig_ManScl( pAux = pAig1, 1, 1, 0, -1, -1, 0, 0 );
115  Aig_ManStop( pAux );
116  pAig2 = Aig_ManDupOneOutput( pAigStop, 0, 1 );
117  pAig2 = Aig_ManScl( pAux = pAig2, 1, 1, 0, -1, -1, 0, 0 );
118  Aig_ManStop( pAux );
119 
120  p->nNodesBegC = Aig_ManNodeNum(pAig1);
121  p->nNodesEndC = Aig_ManNodeNum(pAig2);
122  p->nRegsBegC = Aig_ManRegNum(pAig1);
123  p->nRegsEndC = Aig_ManRegNum(pAig2);
124 
125  Aig_ManStop( pAig1 );
126  Aig_ManStop( pAig2 );
127 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Man_t * Aig_ManScl(Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition: aigScl.c:650
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_Man_t * Aig_ManDupOneOutput(Aig_Man_t *p, int iPoNum, int fAddRegs)
Definition: aigDup.c:1152
void Ssw_ReportOneOutput ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Reports one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file sswCore.c.

141 {
142  if ( pObj == Aig_ManConst1(p) )
143  Abc_Print( 1, "1" );
144  else if ( pObj == Aig_ManConst0(p) )
145  Abc_Print( 1, "0" );
146  else
147  Abc_Print( 1, "X" );
148 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
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
void Ssw_ReportOutputs ( Aig_Man_t pAig)

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

Synopsis [Reports improvements for property cones.]

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file sswCore.c.

162 {
163  Aig_Obj_t * pObj;
164  int i;
165  Saig_ManForEachPo( pAig, pObj, i )
166  {
167  if ( i < Saig_ManPoNum(pAig)-Saig_ManConstrNum(pAig) )
168  Abc_Print( 1, "o" );
169  else
170  Abc_Print( 1, "c" );
171  Ssw_ReportOneOutput( pAig, Aig_ObjChild0(pObj) );
172  }
173  Abc_Print( 1, "\n" );
174 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
void Ssw_ReportOneOutput(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: sswCore.c:140
static int Saig_ManConstrNum(Aig_Man_t *p)
Definition: saig.h:78
Definition: aig.h:69
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
Aig_Man_t* Ssw_SignalCorrespondence ( Aig_Man_t pAig,
Ssw_Pars_t pPars 
)

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

Synopsis [Performs computation of signal correspondence with constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file sswCore.c.

415 {
416  Ssw_Pars_t Pars;
417  Aig_Man_t * pAigNew;
418  Ssw_Man_t * p;
419  assert( Aig_ManRegNum(pAig) > 0 );
420  // reset random numbers
421  Aig_ManRandom( 1 );
422  // if parameters are not given, create them
423  if ( pPars == NULL )
424  Ssw_ManSetDefaultParams( pPars = &Pars );
425  // consider the case of empty AIG
426  if ( Aig_ManNodeNum(pAig) == 0 )
427  {
428  pPars->nIters = 0;
429  // Ntl_ManFinalize() needs the following to satisfy an assertion
430  Aig_ManReprStart( pAig,Aig_ManObjNumMax(pAig) );
431  return Aig_ManDupOrdered(pAig);
432  }
433  // check and update parameters
434  if ( pPars->fLatchCorrOpt )
435  {
436  pPars->fLatchCorr = 1;
437  pPars->nFramesAddSim = 0;
438  if ( (pAig->vClockDoms && Vec_VecSize(pAig->vClockDoms) > 0) )
439  return Ssw_SignalCorrespondencePart( pAig, pPars );
440  }
441  else
442  {
443  assert( pPars->nFramesK > 0 );
444  // perform partitioning
445  if ( (pPars->nPartSize > 0 && pPars->nPartSize < Aig_ManRegNum(pAig))
446  || (pAig->vClockDoms && Vec_VecSize(pAig->vClockDoms) > 0) )
447  return Ssw_SignalCorrespondencePart( pAig, pPars );
448  }
449 
450  if ( pPars->fScorrGia )
451  {
452  if ( pPars->fLatchCorrOpt )
453  {
454  extern Aig_Man_t * Cec_LatchCorrespondence( Aig_Man_t * pAig, int nConfs, int fUseCSat );
455  return Cec_LatchCorrespondence( pAig, pPars->nBTLimit, pPars->fUseCSat );
456  }
457  else
458  {
459  extern Aig_Man_t * Cec_SignalCorrespondence( Aig_Man_t * pAig, int nConfs, int fUseCSat );
460  return Cec_SignalCorrespondence( pAig, pPars->nBTLimit, pPars->fUseCSat );
461  }
462  }
463 
464  // start the induction manager
465  p = Ssw_ManCreate( pAig, pPars );
466  // compute candidate equivalence classes
467 // p->pPars->nConstrs = 1;
468  if ( p->pPars->fConstrs )
469  {
470  // create trivial equivalence classes with all nodes being candidates for constant 1
471  p->ppClasses = Ssw_ClassesPrepareSimple( pAig, pPars->fLatchCorr, pPars->nMaxLevs );
472  Ssw_ClassesSetData( p->ppClasses, NULL, NULL, Ssw_SmlObjIsConstBit, Ssw_SmlObjsAreEqualBit );
473  // derive phase bits to satisfy the constraints
474  if ( Ssw_ManSetConstrPhases( pAig, p->pPars->nFramesK + 1, &p->vInits ) != 0 )
475  {
476  Abc_Print( 1, "Ssw_SignalCorrespondence(): The init state does not satisfy the constraints!\n" );
477  p->pPars->fVerbose = 0;
478  Ssw_ManStop( p );
479  return NULL;
480  }
481  // perform simulation of the first timeframes
483  }
484  else
485  {
486  // perform one round of seq simulation and generate candidate equivalence classes
487  p->ppClasses = Ssw_ClassesPrepare( pAig, pPars->nFramesK, pPars->fLatchCorr, pPars->fConstCorr, pPars->fOutputCorr, pPars->nMaxLevs, pPars->fVerbose );
488 // p->ppClasses = Ssw_ClassesPrepareTargets( pAig );
489  if ( pPars->fLatchCorrOpt )
490  p->pSml = Ssw_SmlStart( pAig, 0, 2, 1 );
491  else if ( pPars->fDynamic )
492  p->pSml = Ssw_SmlStart( pAig, 0, p->nFrames + p->pPars->nFramesAddSim, 1 );
493  else
494  p->pSml = Ssw_SmlStart( pAig, 0, 1 + p->pPars->nFramesAddSim, 1 );
495  Ssw_ClassesSetData( p->ppClasses, p->pSml, (unsigned(*)(void *,Aig_Obj_t *))Ssw_SmlObjHashWord, (int(*)(void *,Aig_Obj_t *))Ssw_SmlObjIsConstWord, (int(*)(void *,Aig_Obj_t *,Aig_Obj_t *))Ssw_SmlObjsAreEqualWord );
496  }
497  // allocate storage
498  if ( p->pPars->fLocalSim )
499  p->pVisited = ABC_CALLOC( int, Ssw_SmlNumFrames( p->pSml ) * Aig_ManObjNumMax(p->pAig) );
500  // perform refinement of classes
501  pAigNew = Ssw_SignalCorrespondenceRefine( p );
502 // Ssw_ReportOutputs( pAigNew );
503  if ( pPars->fConstrs && pPars->fVerbose )
504  Ssw_ReportConeReductions( p, pAig, pAigNew );
505  // cleanup
506  Ssw_ManStop( p );
507  return pAigNew;
508 }
void Ssw_ManStop(Ssw_Man_t *p)
Definition: sswMan.c:189
unsigned Ssw_SmlObjHashWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: sswSim.c:63
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Aig_Man_t * Cec_SignalCorrespondence(Aig_Man_t *pAig, int nConfs, int fUseCSat)
Definition: cecCec.c:491
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
Aig_Man_t * Aig_ManDupOrdered(Aig_Man_t *p)
Definition: aigDup.c:277
int Ssw_SmlNumFrames(Ssw_Sml_t *p)
Definition: sswSim.c:1288
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
int Ssw_SmlObjIsConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition: sswSim.c:102
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
int Ssw_SmlObjsAreEqualBit(void *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition: sswSim.c:163
Ssw_Man_t * Ssw_ManCreate(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
DECLARATIONS ///.
Definition: sswMan.c:45
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
Ssw_Cla_t * Ssw_ClassesPrepare(Aig_Man_t *pAig, int nFramesK, int fLatchCorr, int fConstCorr, int fOutputCorr, int nMaxLevs, int fVerbose)
Definition: sswClass.c:596
Aig_Man_t * Cec_LatchCorrespondence(Aig_Man_t *pAig, int nConfs, int fUseCSat)
Definition: cecCec.c:465
int Ssw_SmlObjsAreEqualWord(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition: sswSim.c:124
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_ReportConeReductions(Ssw_Man_t *p, Aig_Man_t *pAigInit, Aig_Man_t *pAigStop)
Definition: sswCore.c:110
Aig_Man_t * Ssw_SignalCorrespondenceRefine(Ssw_Man_t *p)
Definition: sswCore.c:234
Definition: aig.h:69
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
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
ABC_NAMESPACE_IMPL_START void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition: sswCore.c:45
int Ssw_ManSetConstrPhases(Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
Definition: sswConstr.c:100
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Vec_VecSize(Vec_Vec_t *p)
Definition: vecVec.h:222
#define assert(ex)
Definition: util_old.h:213
void Ssw_ManRefineByConstrSim(Ssw_Man_t *p)
Definition: sswConstr.c:247
Ssw_Sml_t * Ssw_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
Definition: sswSim.c:1148
Aig_Man_t * Ssw_SignalCorrespondencePart(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
DECLARATIONS ///.
Definition: sswPart.c:46
Aig_Man_t* Ssw_SignalCorrespondenceRefine ( Ssw_Man_t p)

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

Synopsis [Performs computation of signal correspondence with constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file sswCore.c.

235 {
236  int nSatProof, nSatCallsSat, nRecycles, nSatFailsReal, nUniques;
237  Aig_Man_t * pAigNew;
238  int RetValue, nIter = -1;
239  abctime clk, clkTotal = Abc_Clock();
240  // get the starting stats
241  p->nLitsBeg = Ssw_ClassesLitNum( p->ppClasses );
242  p->nNodesBeg = Aig_ManNodeNum(p->pAig);
243  p->nRegsBeg = Aig_ManRegNum(p->pAig);
244  // refine classes using BMC
245  if ( p->pPars->fVerbose )
246  {
247  Abc_Print( 1, "Before BMC: " );
248  Ssw_ClassesPrint( p->ppClasses, 0 );
249  }
250  if ( !p->pPars->fLatchCorr )
251  {
252  p->pMSat = Ssw_SatStart( 0 );
253  if ( p->pPars->fConstrs )
255  else
256  Ssw_ManSweepBmc( p );
257  Ssw_SatStop( p->pMSat );
258  p->pMSat = NULL;
259  Ssw_ManCleanup( p );
260  }
261  if ( p->pPars->fVerbose )
262  {
263  Abc_Print( 1, "After BMC: " );
264  Ssw_ClassesPrint( p->ppClasses, 0 );
265  }
266  // apply semi-formal filtering
267 /*
268  if ( p->pPars->fSemiFormal )
269  {
270  Aig_Man_t * pSRed;
271  Ssw_FilterUsingSemi( p, 0, 2000, p->pPars->fVerbose );
272 // Ssw_FilterUsingSemi( p, 1, 100000, p->pPars->fVerbose );
273  pSRed = Ssw_SpeculativeReduction( p );
274  Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
275  Aig_ManStop( pSRed );
276  }
277 */
278  if ( p->pPars->pFunc )
279  {
280  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
281  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
282  }
283  if ( p->pPars->nStepsMax == 0 )
284  {
285  Abc_Print( 1, "Stopped signal correspondence after BMC.\n" );
286  goto finalize;
287  }
288  // refine classes using induction
289  nSatProof = nSatCallsSat = nRecycles = nSatFailsReal = nUniques = 0;
290  for ( nIter = 0; ; nIter++ )
291  {
292  if ( p->pPars->nStepsMax == nIter )
293  {
294  Abc_Print( 1, "Stopped signal correspondence after %d refiment iterations.\n", nIter );
295  goto finalize;
296  }
297  if ( p->pPars->nItersStop >= 0 && p->pPars->nItersStop == nIter )
298  {
299  Aig_Man_t * pSRed = Ssw_SpeculativeReduction( p );
300  Aig_ManDumpBlif( pSRed, "srm.blif", NULL, NULL );
301  Aig_ManStop( pSRed );
302  Abc_Print( 1, "Iterative refinement is stopped before iteration %d.\n", nIter );
303  Abc_Print( 1, "The network is reduced using candidate equivalences.\n" );
304  Abc_Print( 1, "Speculatively reduced miter is saved in file \"%s\".\n", "srm.blif" );
305  Abc_Print( 1, "If the miter is SAT, the reduced result is incorrect.\n" );
306  break;
307  }
308 
309 clk = Abc_Clock();
310  p->pMSat = Ssw_SatStart( 0 );
311  if ( p->pPars->fLatchCorrOpt )
312  {
313  RetValue = Ssw_ManSweepLatch( p );
314  if ( p->pPars->fVerbose )
315  {
316  Abc_Print( 1, "%3d : C =%7d. Cl =%7d. Pr =%6d. Cex =%5d. R =%4d. F =%4d. ",
317  nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
318  p->nSatProof-nSatProof, p->nSatCallsSat-nSatCallsSat,
319  p->nRecycles-nRecycles, p->nSatFailsReal-nSatFailsReal );
320  ABC_PRT( "T", Abc_Clock() - clk );
321  }
322  }
323  else
324  {
325  if ( p->pPars->fConstrs )
326  RetValue = Ssw_ManSweepConstr( p );
327  else if ( p->pPars->fDynamic )
328  RetValue = Ssw_ManSweepDyn( p );
329  else
330  RetValue = Ssw_ManSweep( p );
331 
332  p->pPars->nConflicts += p->pMSat->pSat->stats.conflicts;
333  if ( p->pPars->fVerbose )
334  {
335  Abc_Print( 1, "%3d : C =%7d. Cl =%7d. LR =%6d. NR =%6d. ",
336  nIter, Ssw_ClassesCand1Num(p->ppClasses), Ssw_ClassesClassNum(p->ppClasses),
337  p->nConstrReduced, Aig_ManNodeNum(p->pFrames) );
338  if ( p->pPars->fDynamic )
339  {
340  Abc_Print( 1, "Cex =%5d. ", p->nSatCallsSat-nSatCallsSat );
341  Abc_Print( 1, "R =%4d. ", p->nRecycles-nRecycles );
342  }
343  Abc_Print( 1, "F =%5d. %s ", p->nSatFailsReal-nSatFailsReal,
344  (Saig_ManPoNum(p->pAig)==1 && Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))))? "+" : "-" );
345  ABC_PRT( "T", Abc_Clock() - clk );
346  }
347 // if ( p->pPars->fDynamic && p->nSatCallsSat-nSatCallsSat < 100 )
348 // p->pPars->nBTLimit = 10000;
349 
350  if ( p->pPars->fStopWhenGone && Saig_ManPoNum(p->pAig) == 1 && !Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))) )
351  {
352  printf( "Iterative refinement is stopped after iteration %d\n", nIter );
353  printf( "because the property output is no longer a candidate constant.\n" );
354  // prepare to quite
355  p->nLitsEnd = p->nLitsBeg;
356  p->nNodesEnd = p->nNodesBeg;
357  p->nRegsEnd = p->nRegsBeg;
358  // cleanup
359  Ssw_SatStop( p->pMSat );
360  p->pMSat = NULL;
361  Ssw_ManCleanup( p );
362  // cleanup
363  Aig_ManSetPhase( p->pAig );
365  return Aig_ManDupSimple( p->pAig );
366  }
367  }
368  nSatProof = p->nSatProof;
369  nSatCallsSat = p->nSatCallsSat;
370  nRecycles = p->nRecycles;
371  nSatFailsReal = p->nSatFailsReal;
372  nUniques = p->nUniques;
373 
374  p->nVarsMax = Abc_MaxInt( p->nVarsMax, p->pMSat->nSatVars );
375  p->nCallsMax = Abc_MaxInt( p->nCallsMax, p->pMSat->nSolverCalls );
376  Ssw_SatStop( p->pMSat );
377  p->pMSat = NULL;
378  Ssw_ManCleanup( p );
379  if ( !RetValue )
380  break;
381  if ( p->pPars->pFunc )
382  ((int (*)(void *))p->pPars->pFunc)( p->pPars->pData );
383  }
384 
385 finalize:
386  p->pPars->nIters = nIter + 1;
387 p->timeTotal = Abc_Clock() - clkTotal;
388 
389  Ssw_ManUpdateEquivs( p, p->pAig, p->pPars->fVerbose );
390  pAigNew = Aig_ManDupRepr( p->pAig, 0 );
391  Aig_ManSeqCleanup( pAigNew );
392 //Ssw_ClassesPrint( p->ppClasses, 1 );
393  // get the final stats
394  p->nLitsEnd = Ssw_ClassesLitNum( p->ppClasses );
395  p->nNodesEnd = Aig_ManNodeNum(pAigNew);
396  p->nRegsEnd = Aig_ManRegNum(pAigNew);
397  // cleanup
398  Aig_ManSetPhase( p->pAig );
400  return pAigNew;
401 }
void Ssw_ManUpdateEquivs(Ssw_Man_t *p, Aig_Man_t *pAig, int fVerbose)
Definition: sswCore.c:187
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition: sswClass.c:275
Aig_Man_t * pAig
Definition: llb3Image.c:49
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 int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition: sswClass.c:259
int Ssw_ManSweepLatch(Ssw_Man_t *p)
Definition: sswLcorr.c:238
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition: aigUtil.c:167
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int Ssw_ManSweepDyn(Ssw_Man_t *p)
Definition: sswDyn.c:373
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
int Ssw_ManSweepConstr(Ssw_Man_t *p)
Definition: sswConstr.c:619
void Aig_ManSetPhase(Aig_Man_t *pAig)
Definition: aigUtil.c:1431
int Ssw_ManSweepBmcConstr(Ssw_Man_t *p)
Definition: sswConstr.c:498
int Ssw_ManSweep(Ssw_Man_t *p)
Definition: sswSweep.c:365
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
Definition: sswClass.c:414
int Ssw_ManSweepBmc(Ssw_Man_t *p)
Definition: sswSweep.c:267
void Aig_ManDumpBlif(Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
Definition: aigUtil.c:733
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static int Ssw_ObjIsConst1Cand(Aig_Man_t *pAig, Aig_Obj_t *pObj)
Definition: sswInt.h:172
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
ABC_INT64_T abctime
Definition: abc_global.h:278
Aig_Man_t * Ssw_SpeculativeReduction(Ssw_Man_t *p)
Definition: sswAig.c:212
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Ssw_ClassesLitNum(Ssw_Cla_t *p)
Definition: sswClass.c:291