ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcVerify.c File Reference
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "base/cmd/cmd.h"
#include "proof/fraig/fraig.h"
#include "opt/sim/sim.h"
#include "aig/aig/aig.h"
#include "aig/saig/saig.h"
#include "aig/gia/gia.h"
#include "proof/ssw/ssw.h"
Include dependency graph for abcVerify.c:

Go to the source code of this file.

Functions

void Abc_NtkVerifyReportErrorSeq (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int *pModel, int nFrames)
 
void Abc_NtkCecSat (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConfLimit, int nInsLimit)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkCecFraig (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int fVerbose)
 
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)
 
void Abc_NtkSecSat (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConfLimit, int nInsLimit, int nFrames)
 
int Abc_NtkSecFraig (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int nFrames, int fVerbose)
 
int * Abc_NtkVerifyGetCleanModel (Abc_Ntk_t *pNtk, int nFrames)
 
int * Abc_NtkVerifySimulatePattern (Abc_Ntk_t *pNtk, int *pModel)
 
void Abc_NtkGetSeqPoSupp (Abc_Ntk_t *pNtk, int iFrame, int iNumPo)
 
void Abc_NtkSimulteBuggyMiter (Abc_Ntk_t *pNtk)
 
int Abc_NtkIsTrueCex (Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
 
int Abc_NtkIsValidCex (Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
 

Function Documentation

◆ Abc_NtkCecFraig()

void Abc_NtkCecFraig ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nSeconds,
int fVerbose )

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

Synopsis [Verifies sequential equivalence by fraiging followed by SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file abcVerify.c.

124{
125 abctime clk = Abc_Clock();
126 Prove_Params_t Params, * pParams = &Params;
127// Fraig_Params_t Params;
128// Fraig_Man_t * pMan;
129 Abc_Ntk_t * pMiter, * pTemp;
130 Abc_Ntk_t * pExdc = NULL;
131 int RetValue;
132
133 if ( pNtk1->pExdc != NULL || pNtk2->pExdc != NULL )
134 {
135 if ( pNtk1->pExdc != NULL && pNtk2->pExdc != NULL )
136 {
137 printf( "Comparing EXDC of the two networks:\n" );
138 Abc_NtkCecFraig( pNtk1->pExdc, pNtk2->pExdc, nSeconds, fVerbose );
139 printf( "Comparing networks under EXDC of the first network.\n" );
140 pExdc = pNtk1->pExdc;
141 }
142 else if ( pNtk1->pExdc != NULL )
143 {
144 printf( "Second network has no EXDC. Comparing main networks under EXDC of the first network.\n" );
145 pExdc = pNtk1->pExdc;
146 }
147 else if ( pNtk2->pExdc != NULL )
148 {
149 printf( "First network has no EXDC. Comparing main networks under EXDC of the second network.\n" );
150 pExdc = pNtk2->pExdc;
151 }
152 else assert( 0 );
153 }
154
155 // get the miter of the two networks
156 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0, 0 );
157 if ( pMiter == NULL )
158 {
159 printf( "Miter computation has failed.\n" );
160 return;
161 }
162 // add EXDC to the miter
163 if ( pExdc )
164 {
165 assert( Abc_NtkPoNum(pMiter) == 1 );
166 assert( Abc_NtkPoNum(pExdc) == 1 );
167 pMiter = Abc_NtkMiter( pTemp = pMiter, pExdc, 1, 0, 1, 0 );
168 Abc_NtkDelete( pTemp );
169 }
170 // handle trivial case
171 RetValue = Abc_NtkMiterIsConstant( pMiter );
172 if ( RetValue == 0 )
173 {
174 printf( "Networks are NOT EQUIVALENT after structural hashing. " );
175 // report the error
176 pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, 1 );
177 Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
178 ABC_FREE( pMiter->pModel );
179 Abc_NtkDelete( pMiter );
180 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
181 return;
182 }
183 if ( RetValue == 1 )
184 {
185 printf( "Networks are equivalent after structural hashing. " );
186 Abc_NtkDelete( pMiter );
187 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
188 return;
189 }
190/*
191 // convert the miter into a FRAIG
192 Fraig_ParamsSetDefault( &Params );
193 Params.fVerbose = fVerbose;
194 Params.nSeconds = nSeconds;
195// Params.fFuncRed = 0;
196// Params.nPatsRand = 0;
197// Params.nPatsDyna = 0;
198 pMan = (Fraig_Man_t *)Abc_NtkToFraig( pMiter, &Params, 0, 0 );
199 Fraig_ManProveMiter( pMan );
200
201 // analyze the result
202 RetValue = Fraig_ManCheckMiter( pMan );
203 // report the result
204 if ( RetValue == -1 )
205 printf( "Networks are undecided (SAT solver timed out on the final miter).\n" );
206 else if ( RetValue == 1 )
207 printf( "Networks are equivalent after fraiging.\n" );
208 else if ( RetValue == 0 )
209 {
210 printf( "Networks are NOT EQUIVALENT after fraiging.\n" );
211 Abc_NtkVerifyReportError( pNtk1, pNtk2, Fraig_ManReadModel(pMan) );
212 }
213 else assert( 0 );
214 // delete the fraig manager
215 Fraig_ManFree( pMan );
216 // delete the miter
217 Abc_NtkDelete( pMiter );
218*/
219 // solve the CNF using the SAT solver
220 Prove_ParamsSetDefault( pParams );
221 pParams->nItersMax = 5;
222// RetValue = Abc_NtkMiterProve( &pMiter, pParams );
223// pParams->fVerbose = 1;
224 RetValue = Abc_NtkIvyProve( &pMiter, pParams );
225 if ( RetValue == -1 )
226 printf( "Networks are undecided (resource limits is reached). " );
227 else if ( RetValue == 0 )
228 {
229 int * pSimInfo = Abc_NtkVerifySimulatePattern( pMiter, pMiter->pModel );
230 if ( pSimInfo[0] != 1 )
231 printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
232 else
233 printf( "Networks are NOT EQUIVALENT. " );
234 ABC_FREE( pSimInfo );
235 }
236 else
237 printf( "Networks are equivalent. " );
238 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
239 if ( pMiter->pModel )
240 Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
241 Abc_NtkDelete( pMiter );
242}
void Abc_NtkVerifyReportError(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int *pModel, Vec_Int_t *mismatch)
Definition abcBm.c:810
int * Abc_NtkVerifySimulatePattern(Abc_Ntk_t *pNtk, int *pModel)
Definition abcVerify.c:696
void Abc_NtkCecFraig(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nSeconds, int fVerbose)
Definition abcVerify.c:123
int * Abc_NtkVerifyGetCleanModel(Abc_Ntk_t *pNtk, int nFrames)
Definition abcVerify.c:678
ABC_DLL int Abc_NtkIvyProve(Abc_Ntk_t **ppNtk, void *pPars)
Definition abcIvy.c:503
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
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 ///.
Definition abcMiter.c:59
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL int Abc_NtkMiterIsConstant(Abc_Ntk_t *pMiter)
Definition abcMiter.c:682
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_FREE(obj)
Definition abc_global.h:267
void Prove_ParamsSetDefault(Prove_Params_t *pParams)
FUNCTION DEFINITIONS ///.
Definition fraigMan.c:46
struct Prove_ParamsStruct_t_ Prove_Params_t
Definition ivyFraig.c:108
Abc_Ntk_t * pExdc
Definition abc.h:201
int * pModel
Definition abc.h:198
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCecFraigPart()

