ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fsimSim.c File Reference
#include "fsimInt.h"
#include "aig/ssw/ssw.h"
Include dependency graph for fsimSim.c:

Go to the source code of this file.

Functions

void Fsim_ManSimulateRoundTest (Fsim_Man_t *p)
 
Abc_Cex_tFsim_ManGenerateCounter (Aig_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
 
int Fsim_ManSimulate (Aig_Man_t *pAig, Fsim_ParSim_t *pPars)
 

Function Documentation

◆ Fsim_ManGenerateCounter()

Abc_Cex_t * Fsim_ManGenerateCounter ( Aig_Man_t * pAig,
int iFrame,
int iOut,
int nWords,
int iPat,
Vec_Int_t * vCis2Ids )

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

Synopsis [Returns the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file fsimSim.c.

434{
435 Abc_Cex_t * p;
436 unsigned * pData;
437 int f, i, w, iPioId, Counter;
438 p = Abc_CexAlloc( Aig_ManRegNum(pAig), Saig_ManPiNum(pAig), iFrame+1 );
439 p->iFrame = iFrame;
440 p->iPo = iOut;
441 // fill in the binary data
442 Aig_ManRandom( 1 );
443 Counter = p->nRegs;
444 pData = ABC_ALLOC( unsigned, nWords );
445 for ( f = 0; f <= iFrame; f++, Counter += p->nPis )
446 for ( i = 0; i < Aig_ManPiNum(pAig); i++ )
447 {
448 iPioId = Vec_IntEntry( vCis2Ids, i );
449 if ( iPioId >= p->nPis )
450 continue;
451 for ( w = nWords-1; w >= 0; w-- )
452 pData[w] = Aig_ManRandom( 0 );
453 if ( Aig_InfoHasBit( pData, iPat ) )
454 Aig_InfoSetBit( p->pData, Counter + iPioId );
455 }
456 ABC_FREE( pData );
457 return p;
458}
int nWords
Definition abcNpn.c:127
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
Cube * p
Definition exorList.c:222
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fsim_ManSimulate()

int Fsim_ManSimulate ( Aig_Man_t * pAig,
Fsim_ParSim_t * pPars )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 471 of file fsimSim.c.

472{
473 Fsim_Man_t * p;
475 int i, iOut, iPat;
476 clock_t clk, clkTotal = clock(), clk2, clk2Total = 0;
477 assert( Aig_ManRegNum(pAig) > 0 );
478 if ( pPars->fCheckMiter )
479 {
480 Status = Sec_MiterStatus( pAig );
481 if ( Status.nSat > 0 )
482 {
483 printf( "Miter is trivially satisfiable (output %d).\n", Status.iOut );
484 return 1;
485 }
486 if ( Status.nUndec == 0 )
487 {
488 printf( "Miter is trivially unsatisfiable.\n" );
489 return 0;
490 }
491 }
492 // create manager
493 clk = clock();
494 p = Fsim_ManCreate( pAig );
495 p->nWords = pPars->nWords;
496 if ( pPars->fVerbose )
497 {
498 printf( "Obj = %8d (%8d). Cut = %6d. Front = %6d. FrtMem = %7.2f MB. ",
499 p->nObjs, p->nCis + p->nNodes, p->nCrossCutMax, p->nFront,
500 4.0*p->nWords*(p->nFront)/(1<<20) );
501 ABC_PRT( "Time", clock() - clk );
502 }
503 // create simulation frontier
504 clk = clock();
505 Fsim_ManFront( p, pPars->fCompressAig );
506 if ( pPars->fVerbose )
507 {
508 printf( "Max ID = %8d. Log max ID = %2d. AigMem = %7.2f MB (%5.2f byte/obj). ",
509 p->iNumber, Aig_Base2Log(p->iNumber),
510 1.0*(p->pDataCur-p->pDataAig)/(1<<20),
511 1.0*(p->pDataCur-p->pDataAig)/p->nObjs );
512 ABC_PRT( "Time", clock() - clk );
513 }
514 // perform simulation
515 Aig_ManRandom( 1 );
516 assert( p->pDataSim == NULL );
517 p->pDataSim = ABC_ALLOC( unsigned, p->nWords * p->nFront );
518 p->pDataSimCis = ABC_ALLOC( unsigned, p->nWords * p->nCis );
519 p->pDataSimCos = ABC_ALLOC( unsigned, p->nWords * p->nCos );
520 Fsim_ManSimInfoInit( p );
521 for ( i = 0; i < pPars->nIters; i++ )
522 {
523 Fsim_ManSimulateRound( p );
524 if ( pPars->fVerbose )
525 {
526 printf( "Frame %4d out of %4d and timeout %3d sec. ", i+1, pPars->nIters, pPars->TimeLimit );
527 printf( "Time = %7.2f sec\r", (1.0*clock()-clkTotal)/CLOCKS_PER_SEC );
528 }
529 if ( pPars->fCheckMiter && Fsim_ManCheckPos( p, &iOut, &iPat ) )
530 {
531 assert( pAig->pSeqModel == NULL );
532 pAig->pSeqModel = Fsim_ManGenerateCounter( pAig, i, iOut, p->nWords, iPat, p->vCis2Ids );
533 if ( pPars->fVerbose )
534 printf( "Miter is satisfiable after simulation (output %d).\n", iOut );
535 break;
536 }
537 if ( (clock() - clkTotal)/CLOCKS_PER_SEC >= pPars->TimeLimit )
538 break;
539 clk2 = clock();
540 if ( i < pPars->nIters - 1 )
541 Fsim_ManSimInfoTransfer( p );
542 clk2Total += clock() - clk2;
543 }
544 if ( pAig->pSeqModel == NULL )
545 printf( "No bug detected after %d frames with time limit %d seconds.\n", i+1, pPars->TimeLimit );
546 if ( pPars->fVerbose )
547 {
548 printf( "Maxcut = %8d. AigMem = %7.2f MB. SimMem = %7.2f MB. ",
549 p->nCrossCutMax,
550 p->pDataAig2? 12.0*p->nObjs/(1<<20) : 1.0*(p->pDataCur-p->pDataAig)/(1<<20),
551 4.0*p->nWords*(p->nFront+p->nCis+p->nCos)/(1<<20) );
552 ABC_PRT( "Sim time", clock() - clkTotal );
553
554// ABC_PRT( "Additional time", clk2Total );
555// Fsim_ManSimulateRoundTest( p );
556// Fsim_ManSimulateRoundTest2( p );
557 }
558 Fsim_ManDelete( p );
559 return pAig->pSeqModel != NULL;
560
561}
#define ABC_PRT(a, t)
Definition abc_global.h:255
void Fsim_ManFront(Fsim_Man_t *p, int fCompressAig)
FUNCTION DECLARATIONS ///.
Definition fsimFront.c:245
void Fsim_ManDelete(Fsim_Man_t *p)
Definition fsimMan.c:169
Fsim_Man_t * Fsim_ManCreate(Aig_Man_t *pAig)
Definition fsimMan.c:102
Abc_Cex_t * Fsim_ManGenerateCounter(Aig_Man_t *pAig, int iFrame, int iOut, int nWords, int iPat, Vec_Int_t *vCis2Ids)
Definition fsimSim.c:433
typedefABC_NAMESPACE_HEADER_START struct Fsim_Man_t_ Fsim_Man_t
INCLUDES ///.
Definition fsim.h:42
Sec_MtrStatus_t Sec_MiterStatus(Aig_Man_t *p)
DECLARATIONS ///.
Definition saigMiter.c:46
typedefABC_NAMESPACE_HEADER_START struct Sec_MtrStatus_t_ Sec_MtrStatus_t
INCLUDES ///.
Definition saig.h:41
int nIters
Definition fsim.h:50
int fCheckMiter
Definition fsim.h:52
int fCompressAig
Definition fsim.h:55
int fVerbose
Definition fsim.h:53
int TimeLimit
Definition fsim.h:51
int nWords
Definition fsim.h:49
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Fsim_ManSimulateRoundTest()

void Fsim_ManSimulateRoundTest ( Fsim_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 384 of file fsimSim.c.

385{
386 Fsim_Obj_t * pObj;
387 int i;
388 clock_t clk = clock();
389 Fsim_ManForEachObj( p, pObj, i )
390 {
391 }
392// ABC_PRT( "Unpacking time", p->pPars->nIters * (clock() - clk) );
393}
#define Fsim_ManForEachObj(p, pObj, i)
Definition fsimInt.h:112
typedefABC_NAMESPACE_HEADER_START struct Fsim_Obj_t_ Fsim_Obj_t
INCLUDES ///.
Definition fsimInt.h:46