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 );
77 int RetValue, iOut, nOuts;
82 RetValue =
Fra_FraigCec( &pMiterCec, 10000000, fVerbose );
88 Abc_Print( 1,
"Networks are equivalent. " );
89 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkTotal );
92 else if ( RetValue == 0 )
96 Abc_Print( 1,
"Networks are NOT EQUIVALENT. " );
97 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkTotal );
99 if ( pMiterCec->pData == NULL )
100 Abc_Print( 1,
"Counter-example is not available.\n" );
105 Abc_Print( 1,
"Counter-example verification has failed.\n" );
110 Abc_Print( 1,
"Primary output %d has failed", iOut );
112 Abc_Print( 1,
", along with other %d incorrect outputs", nOuts-1 );
113 Abc_Print( 1,
".\n" );
123 Abc_Print( 1,
"Networks are UNDECIDED. " );
124 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkTotal );
151 pObj2 = Gia_ManPo(
p, ++i );
154 if ( Gia_ObjPhase(pObj1) != Gia_ObjPhase(pObj2) )
158 Abc_Print( 1,
"Networks are NOT EQUIVALENT. Output %d trivially differs (different phase). ", i/2 );
159 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
166 pDri1 = Gia_ObjFanin0(pObj1);
167 pDri2 = Gia_ObjFanin0(pObj2);
169 if ( Gia_ObjIsPi(
p, pDri1) && Gia_ObjIsPi(
p, pDri2) && pDri1 != pDri2 )
173 Abc_Print( 1,
"Networks are NOT EQUIVALENT. Output %d trivially differs (different PIs). ", i/2 );
174 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
179 assert( Gia_ObjFaninC0(pObj1) == Gia_ObjFaninC0(pObj2) );
180 Abc_InfoSetBit(
p->pCexComb->pData, Gia_ObjCioId(pDri1) );
184 if ( (Gia_ObjIsPi(
p, pDri1) && Gia_ObjIsConst0(pDri2)) ||
185 (Gia_ObjIsPi(
p, pDri2) && Gia_ObjIsConst0(pDri1)) )
189 Abc_Print( 1,
"Networks are NOT EQUIVALENT. Output %d trivially differs (PI vs. constant). ", i/2 );
190 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
195 assert( Gia_ObjFaninC0(pObj1) == Gia_ObjFaninC0(pObj2) );
196 if ( Gia_ObjIsPi(
p, pDri1) )
197 Abc_InfoSetBit(
p->pCexComb->pData, Gia_ObjCioId(pDri1) );
199 Abc_InfoSetBit(
p->pCexComb->pData, Gia_ObjCioId(pDri2) );
203 if ( Gia_ManAndNum(
p) == 0 )
207 Abc_Print( 1,
"Networks are equivalent. " );
208 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
231 abctime clkStart = Abc_Clock();
232 int nPairs = Gia_ManPoNum(
p)/2;
233 int nUnsats = 0, nSats = 0, nUndecs = 0, nTrivs = 0;
234 int i, iVar0, iVar1, pLits[2], status, RetValue;
236 assert( Gia_ManPoNum(
p) % 2 == 0 );
237 for ( i = 0; i < nPairs; i++ )
239 if ( (i & 0xFF) == 0 )
240 Extra_ProgressBarUpdate( pProgress, i, NULL );
241 pObj0 = Gia_ManPo(
p, 2*i);
242 pObj1 = Gia_ManPo(
p, 2*i+1);
243 if ( Gia_ObjChild0(pObj0) == Gia_ObjChild0(pObj1) )
249 if ( pPars->
TimeLimit && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= pPars->
TimeLimit )
251 printf(
"Timeout (%d sec) is reached.\n", pPars->
TimeLimit );
252 nUndecs = nPairs - nUnsats - nSats;
255 iVar0 = pCnf->
pVarNums[ Gia_ObjId(
p, pObj0) ];
256 iVar1 = pCnf->
pVarNums[ Gia_ObjId(
p, pObj1) ];
257 assert( iVar0 >= 0 && iVar1 >= 0 );
258 pLits[0] = Abc_Var2Lit( iVar0, 0 );
259 pLits[1] = Abc_Var2Lit( iVar1, 0 );
261 pLits[0] = lit_neg(pLits[0]);
265 pLits[0] = lit_neg( pLits[0] );
266 pLits[1] = lit_neg( pLits[1] );
270 else if ( status ==
l_True )
272 printf(
"Output %d is SAT.\n", i );
285 pLits[0] = lit_neg( pLits[0] );
286 pLits[1] = lit_neg( pLits[1] );
290 else if ( status ==
l_True )
292 printf(
"Output %d is SAT.\n", i );
304 printf(
"UNSAT = %6d. SAT = %6d. UNDEC = %6d. Trivial = %6d. ", nUnsats, nSats, nUndecs, nTrivs );
305 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkStart );
328 int fDumpUndecided = 0;
333 abctime clkTotal = Abc_Clock();
339 if ( RetValue == 0 || RetValue == 1 )
354 p->vSimsPi = Vec_WrdDup(pInit->
vSimsPi);
369 pInit->
pCexComb =
p->pCexComb;
p->pCexComb = NULL;
375 if (
p->pCexComb != NULL )
378 Abc_Print( 1,
"Counter-example simulation has failed.\n" );
381 Abc_Print( 1,
"Networks are NOT EQUIVALENT. " );
382 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
394 Abc_Print( 1,
"Networks are UNDECIDED after the new CEC engine. " );
395 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
397 if ( fDumpUndecided )
402 Abc_Print( 1,
"The result is written into file \"%s\".\n",
"gia_cec_undecided.aig" );
404 if ( pPars->
TimeLimit && (Abc_Clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->
TimeLimit )
411 Abc_Print( 1,
"Calling the old CEC engine.\n" );
416 Abc_Print( 1,
"Counter-example simulation has failed.\n" );
437 assert( Gia_ManCoNum(
p) == 2 );
438 assert( Gia_ManRegNum(
p) == 0 );
461 if ( pMiter == NULL )
476 if ( pMiter == NULL )
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Aig_Man_t * Cec_LatchCorrespondence(Aig_Man_t *pAig, int nConfs, int fUseCSat)
int Cec_ManVerify(Gia_Man_t *pInit, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
ABC_NAMESPACE_IMPL_START void Cec_ManTransformPattern(Gia_Man_t *p, int iOut, int *pValues)
DECLARATIONS ///.
int Cec_ManVerifyTwoAigs(Aig_Man_t *pAig0, Aig_Man_t *pAig1, int fVerbose)
int Cec_ManVerifyNaive(Gia_Man_t *p, Cec_ParCec_t *pPars)
int Cec_ManVerifyTwoInv(Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
Aig_Man_t * Cec_SignalCorrespondence(Aig_Man_t *pAig, int nConfs, int fUseCSat)
int Cec_ManVerifySimple(Gia_Man_t *p)
Aig_Man_t * Cec_FraigCombinational(Aig_Man_t *pAig, int nConfs, int fVerbose)
int Cec_ManHandleSpecialCases(Gia_Man_t *p, Cec_ParCec_t *pPars)
int Cec_ManVerifyTwo(Gia_Man_t *p0, Gia_Man_t *p1, int fVerbose)
int Cec_ManVerifyOld(Gia_Man_t *pMiter, int fVerbose, int *piOutFail, abctime clkTotal, int fSilent)
#define sat_solver_addclause
struct Cec_ParFra_t_ Cec_ParFra_t
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
void Cec_ManFraSetDefaultParams(Cec_ParFra_t *p)
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Gia_Man_t * Cec_ManSatSweeping(Gia_Man_t *pAig, Cec_ParFra_t *pPars, int fSilent)
struct Cec_ParCec_t_ Cec_ParCec_t
struct Cec_ParCor_t_ Cec_ParCor_t
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
int Fra_FraigCec(Aig_Man_t **ppAig, int nConfLimit, int fVerbose)
void Gia_ManReprToAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
void Gia_ManEquivFixOutputPairs(Gia_Man_t *p)
#define Gia_ManForEachPo(p, pObj, i)
Gia_Man_t * Gia_ManTransformMiter(Gia_Man_t *p)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
int Gia_ManVerifyCex(Gia_Man_t *pAig, Abc_Cex_t *p, int fDualOut)
DECLARATIONS ///.
Gia_Man_t * Gia_ManMiterInverse(Gia_Man_t *pBot, Gia_Man_t *pTop, int fDualOut, int fVerbose)
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
void Gia_ManSetPhase(Gia_Man_t *p)
void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
int Ssw_SecCexResimulate(Aig_Man_t *p, int *pModel, int *pnOutputs)
void sat_solver_delete(sat_solver *s)
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.