abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecCec.c File Reference
#include "cecInt.h"
#include "proof/fra/fra.h"
#include "aig/gia/giaAig.h"
#include "misc/extra/extra.h"
#include "sat/cnf/cnf.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Cec_ManTransformPattern (Gia_Man_t *p, int iOut, int *pValues)
 DECLARATIONS ///. More...
 
int Cec_ManVerifyOld (Gia_Man_t *pMiter, int fVerbose, int *piOutFail, abctime clkTotal)
 
int Cec_ManHandleSpecialCases (Gia_Man_t *p, Cec_ParCec_t *pPars)
 
int Cec_ManVerifyNaive (Gia_Man_t *p, Cec_ParCec_t *pPars)
 
int Cec_ManVerify (Gia_Man_t *pInit, Cec_ParCec_t *pPars)
 MACRO DEFINITIONS ///. More...
 
int Cec_ManVerifyTwo (Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
 
int Cec_ManVerifyTwoAigs (Aig_Man_t *pAig0, Aig_Man_t *pAig1, int fVerbose)
 
Aig_Man_tCec_LatchCorrespondence (Aig_Man_t *pAig, int nConfs, int fUseCSat)
 
Aig_Man_tCec_SignalCorrespondence (Aig_Man_t *pAig, int nConfs, int fUseCSat)
 
Aig_Man_tCec_FraigCombinational (Aig_Man_t *pAig, int nConfs, int fVerbose)
 

Function Documentation

Aig_Man_t* Cec_FraigCombinational ( Aig_Man_t pAig,
int  nConfs,
int  fVerbose 
)

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

Synopsis [Implementation of fraiging.]

Description []

SideEffects []

SeeAlso []

Definition at line 516 of file cecCec.c.

517 {
518  Gia_Man_t * pGia;
519  Cec_ParFra_t FraPars, * pFraPars = &FraPars;
520  Cec_ManFraSetDefaultParams( pFraPars );
521  pFraPars->fSatSweeping = 1;
522  pFraPars->nBTLimit = nConfs;
523  pFraPars->nItersMax = 20;
524  pFraPars->fVerbose = fVerbose;
525  pGia = Gia_ManFromAigSimple( pAig );
526  Cec_ManSatSweeping( pGia, pFraPars );
527  Gia_ManReprToAigRepr( pAig, pGia );
528  Gia_ManStop( pGia );
529  return Aig_ManDupSimple( pAig );
530 }
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecCore.c:337
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Gia_ManReprToAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition: giaAig.c:435
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
int fVerbose
Definition: cec.h:112
int nBTLimit
Definition: cec.h:100
int nItersMax
Definition: cec.h:99
Definition: gia.h:95
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
Definition: cecCore.c:125
int fSatSweeping
Definition: cec.h:109
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
Aig_Man_t* Cec_LatchCorrespondence ( Aig_Man_t pAig,
int  nConfs,
int  fUseCSat 
)

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

Synopsis [Implementation of new signal correspodence.]

Description []

SideEffects []

SeeAlso []

Definition at line 465 of file cecCec.c.

466 {
467  Gia_Man_t * pGia;
468  Cec_ParCor_t CorPars, * pCorPars = &CorPars;
469  Cec_ManCorSetDefaultParams( pCorPars );
470  pCorPars->fLatchCorr = 1;
471  pCorPars->fUseCSat = fUseCSat;
472  pCorPars->nBTLimit = nConfs;
473  pGia = Gia_ManFromAigSimple( pAig );
474  Cec_ManLSCorrespondenceClasses( pGia, pCorPars );
475  Gia_ManReprToAigRepr( pAig, pGia );
476  Gia_ManStop( pGia );
477  return Aig_ManDupSimple( pAig );
478 }
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
Definition: cecCore.c:181
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int fUseCSat
Definition: cec.h:146
void Gia_ManReprToAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition: giaAig.c:435
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
int fLatchCorr
Definition: cec.h:142
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:909
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Cec_ManHandleSpecialCases ( Gia_Man_t p,
Cec_ParCec_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file cecCec.c.

136 {
137  Gia_Obj_t * pObj1, * pObj2;
138  Gia_Obj_t * pDri1, * pDri2;
139  int i;
140  abctime clk = Abc_Clock();
141  Gia_ManSetPhase( p );
142  Gia_ManForEachPo( p, pObj1, i )
143  {
144  pObj2 = Gia_ManPo( p, ++i );
145  // check if they different on all-0 pattern
146  // (for example, when they have the same driver but complemented)
147  if ( Gia_ObjPhase(pObj1) != Gia_ObjPhase(pObj2) )
148  {
149  Abc_Print( 1, "Networks are NOT EQUIVALENT. Output %d trivially differs (different phase). ", i/2 );
150  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
151  pPars->iOutFail = i/2;
152  Cec_ManTransformPattern( p, i/2, NULL );
153  return 0;
154  }
155  // get the drivers
156  pDri1 = Gia_ObjFanin0(pObj1);
157  pDri2 = Gia_ObjFanin0(pObj2);
158  // drivers are different PIs
159  if ( Gia_ObjIsPi(p, pDri1) && Gia_ObjIsPi(p, pDri2) && pDri1 != pDri2 )
160  {
161  Abc_Print( 1, "Networks are NOT EQUIVALENT. Output %d trivially differs (different PIs). ", i/2 );
162  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
163  pPars->iOutFail = i/2;
164  Cec_ManTransformPattern( p, i/2, NULL );
165  // if their compl attributes are the same - one should be complemented
166  assert( Gia_ObjFaninC0(pObj1) == Gia_ObjFaninC0(pObj2) );
167  Abc_InfoSetBit( p->pCexComb->pData, Gia_ObjCioId(pDri1) );
168  return 0;
169  }
170  // one of the drivers is a PI; another is a constant 0
171  if ( (Gia_ObjIsPi(p, pDri1) && Gia_ObjIsConst0(pDri2)) ||
172  (Gia_ObjIsPi(p, pDri2) && Gia_ObjIsConst0(pDri1)) )
173  {
174  Abc_Print( 1, "Networks are NOT EQUIVALENT. Output %d trivially differs (PI vs. constant). ", i/2 );
175  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
176  pPars->iOutFail = i/2;
177  Cec_ManTransformPattern( p, i/2, NULL );
178  // the compl attributes are the same - the PI should be complemented
179  assert( Gia_ObjFaninC0(pObj1) == Gia_ObjFaninC0(pObj2) );
180  if ( Gia_ObjIsPi(p, pDri1) )
181  Abc_InfoSetBit( p->pCexComb->pData, Gia_ObjCioId(pDri1) );
182  else
183  Abc_InfoSetBit( p->pCexComb->pData, Gia_ObjCioId(pDri2) );
184  return 0;
185  }
186  }
187  if ( Gia_ManAndNum(p) == 0 )
188  {
189  Abc_Print( 1, "Networks are equivalent. " );
190  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
191  return 1;
192  }
193  return -1;
194 }
static int Gia_ObjPhase(Gia_Obj_t *pObj)
Definition: gia.h:415
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
Abc_Cex_t * pCexComb
Definition: gia.h:135
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
int iOutFail
Definition: cec.h:128
ABC_NAMESPACE_IMPL_START void Cec_ManTransformPattern(Gia_Man_t *p, int iOut, int *pValues)
DECLARATIONS ///.
Definition: cecCec.c:49
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
ABC_NAMESPACE_IMPL_START void Cec_ManTransformPattern ( Gia_Man_t p,
int  iOut,
int *  pValues 
)

DECLARATIONS ///.

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

FileName [cecCec.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [Integrated combinatinal equivalence checker.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cecCec.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Saves the input pattern with the given number.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file cecCec.c.

50 {
51  int i;
52  assert( p->pCexComb == NULL );
53  p->pCexComb = Abc_CexAlloc( 0, Gia_ManCiNum(p), 1 );
54  p->pCexComb->iPo = iOut;
55  for ( i = 0; i < Gia_ManCiNum(p); i++ )
56  if ( pValues && pValues[i] )
57  Abc_InfoSetBit( p->pCexComb->pData, i );
58 }
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
Abc_Cex_t * pCexComb
Definition: gia.h:135
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
#define assert(ex)
Definition: util_old.h:213
int Cec_ManVerify ( Gia_Man_t pInit,
Cec_ParCec_t pPars 
)

MACRO DEFINITIONS ///.

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

Synopsis [New CEC engine.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file cecCec.c.

309 {
310  int fDumpUndecided = 0;
311  Cec_ParFra_t ParsFra, * pParsFra = &ParsFra;
312  Gia_Man_t * p, * pNew;
313  int RetValue;
314  abctime clk = Abc_Clock();
315  abctime clkTotal = Abc_Clock();
316  // consider special cases:
317  // 1) (SAT) a pair of POs have different value under all-0 pattern
318  // 2) (SAT) a pair of POs has different PI/Const drivers
319  // 3) (UNSAT) 1-2 do not hold and there is no nodes
320  RetValue = Cec_ManHandleSpecialCases( pInit, pPars );
321  if ( RetValue == 0 || RetValue == 1 )
322  return RetValue;
323  // preprocess
324  p = Gia_ManDup( pInit );
326  p = Gia_ManCleanup( pNew = p );
327  Gia_ManStop( pNew );
328  if ( pPars->fNaive )
329  {
330  RetValue = Cec_ManVerifyNaive( p, pPars );
331  Gia_ManStop( p );
332  return RetValue;
333  }
334  // sweep for equivalences
335  Cec_ManFraSetDefaultParams( pParsFra );
336  pParsFra->nItersMax = 1000;
337  pParsFra->nBTLimit = pPars->nBTLimit;
338  pParsFra->TimeLimit = pPars->TimeLimit;
339  pParsFra->fVerbose = pPars->fVerbose;
340  pParsFra->fCheckMiter = 1;
341  pParsFra->fDualOut = 1;
342  pNew = Cec_ManSatSweeping( p, pParsFra );
343  pPars->iOutFail = pParsFra->iOutFail;
344  // update
345  pInit->pCexComb = p->pCexComb; p->pCexComb = NULL;
346  Gia_ManStop( p );
347  p = pInit;
348  // continue
349  if ( pNew == NULL )
350  {
351  if ( p->pCexComb != NULL )
352  {
353  if ( p->pCexComb && !Gia_ManVerifyCex( p, p->pCexComb, 1 ) )
354  Abc_Print( 1, "Counter-example simulation has failed.\n" );
355  Abc_Print( 1, "Networks are NOT EQUIVALENT. " );
356  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
357  return 0;
358  }
359  p = Gia_ManDup( pInit );
361  p = Gia_ManCleanup( pNew = p );
362  Gia_ManStop( pNew );
363  pNew = p;
364  }
365  if ( pPars->fVerbose )
366  {
367  Abc_Print( 1, "Networks are UNDECIDED after the new CEC engine. " );
368  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
369  }
370  if ( fDumpUndecided )
371  {
372  ABC_FREE( pNew->pReprs );
373  ABC_FREE( pNew->pNexts );
374  Gia_AigerWrite( pNew, "gia_cec_undecided.aig", 0, 0 );
375  Abc_Print( 1, "The result is written into file \"%s\".\n", "gia_cec_undecided.aig" );
376  }
377  if ( pPars->TimeLimit && (Abc_Clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->TimeLimit )
378  {
379  Gia_ManStop( pNew );
380  return -1;
381  }
382  // call other solver
383  if ( pPars->fVerbose )
384  Abc_Print( 1, "Calling the old CEC engine.\n" );
385  fflush( stdout );
386  RetValue = Cec_ManVerifyOld( pNew, pPars->fVerbose, &pPars->iOutFail, clkTotal );
387  p->pCexComb = pNew->pCexComb; pNew->pCexComb = NULL;
388  if ( p->pCexComb && !Gia_ManVerifyCex( p, p->pCexComb, 1 ) )
389  Abc_Print( 1, "Counter-example simulation has failed.\n" );
390  Gia_ManStop( pNew );
391  return RetValue;
392 }
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars)
Definition: cecCore.c:337
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Definition: giaCex.c:44
int * pNexts
Definition: gia.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Cec_ManVerifyOld(Gia_Man_t *pMiter, int fVerbose, int *piOutFail, abctime clkTotal)
Definition: cecCec.c:71
int nBTLimit
Definition: cec.h:120
int TimeLimit
Definition: cec.h:101
Abc_Cex_t * pCexComb
Definition: gia.h:135
static abctime Abc_Clock()
Definition: abc_global.h:279
int fVerbose
Definition: cec.h:112
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
int fDualOut
Definition: cec.h:107
int TimeLimit
Definition: cec.h:121
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int iOutFail
Definition: cec.h:128
int Cec_ManVerifyNaive(Gia_Man_t *p, Cec_ParCec_t *pPars)
Definition: cecCec.c:207
int nBTLimit
Definition: cec.h:100
int nItersMax
Definition: cec.h:99
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int fCheckMiter
Definition: cec.h:105
int fVerbose
Definition: cec.h:127
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
Definition: cecCore.c:125
Gia_Rpr_t * pReprs
Definition: gia.h:121
int fNaive
Definition: cec.h:125
int Cec_ManHandleSpecialCases(Gia_Man_t *p, Cec_ParCec_t *pPars)
Definition: cecCec.c:135
ABC_INT64_T abctime
Definition: abc_global.h:278
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
Definition: giaEquiv.c:480
int iOutFail
Definition: cec.h:113
int Cec_ManVerifyNaive ( Gia_Man_t p,
Cec_ParCec_t pPars 
)

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

Synopsis [Performs naive checking.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file cecCec.c.

208 {
209  extern Cnf_Dat_t * Mf_ManGenerateCnf( Gia_Man_t * pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fVerbose );
210  Cnf_Dat_t * pCnf = Mf_ManGenerateCnf( p, 8, 0, 0, 0 );
211  sat_solver * pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
212  Gia_Obj_t * pObj0, * pObj1;
213  abctime clkStart = Abc_Clock();
214  int nPairs = Gia_ManPoNum(p)/2;
215  int nUnsats = 0, nSats = 0, nUndecs = 0, nTrivs = 0;
216  int i, iVar0, iVar1, pLits[2], status, RetValue;
217  ProgressBar * pProgress = Extra_ProgressBarStart( stdout, nPairs );
218  assert( Gia_ManPoNum(p) % 2 == 0 );
219  for ( i = 0; i < nPairs; i++ )
220  {
221  if ( (i & 0xFF) == 0 )
222  Extra_ProgressBarUpdate( pProgress, i, NULL );
223  pObj0 = Gia_ManPo(p, 2*i);
224  pObj1 = Gia_ManPo(p, 2*i+1);
225  if ( Gia_ObjChild0(pObj0) == Gia_ObjChild0(pObj1) )
226  {
227  nUnsats++;
228  nTrivs++;
229  continue;
230  }
231  if ( pPars->TimeLimit && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= pPars->TimeLimit )
232  {
233  printf( "Timeout (%d sec) is reached.\n", pPars->TimeLimit );
234  nUndecs = nPairs - nUnsats - nSats;
235  break;
236  }
237  iVar0 = pCnf->pVarNums[ Gia_ObjId(p, pObj0) ];
238  iVar1 = pCnf->pVarNums[ Gia_ObjId(p, pObj1) ];
239  assert( iVar0 >= 0 && iVar1 >= 0 );
240  pLits[0] = Abc_Var2Lit( iVar0, 0 );
241  pLits[1] = Abc_Var2Lit( iVar1, 0 );
242  // check direct
243  pLits[0] = lit_neg(pLits[0]);
244  status = sat_solver_solve( pSat, pLits, pLits + 2, pPars->nBTLimit, 0, 0, 0 );
245  if ( status == l_False )
246  {
247  pLits[0] = lit_neg( pLits[0] );
248  pLits[1] = lit_neg( pLits[1] );
249  RetValue = sat_solver_addclause( pSat, pLits, pLits + 2 );
250  assert( RetValue );
251  }
252  else if ( status == l_True )
253  {
254  printf( "Output %d is SAT.\n", i );
255  nSats++;
256  continue;
257  }
258  else
259  {
260  nUndecs++;
261  continue;
262  }
263  // check inverse
264  status = sat_solver_solve( pSat, pLits, pLits + 2, pPars->nBTLimit, 0, 0, 0 );
265  if ( status == l_False )
266  {
267  pLits[0] = lit_neg( pLits[0] );
268  pLits[1] = lit_neg( pLits[1] );
269  RetValue = sat_solver_addclause( pSat, pLits, pLits + 2 );
270  assert( RetValue );
271  }
272  else if ( status == l_True )
273  {
274  printf( "Output %d is SAT.\n", i );
275  nSats++;
276  continue;
277  }
278  else
279  {
280  nUndecs++;
281  continue;
282  }
283  nUnsats++;
284  }
285  Extra_ProgressBarStop( pProgress );
286  printf( "UNSAT = %6d. SAT = %6d. UNDEC = %6d. Trivial = %6d. ", nUnsats, nSats, nUndecs, nTrivs );
287  Abc_PrintTime( 1, "Time", Abc_Clock() - clkStart );
288  Cnf_DataFree( pCnf );
289  sat_solver_delete( pSat );
290  if ( nSats )
291  return 0;
292  if ( nUndecs )
293  return -1;
294  return 1;
295 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
int nBTLimit
Definition: cec.h:120
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
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
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
int * pVarNums
Definition: cnf.h:63
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: cnf.h:56
Definition: gia.h:75
static lit lit_neg(lit l)
Definition: satVec.h:144
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
DECLARATIONS ///.
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int TimeLimit
Definition: cec.h:121
void Extra_ProgressBarStop(ProgressBar *p)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition: cnfMan.c:463
Definition: gia.h:95
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
Cnf_Dat_t * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fVerbose)
Definition: giaMf.c:1629
ABC_INT64_T abctime
Definition: abc_global.h:278
int Cec_ManVerifyOld ( Gia_Man_t pMiter,
int  fVerbose,
int *  piOutFail,
abctime  clkTotal 
)

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

Synopsis [Interface to the old CEC engine]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file cecCec.c.

72 {
73 // extern int Fra_FraigCec( Aig_Man_t ** ppAig, int nConfLimit, int fVerbose );
74  extern int Ssw_SecCexResimulate( Aig_Man_t * p, int * pModel, int * pnOutputs );
75  Gia_Man_t * pTemp = Gia_ManTransformMiter( pMiter );
76  Aig_Man_t * pMiterCec = Gia_ManToAig( pTemp, 0 );
77  int RetValue, iOut, nOuts;
78  if ( piOutFail )
79  *piOutFail = -1;
80  Gia_ManStop( pTemp );
81  // run CEC on this miter
82  RetValue = Fra_FraigCec( &pMiterCec, 10000000, fVerbose );
83  // report the miter
84  if ( RetValue == 1 )
85  {
86  Abc_Print( 1, "Networks are equivalent. " );
87  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
88  }
89  else if ( RetValue == 0 )
90  {
91  Abc_Print( 1, "Networks are NOT EQUIVALENT. " );
92  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
93  if ( pMiterCec->pData == NULL )
94  Abc_Print( 1, "Counter-example is not available.\n" );
95  else
96  {
97  iOut = Ssw_SecCexResimulate( pMiterCec, (int *)pMiterCec->pData, &nOuts );
98  if ( iOut == -1 )
99  Abc_Print( 1, "Counter-example verification has failed.\n" );
100  else
101  {
102 // Aig_Obj_t * pObj = Aig_ManCo(pMiterCec, iOut);
103 // Aig_Obj_t * pFan = Aig_ObjFanin0(pObj);
104  Abc_Print( 1, "Primary output %d has failed", iOut );
105  if ( nOuts-1 >= 0 )
106  Abc_Print( 1, ", along with other %d incorrect outputs", nOuts-1 );
107  Abc_Print( 1, ".\n" );
108  if ( piOutFail )
109  *piOutFail = iOut;
110  }
111  Cec_ManTransformPattern( pMiter, iOut, (int *)pMiterCec->pData );
112  }
113  }
114  else
115  {
116  Abc_Print( 1, "Networks are UNDECIDED. " );
117  Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
118  }
119  fflush( stdout );
120  Aig_ManStop( pMiterCec );
121  return RetValue;
122 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_ManTransformMiter(Gia_Man_t *p)
Definition: giaDup.c:2324
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 abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void * pData
Definition: gia.h:169
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Ssw_SecCexResimulate(Aig_Man_t *p, int *pModel, int *pnOutputs)
Definition: saigMiter.c:1038
ABC_NAMESPACE_IMPL_START void Cec_ManTransformPattern(Gia_Man_t *p, int iOut, int *pValues)
DECLARATIONS ///.
Definition: cecCec.c:49
Definition: gia.h:95
int Fra_FraigCec(Aig_Man_t **ppAig, int nConfLimit, int fVerbose)
Definition: fraCec.c:320
int Cec_ManVerifyTwo ( Gia_Man_t p0,
Gia_Man_t p1,
int  fVerbose 
)

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

Synopsis [New CEC engine applied to two circuits.]

Description []

SideEffects []

SeeAlso []

Definition at line 405 of file cecCec.c.

406 {
407  Cec_ParCec_t ParsCec, * pPars = &ParsCec;
408  Gia_Man_t * pMiter;
409  int RetValue;
411  pPars->fVerbose = fVerbose;
412  pMiter = Gia_ManMiter( p0, p1, 0, 1, 0, 0, pPars->fVerbose );
413  if ( pMiter == NULL )
414  return -1;
415  RetValue = Cec_ManVerify( pMiter, pPars );
416  p0->pCexComb = pMiter->pCexComb; pMiter->pCexComb = NULL;
417  Gia_ManStop( pMiter );
418  return RetValue;
419 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int Cec_ManVerify(Gia_Man_t *pInit, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
Definition: cecCec.c:308
Abc_Cex_t * pCexComb
Definition: gia.h:135
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
Definition: cecCore.c:157
Definition: gia.h:95
int fVerbose
Definition: cec.h:127
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition: giaDup.c:2128
int Cec_ManVerifyTwoAigs ( Aig_Man_t pAig0,
Aig_Man_t pAig1,
int  fVerbose 
)

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

Synopsis [New CEC engine applied to two circuits.]

Description [Returns 1 if equivalent, 0 if counter-example, -1 if undecided. Counter-example is returned in the first manager as pAig0->pSeqModel. The format is given in Abc_Cex_t (file "abc\src\aig\gia\gia.h").]

SideEffects []

SeeAlso []

Definition at line 434 of file cecCec.c.

435 {
436  Gia_Man_t * p0, * p1, * pTemp;
437  int RetValue;
438 
439  p0 = Gia_ManFromAig( pAig0 );
440  p0 = Gia_ManCleanup( pTemp = p0 );
441  Gia_ManStop( pTemp );
442 
443  p1 = Gia_ManFromAig( pAig1 );
444  p1 = Gia_ManCleanup( pTemp = p1 );
445  Gia_ManStop( pTemp );
446 
447  RetValue = Cec_ManVerifyTwo( p0, p1, fVerbose );
448  pAig0->pSeqModel = p0->pCexComb; p0->pCexComb = NULL;
449  Gia_ManStop( p0 );
450  Gia_ManStop( p1 );
451  return RetValue;
452 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Abc_Cex_t * pCexComb
Definition: gia.h:135
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
int Cec_ManVerifyTwo(Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
Definition: cecCec.c:405
Definition: gia.h:95
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
Aig_Man_t* Cec_SignalCorrespondence ( Aig_Man_t pAig,
int  nConfs,
int  fUseCSat 
)

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

Synopsis [Implementation of new signal correspodence.]

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file cecCec.c.

492 {
493  Gia_Man_t * pGia;
494  Cec_ParCor_t CorPars, * pCorPars = &CorPars;
495  Cec_ManCorSetDefaultParams( pCorPars );
496  pCorPars->fUseCSat = fUseCSat;
497  pCorPars->nBTLimit = nConfs;
498  pGia = Gia_ManFromAigSimple( pAig );
499  Cec_ManLSCorrespondenceClasses( pGia, pCorPars );
500  Gia_ManReprToAigRepr( pAig, pGia );
501  Gia_ManStop( pGia );
502  return Aig_ManDupSimple( pAig );
503 }
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
Definition: cecCore.c:181
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
int fUseCSat
Definition: cec.h:146
void Gia_ManReprToAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition: giaAig.c:435
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition: giaAig.c:171
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:909
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46