abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ssw.h File Reference

Go to the source code of this file.

Data Structures

struct  Ssw_Pars_t_
 
struct  Ssw_RarPars_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Ssw_Pars_t_ 
Ssw_Pars_t
 INCLUDES ///. More...
 
typedef struct Ssw_RarPars_t_ Ssw_RarPars_t
 
typedef struct Ssw_Sml_t_ Ssw_Sml_t
 

Functions

int Ssw_BmcDynamic (Aig_Man_t *pAig, int nFramesMax, int nConfLimit, int fVerbose, int *piFrame)
 MACRO DEFINITIONS ///. More...
 
int Ssw_ManSetConstrPhases (Aig_Man_t *p, int nFrames, Vec_Int_t **pvInits)
 
void Ssw_ManSetDefaultParams (Ssw_Pars_t *p)
 DECLARATIONS ///. More...
 
void Ssw_ManSetDefaultParamsLcorr (Ssw_Pars_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)
 
int Ssw_SecWithSimilarityPairs (Aig_Man_t *p0, Aig_Man_t *p1, Vec_Int_t *vPairs, Ssw_Pars_t *pPars)
 
int Ssw_SecWithSimilarity (Aig_Man_t *p0, Aig_Man_t *p1, Ssw_Pars_t *pPars)
 
Aig_Man_tSsw_SignalCorrespondencePart (Aig_Man_t *pAig, Ssw_Pars_t *pPars)
 DECLARATIONS ///. More...
 
int Ssw_MiterStatus (Aig_Man_t *p, int fVerbose)
 DECLARATIONS ///. More...
 
int Ssw_SecWithPairs (Aig_Man_t *pAig1, Aig_Man_t *pAig2, Vec_Int_t *vIds1, Vec_Int_t *vIds2, Ssw_Pars_t *pPars)
 
int Ssw_SecGeneral (Aig_Man_t *pAig1, Aig_Man_t *pAig2, Ssw_Pars_t *pPars)
 
int Ssw_SecGeneralMiter (Aig_Man_t *pMiter, Ssw_Pars_t *pPars)
 
void Ssw_RarSetDefaultParams (Ssw_RarPars_t *p)
 FUNCTION DEFINITIONS ///. More...
 