void Abc_NtkCecFraigPart ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nSeconds,
int nPartSize,
int fVerbose )

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

Synopsis [Verifies sequential equivalence by fraiging followed by SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file abcVerify.c.

256{
257 Prove_Params_t Params, * pParams = &Params;
258 Abc_Ntk_t * pMiter, * pMiterPart;
259 Abc_Obj_t * pObj;
260 int i, RetValue, Status, nOutputs;
261
262 // solve the CNF using the SAT solver
263 Prove_ParamsSetDefault( pParams );
264 pParams->nItersMax = 5;
265 // pParams->fVerbose = 1;
266
267 assert( nPartSize > 0 );
268
269 // get the miter of the two networks
270 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, nPartSize, 0, 0 );
271 if ( pMiter == NULL )
272 {
273 printf( "Miter computation has failed.\n" );
274 return;
275 }
276 RetValue = Abc_NtkMiterIsConstant( pMiter );
277 if ( RetValue == 0 )
278 {
279 printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
280 // report the error
281 pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, 1 );
282 Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
283 ABC_FREE( pMiter->pModel );
284 Abc_NtkDelete( pMiter );
285 return;
286 }
287 if ( RetValue == 1 )
288 {
289 printf( "Networks are equivalent after structural hashing.\n" );
290 Abc_NtkDelete( pMiter );
291 return;
292 }
293
294 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
295
296 // solve the problem iteratively for each output of the miter
297 Status = 1;
298 nOutputs = 0;
299 Abc_NtkForEachPo( pMiter, pObj, i )
300 {
301 if ( Abc_ObjFanin0(pObj) == Abc_AigConst1(pMiter) )
302 {
303 if ( Abc_ObjFaninC0(pObj) ) // complemented -> const 0
304 RetValue = 1;
305 else
306 RetValue = 0;
307 pMiterPart = NULL;
308 }
309 else
310 {
311 // get the cone of this output
312 pMiterPart = Abc_NtkCreateCone( pMiter, Abc_ObjFanin0(pObj), Abc_ObjName(pObj), 0 );
313 if ( Abc_ObjFaninC0(pObj) )
314 Abc_ObjXorFaninC( Abc_NtkPo(pMiterPart,0), 0 );
315 // solve the cone
316 // RetValue = Abc_NtkMiterProve( &pMiterPart, pParams );
317 RetValue = Abc_NtkIvyProve( &pMiterPart, pParams );
318 }
319
320 if ( RetValue == -1 )
321 {
322 printf( "Networks are undecided (resource limits is reached).\r" );
323 Status = -1;
324 }
325 else if ( RetValue == 0 )
326 {
327 if(!pMiterPart)
328 {
329 printf("ERROR: Failed to create cone for output %d.\n", i);
330 Status = -1;
331 break;
332 }
333 int * pSimInfo = Abc_NtkVerifySimulatePattern( pMiterPart, pMiterPart->pModel );
334 if ( pSimInfo[0] != 1 )
335 printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
336 else
337 printf( "Networks are NOT EQUIVALENT. \n" );
338 ABC_FREE( pSimInfo );
339 Status = 0;
340 break;
341 }
342 else
343 {
344 printf( "Finished part %5d (out of %5d)\r", i+1, Abc_NtkPoNum(pMiter) );
345 nOutputs += nPartSize;
346 }
347// if ( pMiter->pModel )
348// Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
349 if ( pMiterPart )
350 Abc_NtkDelete( pMiterPart );
351 }
352
353 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
354
355 if ( Status == 1 )
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) );
359 Abc_NtkDelete( pMiter );
360}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL Abc_Ntk_t * Abc_NtkCreateCone(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
Definition abcNtk.c:925
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
Here is the call graph for this function:

◆ Abc_NtkCecFraigPartAuto()

void Abc_NtkCecFraigPartAuto ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nSeconds,
int fVerbose )

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

