67 printf(
"Miter computation has failed.\n" );
73 printf(
"Networks are NOT EQUIVALENT after structural hashing.\n" );
84 printf(
"Networks are equivalent after structural hashing.\n" );
93 printf(
"Renoding for CNF has failed.\n" );
98 RetValue =
Abc_NtkMiterSat( pCnf, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, 0, NULL, NULL );
100 printf(
"Networks are undecided (SAT solver timed out).\n" );
101 else if ( RetValue == 0 )
102 printf(
"Networks are NOT EQUIVALENT after SAT.\n" );
104 printf(
"Networks are equivalent after SAT.\n" );
133 if ( pNtk1->
pExdc != NULL || pNtk2->
pExdc != NULL )
135 if ( pNtk1->
pExdc != NULL && pNtk2->
pExdc != NULL )
137 printf(
"Comparing EXDC of the two networks:\n" );
139 printf(
"Comparing networks under EXDC of the first network.\n" );
140 pExdc = pNtk1->
pExdc;
142 else if ( pNtk1->
pExdc != NULL )
144 printf(
"Second network has no EXDC. Comparing main networks under EXDC of the first network.\n" );
145 pExdc = pNtk1->
pExdc;
147 else if ( pNtk2->
pExdc != NULL )
149 printf(
"First network has no EXDC. Comparing main networks under EXDC of the second network.\n" );
150 pExdc = pNtk2->
pExdc;
157 if ( pMiter == NULL )
159 printf(
"Miter computation has failed.\n" );
165 assert( Abc_NtkPoNum(pMiter) == 1 );
166 assert( Abc_NtkPoNum(pExdc) == 1 );
167 pMiter =
Abc_NtkMiter( pTemp = pMiter, pExdc, 1, 0, 1, 0 );
174 printf(
"Networks are NOT EQUIVALENT after structural hashing. " );
180 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
185 printf(
"Networks are equivalent after structural hashing. " );
187 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
225 if ( RetValue == -1 )
226 printf(
"Networks are undecided (resource limits is reached). " );
227 else if ( RetValue == 0 )
230 if ( pSimInfo[0] != 1 )
231 printf(
"ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
233 printf(
"Networks are NOT EQUIVALENT. " );
237 printf(
"Networks are equivalent. " );
238 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
260 int i, RetValue, Status, nOutputs;
270 pMiter =
Abc_NtkMiter( pNtk1, pNtk2, 1, nPartSize, 0, 0 );
271 if ( pMiter == NULL )
273 printf(
"Miter computation has failed.\n" );
279 printf(
"Networks are NOT EQUIVALENT after structural hashing.\n" );
289 printf(
"Networks are equivalent after structural hashing.\n" );
303 if ( Abc_ObjFaninC0(pObj) )
313 if ( Abc_ObjFaninC0(pObj) )
314 Abc_ObjXorFaninC( Abc_NtkPo(pMiterPart,0), 0 );
320 if ( RetValue == -1 )
322 printf(
"Networks are undecided (resource limits is reached).\r" );
325 else if ( RetValue == 0 )
329 printf(
"ERROR: Failed to create cone for output %d.\n", i);
334 if ( pSimInfo[0] != 1 )
335 printf(
"ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
337 printf(
"Networks are NOT EQUIVALENT. \n" );
344 printf(
"Finished part %5d (out of %5d)\r", i+1, Abc_NtkPoNum(pMiter) );
345 nOutputs += nPartSize;
356 printf(
"Networks are equivalent. \n" );
357 else if ( Status == -1 )
358 printf(
"Timed out after verifying %d outputs (out of %d).\n", nOutputs, Abc_NtkCoNum(pNtk1) );
382 int i, RetValue, Status, nOutputs;
391 if ( pMiter == NULL )
393 printf(
"Miter computation has failed.\n" );
399 printf(
"Networks are NOT EQUIVALENT after structural hashing.\n" );
409 printf(
"Networks are equivalent after structural hashing.\n" );
422 vOnePtr = Vec_PtrAlloc( 1000 );
433 printf(
"Networks are NOT EQUIVALENT after partitioning.\n" );
442 printf(
"Verifying part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
443 i+1, Vec_PtrSize(vParts), Abc_NtkPiNum(pMiterPart), Abc_NtkPoNum(pMiterPart),
448 if ( RetValue == -1 )
450 printf(
"Networks are undecided (resource limits is reached).\r" );
453 else if ( RetValue == 0 )
456 if ( pSimInfo[0] != 1 )
457 printf(
"ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
459 printf(
"Networks are NOT EQUIVALENT. \n" );
468 nOutputs += Vec_IntSize(vOne);
474 Vec_PtrFree( vOnePtr );
479 printf(
"Networks are equivalent. \n" );
480 else if ( Status == -1 )
481 printf(
"Timed out after verifying %d outputs (out of %d).\n", nOutputs, Abc_NtkCoNum(pNtk1) );
506 if ( pMiter == NULL )
508 printf(
"Miter computation has failed.\n" );
515 printf(
"Networks are NOT EQUIVALENT after structural hashing.\n" );
521 printf(
"Networks are equivalent after structural hashing.\n" );
528 if ( pFrames == NULL )
530 printf(
"Frames computation has failed.\n" );
537 printf(
"Networks are NOT EQUIVALENT after framing.\n" );
543 printf(
"Networks are equivalent after framing.\n" );
552 printf(
"Renoding for CNF has failed.\n" );
557 RetValue =
Abc_NtkMiterSat( pCnf, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, 0, NULL, NULL );
558 if ( RetValue == -1 )
559 printf(
"Networks are undecided (SAT solver timed out).\n" );
560 else if ( RetValue == 0 )
561 printf(
"Networks are NOT EQUIVALENT after SAT.\n" );
563 printf(
"Networks are equivalent after SAT.\n" );
588 if ( pMiter == NULL )
590 printf(
"Miter computation has failed.\n" );
596 printf(
"Networks are NOT EQUIVALENT after structural hashing.\n" );
607 printf(
"Networks are equivalent after structural hashing.\n" );
614 if ( pFrames == NULL )
616 printf(
"Frames computation has failed.\n" );
622 printf(
"Networks are NOT EQUIVALENT after framing.\n" );
633 printf(
"Networks are equivalent after framing.\n" );
650 if ( RetValue == -1 )
651 printf(
"Networks are undecided (SAT solver timed out on the final miter).\n" );
652 else if ( RetValue == 1 )
653 printf(
"Networks are equivalent after fraiging.\n" );
654 else if ( RetValue == 0 )
656 printf(
"Networks are NOT EQUIVALENT after fraiging.\n" );
664 return RetValue == 1;
680 int * pModel =
ABC_ALLOC(
int, Abc_NtkCiNum(pNtk) * nFrames );
681 memset( pModel, 0,
sizeof(
int) * Abc_NtkCiNum(pNtk) * nFrames );
699 int * pValues, Value0, Value1, i;
701 if ( !Abc_NtkIsStrash(pNtk) )
713 Abc_NtkIncrementTravId( pNtk );
721 Value0 = ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pNode)->pCopy) ^ (
int)Abc_ObjFaninC0(pNode);
722 Value1 = ((int)(ABC_PTRINT_T)Abc_ObjFanin1(pNode)->pCopy) ^ (
int)Abc_ObjFaninC1(pNode);
726 pValues =
ABC_ALLOC(
int, Abc_NtkCoNum(pNtk) );
728 pValues[i] = ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pNode)->pCopy) ^ (
int)Abc_ObjFaninC0(pNode);
750 int * pValues1, * pValues2;
751 int nErrors, nPrinted, i, iNode = -1;
753 assert( Abc_NtkCiNum(pNtk1) == Abc_NtkCiNum(pNtk2) );
754 assert( Abc_NtkCoNum(pNtk1) == Abc_NtkCoNum(pNtk2) );
760 for ( i = 0; i < Abc_NtkCoNum(pNtk1); i++ )
761 nErrors += (
int)( pValues1[i] != pValues2[i] );
762 printf(
"Verification failed for at least %d outputs: ", nErrors );
765 for ( i = 0; i < Abc_NtkCoNum(pNtk1); i++ )
766 if ( pValues1[i] != pValues2[i] )
771 if ( ++nPrinted == 3 )
774 if ( nPrinted != nErrors )
780 printf(
"Output %s: Value in Network1 = %d. Value in Network2 = %d.\n",
781 Abc_ObjName(Abc_NtkCo(pNtk1,iNode)), pValues1[iNode], pValues2[iNode] );
782 printf(
"Input pattern: " );
784 pNode = Abc_NtkCo(pNtk1,iNode);
790 if ( Vec_PtrSize(vNodes) )
792 pNode = (
Abc_Obj_t *)Vec_PtrEntry( vNodes, 0 );
793 if ( Abc_ObjIsCi(pNode) )
797 assert( Abc_ObjIsCi(pNode) );
798 printf(
" %s=%d",
Abc_ObjName(pNode), pModel[(
int)(ABC_PTRINT_T)pNode->
pCopy] );
803 Vec_PtrFree( vNodes );
832 pNodePo = Abc_NtkPo( pFrames, iFrame * Abc_NtkPoNum(pNtk) + iNumPo );
844 if ( Abc_NtkBox(pFrames, i)->pCopy )
847 for ( k = 0; k <= iFrame; k++ )
848 if ( Abc_NtkPi(pFrames, k*Abc_NtkPiNum(pNtk) + i)->pCopy )
851 Vec_PtrFree( vSupp );
869 Abc_Obj_t * pObj, * pObjError, * pObj1, * pObj2;
870 int ValueError1 = -1, ValueError2 = -1;
871 unsigned * pPats1, * pPats2;
872 int i, o, k, nErrors, iFrameError = -1, iNodePo = -1, nPrinted;
873 int fRemove1 = 0, fRemove2 = 0;
875 if ( !Abc_NtkIsStrash(pNtk1) )
877 if ( !Abc_NtkIsStrash(pNtk2) )
887 for ( i = 0; i < nFrames; i++ )
893 pObj2 = Abc_NtkPo( pNtk2, o );
896 if ( pPats1[i] == pPats2[i] )
899 if ( pObjError == NULL )
904 ValueError1 = (pPats1[i] > 0);
905 ValueError2 = (pPats2[i] > 0);
910 if ( pObjError == NULL )
912 printf(
"No output mismatches detected.\n" );
920 printf(
"Verification failed for at least %d output%s of frame %d: ", nErrors, (nErrors>1?
"s":
""), iFrameError+1 );
925 pObj2 = Abc_NtkPo( pNtk2, o );
928 if ( pPats1[iFrameError] == pPats2[iFrameError] )
931 if ( ++nPrinted == 3 )
934 if ( nPrinted != nErrors )
943 printf(
"Output %s: Value in Network1 = %d. Value in Network2 = %d.\n",
944 Abc_ObjName(pObjError), ValueError1, ValueError2 );
946 printf(
"The cone of influence of output %s in Network1:\n",
Abc_ObjName(pObjError) );
952 printf(
"Latches: " );
958 printf(
"The cone of influence of output %s in Network2:\n",
Abc_ObjName(pObjError) );
964 printf(
"Latches: " );
971 for ( i = 0; i <= iFrameError; i++ )
973 printf(
"Frame %d: ", i+1 );
1031 int * pModel1, * pModel2, * pResult1, * pResult2;
1032 char * vPiValues1 =
"01001011100000000011010110101000000";
1033 char * vPiValues2 =
"11001101011101011111110100100010001";
1035 assert(
strlen(vPiValues1) == (
unsigned)Abc_NtkPiNum(pNtk) );
1036 assert( 1 == Abc_NtkPoNum(pNtk) );
1038 pModel1 =
ABC_ALLOC(
int, Abc_NtkCiNum(pNtk) );
1040 pModel1[i] = vPiValues1[i] -
'0';
1042 pModel1[Abc_NtkPiNum(pNtk)+i] = ((int)(ABC_PTRINT_T)pObj->
pData) - 1;
1045 printf(
"Value = %d\n", pResult1[0] );
1047 pModel2 =
ABC_ALLOC(
int, Abc_NtkCiNum(pNtk) );
1049 pModel2[i] = vPiValues2[i] -
'0';
1051 pModel2[Abc_NtkPiNum(pNtk)+i] = pResult1[Abc_NtkPoNum(pNtk)+i];
1054 printf(
"Value = %d\n", pResult2[0] );
1078 int status = 0, fStrashed = 0;
1079 if ( !Abc_NtkIsStrash(pNtk) )
1108 return Abc_NtkPiNum(pNtk) == pCex->nPis;
void Abc_NtkVerifyReportError(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int *pModel, Vec_Int_t *mismatch)
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkMulti(Abc_Ntk_t *pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor)
DECLARATIONS ///.
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
int * Abc_NtkVerifySimulatePattern(Abc_Ntk_t *pNtk, int *pModel)
int Abc_NtkSecFraig(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int nFrames, int fVerbose)
int Abc_NtkIsValidCex(Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
void Abc_NtkSecSat(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConfLimit, int nInsLimit, int nFrames)
void Abc_NtkVerifyReportErrorSeq(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int *pModel, int nFrames)
int Abc_NtkIsTrueCex(Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
void Abc_NtkGetSeqPoSupp(Abc_Ntk_t *pNtk, int iFrame, int iNumPo)
void Abc_NtkCecFraig(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int fVerbose)
void Abc_NtkSimulteBuggyMiter(Abc_Ntk_t *pNtk)
void Abc_NtkCecFraigPart(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int nPartSize, int fVerbose)
void Abc_NtkCecFraigPartAuto(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int fVerbose)
int * Abc_NtkVerifyGetCleanModel(Abc_Ntk_t *pNtk, int nFrames)
void Abc_NtkCecSat(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConfLimit, int nInsLimit)
FUNCTION DEFINITIONS ///.
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL int Abc_NtkIvyProve(Abc_Ntk_t **ppNtk, void *pPars)
ABC_DLL int Abc_NtkCombinePos(Abc_Ntk_t *pNtk, int fAnd, int fXor)
ABC_DLL Abc_Ntk_t * Abc_NtkCreateCone(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
#define Abc_NtkForEachPo(pNtk, pPo, i)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
ABC_DLL int Abc_NtkMiterSat(Abc_Ntk_t *pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
FUNCTION DEFINITIONS ///.
ABC_DLL Abc_Ntk_t * Abc_NtkMiter(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
FUNCTION DEFINITIONS ///.
#define Abc_NtkForEachPi(pNtk, pPi, i)
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCi(pNtk, pCi, i)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
ABC_DLL Abc_Ntk_t * Abc_NtkFrames(Abc_Ntk_t *pNtk, int nFrames, int fInitial, int fVerbose)
ABC_DLL void * Abc_NtkToFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkMiterIsConstant(Abc_Ntk_t *pMiter)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
void Fraig_ManProveMiter(Fraig_Man_t *p)
void Fraig_ManFree(Fraig_Man_t *pMan)
int Fraig_ManCheckMiter(Fraig_Man_t *p)
void Prove_ParamsSetDefault(Prove_Params_t *pParams)
FUNCTION DEFINITIONS ///.
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
struct Fraig_ParamsStruct_t_ Fraig_Params_t
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
struct Prove_ParamsStruct_t_ Prove_Params_t
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
void Sim_UtilInfoFree(Vec_Ptr_t *p)
Vec_Ptr_t * Sim_SimulateSeqModel(Abc_Ntk_t *pNtk, int nFrames, int *pModel)
#define Sim_SimInfoGet(vInfo, pNode)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.