int Ssw_RarSignalFilter (Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
 
int Ssw_RarSimulate (Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
 
Ssw_Sml_tSsw_SmlSimulateComb (Aig_Man_t *pAig, int nWords)
 
Ssw_Sml_tSsw_SmlSimulateSeq (Aig_Man_t *pAig, int nPref, int nFrames, int nWords)
 
void Ssw_SmlUnnormalize (Ssw_Sml_t *p)
 
void Ssw_SmlStop (Ssw_Sml_t *p)
 
int Ssw_SmlNumFrames (Ssw_Sml_t *p)
 
int Ssw_SmlNumWordsTotal (Ssw_Sml_t *p)
 
unsigned * Ssw_SmlSimInfo (Ssw_Sml_t *p, Aig_Obj_t *pObj)
 
int Ssw_SmlObjsAreEqualWord (Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 
void Ssw_SmlInitializeSpecial (Ssw_Sml_t *p, Vec_Int_t *vInit)
 
int Ssw_SmlCheckNonConstOutputs (Ssw_Sml_t *p)
 
Vec_Ptr_tSsw_SmlSimDataPointers (Ssw_Sml_t *p)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t

INCLUDES ///.

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

FileName [ssw.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
ssw.h,v 1.00 2008/09/01 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 40 of file ssw.h.

typedef struct Ssw_RarPars_t_ Ssw_RarPars_t

Definition at line 89 of file ssw.h.

typedef struct Ssw_Sml_t_ Ssw_Sml_t

Definition at line 115 of file ssw.h.

Function Documentation

int Ssw_BmcDynamic ( Aig_Man_t pAig,
int  nFramesMax,
int  nConfLimit,
int  fVerbose,
int *  piFrame 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [Performs BMC for the given AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file sswBmc.c.

127 {
128  Ssw_Frm_t * pFrm;
129  Ssw_Sat_t * pSat;
130  Aig_Obj_t * pObj, * pObjFrame;
131  int status, Lit, i, f, RetValue;
132  abctime clkPart;
133 
134  // start managers
135  assert( Saig_ManRegNum(pAig) > 0 );
136  Aig_ManSetCioIds( pAig );
137  pSat = Ssw_SatStart( 0 );
138  pFrm = Ssw_FrmStart( pAig );
139  pFrm->pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) * 3 );
140  // report statistics
141  if ( fVerbose )
142  {
143  Abc_Print( 1, "AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
144  Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
145  Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
146  fflush( stdout );
147  }
148  // perform dynamic unrolling
149  RetValue = -1;
150  for ( f = 0; f < nFramesMax; f++ )
151  {
152  clkPart = Abc_Clock();
153  Saig_ManForEachPo( pAig, pObj, i )
154  {
155  // unroll the circuit for this output
156  Ssw_BmcUnroll_rec( pFrm, pObj, f );
157  pObjFrame = Ssw_ObjFrame_( pFrm, pObj, f );
158  Ssw_CnfNodeAddToSolver( pSat, Aig_Regular(pObjFrame) );
159  status = sat_solver_simplify(pSat->pSat);
160  assert( status );
161  // solve
162  Lit = toLitCond( Ssw_ObjSatNum(pSat,pObjFrame), Aig_IsComplement(pObjFrame) );
163  if ( fVerbose )
164  {
165  Abc_Print( 1, "Solving output %2d of frame %3d ... \r",
166  i % Saig_ManPoNum(pAig), i / Saig_ManPoNum(pAig) );
167  }
168  status = sat_solver_solve( pSat->pSat, &Lit, &Lit + 1, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
169  if ( status == l_False )
170  {
171 /*
172  Lit = lit_neg( Lit );
173  RetValue = sat_solver_addclause( pSat->pSat, &Lit, &Lit + 1 );
174  assert( RetValue );
175  if ( pSat->pSat->qtail != pSat->pSat->qhead )
176  {
177  RetValue = sat_solver_simplify(pSat->pSat);
178  assert( RetValue );
179  }
180 */
181  RetValue = 1;
182  continue;
183  }
184  else if ( status == l_True )
185  {
186  pAig->pSeqModel = Ssw_BmcGetCounterExample( pFrm, pSat, i, f );
187  if ( piFrame )
188  *piFrame = f;
189  RetValue = 0;
190  break;
191  }
192  else
193  {
194  if ( piFrame )
195  *piFrame = f;
196  RetValue = -1;
197  break;
198  }
199  }
200  if ( fVerbose )
201  {
202  Abc_Print( 1, "Solved %2d outputs of frame %3d. ", Saig_ManPoNum(pAig), f );
203  Abc_Print( 1, "Conf =%8.0f. Var =%8d. AIG=%9d. ",
204  (double)pSat->pSat->stats.conflicts,
205  pSat->nSatVars, Aig_ManNodeNum(pFrm->pFrames) );
206  ABC_PRT( "T", Abc_Clock() - clkPart );
207  clkPart = Abc_Clock();
208  fflush( stdout );
209  }
210  if ( RetValue != 1 )
211  break;
212  }
213 
214  Ssw_SatStop( pSat );
215  Ssw_FrmStop( pFrm );
216  return RetValue;
217 }
void Ssw_CnfNodeAddToSolver(Ssw_Sat_t *p, Aig_Obj_t *pObj)
Definition: sswCnf.c:351
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
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
#define l_True
Definition: SolverTypes.h:84
ABC_NAMESPACE_IMPL_START Aig_Obj_t * Ssw_BmcUnroll_rec(Ssw_Frm_t *pFrm, Aig_Obj_t *pObj, int f)
DECLARATIONS ///.
Definition: sswBmc.c:45
static abctime Abc_Clock()
Definition: abc_global.h:279
stats_t stats
Definition: satSolver.h:156
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
sat_solver * pSat
Definition: sswInt.h:147
static lit toLitCond(int v, int c)
Definition: satVec.h:143
Aig_Man_t * pFrames
Definition: sswInt.h:161
Definition: aig.h:69
ABC_NAMESPACE_IMPL_START Ssw_Frm_t * Ssw_FrmStart(Aig_Man_t *pAig)
DECLARATIONS ///.
Definition: sswAig.c:45
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Ssw_ObjFrame_(Ssw_Frm_t *p, Aig_Obj_t *pObj, int i)
Definition: sswInt.h:188
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int Aig_ManLevelNum(Aig_Man_t *p)
Definition: aigDfs.c:486
ABC_INT64_T conflicts
Definition: satVec.h:154
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Abc_Cex_t * Ssw_BmcGetCounterExample(Ssw_Frm_t *pFrm, Ssw_Sat_t *pSat, int iPo, int iFrame)
Definition: sswBmc.c:90
#define l_False
Definition: SolverTypes.h:85
static int Ssw_ObjSatNum(Ssw_Sat_t *p, Aig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: sswInt.h:169
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
void Ssw_FrmStop(Ssw_Frm_t *p)
Definition: sswAig.c:70
void Ssw_SatStop(Ssw_Sat_t *p)
Definition: sswCnf.c:81
ABC_INT64_T abctime
Definition: abc_global.h:278
int nSatVars
Definition: sswInt.h:148
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
int Ssw_ManSetConstrPhases ( Aig_Man_t p,
int  nFrames,
Vec_Int_t **  pvInits 
)

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

Synopsis [Finds one satisfiable assignment of the timeframes.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file sswConstr.c.

101 {
102  Aig_Man_t * pFrames;
103  sat_solver * pSat;
104  Cnf_Dat_t * pCnf;
105  Aig_Obj_t * pObj;
106  int i, RetValue;
107  if ( pvInits )
108  *pvInits = NULL;
109 // assert( p->nConstrs > 0 );
110  // derive the timeframes
111  pFrames = Ssw_FramesWithConstraints( p, nFrames );
112  // create CNF
113  pCnf = Cnf_Derive( pFrames, 0 );
114  // create SAT solver
115  pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
116  if ( pSat == NULL )
117  {
118  Cnf_DataFree( pCnf );
119  Aig_ManStop( pFrames );
120  return 1;
121  }
122  // solve
123  RetValue = sat_solver_solve( pSat, NULL, NULL,
124  (ABC_INT64_T)1000000, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
125  if ( RetValue == l_True && pvInits )
126  {
127  *pvInits = Vec_IntAlloc( 1000 );
128  Aig_ManForEachCi( pFrames, pObj, i )
129  Vec_IntPush( *pvInits, sat_solver_var_value(pSat, pCnf->pVarNums[Aig_ObjId(pObj)]) );
130 
131 // Aig_ManForEachCi( pFrames, pObj, i )
132 // Abc_Print( 1, "%d", Vec_IntEntry(*pvInits, i) );
133 // Abc_Print( 1, "\n" );
134  }
135  sat_solver_delete( pSat );
136  Cnf_DataFree( pCnf );
137  Aig_ManStop( pFrames );
138  if ( RetValue == l_False )
139  return 1;
140  if ( RetValue == l_True )
141  return 0;
142  return -1;
143 }
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
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 sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define l_True
Definition: SolverTypes.h:84
Definition: cnf.h:56
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_NAMESPACE_IMPL_START Aig_Man_t * Ssw_FramesWithConstraints(Aig_Man_t *p, int nFrames)
DECLARATIONS ///.
Definition: sswConstr.c:47
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition: cnfMan.c:463
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
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
int Ssw_MiterStatus ( Aig_Man_t p,
int  fVerbose 
)

DECLARATIONS ///.

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

FileName [sswPairs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Calls to the SAT solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sswPairs.c.

46 {
47  Aig_Obj_t * pObj, * pChild;
48  int i, CountConst0 = 0, CountNonConst0 = 0, CountUndecided = 0;
49 // if ( p->pData )
50 // return 0;
51  Saig_ManForEachPo( p, pObj, i )
52  {
53  pChild = Aig_ObjChild0(pObj);
54  // check if the output is constant 0
55  if ( pChild == Aig_ManConst0(p) )
56  {
57  CountConst0++;
58  continue;
59  }
60  // check if the output is constant 1
61  if ( pChild == Aig_ManConst1(p) )
62  {
63  CountNonConst0++;
64  continue;
65  }
66  // check if the output is a primary input
67  if ( p->nRegs == 0 && Aig_ObjIsCi(Aig_Regular(pChild)) )
68  {
69  CountNonConst0++;
70  continue;
71  }
72  // check if the output can be not constant 0
73  if ( Aig_Regular(pChild)->fPhase != (unsigned)Aig_IsComplement(pChild) )
74  {
75  CountNonConst0++;
76  continue;
77  }
78  CountUndecided++;
79  }
80 
81  if ( fVerbose )
82  {
83  Abc_Print( 1, "Miter has %d outputs. ", Saig_ManPoNum(p) );
84  Abc_Print( 1, "Const0 = %d. ", CountConst0 );
85  Abc_Print( 1, "NonConst0 = %d. ", CountNonConst0 );
86  Abc_Print( 1, "Undecided = %d. ", CountUndecided );
87  Abc_Print( 1, "\n" );
88  }
89 
90  if ( CountNonConst0 )
91  return 0;
92  if ( CountUndecided )
93  return -1;
94  return 1;
95 }
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
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
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
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Ssw_RarSetDefaultParams ( Ssw_RarPars_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file sswRarity.c.

103 {
104  memset( p, 0, sizeof(Ssw_RarPars_t) );
105  p->nFrames = 20;
106  p->nWords = 50;
107  p->nBinSize = 8;
108  p->nRounds = 0;
109  p->nRestart = 0;
110  p->nRandSeed = 0;
111  p->TimeOut = 0;
112  p->TimeOutGap = 0;
113  p->fSolveAll = 0;
114  p->fDropSatOuts = 0;
115  p->fSetLastState = 0;
116  p->fVerbose = 0;
117  p->fNotVerbose = 0;
118 }
char * memset()
int fSetLastState
Definition: ssw.h:101
int nFrames
Definition: ssw.h:92
int TimeOutGap
Definition: ssw.h:99
int fNotVerbose
Definition: ssw.h:103
int fVerbose
Definition: ssw.h:102
int TimeOut
Definition: ssw.h:98
int nRestart
Definition: ssw.h:96
int nWords
Definition: ssw.h:93
int fSolveAll
Definition: ssw.h:100
int nRandSeed
Definition: ssw.h:97
int fDropSatOuts
Definition: ssw.h:105
int nRounds
Definition: ssw.h:95
int nBinSize
Definition: ssw.h:94
int Ssw_RarSignalFilter ( Aig_Man_t pAig,
Ssw_RarPars_t pPars 
)

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

Synopsis [Filter equivalence classes of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1219 of file sswRarity.c.

1220 {
1221  Ssw_RarMan_t * p;
1222  int r, f = -1, i, k;
1223  abctime clkTotal = Abc_Clock();
1224  abctime nTimeToStop = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
1225  int nNumRestart = 0;
1226  int nSavedSeed = pPars->nRandSeed;
1227  int RetValue = -1;
1228  assert( Aig_ManRegNum(pAig) > 0 );
1229  assert( Aig_ManConstrNum(pAig) == 0 );
1230  // consider the case of empty AIG
1231  if ( Aig_ManNodeNum(pAig) == 0 )
1232  return -1;
1233  // check trivially SAT miters
1234  if ( pPars->fMiter && Ssw_RarCheckTrivial( pAig, 1 ) )
1235  return 0;
1236  if ( pPars->fVerbose )
1237  Abc_Print( 1, "Rarity equiv filtering with %d words, %d frames, %d rounds, %d seed, and %d sec timeout.\n",
1238  pPars->nWords, pPars->nFrames, pPars->nRounds, pPars->nRandSeed, pPars->TimeOut );
1239  // reset random numbers
1240  Ssw_RarManPrepareRandom( nSavedSeed );
1241 
1242  // create manager
1243  p = Ssw_RarManStart( pAig, pPars );
1244  // compute starting state if needed
1245  assert( p->vInits == NULL );
1246  if ( pPars->pCex )
1247  {
1248  p->vInits = Ssw_RarFindStartingState( pAig, pPars->pCex );
1249  Abc_Print( 1, "Beginning simulation from the state derived using the counter-example.\n" );
1250  }
1251  else
1252  p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) );
1253  // duplicate the array
1254  for ( i = 1; i < pPars->nWords; i++ )
1255  for ( k = 0; k < Aig_ManRegNum(pAig); k++ )
1256  Vec_IntPush( p->vInits, Vec_IntEntry(p->vInits, k) );
1257  assert( Vec_IntSize(p->vInits) == Aig_ManRegNum(pAig) * pPars->nWords );
1258 
1259  // create trivial equivalence classes with all nodes being candidates for constant 1
1260  if ( pAig->pReprs == NULL )
1261  p->ppClasses = Ssw_ClassesPrepareSimple( pAig, pPars->fLatchOnly, 0 );
1262  else
1263  p->ppClasses = Ssw_ClassesPrepareFromReprs( pAig );
1265  // print the stats
1266  if ( pPars->fVerbose )
1267  {
1268  Abc_Print( 1, "Initial : " );
1269  Ssw_ClassesPrint( p->ppClasses, 0 );
1270  }
1271  // refine classes using BMC
1272  for ( r = 0; !pPars->nRounds || (nNumRestart * pPars->nRestart + r < pPars->nRounds); r++ )
1273  {
1274  // start filtering equivalence classes
1275  if ( Ssw_ClassesCand1Num(p->ppClasses) == 0 && Ssw_ClassesClassNum(p->ppClasses) == 0 )
1276  {
1277  Abc_Print( 1, "All equivalences are refined away.\n" );
1278  break;
1279  }
1280  // simulate
1281  for ( f = 0; f < pPars->nFrames; f++ )
1282  {
1283  Ssw_RarManSimulate( p, f ? NULL : p->vInits, 1, !r && !f );
1284  if ( pPars->fMiter && Ssw_RarManCheckNonConstOutputs(p, -1, 0) )
1285  {
1286  if ( !pPars->fVerbose )
1287  Abc_Print( 1, "%s", Abc_FrameIsBatchMode() ? "\n" : "\r" );
1288 // Abc_Print( 1, "Simulation asserted a PO in frame f: %d <= f < %d.\n", r * pPars->nFrames, (r+1) * pPars->nFrames );
1289  if ( pPars->fVerbose )
1290  Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts.\n", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1291  Ssw_RarManPrepareRandom( nSavedSeed );
1292  Abc_CexFree( pAig->pSeqModel );
1293  pAig->pSeqModel = Ssw_RarDeriveCex( p, r * p->pPars->nFrames + f, p->iFailPo, p->iFailPat, 1 );
1294  // print final report
1295  Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", pAig->pSeqModel->iPo, pAig->pName, pAig->pSeqModel->iFrame );
1296  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1297  RetValue = 0;
1298  goto finish;
1299  }
1300  // check timeout
1301  if ( pPars->TimeOut && Abc_Clock() > nTimeToStop )
1302  {
1303  if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1304  Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1305  Abc_Print( 1, "Reached timeout (%d sec).\n", pPars->TimeOut );
1306  goto finish;
1307  }
1308  }
1309  // get initialization patterns
1310  if ( pPars->pCex == NULL && pPars->nRestart && r == pPars->nRestart )
1311  {
1312  r = -1;
1313  nSavedSeed = (nSavedSeed + 1) % 1000;
1314  Ssw_RarManPrepareRandom( nSavedSeed );
1315  Vec_IntFill( p->vInits, Aig_ManRegNum(pAig) * pPars->nWords, 0 );
1316  nNumRestart++;
1317  Vec_IntClear( p->vPatBests );
1318  // clean rarity info
1319 // memset( p->pRarity, 0, sizeof(int) * (1 << nBinSize) * p->nGroups );
1320  }
1321  else
1322  Ssw_RarTransferPatterns( p, p->vInits );
1323  // printout
1324  if ( pPars->fVerbose )
1325  {
1326  Abc_Print( 1, "Round %3d: ", r );
1327  Ssw_ClassesPrint( p->ppClasses, 0 );
1328  }
1329  else
1330  {
1331  Abc_Print( 1, "." );
1332  }
1333  }
1334 finish:
1335  // report
1336  if ( r == pPars->nRounds && f == pPars->nFrames )
1337  {
1338  if ( !pPars->fVerbose )
1339  Abc_Print( 1, "%s", Abc_FrameIsBatchMode() ? "\n" : "\r" );
1340  Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts did not assert POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1341  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1342  }
1343  // cleanup
1344  Ssw_RarManStop( p );
1345  return RetValue;
1346 }
static Vec_Int_t * Ssw_RarFindStartingState(Aig_Man_t *pAig, Abc_Cex_t *pCex)
Definition: sswRarity.c:886
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
Definition: sswClass.c:275
int nFrames
Definition: ssw.h:92
static int Aig_ManConstrNum(Aig_Man_t *p)
Definition: aig.h:261
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Definition: sswClass.c:259
ABC_DLL int Abc_FrameIsBatchMode()
Definition: mainFrame.c:92
unsigned Ssw_RarManObjHashWord(void *pMan, Aig_Obj_t *pObj)
Definition: sswRarity.c:530
void Ssw_RarManSimulate(Ssw_RarMan_t *p, Vec_Int_t *vInit, int fUpdate, int fFirst)
Definition: sswRarity.c:651
static void Ssw_RarManStop(Ssw_RarMan_t *p)
Definition: sswRarity.c:782
static abctime Abc_Clock()
Definition: abc_global.h:279
static Ssw_RarMan_t * Ssw_RarManStart(Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
Definition: sswRarity.c:751
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
static void Ssw_RarTransferPatterns(Ssw_RarMan_t *p, Vec_Int_t *vInits)
Definition: sswRarity.c:814
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Abc_Cex_t * pCex
Definition: ssw.h:111
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
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
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int fVerbose
Definition: ssw.h:102
int TimeOut
Definition: ssw.h:98
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
int nRestart
Definition: ssw.h:96
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int fLatchOnly
Definition: ssw.h:108
int Ssw_RarCheckTrivial(Aig_Man_t *pAig, int fVerbose)
Definition: sswRarity.c:941
typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
DECLARATIONS ///.
Definition: sswRarity.c:33
int Ssw_RarManCheckNonConstOutputs(Ssw_RarMan_t *p, int iFrame, abctime Time)
Definition: sswRarity.c:597
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Ssw_RarManObjIsConst(void *pMan, Aig_Obj_t *pObj)
Definition: sswRarity.c:483
Ssw_Cla_t * Ssw_ClassesPrepareFromReprs(Aig_Man_t *pAig)
Definition: sswClass.c:768
int nWords
Definition: ssw.h:93
int Ssw_RarManObjsAreEqual(void *pMan, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition: sswRarity.c:506
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
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
int nRandSeed
Definition: ssw.h:97
int fMiter
Definition: ssw.h:106
void Abc_CexFree(Abc_Cex_t *p)
Definition: utilCex.c:371
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t * Ssw_RarDeriveCex(Ssw_RarMan_t *p, int iFrame, int iPo, int iPatFinal, int fVerbose)
Definition: sswRarity.c:177
void Ssw_RarManPrepareRandom(int nRandSeed)
Definition: sswRarity.c:131
int nRounds
Definition: ssw.h:95
int Ssw_RarSimulate ( Aig_Man_t pAig,
Ssw_RarPars_t pPars 
)

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

Synopsis [Perform sequential simulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 973 of file sswRarity.c.

974 {
975  int fTryBmc = 0;
976  int fMiter = 1;
977  Ssw_RarMan_t * p;
978  int r, f = -1;
979  abctime clk, clkTotal = Abc_Clock();
980  abctime nTimeToStop = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
981  abctime timeLastSolved = 0;
982  int nNumRestart = 0;
983  int nSavedSeed = pPars->nRandSeed;
984  int RetValue = -1;
985  int iFrameFail = -1;
986  assert( Aig_ManRegNum(pAig) > 0 );
987  assert( Aig_ManConstrNum(pAig) == 0 );
988  ABC_FREE( pAig->pSeqModel );
989  // consider the case of empty AIG
990 // if ( Aig_ManNodeNum(pAig) == 0 )
991 // return -1;
992  // check trivially SAT miters
993 // if ( fMiter && Ssw_RarCheckTrivial( pAig, fVerbose ) )
994 // return 0;
995  if ( pPars->fVerbose )
996  Abc_Print( 1, "Rarity simulation with %d words, %d frames, %d rounds, %d restart, %d seed, and %d sec timeout.\n",
997  pPars->nWords, pPars->nFrames, pPars->nRounds, pPars->nRestart, pPars->nRandSeed, pPars->TimeOut );
998  // reset random numbers
999  Ssw_RarManPrepareRandom( nSavedSeed );
1000 
1001  // create manager
1002  p = Ssw_RarManStart( pAig, pPars );
1003  p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) * pPars->nWords );
1004 
1005  // perform simulation rounds
1006  pPars->nSolved = 0;
1007  timeLastSolved = Abc_Clock();
1008  for ( r = 0; !pPars->nRounds || (nNumRestart * pPars->nRestart + r < pPars->nRounds); r++ )
1009  {
1010  clk = Abc_Clock();
1011  if ( fTryBmc )
1012  {
1013  Aig_Man_t * pNewAig = Saig_ManDupWithPhase( pAig, p->vInits );
1014  Saig_BmcPerform( pNewAig, 0, 100, 2000, 3, 0, 0, 1 /*fVerbose*/, 0, &iFrameFail, 0 );
1015 // if ( pNewAig->pSeqModel != NULL )
1016 // Abc_Print( 1, "BMC has found a counter-example in frame %d.\n", iFrameFail );
1017  Aig_ManStop( pNewAig );
1018  }
1019  // simulate
1020  for ( f = 0; f < pPars->nFrames; f++ )
1021  {
1022  Ssw_RarManSimulate( p, f ? NULL : p->vInits, 0, 0 );
1023  if ( fMiter )
1024  {
1025  int Status = Ssw_RarManCheckNonConstOutputs(p, r * p->pPars->nFrames + f, Abc_Clock() - clkTotal);
1026  if ( Status == 2 )
1027  {
1028  Abc_Print( 1, "Quitting due to callback on fail.\n" );
1029  goto finish;
1030  }
1031  if ( Status == 1 ) // found CEX
1032  {
1033  RetValue = 0;
1034  if ( !pPars->fSolveAll )
1035  {
1036  if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1037  // Abc_Print( 1, "Simulation asserted a PO in frame f: %d <= f < %d.\n", r * nFrames, (r+1) * nFrames );
1038  Ssw_RarManPrepareRandom( nSavedSeed );
1039  if ( pPars->fVerbose )
1040  Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts.\n", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1041  pAig->pSeqModel = Ssw_RarDeriveCex( p, r * p->pPars->nFrames + f, p->iFailPo, p->iFailPat, pPars->fVerbose );
1042  // print final report
1043  Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", pAig->pSeqModel->iPo, pAig->pName, pAig->pSeqModel->iFrame );
1044  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1045  goto finish;
1046  }
1047  timeLastSolved = Abc_Clock();
1048  }
1049  // else - did not find a counter example
1050  }
1051  // check timeout
1052  if ( pPars->TimeOut && Abc_Clock() > nTimeToStop )
1053  {
1054  if ( !pPars->fSilent )
1055  {
1056  if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1057  Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts and solved %d outputs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved );
1058  Abc_Print( 1, "Reached timeout (%d sec).\n", pPars->TimeOut );
1059  }
1060  goto finish;
1061  }
1062  if ( pPars->TimeOutGap && timeLastSolved && Abc_Clock() > timeLastSolved + pPars->TimeOutGap * CLOCKS_PER_SEC )
1063  {
1064  if ( !pPars->fSilent )
1065  {
1066  if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1067  Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts and solved %d outputs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved );
1068  Abc_Print( 1, "Reached gap timeout (%d sec).\n", pPars->TimeOutGap );
1069  }
1070  goto finish;
1071  }
1072  // check if all outputs are solved by now
1073  if ( pPars->fSolveAll && p->vCexes && Vec_PtrCountZero(p->vCexes) == 0 )
1074  goto finish;
1075  }
1076  // get initialization patterns
1077  if ( pPars->nRestart && r == pPars->nRestart )
1078  {
1079  r = -1;
1080  nSavedSeed = (nSavedSeed + 1) % 1000;
1081  Ssw_RarManPrepareRandom( nSavedSeed );
1082  Vec_IntFill( p->vInits, Aig_ManRegNum(pAig) * pPars->nWords, 0 );
1083  nNumRestart++;
1084  Vec_IntClear( p->vPatBests );
1085  // clean rarity info
1086 // memset( p->pRarity, 0, sizeof(int) * (1 << nBinSize) * p->nGroups );
1087  }
1088  else
1089  Ssw_RarTransferPatterns( p, p->vInits );
1090  // printout
1091  if ( pPars->fVerbose )
1092  {
1093  if ( pPars->fSolveAll )
1094  {
1095  Abc_Print( 1, "Starts =%6d ", nNumRestart );
1096  Abc_Print( 1, "Rounds =%6d ", nNumRestart * pPars->nRestart + ((r==-1)?0:r) );
1097  Abc_Print( 1, "Frames =%6d ", (nNumRestart * pPars->nRestart + r) * pPars->nFrames );
1098  Abc_Print( 1, "CEX =%6d (%6.2f %%) ", pPars->nSolved, 100.0*pPars->nSolved/Saig_ManPoNum(p->pAig) );
1099  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1100  }
1101  else
1102  Abc_Print( 1, "." );
1103  }
1104 
1105  }
1106 finish:
1107  if ( pPars->fSetLastState && p->vInits )
1108  {
1109  assert( Vec_IntSize(p->vInits) % Aig_ManRegNum(pAig) == 0 );
1110  Vec_IntShrink( p->vInits, Aig_ManRegNum(pAig) );
1111  pAig->pData = p->vInits; p->vInits = NULL;
1112  }
1113  if ( pPars->nSolved )
1114  {
1115 /*
1116  if ( !pPars->fSilent )
1117  {
1118  if ( pPars->fVerbose && !pPars->fSolveAll ) Abc_Print( 1, "\n" );
1119  Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts asserted %d (out of %d) POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart, pPars->nSolved, Saig_ManPoNum(p->pAig) );
1120  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1121  }
1122 */
1123  }
1124  else if ( r == pPars->nRounds && f == pPars->nFrames )
1125  {
1126  if ( !pPars->fSilent )
1127  {
1128  if ( pPars->fVerbose ) Abc_Print( 1, "\n" );
1129  Abc_Print( 1, "Simulation of %d frames for %d rounds with %d restarts did not assert POs. ", pPars->nFrames, nNumRestart * pPars->nRestart + r, nNumRestart );
1130  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
1131  }
1132  }
1133  // cleanup
1134  Ssw_RarManStop( p );
1135  return RetValue;
1136 }
int fSetLastState
Definition: ssw.h:101
int nFrames
Definition: ssw.h:92
static int Aig_ManConstrNum(Aig_Man_t *p)
Definition: aig.h:261
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
void Ssw_RarManSimulate(Ssw_RarMan_t *p, Vec_Int_t *vInit, int fUpdate, int fFirst)
Definition: sswRarity.c:651
static void Ssw_RarManStop(Ssw_RarMan_t *p)
Definition: sswRarity.c:782
int TimeOutGap
Definition: ssw.h:99
int fSilent
Definition: ssw.h:104
int Saig_BmcPerform(Aig_Man_t *pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int *piFrames, int fSilent)
Definition: bmcBmc2.c:761
static abctime Abc_Clock()
Definition: abc_global.h:279
static Ssw_RarMan_t * Ssw_RarManStart(Aig_Man_t *pAig, Ssw_RarPars_t *pPars)
Definition: sswRarity.c:751
static void Ssw_RarTransferPatterns(Ssw_RarMan_t *p, Vec_Int_t *vInits)
Definition: sswRarity.c:814
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
int nSolved
Definition: ssw.h:110
int fVerbose
Definition: ssw.h:102
int TimeOut
Definition: ssw.h:98
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
int nRestart
Definition: ssw.h:96
Aig_Man_t * Saig_ManDupWithPhase(Aig_Man_t *pAig, Vec_Int_t *vInit)
Definition: saigDup.c:480
typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
DECLARATIONS ///.
Definition: sswRarity.c:33
int Ssw_RarManCheckNonConstOutputs(Ssw_RarMan_t *p, int iFrame, abctime Time)
Definition: sswRarity.c:597
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Vec_PtrCountZero(Vec_Ptr_t *p)
Definition: vecPtr.h:343
int nWords
Definition: ssw.h:93
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_FREE(obj)
Definition: abc_global.h:232
int fSolveAll
Definition: ssw.h:100
#define assert(ex)
Definition: util_old.h:213
int nRandSeed
Definition: ssw.h:97
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
Abc_Cex_t * Ssw_RarDeriveCex(Ssw_RarMan_t *p, int iFrame, int iPo, int iPatFinal, int fVerbose)
Definition: sswRarity.c:177
void Ssw_RarManPrepareRandom(int nRandSeed)
Definition: sswRarity.c:131
int nRounds
Definition: ssw.h:95
int Ssw_SecGeneral ( Aig_Man_t pAig1,
Aig_Man_t pAig2,
Ssw_Pars_t pPars 
)

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

Synopsis [Runs inductive SEC for the miter of two AIGs.]

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file sswPairs.c.

416 {
417  Aig_Man_t * pAigRes, * pMiter;
418  int RetValue;
419  abctime clk = Abc_Clock();
420  // try the new AIGs
421  Abc_Print( 1, "Performing general verification without node pairs.\n" );
422  pMiter = Saig_ManCreateMiter( pAig1, pAig2, 0 );
423  Aig_ManCleanup( pMiter );
424  pAigRes = Ssw_SignalCorrespondence( pMiter, pPars );
425  Aig_ManStop( pMiter );
426  // report the results
427  RetValue = Ssw_MiterStatus( pAigRes, 1 );
428  if ( RetValue == 1 )
429  Abc_Print( 1, "Verification successful. " );
430  else if ( RetValue == 0 )
431  Abc_Print( 1, "Verification failed with a counter-example. " );
432  else
433  Abc_Print( 1, "Verification UNDECIDED. The number of remaining regs = %d (total = %d). ",
434  Aig_ManRegNum(pAigRes), Aig_ManRegNum(pAig1) + Aig_ManRegNum(pAig2) );
435  ABC_PRT( "Time", Abc_Clock() - clk );
436  // cleanup
437  Aig_ManStop( pAigRes );
438  return RetValue;
439 }
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
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
static abctime Abc_Clock()
Definition: abc_global.h:279
Aig_Man_t * Saig_ManCreateMiter(Aig_Man_t *p1, Aig_Man_t *p2, int Oper)
Definition: saigMiter.c:100
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
ABC_NAMESPACE_IMPL_START int Ssw_MiterStatus(Aig_Man_t *p, int fVerbose)
DECLARATIONS ///.
Definition: sswPairs.c:45
ABC_INT64_T abctime
Definition: abc_global.h:278
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
int Ssw_SecGeneralMiter ( Aig_Man_t pMiter,
Ssw_Pars_t pPars 
)

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

Synopsis [Runs inductive SEC for the miter of two AIGs.]

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file sswPairs.c.

453 {
454  Aig_Man_t * pAigRes;
455  int RetValue;
456  abctime clk = Abc_Clock();
457  // try the new AIGs
458 // Abc_Print( 1, "Performing general verification without node pairs.\n" );
459  pAigRes = Ssw_SignalCorrespondence( pMiter, pPars );
460  // report the results
461  RetValue = Ssw_MiterStatus( pAigRes, 1 );
462  if ( RetValue == 1 )
463  Abc_Print( 1, "Verification successful. " );
464  else if ( RetValue == 0 )
465  Abc_Print( 1, "Verification failed with a counter-example. " );
466  else
467  Abc_Print( 1, "Verification UNDECIDED. The number of remaining regs = %d (total = %d). ",
468  Aig_ManRegNum(pAigRes), Aig_ManRegNum(pMiter) );
469  ABC_PRT( "Time", Abc_Clock() - clk );
470  // cleanup
471  Aig_ManStop( pAigRes );
472  return RetValue;
473 }
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
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
ABC_NAMESPACE_IMPL_START int Ssw_MiterStatus(Aig_Man_t *p, int fVerbose)
DECLARATIONS ///.
Definition: sswPairs.c:45
ABC_INT64_T abctime
Definition: abc_global.h:278
int Ssw_SecWithPairs ( Aig_Man_t pAig1,
Aig_Man_t pAig2,
Vec_Int_t vIds1,
Vec_Int_t vIds2,
Ssw_Pars_t pPars 
)

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

Synopsis [Runs inductive SEC for the miter of two AIGs with node pairs defined.]

Description []

SideEffects []

SeeAlso []

Definition at line 380 of file sswPairs.c.

381 {
382  Aig_Man_t * pAigRes;
383  int RetValue;
384  abctime clk = Abc_Clock();
385  assert( vIds1 != NULL && vIds2 != NULL );
386  // try the new AIGs
387  Abc_Print( 1, "Performing specialized verification with node pairs.\n" );
388  pAigRes = Ssw_SignalCorrespondenceWithPairs( pAig1, pAig2, vIds1, vIds2, pPars );
389  // report the results
390  RetValue = Ssw_MiterStatus( pAigRes, 1 );
391  if ( RetValue == 1 )
392  Abc_Print( 1, "Verification successful. " );
393  else if ( RetValue == 0 )
394  Abc_Print( 1, "Verification failed with a counter-example. " );
395  else
396  Abc_Print( 1, "Verification UNDECIDED. The number of remaining regs = %d (total = %d). ",
397  Aig_ManRegNum(pAigRes), Aig_ManRegNum(pAig1) + Aig_ManRegNum(pAig2) );
398  ABC_PRT( "Time", Abc_Clock() - clk );
399  // cleanup
400  Aig_ManStop( pAigRes );
401  return RetValue;
402 }
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
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_Man_t * Ssw_SignalCorrespondenceWithPairs(Aig_Man_t *pAig1, Aig_Man_t *pAig2, Vec_Int_t *vIds1, Vec_Int_t *vIds2, Ssw_Pars_t *pPars)
Definition: sswPairs.c:272
#define ABC_PRT(a, t)
Definition: abc_global.h:220
ABC_NAMESPACE_IMPL_START int Ssw_MiterStatus(Aig_Man_t *p, int fVerbose)
DECLARATIONS ///.
Definition: sswPairs.c:45
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int Ssw_SecWithSimilarity ( Aig_Man_t p0,
Aig_Man_t p1,
Ssw_Pars_t pPars 
)

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

Synopsis [Solves SEC with structural similarity.]

Description []

SideEffects []

SeeAlso []

Definition at line 542 of file sswIslands.c.

543 {
544  Vec_Int_t * vPairs;
545  Aig_Man_t * pPart0, * pPart1;
546  int RetValue;
547  if ( pPars->fVerbose )
548  Abc_Print( 1, "Performing sequential verification using structural similarity.\n" );
549  // consider the case when a miter is given
550  if ( p1 == NULL )
551  {
552  if ( pPars->fVerbose )
553  {
554  Aig_ManPrintStats( p0 );
555  }
556  // demiter the miter
557  if ( !Saig_ManDemiterSimpleDiff( p0, &pPart0, &pPart1 ) )
558  {
559  Abc_Print( 1, "Demitering has failed.\n" );
560  return -1;
561  }
562  }
563  else
564  {
565  pPart0 = Aig_ManDupSimple( p0 );
566  pPart1 = Aig_ManDupSimple( p1 );
567  }
568  if ( pPars->fVerbose )
569  {
570 // Aig_ManPrintStats( pPart0 );
571 // Aig_ManPrintStats( pPart1 );
572  if ( p1 == NULL )
573  {
574 // Aig_ManDumpBlif( pPart0, "part0.blif", NULL, NULL );
575 // Aig_ManDumpBlif( pPart1, "part1.blif", NULL, NULL );
576 // Abc_Print( 1, "The result of demitering is written into files \"%s\" and \"%s\".\n", "part0.blif", "part1.blif" );
577  }
578  }
579  assert( Aig_ManRegNum(pPart0) > 0 );
580  assert( Aig_ManRegNum(pPart1) > 0 );
581  assert( Saig_ManPiNum(pPart0) == Saig_ManPiNum(pPart1) );
582  assert( Saig_ManPoNum(pPart0) == Saig_ManPoNum(pPart1) );
583  // derive pairs
584 // vPairs = Saig_StrSimPerformMatching_hack( pPart0, pPart1 );
585  vPairs = Saig_StrSimPerformMatching( pPart0, pPart1, 0, pPars->fVerbose, NULL );
586  RetValue = Ssw_SecWithSimilarityPairs( pPart0, pPart1, vPairs, pPars );
587  Aig_ManStop( pPart0 );
588  Aig_ManStop( pPart1 );
589  Vec_IntFree( vPairs );
590  return RetValue;
591 }
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
Vec_Int_t * Saig_StrSimPerformMatching(Aig_Man_t *p0, Aig_Man_t *p1, int nDist, int fVerbose, Aig_Man_t **ppMiter)
Definition: saigStrSim.c:873
int Saig_ManDemiterSimpleDiff(Aig_Man_t *p, Aig_Man_t **ppAig0, Aig_Man_t **ppAig1)
Definition: saigMiter.c:660
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Ssw_SecWithSimilarityPairs(Aig_Man_t *p0, Aig_Man_t *p1, Vec_Int_t *vPairs, Ssw_Pars_t *pPars)
Definition: sswIslands.c:478
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Ssw_SecWithSimilarityPairs ( Aig_Man_t p0,
Aig_Man_t p1,
Vec_Int_t vPairs,
Ssw_Pars_t pPars 
)

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

Synopsis [Solves SEC with structural similarity.]

Description [The first two arguments are pointers to the AIG managers. The third argument is the array of pairs of IDs of structurally equivalent nodes from the first and second managers, respectively.]

SideEffects [The managers will be updated by adding "islands of difference".]

SeeAlso []

Definition at line 478 of file sswIslands.c.

479 {
480  Ssw_Pars_t Pars;
481  Aig_Man_t * pAigRes;
482  int RetValue;
483  abctime clk = Abc_Clock();
484  // derive parameters if not given
485  if ( pPars == NULL )
486  Ssw_ManSetDefaultParams( pPars = &Pars );
487  // reduce the AIG with pairs
488  pAigRes = Ssw_SecWithSimilaritySweep( p0, p1, vPairs, pPars );
489  // report the result of verification
490  RetValue = Ssw_MiterStatus( pAigRes, 1 );
491  if ( RetValue == 1 )
492  Abc_Print( 1, "Verification successful. " );
493  else if ( RetValue == 0 )
494  Abc_Print( 1, "Verification failed with a counter-example. " );
495  else
496  Abc_Print( 1, "Verification UNDECIDED. The number of remaining regs = %d (total = %d). ",
497  Aig_ManRegNum(pAigRes), Aig_ManRegNum(p0)+Aig_ManRegNum(p1) );
498  ABC_PRT( "Time", Abc_Clock() - clk );
499  Aig_ManStop( pAigRes );
500  return RetValue;
501 }
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
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
static abctime Abc_Clock()
Definition: abc_global.h:279
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition: sswCore.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Aig_Man_t * Ssw_SecWithSimilaritySweep(Aig_Man_t *p0, Aig_Man_t *p1, Vec_Int_t *vPairs, Ssw_Pars_t *pPars)
Definition: sswIslands.c:419
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int Ssw_MiterStatus(Aig_Man_t *p, int fVerbose)
DECLARATIONS ///.
Definition: sswPairs.c:45
ABC_INT64_T abctime
Definition: abc_global.h:278
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_SignalCorrespondencePart ( Aig_Man_t pAig,
Ssw_Pars_t pPars 
)

DECLARATIONS ///.

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

FileName [sswPart.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Partitioned signal correspondence.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Performs partitioned sequential SAT sweeping.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file sswPart.c.

47 {
48  int fPrintParts = 0;
49  char Buffer[100];
50  Aig_Man_t * pTemp, * pNew;
51  Vec_Ptr_t * vResult;
52  Vec_Int_t * vPart;
53  int * pMapBack;
54  int i, nCountPis, nCountRegs;
55  int nClasses, nPartSize, fVerbose;
56  abctime clk = Abc_Clock();
57  if ( pPars->fConstrs )
58  {
59  Abc_Print( 1, "Cannot use partitioned computation with constraints.\n" );
60  return NULL;
61  }
62  // save parameters
63  nPartSize = pPars->nPartSize; pPars->nPartSize = 0;
64  fVerbose = pPars->fVerbose; pPars->fVerbose = 0;
65  // generate partitions
66  if ( pAig->vClockDoms )
67  {
68  // divide large clock domains into separate partitions
69  vResult = Vec_PtrAlloc( 100 );
70  Vec_PtrForEachEntry( Vec_Int_t *, (Vec_Ptr_t *)pAig->vClockDoms, vPart, i )
71  {
72  if ( nPartSize && Vec_IntSize(vPart) > nPartSize )
73  Aig_ManPartDivide( vResult, vPart, nPartSize, pPars->nOverSize );
74  else
75  Vec_PtrPush( vResult, Vec_IntDup(vPart) );
76  }
77  }
78  else
79  vResult = Aig_ManRegPartitionSimple( pAig, nPartSize, pPars->nOverSize );
80 // vResult = Aig_ManPartitionSmartRegisters( pAig, nPartSize, 0 );
81 // vResult = Aig_ManRegPartitionSmart( pAig, nPartSize );
82  if ( fPrintParts )
83  {
84  // print partitions
85  Abc_Print( 1, "Simple partitioning. %d partitions are saved:\n", Vec_PtrSize(vResult) );
86  Vec_PtrForEachEntry( Vec_Int_t *, vResult, vPart, i )
87  {
88 // extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact );
89  sprintf( Buffer, "part%03d.aig", i );
90  pTemp = Aig_ManRegCreatePart( pAig, vPart, &nCountPis, &nCountRegs, NULL );
91  Ioa_WriteAiger( pTemp, Buffer, 0, 0 );
92  Abc_Print( 1, "part%03d.aig : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d.\n",
93  i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp) );
94  Aig_ManStop( pTemp );
95  }
96  }
97 
98  // perform SSW with partitions
99  Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
100  Vec_PtrForEachEntry( Vec_Int_t *, vResult, vPart, i )
101  {
102  pTemp = Aig_ManRegCreatePart( pAig, vPart, &nCountPis, &nCountRegs, &pMapBack );
103  Aig_ManSetRegNum( pTemp, pTemp->nRegs );
104  // create the projection of 1-hot registers
105  if ( pAig->vOnehots )
106  pTemp->vOnehots = Aig_ManRegProjectOnehots( pAig, pTemp, pAig->vOnehots, fVerbose );
107  // run SSW
108  if (nCountPis>0) {
109  pNew = Ssw_SignalCorrespondence( pTemp, pPars );
110  nClasses = Aig_TransferMappedClasses( pAig, pTemp, pMapBack );
111  if ( fVerbose )
112  Abc_Print( 1, "%3d : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d. It = %3d. Cl = %5d.\n",
113  i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp), pPars->nIters, nClasses );
114  Aig_ManStop( pNew );
115  }
116  Aig_ManStop( pTemp );
117  ABC_FREE( pMapBack );
118  }
119  // remap the AIG
120  pNew = Aig_ManDupRepr( pAig, 0 );
121  Aig_ManSeqCleanup( pNew );
122 // Aig_ManPrintStats( pAig );
123 // Aig_ManPrintStats( pNew );
124  Vec_VecFree( (Vec_Vec_t *)vResult );
125  pPars->nPartSize = nPartSize;
126  pPars->fVerbose = fVerbose;
127  if ( fVerbose )
128  {
129  ABC_PRT( "Total time", Abc_Clock() - clk );
130  }
131  return pNew;
132 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Aig_Man_t * Aig_ManRegCreatePart(Aig_Man_t *pAig, Vec_Int_t *vPart, int *pnCountPis, int *pnCountRegs, int **ppMapBack)
Definition: aigPartReg.c:308
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManPartDivide(Vec_Ptr_t *vResult, Vec_Int_t *vDomain, int nPartSize, int nOverSize)
Definition: aigPartReg.c:513
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
Vec_Ptr_t * Aig_ManRegProjectOnehots(Aig_Man_t *pAig, Aig_Man_t *pPart, Vec_Ptr_t *vOnehots, int fVerbose)
Definition: aigPartReg.c:248
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
int Aig_TransferMappedClasses(Aig_Man_t *pAig, Aig_Man_t *pPart, int *pMapBack)
Definition: aigRepr.c:533
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
char * sprintf()
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Ptr_t * Aig_ManRegPartitionSimple(Aig_Man_t *pAig, int nPartSize, int nOverSize)
Definition: aigPartReg.c:474
int Ssw_SmlCheckNonConstOutputs ( Ssw_Sml_t p)

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

Synopsis [Check if any of the POs becomes non-constant.]

Description []

SideEffects []

SeeAlso []

Definition at line 980 of file sswSim.c.

981 {
982  Aig_Obj_t * pObj;
983  int i;
984  Saig_ManForEachPo( p->pAig, pObj, i )
985  {
986  if ( p->pAig->nConstrs && i >= Saig_ManPoNum(p->pAig) - p->pAig->nConstrs )
987  return 0;
988  if ( !Ssw_SmlNodeIsZero(p, pObj) )
989  return 1;
990  }
991  return 0;
992 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
int Ssw_SmlNodeIsZero(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition: sswSim.c:294
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
void Ssw_SmlInitializeSpecial ( Ssw_Sml_t p,
Vec_Int_t vInit 
)

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

Synopsis [Assings random simulation info for the PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 928 of file sswSim.c.

929 {
930  Aig_Obj_t * pObj;
931  int Entry, i, nRegs;
932  nRegs = Aig_ManRegNum(p->pAig);
933  assert( nRegs > 0 );
934  assert( nRegs <= Aig_ManCiNum(p->pAig) );
935  assert( Vec_IntSize(vInit) == nRegs * p->nWordsFrame );
936  // assign random info for primary inputs
937  Saig_ManForEachPi( p->pAig, pObj, i )
938  Ssw_SmlAssignRandom( p, pObj );
939  // assign the initial state for the latches
940  Vec_IntForEachEntry( vInit, Entry, i )
941  Ssw_SmlObjAssignConstWord( p, Saig_ManLo(p->pAig, i % nRegs), Entry, 0, i / nRegs );
942 }
void Ssw_SmlObjAssignConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj, int fConst1, int iFrame, int iWord)
Definition: sswSim.c:582
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
void Ssw_SmlAssignRandom(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition: sswSim.c:513
int nWordsFrame
Definition: sswSim.c:36
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
int Ssw_SmlNumFrames ( Ssw_Sml_t p)

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

Synopsis [Returns the number of frames simulated in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1288 of file sswSim.c.

1289 {
1290  return p->nFrames;
1291 }
int nFrames
Definition: sswSim.c:35
int Ssw_SmlNumWordsTotal ( Ssw_Sml_t p)

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

Synopsis [Returns the total number of simulation words.]

Description []

SideEffects []

SeeAlso []

Definition at line 1304 of file sswSim.c.

1305 {
1306  return p->nWordsTotal;
1307 }
int nWordsTotal
Definition: sswSim.c:37
int Ssw_SmlObjsAreEqualWord ( Ssw_Sml_t p,
Aig_Obj_t pObj0,
Aig_Obj_t pObj1 
)

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

Synopsis [Returns 1 if simulation infos are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file sswSim.c.

125 {
126  unsigned * pSims0, * pSims1;
127  int i;
128  pSims0 = Ssw_ObjSim(p, pObj0->Id);
129  pSims1 = Ssw_ObjSim(p, pObj1->Id);
130  for ( i = p->nWordsPref; i < p->nWordsTotal; i++ )
131  if ( pSims0[i] != pSims1[i] )
132  return 0;
133  return 1;
134 }
int nWordsPref
Definition: sswSim.c:38
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
int Id
Definition: aig.h:85
Vec_Ptr_t* Ssw_SmlSimDataPointers ( Ssw_Sml_t p)

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

Synopsis [Get simulation data.]

Description []

SideEffects []

SeeAlso []

Definition at line 1189 of file sswSim.c.

1190 {
1191  Vec_Ptr_t * vSimInfo;
1192  Aig_Obj_t * pObj;
1193  int i;
1194  vSimInfo = Vec_PtrStart( Aig_ManObjNumMax(p->pAig) );
1195  Aig_ManForEachObj( p->pAig, pObj, i )
1196  Vec_PtrWriteEntry( vSimInfo, i, Ssw_ObjSim(p, i) );
1197  return vSimInfo;
1198 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
unsigned* Ssw_SmlSimInfo ( Ssw_Sml_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Returns the pointer to the simulation info of the node.]

Description [The simulation info is normalized unless procedure Ssw_SmlUnnormalize() is called in advance.]

SideEffects []

SeeAlso []

Definition at line 1321 of file sswSim.c.

1322 {
1323  assert( !Aig_IsComplement(pObj) );
1324  return Ssw_ObjSim( p, pObj->Id );
1325 }
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
Ssw_Sml_t* Ssw_SmlSimulateComb ( Aig_Man_t pAig,
int  nWords 
)

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

Synopsis [Performs simulation of the uninitialized circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 1228 of file sswSim.c.

1229 {
1230  Ssw_Sml_t * p;
1231  p = Ssw_SmlStart( pAig, 0, 1, nWords );
1232  Ssw_SmlInitialize( p, 0 );
1233  Ssw_SmlSimulateOne( p );
1234  return p;
1235 }
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition: sswSim.c:1005
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
Ssw_Sml_t * Ssw_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
Definition: sswSim.c:1148
void Ssw_SmlInitialize(Ssw_Sml_t *p, int fInit)
Definition: sswSim.c:895
DECLARATIONS ///.
Definition: sswSim.c:31
Ssw_Sml_t* Ssw_SmlSimulateSeq ( Aig_Man_t pAig,
int  nPref,
int  nFrames,
int  nWords 
)

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

Synopsis [Performs simulation of the initialized circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 1248 of file sswSim.c.

1249 {
1250  Ssw_Sml_t * p;
1251  p = Ssw_SmlStart( pAig, nPref, nFrames, nWords );
1252  Ssw_SmlInitialize( p, 1 );
1253  Ssw_SmlSimulateOne( p );
1255  return p;
1256 }
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
Definition: sswSim.c:1005
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
int fNonConstOut
Definition: sswSim.c:39
Ssw_Sml_t * Ssw_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
Definition: sswSim.c:1148
int Ssw_SmlCheckNonConstOutputs(Ssw_Sml_t *p)
Definition: sswSim.c:980
void Ssw_SmlInitialize(Ssw_Sml_t *p, int fInit)
Definition: sswSim.c:895
DECLARATIONS ///.
Definition: sswSim.c:31
void Ssw_SmlStop ( Ssw_Sml_t p)

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

Synopsis [Deallocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1211 of file sswSim.c.

1212 {
1213  ABC_FREE( p );
1214 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Ssw_SmlUnnormalize ( Ssw_Sml_t p)

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

Synopsis [Converts simulation information to be not normallized.]

Description []

SideEffects []

SeeAlso []

Definition at line 1044 of file sswSim.c.

1045 {
1046  Aig_Obj_t * pObj;
1047  unsigned * pSims;
1048  int i, k;
1049  // convert constant 1
1050  pSims = Ssw_ObjSim( p, 0 );
1051  for ( i = 0; i < p->nWordsFrame; i++ )
1052  pSims[i] = ~pSims[i];
1053  // convert internal nodes
1054  Aig_ManForEachNode( p->pAig, pObj, k )
1055  {
1056  if ( pObj->fPhase == 0 )
1057  continue;
1058  pSims = Ssw_ObjSim( p, pObj->Id );
1059  for ( i = 0; i < p->nWordsFrame; i++ )
1060  pSims[i] = ~pSims[i];
1061  }
1062  // PIs/POs are always stored in their natural state
1063 }
int nWordsFrame
Definition: sswSim.c:36
static unsigned * Ssw_ObjSim(Ssw_Sml_t *p, int Id)
Definition: sswSim.c:45
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
Definition: aig.h:69
Aig_Man_t * pAig
Definition: sswSim.c:33
unsigned int fPhase
Definition: aig.h:78
int Id
Definition: aig.h:85