Synopsis [Verifies sequential equivalence by fraiging followed by SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file abcVerify.c.

374{
375 extern Vec_Ptr_t * Abc_NtkPartitionSmart( Abc_Ntk_t * pNtk, int nPartSizeLimit, int fVerbose );
376 extern void Abc_NtkConvertCos( Abc_Ntk_t * pNtk, Vec_Int_t * vOuts, Vec_Ptr_t * vOnePtr );
377
378 Vec_Ptr_t * vParts, * vOnePtr;
379 Vec_Int_t * vOne;
380 Prove_Params_t Params, * pParams = &Params;
381 Abc_Ntk_t * pMiter, * pMiterPart;
382 int i, RetValue, Status, nOutputs;
383
384 // solve the CNF using the SAT solver
385 Prove_ParamsSetDefault( pParams );
386 pParams->nItersMax = 5;
387 // pParams->fVerbose = 1;
388
389 // get the miter of the two networks
390 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 1, 0, 0 );
391 if ( pMiter == NULL )
392 {
393 printf( "Miter computation has failed.\n" );
394 return;
395 }
396 RetValue = Abc_NtkMiterIsConstant( pMiter );
397 if ( RetValue == 0 )
398 {
399 printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
400 // report the error
401 pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, 1 );
402 Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
403 ABC_FREE( pMiter->pModel );
404 Abc_NtkDelete( pMiter );
405 return;
406 }
407 if ( RetValue == 1 )
408 {
409 printf( "Networks are equivalent after structural hashing.\n" );
410 Abc_NtkDelete( pMiter );
411 return;
412 }
413
414 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
415
416 // partition the outputs
417 vParts = Abc_NtkPartitionSmart( pMiter, 300, 0 );
418
419 // fraig each partition
420 Status = 1;
421 nOutputs = 0;
422 vOnePtr = Vec_PtrAlloc( 1000 );
423 Vec_PtrForEachEntry( Vec_Int_t *, vParts, vOne, i )
424 {
425 // get this part of the miter
426 Abc_NtkConvertCos( pMiter, vOne, vOnePtr );
427 pMiterPart = Abc_NtkCreateConeArray( pMiter, vOnePtr, 0 );
428 Abc_NtkCombinePos( pMiterPart, 0, 0 );
429 // check the miter for being constant
430 RetValue = Abc_NtkMiterIsConstant( pMiterPart );
431 if ( RetValue == 0 )
432 {
433 printf( "Networks are NOT EQUIVALENT after partitioning.\n" );
434 Abc_NtkDelete( pMiterPart );
435 break;
436 }
437 if ( RetValue == 1 )
438 {
439 Abc_NtkDelete( pMiterPart );
440 continue;
441 }
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),
444 Abc_NtkNodeNum(pMiterPart), Abc_AigLevel(pMiterPart) );
445 fflush( stdout );
446 // solve the problem
447 RetValue = Abc_NtkIvyProve( &pMiterPart, pParams );
448 if ( RetValue == -1 )
449 {
450 printf( "Networks are undecided (resource limits is reached).\r" );
451 Status = -1;
452 }
453 else if ( RetValue == 0 )
454 {
455 int * pSimInfo = Abc_NtkVerifySimulatePattern( pMiterPart, pMiterPart->pModel );
456 if ( pSimInfo[0] != 1 )
457 printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
458 else
459 printf( "Networks are NOT EQUIVALENT. \n" );
460 ABC_FREE( pSimInfo );
461 Status = 0;
462 Abc_NtkDelete( pMiterPart );
463 break;
464 }
465 else
466 {
467// printf( "Finished part %5d (out of %5d)\r", i+1, Vec_PtrSize(vParts) );
468 nOutputs += Vec_IntSize(vOne);
469 }
470 Abc_NtkDelete( pMiterPart );
471 }
472 printf( " \r" );
473 Vec_VecFree( (Vec_Vec_t *)vParts );
474 Vec_PtrFree( vOnePtr );
475
476 Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
477
478 if ( Status == 1 )
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) );
482 Abc_NtkDelete( pMiter );
483}
void Abc_NtkConvertCos(Abc_Ntk_t *pNtk, Vec_Int_t *vOuts, Vec_Ptr_t *vOutsPtr)
Definition abcPart.c:885
Vec_Ptr_t * Abc_NtkPartitionSmart(Abc_Ntk_t *pNtk, int nSuppSizeLimit, int fVerbose)
Definition abcPart.c:730
ABC_DLL int Abc_NtkCombinePos(Abc_Ntk_t *pNtk, int fAnd, int fXor)
Definition abcMiter.c:1155
ABC_DLL int Abc_AigLevel(Abc_Ntk_t *pNtk)
Definition abcAig.c:292
ABC_DLL Abc_Ntk_t * Abc_NtkCreateConeArray(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
Definition abcNtk.c:995
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:

◆ Abc_NtkCecSat()

void Abc_NtkCecSat ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nConfLimit,
int nInsLimit )

FUNCTION DEFINITIONS ///.

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

Synopsis [Verifies combinational equivalence by brute-force SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file abcVerify.c.

57{
58 extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
59 Abc_Ntk_t * pMiter;
60 Abc_Ntk_t * pCnf;
61 int RetValue;
62
63 // get the miter of the two networks
64 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0, 0 );
65 if ( pMiter == NULL )
66 {
67 printf( "Miter computation has failed.\n" );
68 return;
69 }
70 RetValue = Abc_NtkMiterIsConstant( pMiter );
71 if ( RetValue == 0 )
72 {
73 printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
74 // report the error
75 pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, 1 );
76 Abc_NtkVerifyReportError( pNtk1, pNtk2, pMiter->pModel );
77 ABC_FREE( pMiter->pModel );
78 Abc_NtkDelete( pMiter );
79 return;
80 }
81 if ( RetValue == 1 )
82 {
83 Abc_NtkDelete( pMiter );
84 printf( "Networks are equivalent after structural hashing.\n" );
85 return;
86 }
87
88 // convert the miter into a CNF
89 pCnf = Abc_NtkMulti( pMiter, 0, 100, 1, 0, 0, 0 );
90 Abc_NtkDelete( pMiter );
91 if ( pCnf == NULL )
92 {
93 printf( "Renoding for CNF has failed.\n" );
94 return;
95 }
96
97 // solve the CNF using the SAT solver
98 RetValue = Abc_NtkMiterSat( pCnf, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, 0, NULL, NULL );
99 if ( RetValue == -1 )
100 printf( "Networks are undecided (SAT solver timed out).\n" );
101 else if ( RetValue == 0 )
102 printf( "Networks are NOT EQUIVALENT after SAT.\n" );
103 else
104 printf( "Networks are equivalent after SAT.\n" );
105 if ( pCnf->pModel )
106 Abc_NtkVerifyReportError( pNtk1, pNtk2, pCnf->pModel );
107 ABC_FREE( pCnf->pModel );
108 Abc_NtkDelete( pCnf );
109}
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 ///.
Definition abcMulti.c:650
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 ///.
Definition abcSat.c:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkGetSeqPoSupp()

void Abc_NtkGetSeqPoSupp ( Abc_Ntk_t * pNtk,
int iFrame,
int iNumPo )

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

Synopsis [Computes the COs in the support of the PO in the given frame.]

Description []

SideEffects []

SeeAlso []

Definition at line 821 of file abcVerify.c.

822{
823 Abc_Ntk_t * pFrames;
824 Abc_Obj_t * pObj, * pNodePo;
825 Vec_Ptr_t * vSupp;
826 int i, k;
827 // get the timeframes of the network
828 pFrames = Abc_NtkFrames( pNtk, iFrame + 1, 0, 0 );
829//Abc_NtkShowAig( pFrames );
830
831 // get the PO of the timeframes
832 pNodePo = Abc_NtkPo( pFrames, iFrame * Abc_NtkPoNum(pNtk) + iNumPo );
833 // set the support
834 vSupp = Abc_NtkNodeSupport( pFrames, &pNodePo, 1 );
835 // mark the support of the frames
836 Abc_NtkForEachCi( pFrames, pObj, i )
837 pObj->pCopy = NULL;
838 Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
839 pObj->pCopy = (Abc_Obj_t *)1;
840 // mark the support of the network if the support of the timeframes is marked
841 Abc_NtkForEachCi( pNtk, pObj, i )
842 pObj->pCopy = NULL;
843 Abc_NtkForEachLatch( pNtk, pObj, i )
844 if ( Abc_NtkBox(pFrames, i)->pCopy )
845 pObj->pCopy = (Abc_Obj_t *)1;
846 Abc_NtkForEachPi( pNtk, pObj, i )
847 for ( k = 0; k <= iFrame; k++ )
848 if ( Abc_NtkPi(pFrames, k*Abc_NtkPiNum(pNtk) + i)->pCopy )
849 pObj->pCopy = (Abc_Obj_t *)1;
850 // free stuff
851 Vec_PtrFree( vSupp );
852 Abc_NtkDelete( pFrames );
853}
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition abcDfs.c:890
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL Abc_Ntk_t * Abc_NtkFrames(Abc_Ntk_t *pNtk, int nFrames, int fInitial, int fVerbose)
Definition abcMiter.c:775
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkIsTrueCex()

int Abc_NtkIsTrueCex ( Abc_Ntk_t * pNtk,
Abc_Cex_t * pCex )

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

Synopsis [Returns the PO values under the given input pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 1074 of file abcVerify.c.

1075{
1076 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
1077 Aig_Man_t * pMan;
1078 int status = 0, fStrashed = 0;
1079 if ( !Abc_NtkIsStrash(pNtk) )
1080 {
1081 pNtk = Abc_NtkStrash(pNtk, 0, 0, 0);
1082 fStrashed = 1;
1083 }
1084 pMan = Abc_NtkToDar( pNtk, 0, 1 );
1085 if ( pMan )
1086 {
1087 status = Saig_ManVerifyCex( pMan, pCex );
1088 Aig_ManStop( pMan );
1089 }
1090 if ( fStrashed )
1091 Abc_NtkDelete( pNtk );
1092 return status;
1093}
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:281
Here is the call graph for this function:

◆ Abc_NtkIsValidCex()

int Abc_NtkIsValidCex ( Abc_Ntk_t * pNtk,
Abc_Cex_t * pCex )

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

Synopsis [Returns 1 if the number of PIs matches.]

Description []

SideEffects []

SeeAlso []

Definition at line 1106 of file abcVerify.c.

1107{
1108 return Abc_NtkPiNum(pNtk) == pCex->nPis;
1109}

◆ Abc_NtkSecFraig()

int Abc_NtkSecFraig ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nSeconds,
int nFrames,
int fVerbose )

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

Synopsis [Verifies combinational equivalence by fraiging followed by SAT]

Description []

SideEffects []

SeeAlso []

Definition at line 578 of file abcVerify.c.

579{
580 Fraig_Params_t Params;
581 Fraig_Man_t * pMan;
582 Abc_Ntk_t * pMiter;
583 Abc_Ntk_t * pFrames;
584 int RetValue;
585
586 // get the miter of the two networks
587 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
588 if ( pMiter == NULL )
589 {
590 printf( "Miter computation has failed.\n" );
591 return 0;
592 }
593 RetValue = Abc_NtkMiterIsConstant( pMiter );
594 if ( RetValue == 0 )
595 {
596 printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
597 // report the error
598 pMiter->pModel = Abc_NtkVerifyGetCleanModel( pMiter, nFrames );
599 Abc_NtkVerifyReportErrorSeq( pNtk1, pNtk2, pMiter->pModel, nFrames );
600 ABC_FREE( pMiter->pModel );
601 Abc_NtkDelete( pMiter );
602 return 0;
603 }
604 if ( RetValue == 1 )
605 {
606 Abc_NtkDelete( pMiter );
607 printf( "Networks are equivalent after structural hashing.\n" );
608 return 1;
609 }
610
611 // create the timeframes
612 pFrames = Abc_NtkFrames( pMiter, nFrames, 1, 0 );
613 Abc_NtkDelete( pMiter );
614 if ( pFrames == NULL )
615 {
616 printf( "Frames computation has failed.\n" );
617 return 0;
618 }
619 RetValue = Abc_NtkMiterIsConstant( pFrames );
620 if ( RetValue == 0 )
621 {
622 printf( "Networks are NOT EQUIVALENT after framing.\n" );
623 // report the error
624 pFrames->pModel = Abc_NtkVerifyGetCleanModel( pFrames, 1 );
625// Abc_NtkVerifyReportErrorSeq( pNtk1, pNtk2, pFrames->pModel, nFrames );
626 ABC_FREE( pFrames->pModel );
627 Abc_NtkDelete( pFrames );
628 return 0;
629 }
630 if ( RetValue == 1 )
631 {
632 Abc_NtkDelete( pFrames );
633 printf( "Networks are equivalent after framing.\n" );
634 return 1;
635 }
636
637 // convert the miter into a FRAIG
638 Fraig_ParamsSetDefault( &Params );
639 Params.fVerbose = fVerbose;
640 Params.nSeconds = nSeconds;
641// Params.fFuncRed = 0;
642// Params.nPatsRand = 0;
643// Params.nPatsDyna = 0;
644 pMan = (Fraig_Man_t *)Abc_NtkToFraig( pFrames, &Params, 0, 0 );
645 Fraig_ManProveMiter( pMan );
646
647 // analyze the result
648 RetValue = Fraig_ManCheckMiter( pMan );
649 // report the result
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 )
655 {
656 printf( "Networks are NOT EQUIVALENT after fraiging.\n" );
657// Abc_NtkVerifyReportErrorSeq( pNtk1, pNtk2, Fraig_ManReadModel(pMan), nFrames );
658 }
659 else assert( 0 );
660 // delete the fraig manager
661 Fraig_ManFree( pMan );
662 // delete the miter
663 Abc_NtkDelete( pFrames );
664 return RetValue == 1;
665}
void Abc_NtkVerifyReportErrorSeq(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int *pModel, int nFrames)
Definition abcVerify.c:866
ABC_DLL void * Abc_NtkToFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
Definition abcFraig.c:103
void Fraig_ManProveMiter(Fraig_Man_t *p)
Definition fraigSat.c:85
void Fraig_ManFree(Fraig_Man_t *pMan)
Definition fraigMan.c:262
int Fraig_ManCheckMiter(Fraig_Man_t *p)
Definition fraigSat.c:130
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
Definition fraigMan.c:122
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
Definition fraig.h:40
struct Fraig_ParamsStruct_t_ Fraig_Params_t
Definition fraig.h:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkSecSat()

void Abc_NtkSecSat ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int nConfLimit,
int nInsLimit,
int nFrames )

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

Synopsis [Verifies sequential equivalence by brute-force SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 496 of file abcVerify.c.

497{
498 extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
499 Abc_Ntk_t * pMiter;
500 Abc_Ntk_t * pFrames;
501 Abc_Ntk_t * pCnf;
502 int RetValue;
503
504 // get the miter of the two networks
505 pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
506 if ( pMiter == NULL )
507 {
508 printf( "Miter computation has failed.\n" );
509 return;
510 }
511 RetValue = Abc_NtkMiterIsConstant( pMiter );
512 if ( RetValue == 0 )
513 {
514 Abc_NtkDelete( pMiter );
515 printf( "Networks are NOT EQUIVALENT after structural hashing.\n" );
516 return;
517 }
518 if ( RetValue == 1 )
519 {
520 Abc_NtkDelete( pMiter );
521 printf( "Networks are equivalent after structural hashing.\n" );
522 return;
523 }
524
525 // create the timeframes
526 pFrames = Abc_NtkFrames( pMiter, nFrames, 1, 0 );
527 Abc_NtkDelete( pMiter );
528 if ( pFrames == NULL )
529 {
530 printf( "Frames computation has failed.\n" );
531 return;
532 }
533 RetValue = Abc_NtkMiterIsConstant( pFrames );
534 if ( RetValue == 0 )
535 {
536 Abc_NtkDelete( pFrames );
537 printf( "Networks are NOT EQUIVALENT after framing.\n" );
538 return;
539 }
540 if ( RetValue == 1 )
541 {
542 Abc_NtkDelete( pFrames );
543 printf( "Networks are equivalent after framing.\n" );
544 return;
545 }
546
547 // convert the miter into a CNF
548 pCnf = Abc_NtkMulti( pFrames, 0, 100, 1, 0, 0, 0 );
549 Abc_NtkDelete( pFrames );
550 if ( pCnf == NULL )
551 {
552 printf( "Renoding for CNF has failed.\n" );
553 return;
554 }
555
556 // solve the CNF using the SAT solver
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" );
562 else
563 printf( "Networks are equivalent after SAT.\n" );
564 Abc_NtkDelete( pCnf );
565}
Here is the call graph for this function:

◆ Abc_NtkSimulteBuggyMiter()

void Abc_NtkSimulteBuggyMiter ( Abc_Ntk_t * pNtk)

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

Synopsis [Simulates buggy miter emailed by Mike.]

Description []

SideEffects []

SeeAlso []

Definition at line 1027 of file abcVerify.c.

1028{
1029 Abc_Obj_t * pObj;
1030 int i;
1031 int * pModel1, * pModel2, * pResult1, * pResult2;
1032 char * vPiValues1 = "01001011100000000011010110101000000";
1033 char * vPiValues2 = "11001101011101011111110100100010001";
1034
1035 assert( strlen(vPiValues1) == (unsigned)Abc_NtkPiNum(pNtk) );
1036 assert( 1 == Abc_NtkPoNum(pNtk) );
1037
1038 pModel1 = ABC_ALLOC( int, Abc_NtkCiNum(pNtk) );
1039 Abc_NtkForEachPi( pNtk, pObj, i )
1040 pModel1[i] = vPiValues1[i] - '0';
1041 Abc_NtkForEachLatch( pNtk, pObj, i )
1042 pModel1[Abc_NtkPiNum(pNtk)+i] = ((int)(ABC_PTRINT_T)pObj->pData) - 1;
1043
1044 pResult1 = Abc_NtkVerifySimulatePattern( pNtk, pModel1 );
1045 printf( "Value = %d\n", pResult1[0] );
1046
1047 pModel2 = ABC_ALLOC( int, Abc_NtkCiNum(pNtk) );
1048 Abc_NtkForEachPi( pNtk, pObj, i )
1049 pModel2[i] = vPiValues2[i] - '0';
1050 Abc_NtkForEachLatch( pNtk, pObj, i )
1051 pModel2[Abc_NtkPiNum(pNtk)+i] = pResult1[Abc_NtkPoNum(pNtk)+i];
1052
1053 pResult2 = Abc_NtkVerifySimulatePattern( pNtk, pModel2 );
1054 printf( "Value = %d\n", pResult2[0] );
1055
1056 ABC_FREE( pModel1 );
1057 ABC_FREE( pModel2 );
1058 ABC_FREE( pResult1 );
1059 ABC_FREE( pResult2 );
1060}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
void * pData
Definition abc.h:145
int strlen()
Here is the call graph for this function:

◆ Abc_NtkVerifyGetCleanModel()

int * Abc_NtkVerifyGetCleanModel ( Abc_Ntk_t * pNtk,
int nFrames )

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

Synopsis [Returns a dummy pattern full of zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 678 of file abcVerify.c.

679{
680 int * pModel = ABC_ALLOC( int, Abc_NtkCiNum(pNtk) * nFrames );
681 memset( pModel, 0, sizeof(int) * Abc_NtkCiNum(pNtk) * nFrames );
682 return pModel;
683}
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkVerifyReportErrorSeq()

void Abc_NtkVerifyReportErrorSeq ( Abc_Ntk_t * pNtk1,
Abc_Ntk_t * pNtk2,
int * pModel,
int nFrames )
extern

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

Synopsis [Reports mismatch between the two sequential networks.]

Description []

SideEffects []

SeeAlso []

Definition at line 866 of file abcVerify.c.

867{
868 Vec_Ptr_t * vInfo1, * vInfo2;
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;
874
875 if ( !Abc_NtkIsStrash(pNtk1) )
876 fRemove1 = 1, pNtk1 = Abc_NtkStrash( pNtk1, 0, 0, 0 );
877 if ( !Abc_NtkIsStrash(pNtk2) )
878 fRemove2 = 1, pNtk2 = Abc_NtkStrash( pNtk2, 0, 0, 0 );
879
880 // simulate sequential circuits
881 vInfo1 = Sim_SimulateSeqModel( pNtk1, nFrames, pModel );
882 vInfo2 = Sim_SimulateSeqModel( pNtk2, nFrames, pModel );
883
884 // look for a discrepancy in the PO values
885 nErrors = 0;
886 pObjError = NULL;
887 for ( i = 0; i < nFrames; i++ )
888 {
889 if ( pObjError )
890 break;
891 Abc_NtkForEachPo( pNtk1, pObj1, o )
892 {
893 pObj2 = Abc_NtkPo( pNtk2, o );
894 pPats1 = Sim_SimInfoGet(vInfo1, pObj1);
895 pPats2 = Sim_SimInfoGet(vInfo2, pObj2);
896 if ( pPats1[i] == pPats2[i] )
897 continue;
898 nErrors++;
899 if ( pObjError == NULL )
900 {
901 pObjError = pObj1;
902 iFrameError = i;
903 iNodePo = o;
904 ValueError1 = (pPats1[i] > 0);
905 ValueError2 = (pPats2[i] > 0);
906 }
907 }
908 }
909
910 if ( pObjError == NULL )
911 {
912 printf( "No output mismatches detected.\n" );
913 Sim_UtilInfoFree( vInfo1 );
914 Sim_UtilInfoFree( vInfo2 );
915 if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
916 if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
917 return;
918 }
919
920 printf( "Verification failed for at least %d output%s of frame %d: ", nErrors, (nErrors>1? "s":""), iFrameError+1 );
921 // print the first 3 outputs
922 nPrinted = 0;
923 Abc_NtkForEachPo( pNtk1, pObj1, o )
924 {
925 pObj2 = Abc_NtkPo( pNtk2, o );
926 pPats1 = Sim_SimInfoGet(vInfo1, pObj1);
927 pPats2 = Sim_SimInfoGet(vInfo2, pObj2);
928 if ( pPats1[iFrameError] == pPats2[iFrameError] )
929 continue;
930 printf( " %s", Abc_ObjName(pObj1) );
931 if ( ++nPrinted == 3 )
932 break;
933 }
934 if ( nPrinted != nErrors )
935 printf( " ..." );
936 printf( "\n" );
937
938 // mark CIs of the networks in the cone of influence of this output
939 Abc_NtkGetSeqPoSupp( pNtk1, iFrameError, iNodePo );
940 Abc_NtkGetSeqPoSupp( pNtk2, iFrameError, iNodePo );
941
942 // report mismatch for the first output
943 printf( "Output %s: Value in Network1 = %d. Value in Network2 = %d.\n",
944 Abc_ObjName(pObjError), ValueError1, ValueError2 );
945
946 printf( "The cone of influence of output %s in Network1:\n", Abc_ObjName(pObjError) );
947 printf( "PIs: " );
948 Abc_NtkForEachPi( pNtk1, pObj, i )
949 if ( pObj->pCopy )
950 printf( "%s ", Abc_ObjName(pObj) );
951 printf( "\n" );
952 printf( "Latches: " );
953 Abc_NtkForEachLatch( pNtk1, pObj, i )
954 if ( pObj->pCopy )
955 printf( "%s ", Abc_ObjName(pObj) );
956 printf( "\n" );
957
958 printf( "The cone of influence of output %s in Network2:\n", Abc_ObjName(pObjError) );
959 printf( "PIs: " );
960 Abc_NtkForEachPi( pNtk2, pObj, i )
961 if ( pObj->pCopy )
962 printf( "%s ", Abc_ObjName(pObj) );
963 printf( "\n" );
964 printf( "Latches: " );
965 Abc_NtkForEachLatch( pNtk2, pObj, i )
966 if ( pObj->pCopy )
967 printf( "%s ", Abc_ObjName(pObj) );
968 printf( "\n" );
969
970 // print the patterns
971 for ( i = 0; i <= iFrameError; i++ )
972 {
973 printf( "Frame %d: ", i+1 );
974
975 printf( "PI(1):" );
976 Abc_NtkForEachPi( pNtk1, pObj, k )
977 if ( pObj->pCopy )
978 printf( "%d", Sim_SimInfoGet(vInfo1, pObj)[i] > 0 );
979 printf( " " );
980 printf( "L(1):" );
981 Abc_NtkForEachLatch( pNtk1, pObj, k )
982 if ( pObj->pCopy )
983 printf( "%d", Sim_SimInfoGet(vInfo1, pObj)[i] > 0 );
984 printf( " " );
985 printf( "%s(1):", Abc_ObjName(pObjError) );
986 printf( "%d", Sim_SimInfoGet(vInfo1, pObjError)[i] > 0 );
987
988 printf( " " );
989
990 printf( "PI(2):" );
991 Abc_NtkForEachPi( pNtk2, pObj, k )
992 if ( pObj->pCopy )
993 printf( "%d", Sim_SimInfoGet(vInfo2, pObj)[i] > 0 );
994 printf( " " );
995 printf( "L(2):" );
996 Abc_NtkForEachLatch( pNtk2, pObj, k )
997 if ( pObj->pCopy )
998 printf( "%d", Sim_SimInfoGet(vInfo2, pObj)[i] > 0 );
999 printf( " " );
1000 printf( "%s(2):", Abc_ObjName(pObjError) );
1001 printf( "%d", Sim_SimInfoGet(vInfo2, pObjError)[i] > 0 );
1002
1003 printf( "\n" );
1004 }
1005 Abc_NtkForEachCi( pNtk1, pObj, i )
1006 pObj->pCopy = NULL;
1007 Abc_NtkForEachCi( pNtk2, pObj, i )
1008 pObj->pCopy = NULL;
1009
1010 Sim_UtilInfoFree( vInfo1 );
1011 Sim_UtilInfoFree( vInfo2 );
1012 if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
1013 if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
1014}
void Abc_NtkGetSeqPoSupp(Abc_Ntk_t *pNtk, int iFrame, int iNumPo)
Definition abcVerify.c:821
void Sim_UtilInfoFree(Vec_Ptr_t *p)
Definition simUtils.c:84
Vec_Ptr_t * Sim_SimulateSeqModel(Abc_Ntk_t *pNtk, int nFrames, int *pModel)
Definition simSeq.c:92
#define Sim_SimInfoGet(vInfo, pNode)
Definition sim.h:172
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkVerifySimulatePattern()

int * Abc_NtkVerifySimulatePattern ( Abc_Ntk_t * pNtk,
int * pModel )

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

Synopsis [Returns the PO values under the given input pattern.]

Description []

SideEffects []

SeeAlso []

Definition at line 696 of file abcVerify.c.

697{
698 Abc_Obj_t * pNode;
699 int * pValues, Value0, Value1, i;
700 int fStrashed = 0;
701 if ( !Abc_NtkIsStrash(pNtk) )
702 {
703 pNtk = Abc_NtkStrash(pNtk, 0, 0, 0);
704 fStrashed = 1;
705 }
706/*
707 printf( "Counter example: " );
708 Abc_NtkForEachCi( pNtk, pNode, i )
709 printf( " %d", pModel[i] );
710 printf( "\n" );
711*/
712 // increment the trav ID
713 Abc_NtkIncrementTravId( pNtk );
714 // set the CI values
715 Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)1;
716 Abc_NtkForEachCi( pNtk, pNode, i )
717 pNode->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)pModel[i];
718 // simulate in the topological order
719 Abc_NtkForEachNode( pNtk, pNode, i )
720 {
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);
723 pNode->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)(Value0 & Value1);
724 }
725 // fill the output values
726 pValues = ABC_ALLOC( int, Abc_NtkCoNum(pNtk) );
727 Abc_NtkForEachCo( pNtk, pNode, i )
728 pValues[i] = ((int)(ABC_PTRINT_T)Abc_ObjFanin0(pNode)->pCopy) ^ (int)Abc_ObjFaninC0(pNode);
729 if ( fStrashed )
730 Abc_NtkDelete( pNtk );
731 return pValues;
732}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Here is the call graph for this function:
Here is the caller graph for this function: