ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fra.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "aig/aig/aig.h"
#include "opt/dar/dar.h"
#include "sat/bsat/satSolver.h"
#include "aig/ioa/ioa.h"
Include dependency graph for fra.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Fra_Par_t_
 
struct  Fra_Ssw_t_
 
struct  Fra_Sec_t_
 
struct  Fra_Cla_t_
 
struct  Fra_Sml_t_
 
struct  Fra_Man_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Fra_Par_t_ Fra_Par_t
 INCLUDES ///.
 
typedef struct Fra_Ssw_t_ Fra_Ssw_t
 
typedef struct Fra_Sec_t_ Fra_Sec_t
 
typedef struct Fra_Man_t_ Fra_Man_t
 
typedef struct Fra_Cla_t_ Fra_Cla_t
 
typedef struct Fra_Sml_t_ Fra_Sml_t
 
typedef struct Fra_Bmc_t_ Fra_Bmc_t
 

Functions

int Fra_FraigSat (Aig_Man_t *pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int nLearnedStart, int nLearnedDelta, int nLearnedPerce, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose)
 ITERATORS ///.
 
int Fra_FraigCec (Aig_Man_t **ppAig, int nConfLimit, int fVerbose)
 
int Fra_FraigCecPartitioned (Aig_Man_t *pMan1, Aig_Man_t *pMan2, int nConfLimit, int nPartSize, int fSmart, int fVerbose)
 
int Fra_BmcNodeIsConst (Aig_Obj_t *pObj)
 
int Fra_BmcNodesAreEqual (Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 FUNCTION DEFINITIONS ///.
 
void Fra_BmcStop (Fra_Bmc_t *p)
 
void Fra_BmcPerform (Fra_Man_t *p, int nPref, int nDepth)
 
void Fra_BmcPerformSimple (Aig_Man_t *pAig, int nFrames, int nBTLimit, int fRewrite, int fVerbose)
 
Fra_Cla_tFra_ClassesStart (Aig_Man_t *pAig)
 FUNCTION DEFINITIONS ///.
 
void Fra_ClassesStop (Fra_Cla_t *p)
 
void Fra_ClassesCopyReprs (Fra_Cla_t *p, Vec_Ptr_t *vFailed)
 
void Fra_ClassesPrint (Fra_Cla_t *p, int fVeryVerbose)
 
void Fra_ClassesPrepare (Fra_Cla_t *p, int fLatchCorr, int nMaxLevs)
 
int Fra_ClassesRefine (Fra_Cla_t *p)
 
int Fra_ClassesRefine1 (Fra_Cla_t *p, int fRefineNewClass, int *pSkipped)
 
int Fra_ClassesCountLits (Fra_Cla_t *p)
 
int Fra_ClassesCountPairs (Fra_Cla_t *p)
 
void Fra_ClassesTest (Fra_Cla_t *p, int Id1, int Id2)
 
void Fra_ClassesLatchCorr (Fra_Man_t *p)
 
void Fra_ClassesPostprocess (Fra_Cla_t *p)
 
void Fra_ClassesSelectRepr (Fra_Cla_t *p)
 
Aig_Man_tFra_ClassesDeriveAig (Fra_Cla_t *p, int nFramesK)
 
void Fra_CnfNodeAddToSolver (Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
 
void Fra_FraigSweep (Fra_Man_t *pManAig)
 
int Fra_FraigMiterStatus (Aig_Man_t *p)
 DECLARATIONS ///.
 
int Fra_FraigMiterAssertedOutput (Aig_Man_t *p)
 
Aig_Man_tFra_FraigPerform (Aig_Man_t *pManAig, Fra_Par_t *pPars)
 
Aig_Man_tFra_FraigChoice (Aig_Man_t *pManAig, int nConfMax, int nLevelMax)
 
Aig_Man_tFra_FraigEquivence (Aig_Man_t *pManAig, int nConfMax, int fProve)
 
Vec_Int_tFra_OneHotCompute (Fra_Man_t *p, Fra_Sml_t *pSim)
 
void Fra_OneHotAssume (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
void Fra_OneHotCheck (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
int Fra_OneHotRefineUsingCex (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
int Fra_OneHotCount (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
void Fra_OneHotEstimateCoverage (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
Aig_Man_tFra_OneHotCreateExdc (Fra_Man_t *p, Vec_Int_t *vOneHots)
 
void Fra_OneHotAddKnownConstraint (Fra_Man_t *p, Vec_Ptr_t *vOnehots)
 
Vec_Int_tFra_ImpDerive (Fra_Man_t *p, int nImpMaxLimit, int nImpUseLimit, int fLatchCorr)
 
void Fra_ImpAddToSolver (Fra_Man_t *p, Vec_Int_t *vImps, int *pSatVarNums)
 
int Fra_ImpCheckForNode (Fra_Man_t *p, Vec_Int_t *vImps, Aig_Obj_t *pNode, int Pos)
 
int Fra_ImpRefineUsingCex (Fra_Man_t *p, Vec_Int_t *vImps)
 
void Fra_ImpCompactArray (Vec_Int_t *vImps)
 
double Fra_ImpComputeStateSpaceRatio (Fra_Man_t *p)
 
int Fra_ImpVerifyUsingSimulation (Fra_Man_t *p)
 
void Fra_ImpRecordInManager (Fra_Man_t *p, Aig_Man_t *pNew)
 
Aig_Man_tFra_FraigInduction (Aig_Man_t *p, Fra_Ssw_t *pPars)
 
int Fra_InvariantVerify (Aig_Man_t *p, int nFrames, Vec_Int_t *vClauses, Vec_Int_t *vLits)
 DECLARATIONS ///.
 
Aig_Man_tFra_FraigLatchCorrespondence (Aig_Man_t *pAig, int nFramesP, int nConfMax, int fProve, int fVerbose, int *pnIter, float TimeLimit)
 
void Fra_ParamsDefault (Fra_Par_t *pParams)
 DECLARATIONS ///.
 
void Fra_ParamsDefaultSeq (Fra_Par_t *pParams)
 
Fra_Man_tFra_ManStart (Aig_Man_t *pManAig, Fra_Par_t *pParams)
 
void Fra_ManClean (Fra_Man_t *p, int nNodesMax)
 
Aig_Man_tFra_ManPrepareComb (Fra_Man_t *p)
 
void Fra_ManFinalizeComb (Fra_Man_t *p)
 
void Fra_ManStop (Fra_Man_t *p)
 
void Fra_ManPrint (Fra_Man_t *p)
 
int Fra_NodesAreEquiv (Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
 FUNCTION DEFINITIONS ///.
 
int Fra_NodesAreImp (Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew, int fComplL, int fComplR)
 
int Fra_NodesAreClause (Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew, int fComplL, int fComplR)
 
int Fra_NodeIsConst (Fra_Man_t *p, Aig_Obj_t *pNew)
 
void Fra_SecSetDefaultParams (Fra_Sec_t *p)
 DECLARATIONS ///.
 
int Fra_FraigSec (Aig_Man_t *p, Fra_Sec_t *pParSec, Aig_Man_t **ppResult)
 
int Fra_SmlNodeHash (Aig_Obj_t *pObj, int nTableSize)
 DECLARATIONS ///.
 
int Fra_SmlNodeIsConst (Aig_Obj_t *pObj)
 
int Fra_SmlNodesAreEqual (Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
 
int Fra_SmlNodeNotEquWeight (Fra_Sml_t *p, int Left, int Right)
 
int Fra_SmlNodeCountOnes (Fra_Sml_t *p, Aig_Obj_t *pObj)
 
int Fra_SmlCheckOutput (Fra_Man_t *p)
 
void Fra_SmlSavePattern (Fra_Man_t *p)
 
void Fra_SmlSimulate (Fra_Man_t *p, int fInit)
 
void Fra_SmlResimulate (Fra_Man_t *p)
 
Fra_Sml_tFra_SmlStart (Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
 
void Fra_SmlStop (Fra_Sml_t *p)
 
Fra_Sml_tFra_SmlSimulateComb (Aig_Man_t *pAig, int nWords, int fCheckMiter)
 
Fra_Sml_tFra_SmlSimulateCombGiven (Aig_Man_t *pAig, char *pFileName, int fCheckMiter, int fVerbose)
 
Fra_Sml_tFra_SmlSimulateSeq (Aig_Man_t *pAig, int nPref, int nFrames, int nWords, int fCheckMiter)
 
Abc_Cex_tFra_SmlGetCounterExample (Fra_Sml_t *p)
 
Abc_Cex_tFra_SmlCopyCounterExample (Aig_Man_t *pAig, Aig_Man_t *pFrames, int *pModel)
 

Typedef Documentation

◆ Fra_Bmc_t

typedef struct Fra_Bmc_t_ Fra_Bmc_t

Definition at line 59 of file fra.h.

◆ Fra_Cla_t

typedef struct Fra_Cla_t_ Fra_Cla_t

Definition at line 57 of file fra.h.

◆ Fra_Man_t

typedef struct Fra_Man_t_ Fra_Man_t

Definition at line 56 of file fra.h.

◆ Fra_Par_t

typedef typedefABC_NAMESPACE_HEADER_START struct Fra_Par_t_ Fra_Par_t

INCLUDES ///.

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

FileName [fra.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [[New FRAIG package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fra.h,v 1.00 2007/06/30 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 53 of file fra.h.

◆ Fra_Sec_t

typedef struct Fra_Sec_t_ Fra_Sec_t

Definition at line 55 of file fra.h.

◆ Fra_Sml_t

typedef struct Fra_Sml_t_ Fra_Sml_t

Definition at line 58 of file fra.h.

◆ Fra_Ssw_t

typedef struct Fra_Ssw_t_ Fra_Ssw_t

Definition at line 54 of file fra.h.

Function Documentation

◆ Fra_BmcNodeIsConst()

int Fra_BmcNodeIsConst ( Aig_Obj_t * pObj)
extern

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

Synopsis [Returns 1 if the node is costant.]

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file fraBmc.c.

104{
105 Fra_Man_t * p = (Fra_Man_t *)pObj->pData;
106 return Fra_BmcNodesAreEqual( pObj, Aig_ManConst1(p->pManAig) );
107}
Cube * p
Definition exorList.c:222
int Fra_BmcNodesAreEqual(Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
FUNCTION DEFINITIONS ///.
Definition fraBmc.c:72
struct Fra_Man_t_ Fra_Man_t
Definition fra.h:56
void * pData
Definition aig.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_BmcNodesAreEqual()

int Fra_BmcNodesAreEqual ( Aig_Obj_t * pObj0,
Aig_Obj_t * pObj1 )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns 1 if the nodes are equivalent.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file fraBmc.c.

73{
74 Fra_Man_t * p = (Fra_Man_t *)pObj0->pData;
75 Aig_Obj_t * pObjFrames0, * pObjFrames1;
76 Aig_Obj_t * pObjFraig0, * pObjFraig1;
77 int i;
78 for ( i = p->pBmc->nPref; i < p->pBmc->nFramesAll; i++ )
79 {
80 pObjFrames0 = Aig_Regular( Bmc_ObjFrames(pObj0, i) );
81 pObjFrames1 = Aig_Regular( Bmc_ObjFrames(pObj1, i) );
82 if ( pObjFrames0 == pObjFrames1 )
83 continue;
84 pObjFraig0 = Aig_Regular( Bmc_ObjFraig(pObjFrames0) );
85 pObjFraig1 = Aig_Regular( Bmc_ObjFraig(pObjFrames1) );
86 if ( pObjFraig0 != pObjFraig1 )
87 return 0;
88 }
89 return 1;
90}
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Here is the caller graph for this function:

◆ Fra_BmcPerform()

void Fra_BmcPerform ( Fra_Man_t * p,
int nPref,
int nDepth )
extern

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

Synopsis [Performs BMC for the given AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file fraBmc.c.

312{
313 Aig_Obj_t * pObj;
314 int i, nImpsOld = 0;
315 abctime clk = Abc_Clock();
316 assert( p->pBmc == NULL );
317 // derive and fraig the frames
318 p->pBmc = Fra_BmcStart( p->pManAig, nPref, nDepth );
319 p->pBmc->pAigFrames = Fra_BmcFrames( p->pBmc, 0 );
320 // if implications are present, configure the AIG manager to check them
321 if ( p->pCla->vImps )
322 {
323 p->pBmc->pAigFrames->pImpFunc = (void (*) (void*, void*))Fra_BmcFilterImplications;
324 p->pBmc->pAigFrames->pImpData = p->pBmc;
325 p->pBmc->vImps = p->pCla->vImps;
326 nImpsOld = Vec_IntSize(p->pCla->vImps);
327 }
328 p->pBmc->pAigFraig = Fra_FraigEquivence( p->pBmc->pAigFrames, 1000000, 0 );
329 p->pBmc->pObjToFraig = p->pBmc->pAigFrames->pObjCopies;
330 p->pBmc->pAigFrames->pObjCopies = NULL;
331 // annotate frames nodes with pointers to the manager
332 Aig_ManForEachObj( p->pBmc->pAigFrames, pObj, i )
333 pObj->pData = p;
334 // report the results
335 if ( p->pPars->fVerbose )
336 {
337 printf( "Original AIG = %d. Init %d frames = %d. Fraig = %d. ",
338 Aig_ManNodeNum(p->pBmc->pAig), p->pBmc->nFramesAll,
339 Aig_ManNodeNum(p->pBmc->pAigFrames), Aig_ManNodeNum(p->pBmc->pAigFraig) );
340 ABC_PRT( "Time", Abc_Clock() - clk );
341 printf( "Before BMC: " );
342// Fra_ClassesPrint( p->pCla, 0 );
343 printf( "Const = %5d. Class = %5d. Lit = %5d. ",
344 Vec_PtrSize(p->pCla->vClasses1), Vec_PtrSize(p->pCla->vClasses), Fra_ClassesCountLits(p->pCla) );
345 if ( p->pCla->vImps )
346 printf( "Imp = %5d. ", nImpsOld );
347 printf( "\n" );
348 }
349 // refine the classes
350 p->pCla->pFuncNodeIsConst = Fra_BmcNodeIsConst;
351 p->pCla->pFuncNodesAreEqual = Fra_BmcNodesAreEqual;
352 Fra_ClassesRefine( p->pCla );
353 Fra_ClassesRefine1( p->pCla, 1, NULL );
354 p->pCla->pFuncNodeIsConst = Fra_SmlNodeIsConst;
355 p->pCla->pFuncNodesAreEqual = Fra_SmlNodesAreEqual;
356 // report the results
357 if ( p->pPars->fVerbose )
358 {
359 printf( "After BMC: " );
360// Fra_ClassesPrint( p->pCla, 0 );
361 printf( "Const = %5d. Class = %5d. Lit = %5d. ",
362 Vec_PtrSize(p->pCla->vClasses1), Vec_PtrSize(p->pCla->vClasses), Fra_ClassesCountLits(p->pCla) );
363 if ( p->pCla->vImps )
364 printf( "Imp = %5d. ", Vec_IntSize(p->pCla->vImps) );
365 printf( "\n" );
366 }
367 // free the BMC manager
368 Fra_BmcStop( p->pBmc );
369 p->pBmc = NULL;
370}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
Fra_Bmc_t * Fra_BmcStart(Aig_Man_t *pAig, int nPref, int nDepth)
Definition fraBmc.c:191
void Fra_BmcStop(Fra_Bmc_t *p)
Definition fraBmc.c:216
Aig_Man_t * Fra_BmcFrames(Fra_Bmc_t *p, int fKeepPos)
Definition fraBmc.c:237
void Fra_BmcFilterImplications(Fra_Man_t *p, Fra_Bmc_t *pBmc)
Definition fraBmc.c:121
int Fra_ClassesRefine1(Fra_Cla_t *p, int fRefineNewClass, int *pSkipped)
Definition fraClass.c:527
int Fra_SmlNodeIsConst(Aig_Obj_t *pObj)
Definition fraSim.c:86
Aig_Man_t * Fra_FraigEquivence(Aig_Man_t *pManAig, int nConfMax, int fProve)
Definition fraCore.c:468
int Fra_ClassesRefine(Fra_Cla_t *p)
Definition fraClass.c:493
int Fra_ClassesCountLits(Fra_Cla_t *p)
Definition fraClass.c:164
int Fra_BmcNodeIsConst(Aig_Obj_t *pObj)
Definition fraBmc.c:103
int Fra_SmlNodesAreEqual(Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition fraSim.c:109
int Fra_BmcNodesAreEqual(Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
FUNCTION DEFINITIONS ///.
Definition fraBmc.c:72
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_BmcPerformSimple()

void Fra_BmcPerformSimple ( Aig_Man_t * pAig,
int nFrames,
int nBTLimit,
int fRewrite,
int fVerbose )
extern

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

Synopsis [Performs BMC for the given AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 383 of file fraBmc.c.

384{
385 extern Fra_Man_t * Fra_LcrAigPrepare( Aig_Man_t * pAig );
386 Fra_Man_t * pTemp;
387 Fra_Bmc_t * pBmc;
388 Aig_Man_t * pAigTemp;
389 abctime clk;
390 int iOutput;
391 // derive and fraig the frames
392 clk = Abc_Clock();
393 pBmc = Fra_BmcStart( pAig, 0, nFrames );
394 pTemp = Fra_LcrAigPrepare( pAig );
395 pTemp->pBmc = pBmc;
396 pBmc->pAigFrames = Fra_BmcFrames( pBmc, 1 );
397 if ( fVerbose )
398 {
399 printf( "AIG: PI/PO/Reg = %d/%d/%d. Node = %6d. Lev = %5d.\n",
400 Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig), Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig), Aig_ManRegNum(pAig),
401 Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
402 printf( "Time-frames (%d): PI/PO = %d/%d. Node = %6d. Lev = %5d. ",
403 nFrames, Aig_ManCiNum(pBmc->pAigFrames), Aig_ManCoNum(pBmc->pAigFrames),
404 Aig_ManNodeNum(pBmc->pAigFrames), Aig_ManLevelNum(pBmc->pAigFrames) );
405 ABC_PRT( "Time", Abc_Clock() - clk );
406 }
407 if ( fRewrite )
408 {
409 clk = Abc_Clock();
410 pBmc->pAigFrames = Dar_ManRwsat( pAigTemp = pBmc->pAigFrames, 1, 0 );
411 Aig_ManStop( pAigTemp );
412 if ( fVerbose )
413 {
414 printf( "Time-frames after rewriting: Node = %6d. Lev = %5d. ",
415 Aig_ManNodeNum(pBmc->pAigFrames), Aig_ManLevelNum(pBmc->pAigFrames) );
416 ABC_PRT( "Time", Abc_Clock() - clk );
417 }
418 }
419 clk = Abc_Clock();
420 iOutput = Fra_FraigMiterAssertedOutput( pBmc->pAigFrames );
421 if ( iOutput >= 0 )
422 pAig->pSeqModel = Abc_CexMakeTriv( Aig_ManRegNum(pAig), Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig), Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig), iOutput );
423 else
424 {
425 pBmc->pAigFraig = Fra_FraigEquivence( pBmc->pAigFrames, nBTLimit, 1 );
426 iOutput = Fra_FraigMiterAssertedOutput( pBmc->pAigFraig );
427 if ( pBmc->pAigFraig->pData )
428 {
429 pAig->pSeqModel = Fra_SmlCopyCounterExample( pAig, pBmc->pAigFrames, (int *)pBmc->pAigFraig->pData );
430 ABC_FREE( pBmc->pAigFraig->pData );
431 }
432 else if ( iOutput >= 0 )
433 pAig->pSeqModel = Abc_CexMakeTriv( Aig_ManRegNum(pAig), Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig), Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig), iOutput );
434 }
435 if ( fVerbose )
436 {
437 printf( "Fraiged init frames: Node = %6d. Lev = %5d. ",
438 pBmc->pAigFraig? Aig_ManNodeNum(pBmc->pAigFraig) : -1,
439 pBmc->pAigFraig? Aig_ManLevelNum(pBmc->pAigFraig) : -1 );
440 ABC_PRT( "Time", Abc_Clock() - clk );
441 }
442 Fra_BmcStop( pBmc );
443 ABC_FREE( pTemp );
444}
#define ABC_FREE(obj)
Definition abc_global.h:267
ABC_NAMESPACE_IMPL_START Aig_Man_t * Dar_ManRwsat(Aig_Man_t *pAig, int fBalance, int fVerbose)
DECLARATIONS ///.
Definition darScript.c:71
int Aig_ManLevelNum(Aig_Man_t *p)
Definition aigDfs.c:500
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
Fra_Man_t * Fra_LcrAigPrepare(Aig_Man_t *pAig)
Definition fraLcr.c:158
struct Fra_Bmc_t_ Fra_Bmc_t
Definition fra.h:59
Abc_Cex_t * Fra_SmlCopyCounterExample(Aig_Man_t *pAig, Aig_Man_t *pFrames, int *pModel)
Definition fraSim.c:1123
int Fra_FraigMiterAssertedOutput(Aig_Man_t *p)
Definition fraCore.c:125
Aig_Man_t * pAigFraig
Definition fraBmc.c:42
Aig_Man_t * pAigFrames
Definition fraBmc.c:41
Fra_Bmc_t * pBmc
Definition fra.h:202
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
Definition utilCex.c:85
Here is the call graph for this function:

◆ Fra_BmcStop()

void Fra_BmcStop ( Fra_Bmc_t * p)
extern

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

Synopsis [Stops the BMC manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 216 of file fraBmc.c.

217{
218 Aig_ManStop( p->pAigFrames );
219 if ( p->pAigFraig )
220 Aig_ManStop( p->pAigFraig );
221 ABC_FREE( p->pObjToFrames );
222 ABC_FREE( p->pObjToFraig );
223 ABC_FREE( p );
224}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesCopyReprs()

void Fra_ClassesCopyReprs ( Fra_Cla_t * p,
Vec_Ptr_t * vFailed )
extern

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

Synopsis [Starts representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file fraClass.c.

115{
116 Aig_Obj_t * pObj;
117 int i;
118 Aig_ManReprStart( p->pAig, Aig_ManObjNumMax(p->pAig) );
119 memmove( p->pAig->pReprs, p->pMemRepr, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(p->pAig) );
120 if ( Vec_PtrSize(p->vClasses1) == 0 && Vec_PtrSize(p->vClasses) == 0 )
121 {
122 Aig_ManForEachObj( p->pAig, pObj, i )
123 {
124 if ( p->pAig->pReprs[i] != NULL )
125 printf( "Classes are not cleared!\n" );
126 assert( p->pAig->pReprs[i] == NULL );
127 }
128 }
129 if ( vFailed )
130 Vec_PtrForEachEntry( Aig_Obj_t *, vFailed, pObj, i )
131 p->pAig->pReprs[pObj->Id] = NULL;
132}
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition aigRepr.c:45
int Id
Definition aig.h:85
char * memmove()
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesCountLits()

int Fra_ClassesCountLits ( Fra_Cla_t * p)
extern

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

Synopsis [Count the number of literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 164 of file fraClass.c.

165{
166 Aig_Obj_t ** pClass;
167 int i, nNodes, nLits = 0;
168 nLits = Vec_PtrSize( p->vClasses1 );
169 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, pClass, i )
170 {
171 nNodes = Fra_ClassCount( pClass );
172 assert( nNodes > 1 );
173 nLits += nNodes - 1;
174 }
175 return nLits;
176}
int Fra_ClassCount(Aig_Obj_t **pClass)
Definition fraClass.c:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesCountPairs()

int Fra_ClassesCountPairs ( Fra_Cla_t * p)
extern

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

Synopsis [Count the number of pairs.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file fraClass.c.

190{
191 Aig_Obj_t ** pClass;
192 int i, nNodes, nPairs = 0;
193 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, pClass, i )
194 {
195 nNodes = Fra_ClassCount( pClass );
196 assert( nNodes > 1 );
197 nPairs += nNodes * (nNodes - 1) / 2;
198 }
199 return nPairs;
200}
Here is the call graph for this function:

◆ Fra_ClassesDeriveAig()

Aig_Man_t * Fra_ClassesDeriveAig ( Fra_Cla_t * p,
int nFramesK )
extern

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

Synopsis [Derives AIG for the partitioned problem.]

Description []

SideEffects []

SeeAlso []

Definition at line 796 of file fraClass.c.

797{
798 Aig_Man_t * pManFraig;
799 Aig_Obj_t * pObj, * pObjNew;
800 Aig_Obj_t ** pLatches, ** ppEquivs;
801 int i, k, f, nFramesAll = nFramesK + 1;
802 assert( Aig_ManRegNum(p->pAig) > 0 );
803 assert( Aig_ManRegNum(p->pAig) < Aig_ManCiNum(p->pAig) );
804 assert( nFramesK > 0 );
805 // start the fraig package
806 pManFraig = Aig_ManStart( Aig_ManObjNumMax(p->pAig) * nFramesAll );
807 pManFraig->pName = Abc_UtilStrsav( p->pAig->pName );
808 pManFraig->pSpec = Abc_UtilStrsav( p->pAig->pSpec );
809 // allocate place for the node mapping
810 ppEquivs = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(p->pAig) );
811 Fra_ObjSetEqu( ppEquivs, Aig_ManConst1(p->pAig), Aig_ManConst1(pManFraig) );
812 // create latches for the first frame
813 Aig_ManForEachLoSeq( p->pAig, pObj, i )
814 Fra_ObjSetEqu( ppEquivs, pObj, Aig_ObjCreateCi(pManFraig) );
815 // add timeframes
816 pLatches = ABC_ALLOC( Aig_Obj_t *, Aig_ManRegNum(p->pAig) );
817 for ( f = 0; f < nFramesAll; f++ )
818 {
819 // create PIs for this frame
820 Aig_ManForEachPiSeq( p->pAig, pObj, i )
821 Fra_ObjSetEqu( ppEquivs, pObj, Aig_ObjCreateCi(pManFraig) );
822 // set the constraints on the latch outputs
823 Aig_ManForEachLoSeq( p->pAig, pObj, i )
824 Fra_ClassesDeriveNode( pManFraig, pObj, ppEquivs );
825 // add internal nodes of this frame
826 Aig_ManForEachNode( p->pAig, pObj, i )
827 {
828 pObjNew = Aig_And( pManFraig, Fra_ObjChild0Equ(ppEquivs, pObj), Fra_ObjChild1Equ(ppEquivs, pObj) );
829 Fra_ObjSetEqu( ppEquivs, pObj, pObjNew );
830 Fra_ClassesDeriveNode( pManFraig, pObj, ppEquivs );
831 }
832 if ( f == nFramesAll - 1 )
833 break;
834 if ( f == nFramesAll - 2 )
835 pManFraig->nAsserts = Aig_ManCoNum(pManFraig);
836 // save the latch input values
837 k = 0;
838 Aig_ManForEachLiSeq( p->pAig, pObj, i )
839 pLatches[k++] = Fra_ObjChild0Equ( ppEquivs, pObj );
840 // insert them to the latch output values
841 k = 0;
842 Aig_ManForEachLoSeq( p->pAig, pObj, i )
843 Fra_ObjSetEqu( ppEquivs, pObj, pLatches[k++] );
844 }
845 ABC_FREE( pLatches );
846 ABC_FREE( ppEquivs );
847 // mark the asserts
848 assert( Aig_ManCoNum(pManFraig) % nFramesAll == 0 );
849printf( "Assert miters = %6d. Output miters = %6d.\n",
850 pManFraig->nAsserts, Aig_ManCoNum(pManFraig) - pManFraig->nAsserts );
851 // remove dangling nodes
852 Aig_ManCleanup( pManFraig );
853 return pManFraig;
854}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition aig.h:447
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition aig.h:438
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition aig.h:441
Here is the call graph for this function:

◆ Fra_ClassesLatchCorr()

void Fra_ClassesLatchCorr ( Fra_Man_t * p)
extern

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

Synopsis [Creates latch correspondence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 615 of file fraClass.c.

616{
617 Aig_Obj_t * pObj;
618 int i, nEntries = 0;
619 Vec_PtrClear( p->pCla->vClasses1 );
620 Aig_ManForEachLoSeq( p->pManAig, pObj, i )
621 {
622 Vec_PtrPush( p->pCla->vClasses1, pObj );
623 Fra_ClassObjSetRepr( pObj, Aig_ManConst1(p->pManAig) );
624 }
625 // allocate room for classes
626 p->pCla->pMemClasses = ABC_ALLOC( Aig_Obj_t *, 2*(nEntries + Vec_PtrSize(p->pCla->vClasses1)) );
627 p->pCla->pMemClassesFree = p->pCla->pMemClasses + 2*nEntries;
628}

◆ Fra_ClassesPostprocess()

void Fra_ClassesPostprocess ( Fra_Cla_t * p)
extern

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

Synopsis [Postprocesses the classes by removing half of the less useful.]

Description []

SideEffects []

SeeAlso []

Definition at line 641 of file fraClass.c.

642{
643 int Ratio = 2;
644 Fra_Sml_t * pComb;
645 Aig_Obj_t * pObj, * pRepr, ** ppClass;
646 int * pWeights, WeightMax = 0, i, k, c;
647 // perform combinational simulation
648 pComb = Fra_SmlSimulateComb( p->pAig, 32, 0 );
649 // compute the weight of each node in the classes
650 pWeights = ABC_ALLOC( int, Aig_ManObjNumMax(p->pAig) );
651 memset( pWeights, 0, sizeof(int) * Aig_ManObjNumMax(p->pAig) );
652 Aig_ManForEachObj( p->pAig, pObj, i )
653 {
654 pRepr = Fra_ClassObjRepr( pObj );
655 if ( pRepr == NULL )
656 continue;
657 pWeights[i] = Fra_SmlNodeNotEquWeight( pComb, pRepr->Id, pObj->Id );
658 WeightMax = Abc_MaxInt( WeightMax, pWeights[i] );
659 }
660 Fra_SmlStop( pComb );
661 printf( "Before: Const = %6d. Class = %6d. ", Vec_PtrSize(p->vClasses1), Vec_PtrSize(p->vClasses) );
662 // remove nodes from classes whose weight is less than WeightMax/Ratio
663 k = 0;
664 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClasses1, pObj, i )
665 {
666 if ( pWeights[pObj->Id] >= WeightMax/Ratio )
667 Vec_PtrWriteEntry( p->vClasses1, k++, pObj );
668 else
669 Fra_ClassObjSetRepr( pObj, NULL );
670 }
671 Vec_PtrShrink( p->vClasses1, k );
672 // in each class, compact the nodes
673 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, ppClass, i )
674 {
675 k = 1;
676 for ( c = 1; ppClass[c]; c++ )
677 {
678 if ( pWeights[ppClass[c]->Id] >= WeightMax/Ratio )
679 ppClass[k++] = ppClass[c];
680 else
681 Fra_ClassObjSetRepr( ppClass[c], NULL );
682 }
683 ppClass[k] = NULL;
684 }
685 // remove classes with only repr
686 k = 0;
687 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, ppClass, i )
688 if ( ppClass[1] != NULL )
689 Vec_PtrWriteEntry( p->vClasses, k++, ppClass );
690 Vec_PtrShrink( p->vClasses, k );
691 printf( "After: Const = %6d. Class = %6d. \n", Vec_PtrSize(p->vClasses1), Vec_PtrSize(p->vClasses) );
692 ABC_FREE( pWeights );
693}
void Fra_SmlStop(Fra_Sml_t *p)
Definition fraSim.c:839
int Fra_SmlNodeNotEquWeight(Fra_Sml_t *p, int Left, int Right)
Definition fraSim.c:133
struct Fra_Sml_t_ Fra_Sml_t
Definition fra.h:58
Fra_Sml_t * Fra_SmlSimulateComb(Aig_Man_t *pAig, int nWords, int fCheckMiter)
Definition fraSim.c:856
char * memset()
Here is the call graph for this function:

◆ Fra_ClassesPrepare()

void Fra_ClassesPrepare ( Fra_Cla_t * p,
int fLatchCorr,
int nMaxLevs )
extern

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

Synopsis [Creates initial simulation classes.]

Description [Assumes that simulation info is assigned.]

SideEffects []

SeeAlso []

Definition at line 276 of file fraClass.c.

277{
278 Aig_Obj_t ** ppTable, ** ppNexts;
279 Aig_Obj_t * pObj, * pTemp;
280 int i, k, nTableSize, nEntries, nNodes, iEntry;
281
282 // allocate the hash table hashing simulation info into nodes
283 nTableSize = Abc_PrimeCudd( Aig_ManObjNumMax(p->pAig) );
284 ppTable = ABC_FALLOC( Aig_Obj_t *, nTableSize );
285 ppNexts = ABC_FALLOC( Aig_Obj_t *, nTableSize );
286 memset( ppTable, 0, sizeof(Aig_Obj_t *) * nTableSize );
287
288 // add all the nodes to the hash table
289 Vec_PtrClear( p->vClasses1 );
290 Aig_ManForEachObj( p->pAig, pObj, i )
291 {
292 if ( fLatchCorr )
293 {
294 if ( !Aig_ObjIsCi(pObj) )
295 continue;
296 }
297 else
298 {
299 if ( !Aig_ObjIsNode(pObj) && !Aig_ObjIsCi(pObj) )
300 continue;
301 // skip the node with more that the given number of levels
302 if ( nMaxLevs && (int)pObj->Level > nMaxLevs )
303 continue;
304 }
305 // hash the node by its simulation info
306 iEntry = p->pFuncNodeHash( pObj, nTableSize );
307 // check if the node belongs to the class of constant 1
308 if ( p->pFuncNodeIsConst( pObj ) )
309 {
310 Vec_PtrPush( p->vClasses1, pObj );
311 Fra_ClassObjSetRepr( pObj, Aig_ManConst1(p->pAig) );
312 continue;
313 }
314 // add the node to the class
315 if ( ppTable[iEntry] == NULL )
316 {
317 ppTable[iEntry] = pObj;
318 Fra_ObjSetNext( ppNexts, pObj, pObj );
319 }
320 else
321 {
322 Fra_ObjSetNext( ppNexts, pObj, Fra_ObjNext(ppNexts,ppTable[iEntry]) );
323 Fra_ObjSetNext( ppNexts, ppTable[iEntry], pObj );
324 }
325 }
326
327 // count the total number of nodes in the non-trivial classes
328 // mark the representative nodes of each equivalence class
329 nEntries = 0;
330 for ( i = 0; i < nTableSize; i++ )
331 if ( ppTable[i] && ppTable[i] != Fra_ObjNext(ppNexts, ppTable[i]) )
332 {
333 for ( pTemp = Fra_ObjNext(ppNexts, ppTable[i]), k = 1;
334 pTemp != ppTable[i];
335 pTemp = Fra_ObjNext(ppNexts, pTemp), k++ );
336 assert( k > 1 );
337 nEntries += k;
338 // mark the node
339 assert( ppTable[i]->fMarkA == 0 );
340 ppTable[i]->fMarkA = 1;
341 }
342
343 // allocate room for classes
344 p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, 2*(nEntries + Vec_PtrSize(p->vClasses1)) );
345 p->pMemClassesFree = p->pMemClasses + 2*nEntries;
346
347 // copy the entries into storage in the topological order
348 Vec_PtrClear( p->vClasses );
349 nEntries = 0;
350 Aig_ManForEachObj( p->pAig, pObj, i )
351 {
352 if ( !Aig_ObjIsNode(pObj) && !Aig_ObjIsCi(pObj) )
353 continue;
354 // skip the nodes that are not representatives of non-trivial classes
355 if ( pObj->fMarkA == 0 )
356 continue;
357 pObj->fMarkA = 0;
358 // add the class of nodes
359 Vec_PtrPush( p->vClasses, p->pMemClasses + 2*nEntries );
360 // count the number of entries in this class
361 for ( pTemp = Fra_ObjNext(ppNexts, pObj), k = 1;
362 pTemp != pObj;
363 pTemp = Fra_ObjNext(ppNexts, pTemp), k++ );
364 nNodes = k;
365 assert( nNodes > 1 );
366 // add the nodes to the class in the topological order
367 p->pMemClasses[2*nEntries] = pObj;
368 for ( pTemp = Fra_ObjNext(ppNexts, pObj), k = 1;
369 pTemp != pObj;
370 pTemp = Fra_ObjNext(ppNexts, pTemp), k++ )
371 {
372 p->pMemClasses[2*nEntries+nNodes-k] = pTemp;
373 Fra_ClassObjSetRepr( pTemp, pObj );
374 }
375 // add as many empty entries
376 p->pMemClasses[2*nEntries + nNodes] = NULL;
377 // increment the number of entries
378 nEntries += k;
379 }
380 ABC_FREE( ppTable );
381 ABC_FREE( ppNexts );
382 // now it is time to refine the classes
384// Fra_ClassesPrint( p, 0 );
385}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
int Fra_ClassesRefine(Fra_Cla_t *p)
Definition fraClass.c:493
unsigned int fMarkA
Definition aig.h:79
unsigned Level
Definition aig.h:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesPrint()

void Fra_ClassesPrint ( Fra_Cla_t * p,
int fVeryVerbose )
extern

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

Synopsis [Prints simulation classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file fraClass.c.

237{
238 Aig_Obj_t ** pClass;
239 Aig_Obj_t * pObj;
240 int i;
241
242 printf( "Const = %5d. Class = %5d. Lit = %5d. ",
243 Vec_PtrSize(p->vClasses1), Vec_PtrSize(p->vClasses), Fra_ClassesCountLits(p) );
244 if ( p->vImps && Vec_IntSize(p->vImps) > 0 )
245 printf( "Imp = %5d. ", Vec_IntSize(p->vImps) );
246 printf( "\n" );
247
248 if ( fVeryVerbose )
249 {
250 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClasses1, pObj, i )
251 assert( Fra_ClassObjRepr(pObj) == Aig_ManConst1(p->pAig) );
252 printf( "Constants { " );
253 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClasses1, pObj, i )
254 printf( "%d(%d,%d) ", pObj->Id, pObj->Level, Aig_SupportSize(p->pAig,pObj) );
255 printf( "}\n" );
256 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, pClass, i )
257 {
258 printf( "%3d (%3d) : ", i, Fra_ClassCount(pClass) );
259 Fra_PrintClass( p, pClass );
260 }
261 printf( "\n" );
262 }
263}
int Aig_SupportSize(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition aigDfs.c:772
void Fra_PrintClass(Fra_Cla_t *p, Aig_Obj_t **pClass)
Definition fraClass.c:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesRefine()

int Fra_ClassesRefine ( Fra_Cla_t * p)
extern

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

Synopsis [Refines the classes after simulation.]

Description [Assumes that simulation info is assigned. Returns the number of classes refined.]

SideEffects []

SeeAlso []

Definition at line 493 of file fraClass.c.

494{
495 Vec_Ptr_t * vTemp;
496 Aig_Obj_t ** pClass;
497 int i, nRefis;
498 // refine the classes
499 nRefis = 0;
500 Vec_PtrClear( p->vClassesTemp );
501 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, pClass, i )
502 {
503 // add the class to the new array
504 assert( pClass[0] != NULL );
505 Vec_PtrPush( p->vClassesTemp, pClass );
506 // refine the class iteratively
507 nRefis += Fra_RefineClassLastIter( p, p->vClassesTemp );
508 }
509 // exchange the class representation
510 vTemp = p->vClassesTemp;
511 p->vClassesTemp = p->vClasses;
512 p->vClasses = vTemp;
513 return nRefis;
514}
int Fra_RefineClassLastIter(Fra_Cla_t *p, Vec_Ptr_t *vClasses)
Definition fraClass.c:457
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesRefine1()

int Fra_ClassesRefine1 ( Fra_Cla_t * p,
int fRefineNewClass,
int * pSkipped )
extern

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

Synopsis [Refines constant 1 equivalence class.]

Description []

SideEffects []

SeeAlso []

Definition at line 527 of file fraClass.c.

528{
529 Aig_Obj_t * pObj, ** ppClass;
530 int i, k, nRefis = 1;
531 // check if there is anything to refine
532 if ( Vec_PtrSize(p->vClasses1) == 0 )
533 return 0;
534 // make sure constant 1 class contains only non-constant nodes
535 assert( Vec_PtrEntry(p->vClasses1,0) != Aig_ManConst1(p->pAig) );
536 // collect all the nodes to be refined
537 k = 0;
538 Vec_PtrClear( p->vClassNew );
539 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClasses1, pObj, i )
540 {
541 if ( p->pFuncNodeIsConst( pObj ) )
542 Vec_PtrWriteEntry( p->vClasses1, k++, pObj );
543 else
544 Vec_PtrPush( p->vClassNew, pObj );
545 }
546 Vec_PtrShrink( p->vClasses1, k );
547 if ( Vec_PtrSize(p->vClassNew) == 0 )
548 return 0;
549/*
550 printf( "Refined const-1 class: {" );
551 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
552 printf( " %d", pObj->Id );
553 printf( " }\n" );
554*/
555 if ( Vec_PtrSize(p->vClassNew) == 1 )
556 {
557 Fra_ClassObjSetRepr( (Aig_Obj_t *)Vec_PtrEntry(p->vClassNew,0), NULL );
558 return 1;
559 }
560 // create a new class composed of these nodes
561 ppClass = p->pMemClassesFree;
562 p->pMemClassesFree += 2 * Vec_PtrSize(p->vClassNew);
563 Vec_PtrForEachEntry( Aig_Obj_t *, p->vClassNew, pObj, i )
564 {
565 ppClass[i] = pObj;
566 ppClass[Vec_PtrSize(p->vClassNew)+i] = NULL;
567 Fra_ClassObjSetRepr( pObj, i? ppClass[0] : NULL );
568 }
569 assert( ppClass[0] != NULL );
570 Vec_PtrPush( p->vClasses, ppClass );
571 // iteratively refine this class
572 if ( fRefineNewClass )
573 nRefis += Fra_RefineClassLastIter( p, p->vClasses );
574 else if ( pSkipped )
575 (*pSkipped)++;
576 return nRefis;
577}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesSelectRepr()

void Fra_ClassesSelectRepr ( Fra_Cla_t * p)
extern

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

Synopsis [Postprocesses the classes by selecting representative lowest in top order.]

Description []

SideEffects []

SeeAlso []

Definition at line 706 of file fraClass.c.

707{
708 Aig_Obj_t ** pClass, * pNodeMin;
709 int i, c, cMinSupp, nSuppSizeMin, nSuppSizeCur;
710 // reassign representatives in each class
711 Vec_PtrForEachEntry( Aig_Obj_t **, p->vClasses, pClass, i )
712 {
713 // collect support sizes and find the min-support node
714 cMinSupp = -1;
715 pNodeMin = NULL;
716 nSuppSizeMin = ABC_INFINITY;
717 for ( c = 0; pClass[c]; c++ )
718 {
719 nSuppSizeCur = Aig_SupportSize( p->pAig, pClass[c] );
720// nSuppSizeCur = 1;
721 if ( nSuppSizeMin > nSuppSizeCur ||
722 (nSuppSizeMin == nSuppSizeCur && pNodeMin->Level > pClass[c]->Level) )
723 {
724 nSuppSizeMin = nSuppSizeCur;
725 pNodeMin = pClass[c];
726 cMinSupp = c;
727 }
728 }
729 // skip the case when the repr did not change
730 if ( cMinSupp == 0 )
731 continue;
732 // make the new node the representative of the class
733 pClass[cMinSupp] = pClass[0];
734 pClass[0] = pNodeMin;
735 // set the representative
736 for ( c = 0; pClass[c]; c++ )
737 Fra_ClassObjSetRepr( pClass[c], c? pClass[0] : NULL );
738 }
739}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesStart()

Fra_Cla_t * Fra_ClassesStart ( Aig_Man_t * pAig)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 60 of file fraClass.c.

61{
62 Fra_Cla_t * p;
63 p = ABC_ALLOC( Fra_Cla_t, 1 );
64 memset( p, 0, sizeof(Fra_Cla_t) );
65 p->pAig = pAig;
66 p->pMemRepr = ABC_ALLOC( Aig_Obj_t *, Aig_ManObjNumMax(pAig) );
67 memset( p->pMemRepr, 0, sizeof(Aig_Obj_t *) * Aig_ManObjNumMax(pAig) );
68 p->vClasses = Vec_PtrAlloc( 100 );
69 p->vClasses1 = Vec_PtrAlloc( 100 );
70 p->vClassesTemp = Vec_PtrAlloc( 100 );
71 p->vClassOld = Vec_PtrAlloc( 100 );
72 p->vClassNew = Vec_PtrAlloc( 100 );
73 p->pFuncNodeHash = Fra_SmlNodeHash;
74 p->pFuncNodeIsConst = Fra_SmlNodeIsConst;
75 p->pFuncNodesAreEqual = Fra_SmlNodesAreEqual;
76 return p;
77}
int Fra_SmlNodeHash(Aig_Obj_t *pObj, int nTableSize)
DECLARATIONS ///.
Definition fraSim.c:46
struct Fra_Cla_t_ Fra_Cla_t
Definition fra.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ClassesStop()

void Fra_ClassesStop ( Fra_Cla_t * p)
extern

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

Synopsis [Stop representation of equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file fraClass.c.

91{
92 ABC_FREE( p->pMemClasses );
93 ABC_FREE( p->pMemRepr );
94 if ( p->vClassesTemp ) Vec_PtrFree( p->vClassesTemp );
95 if ( p->vClassNew ) Vec_PtrFree( p->vClassNew );
96 if ( p->vClassOld ) Vec_PtrFree( p->vClassOld );
97 if ( p->vClasses1 ) Vec_PtrFree( p->vClasses1 );
98 if ( p->vClasses ) Vec_PtrFree( p->vClasses );
99 if ( p->vImps ) Vec_IntFree( p->vImps );
100 ABC_FREE( p );
101}
Here is the caller graph for this function:

◆ Fra_ClassesTest()

void Fra_ClassesTest ( Fra_Cla_t * p,
int Id1,
int Id2 )
extern

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

Synopsis [Starts representation of equivalence classes with one class.]

Description []

SideEffects []

SeeAlso []

Definition at line 590 of file fraClass.c.

591{
592 Aig_Obj_t ** pClass;
593 p->pMemClasses = ABC_ALLOC( Aig_Obj_t *, 4 );
594 pClass = p->pMemClasses;
595 assert( Id1 < Id2 );
596 pClass[0] = Aig_ManObj( p->pAig, Id1 );
597 pClass[1] = Aig_ManObj( p->pAig, Id2 );
598 pClass[2] = NULL;
599 pClass[3] = NULL;
600 Fra_ClassObjSetRepr( pClass[1], pClass[0] );
601 Vec_PtrPush( p->vClasses, pClass );
602}

◆ Fra_CnfNodeAddToSolver()

void Fra_CnfNodeAddToSolver ( Fra_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew )
extern

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

Synopsis [Updates the solver clause database.]

Description []

SideEffects []

SeeAlso []

Definition at line 238 of file fraCnf.c.

239{
240 Vec_Ptr_t * vFrontier, * vFanins;
241 Aig_Obj_t * pNode, * pFanin;
242 int i, k, fUseMuxes = 1;
243 assert( pOld || pNew );
244 // quit if CNF is ready
245 if ( (!pOld || Fra_ObjFaninVec(pOld)) && (!pNew || Fra_ObjFaninVec(pNew)) )
246 return;
247 // start the frontier
248 vFrontier = Vec_PtrAlloc( 100 );
249 if ( pOld ) Fra_ObjAddToFrontier( p, pOld, vFrontier );
250 if ( pNew ) Fra_ObjAddToFrontier( p, pNew, vFrontier );
251 // explore nodes in the frontier
252 Vec_PtrForEachEntry( Aig_Obj_t *, vFrontier, pNode, i )
253 {
254 // create the supergate
255 assert( Fra_ObjSatNum(pNode) );
256 assert( Fra_ObjFaninVec(pNode) == NULL );
257 if ( fUseMuxes && Aig_ObjIsMuxType(pNode) )
258 {
259 vFanins = Vec_PtrAlloc( 4 );
260 Vec_PtrPushUnique( vFanins, Aig_ObjFanin0( Aig_ObjFanin0(pNode) ) );
261 Vec_PtrPushUnique( vFanins, Aig_ObjFanin0( Aig_ObjFanin1(pNode) ) );
262 Vec_PtrPushUnique( vFanins, Aig_ObjFanin1( Aig_ObjFanin0(pNode) ) );
263 Vec_PtrPushUnique( vFanins, Aig_ObjFanin1( Aig_ObjFanin1(pNode) ) );
264 Vec_PtrForEachEntry( Aig_Obj_t *, vFanins, pFanin, k )
265 Fra_ObjAddToFrontier( p, Aig_Regular(pFanin), vFrontier );
266 Fra_AddClausesMux( p, pNode );
267 }
268 else
269 {
270 vFanins = Fra_CollectSuper( pNode, fUseMuxes );
271 Vec_PtrForEachEntry( Aig_Obj_t *, vFanins, pFanin, k )
272 Fra_ObjAddToFrontier( p, Aig_Regular(pFanin), vFrontier );
273 Fra_AddClausesSuper( p, pNode, vFanins );
274 }
275 assert( Vec_PtrSize(vFanins) > 1 );
276 Fra_ObjSetFaninVec( pNode, vFanins );
277 }
278 Vec_PtrFree( vFrontier );
279}
int Aig_ObjIsMuxType(Aig_Obj_t *pObj)
Definition aigUtil.c:307
void Fra_AddClausesSuper(Fra_Man_t *p, Aig_Obj_t *pNode, Vec_Ptr_t *vSuper)
Definition fraCnf.c:129
void Fra_ObjAddToFrontier(Fra_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vFrontier)
Definition fraCnf.c:213
Vec_Ptr_t * Fra_CollectSuper(Aig_Obj_t *pObj, int fUseMuxes)
Definition fraCnf.c:192
ABC_NAMESPACE_IMPL_START void Fra_AddClausesMux(Fra_Man_t *p, Aig_Obj_t *pNode)
DECLARATIONS ///.
Definition fraCnf.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigCec()

int Fra_FraigCec ( Aig_Man_t ** ppAig,
int nConfLimit,
int fVerbose )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file fraCec.c.

321{
322 int nBTLimitStart = 300; // starting SAT run
323 int nBTLimitFirst = 2; // first fraiging iteration
324 int nBTLimitLast = nConfLimit; // the last-gasp SAT run
325
326 Fra_Par_t Params, * pParams = &Params;
327 Aig_Man_t * pAig = *ppAig, * pTemp;
328 int i, RetValue;
329 abctime clk;
330
331 // report the original miter
332 if ( fVerbose )
333 {
334 printf( "Original miter: Nodes = %6d.\n", Aig_ManNodeNum(pAig) );
335 }
336 RetValue = Fra_FraigMiterStatus( pAig );
337// assert( RetValue == -1 );
338 if ( RetValue == 0 )
339 {
340 pAig->pData = ABC_ALLOC( int, Aig_ManCiNum(pAig) );
341 memset( pAig->pData, 0, sizeof(int) * Aig_ManCiNum(pAig) );
342 return RetValue;
343 }
344
345 // if SAT only, solve without iteration
346clk = Abc_Clock();
347 RetValue = Fra_FraigSat( pAig, (ABC_INT64_T)2*nBTLimitStart, (ABC_INT64_T)0, 0, 0, 0, 1, 0, 0, 0 );
348 if ( fVerbose )
349 {
350 printf( "Initial SAT: Nodes = %6d. ", Aig_ManNodeNum(pAig) );
351ABC_PRT( "Time", Abc_Clock() - clk );
352 }
353 if ( RetValue >= 0 )
354 return RetValue;
355
356 // duplicate the AIG
357clk = Abc_Clock();
358 pAig = Dar_ManRwsat( pTemp = pAig, 1, 0 );
359 Aig_ManStop( pTemp );
360 if ( fVerbose )
361 {
362 printf( "Rewriting: Nodes = %6d. ", Aig_ManNodeNum(pAig) );
363ABC_PRT( "Time", Abc_Clock() - clk );
364 }
365
366 // perform the loop
367 Fra_ParamsDefault( pParams );
368 pParams->nBTLimitNode = nBTLimitFirst;
369 pParams->nBTLimitMiter = nBTLimitStart;
370 pParams->fDontShowBar = 1;
371 pParams->fProve = 1;
372 for ( i = 0; i < 6; i++ )
373 {
374//printf( "Running fraiging with %d BTnode and %d BTmiter.\n", pParams->nBTLimitNode, pParams->nBTLimitMiter );
375 // try XOR balancing
376 if ( Aig_ManCountXors(pAig) * 30 > Aig_ManNodeNum(pAig) + 300 )
377 {
378clk = Abc_Clock();
379 pAig = Dar_ManBalanceXor( pTemp = pAig, 1, 0, 0 );
380 Aig_ManStop( pTemp );
381 if ( fVerbose )
382 {
383 printf( "Balance-X: Nodes = %6d. ", Aig_ManNodeNum(pAig) );
384ABC_PRT( "Time", Abc_Clock() - clk );
385 }
386 }
387
388 // run fraiging
389clk = Abc_Clock();
390 pAig = Fra_FraigPerform( pTemp = pAig, pParams );
391 Aig_ManStop( pTemp );
392 if ( fVerbose )
393 {
394 printf( "Fraiging (i=%d): Nodes = %6d. ", i+1, Aig_ManNodeNum(pAig) );
395ABC_PRT( "Time", Abc_Clock() - clk );
396 }
397
398 // check the miter status
399 RetValue = Fra_FraigMiterStatus( pAig );
400 if ( RetValue >= 0 )
401 break;
402
403 // perform rewriting
404clk = Abc_Clock();
405 pAig = Dar_ManRewriteDefault( pTemp = pAig );
406 Aig_ManStop( pTemp );
407 if ( fVerbose )
408 {
409 printf( "Rewriting: Nodes = %6d. ", Aig_ManNodeNum(pAig) );
410ABC_PRT( "Time", Abc_Clock() - clk );
411 }
412
413 // check the miter status
414 RetValue = Fra_FraigMiterStatus( pAig );
415 if ( RetValue >= 0 )
416 break;
417 // try simulation
418
419 // set the parameters for the next run
420 pParams->nBTLimitNode = 8 * pParams->nBTLimitNode;
421 pParams->nBTLimitMiter = 2 * pParams->nBTLimitMiter;
422 }
423
424 // if still unsolved try last gasp
425 if ( RetValue == -1 )
426 {
427clk = Abc_Clock();
428 RetValue = Fra_FraigSat( pAig, (ABC_INT64_T)nBTLimitLast, (ABC_INT64_T)0, 0, 0, 0, 1, 0, 0, 0 );
429 if ( fVerbose )
430 {
431 printf( "Final SAT: Nodes = %6d. ", Aig_ManNodeNum(pAig) );
432ABC_PRT( "Time", Abc_Clock() - clk );
433 }
434 }
435
436 *ppAig = pAig;
437 return RetValue;
438}
Aig_Man_t * Dar_ManBalanceXor(Aig_Man_t *pAig, int fExor, int fUpdateLevel, int fVerbose)
Definition darBalance.c:687
Aig_Man_t * Dar_ManRewriteDefault(Aig_Man_t *pAig)
DECLARATIONS ///.
Definition darScript.c:48
ABC_NAMESPACE_IMPL_START int Fra_FraigSat(Aig_Man_t *pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int nLearnedStart, int nLearnedDelta, int nLearnedPerce, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose)
DECLARATIONS ///.
Definition fraCec.c:47
int Aig_ManCountXors(Aig_Man_t *p)
Definition fraCec.c:298
typedefABC_NAMESPACE_HEADER_START struct Fra_Par_t_ Fra_Par_t
INCLUDES ///.
Definition fra.h:53
Aig_Man_t * Fra_FraigPerform(Aig_Man_t *pManAig, Fra_Par_t *pPars)
Definition fraCore.c:375
int Fra_FraigMiterStatus(Aig_Man_t *p)
DECLARATIONS ///.
Definition fraCore.c:62
void Fra_ParamsDefault(Fra_Par_t *pParams)
DECLARATIONS ///.
Definition fraMan.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigCecPartitioned()

int Fra_FraigCecPartitioned ( Aig_Man_t * pMan1,
Aig_Man_t * pMan2,
int nConfLimit,
int nPartSize,
int fSmart,
int fVerbose )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 451 of file fraCec.c.

452{
453 Aig_Man_t * pAig;
454 Vec_Ptr_t * vParts;
455 int i, RetValue = 1, nOutputs;
456 // create partitions
457 vParts = Aig_ManMiterPartitioned( pMan1, pMan2, nPartSize, fSmart );
458 // solve the partitions
459 nOutputs = -1;
460 Vec_PtrForEachEntry( Aig_Man_t *, vParts, pAig, i )
461 {
462 nOutputs++;
463 if ( fVerbose )
464 {
465 printf( "Verifying part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
466 i+1, Vec_PtrSize(vParts), Aig_ManCiNum(pAig), Aig_ManCoNum(pAig),
467 Aig_ManNodeNum(pAig), Aig_ManLevelNum(pAig) );
468 fflush( stdout );
469 }
470 RetValue = Fra_FraigMiterStatus( pAig );
471 if ( RetValue == 1 )
472 continue;
473 if ( RetValue == 0 )
474 break;
475 RetValue = Fra_FraigCec( &pAig, nConfLimit, 0 );
476 Vec_PtrWriteEntry( vParts, i, pAig );
477 if ( RetValue == 1 )
478 continue;
479 if ( RetValue == 0 )
480 break;
481 break;
482 }
483 // clear the result
484 if ( fVerbose )
485 {
486 printf( " \r" );
487 fflush( stdout );
488 }
489 // report the timeout
490 if ( RetValue == -1 )
491 {
492 printf( "Timed out after verifying %d partitions (out of %d).\n", nOutputs, Vec_PtrSize(vParts) );
493 fflush( stdout );
494 }
495 // free intermediate results
496 Vec_PtrForEachEntry( Aig_Man_t *, vParts, pAig, i )
497 Aig_ManStop( pAig );
498 Vec_PtrFree( vParts );
499 return RetValue;
500}
Vec_Ptr_t * Aig_ManMiterPartitioned(Aig_Man_t *p1, Aig_Man_t *p2, int nPartSize, int fSmart)
Definition aigPart.c:1189
int Fra_FraigCec(Aig_Man_t **ppAig, int nConfLimit, int fVerbose)
Definition fraCec.c:320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigChoice()

Aig_Man_t * Fra_FraigChoice ( Aig_Man_t * pManAig,
int nConfMax,
int nLevelMax )
extern

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

Synopsis [Performs choicing of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 442 of file fraCore.c.

443{
444 Fra_Par_t Pars, * pPars = &Pars;
445 Fra_ParamsDefault( pPars );
446 pPars->nBTLimitNode = nConfMax;
447 pPars->fChoicing = 1;
448 pPars->fDoSparse = 1;
449 pPars->fSpeculate = 0;
450 pPars->fProve = 0;
451 pPars->fVerbose = 0;
452 pPars->fDontShowBar = 1;
453 pPars->nLevelMax = nLevelMax;
454 return Fra_FraigPerform( pManAig, pPars );
455}
Aig_Man_t * Fra_FraigPerform(Aig_Man_t *pManAig, Fra_Par_t *pPars)
Definition fraCore.c:375
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigEquivence()

Aig_Man_t * Fra_FraigEquivence ( Aig_Man_t * pManAig,
int nConfMax,
int fProve )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 468 of file fraCore.c.

469{
470 Aig_Man_t * pFraig;
471 Fra_Par_t Pars, * pPars = &Pars;
472 Fra_ParamsDefault( pPars );
473 pPars->nBTLimitNode = nConfMax;
474 pPars->fChoicing = 0;
475 pPars->fDoSparse = 1;
476 pPars->fSpeculate = 0;
477 pPars->fProve = fProve;
478 pPars->fVerbose = 0;
479 pPars->fDontShowBar = 1;
480 pFraig = Fra_FraigPerform( pManAig, pPars );
481 return pFraig;
482}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigInduction()

Aig_Man_t * Fra_FraigInduction ( Aig_Man_t * pManAig,
Fra_Ssw_t * pParams )
extern

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

Synopsis [Performs sequential SAT sweeping.]

Description []

SideEffects []

SeeAlso []

Definition at line 344 of file fraInd.c.

345{
346 int fUseSimpleCnf = 0;
347 int fUseOldSimulation = 0;
348 // other paramaters affecting performance
349 // - presence of FRAIGing in Abc_NtkDarSeqSweep()
350 // - using distance-1 patterns in Fra_SmlAssignDist1()
351 // - the number of simulation patterns
352 // - the number of BMC frames
353
354 Fra_Man_t * p;
355 Fra_Par_t Pars, * pPars = &Pars;
356 Aig_Obj_t * pObj;
357 Cnf_Dat_t * pCnf;
358 Aig_Man_t * pManAigNew = NULL;
359 int nNodesBeg, nRegsBeg;
360 int nIter = -1; // Suppress "might be used uninitialized"
361 int i;
362 abctime clk = Abc_Clock(), clk2;
363 abctime TimeToStop = pParams->TimeLimit ? pParams->TimeLimit * CLOCKS_PER_SEC + Abc_Clock() : 0;
364
365 if ( Aig_ManNodeNum(pManAig) == 0 )
366 {
367 pParams->nIters = 0;
368 // Ntl_ManFinalize() needs the following to satisfy an assertion
369 Aig_ManReprStart(pManAig,Aig_ManObjNumMax(pManAig));
370 return Aig_ManDupOrdered(pManAig);
371 }
372 assert( Aig_ManRegNum(pManAig) > 0 );
373 assert( pParams->nFramesK > 0 );
374//Aig_ManShow( pManAig, 0, NULL );
375
376 if ( pParams->fWriteImps && pParams->nPartSize > 0 )
377 {
378 pParams->nPartSize = 0;
379 printf( "Partitioning was disabled to allow implication writing.\n" );
380 }
381 // perform partitioning
382 if ( (pParams->nPartSize > 0 && pParams->nPartSize < Aig_ManRegNum(pManAig))
383 || (pManAig->vClockDoms && Vec_VecSize(pManAig->vClockDoms) > 0) )
384 return Fra_FraigInductionPart( pManAig, pParams );
385
386 nNodesBeg = Aig_ManNodeNum(pManAig);
387 nRegsBeg = Aig_ManRegNum(pManAig);
388
389 // enhance the AIG by adding timeframes
390// Fra_FramesAddMore( pManAig, 3 );
391
392 // get parameters
393 Fra_ParamsDefaultSeq( pPars );
394 pPars->nFramesP = pParams->nFramesP;
395 pPars->nFramesK = pParams->nFramesK;
396 pPars->nMaxImps = pParams->nMaxImps;
397 pPars->nMaxLevs = pParams->nMaxLevs;
398 pPars->fVerbose = pParams->fVerbose;
399 pPars->fRewrite = pParams->fRewrite;
400 pPars->fLatchCorr = pParams->fLatchCorr;
401 pPars->fUseImps = pParams->fUseImps;
402 pPars->fWriteImps = pParams->fWriteImps;
403 pPars->fUse1Hot = pParams->fUse1Hot;
404
405 assert( !(pPars->nFramesP > 0 && pPars->fUse1Hot) );
406 assert( !(pPars->nFramesK > 1 && pPars->fUse1Hot) );
407
408 // start the fraig manager for this run
409 p = Fra_ManStart( pManAig, pPars );
410 p->pPars->nBTLimitNode = 0;
411 // derive and refine e-classes using K initialized frames
412 if ( fUseOldSimulation )
413 {
414 if ( pPars->nFramesP > 0 )
415 {
416 pPars->nFramesP = 0;
417 printf( "Fra_FraigInduction(): Prefix cannot be used.\n" );
418 }
419 p->pSml = Fra_SmlStart( pManAig, 0, pPars->nFramesK + 1, pPars->nSimWords );
420 Fra_SmlSimulate( p, 1 );
421 }
422 else
423 {
424 // bug: r iscas/blif/s5378.blif ; st; ssw -v
425 // bug: r iscas/blif/s1238.blif ; st; ssw -v
426 // refine the classes with more simulation rounds
427if ( pPars->fVerbose )
428printf( "Simulating %d AIG nodes for %d cycles ... ", Aig_ManNodeNum(pManAig), pPars->nFramesP + 32 );
429 p->pSml = Fra_SmlSimulateSeq( pManAig, pPars->nFramesP, 32, 1, 1 ); //pPars->nFramesK + 1, 1 );
430if ( pPars->fVerbose )
431{
432ABC_PRT( "Time", Abc_Clock() - clk );
433}
434 Fra_ClassesPrepare( p->pCla, p->pPars->fLatchCorr, p->pPars->nMaxLevs );
435// Fra_ClassesPostprocess( p->pCla );
436 // compute one-hotness conditions
437 if ( p->pPars->fUse1Hot )
438 p->vOneHots = Fra_OneHotCompute( p, p->pSml );
439 // allocate new simulation manager for simulating counter-examples
440 Fra_SmlStop( p->pSml );
441 p->pSml = Fra_SmlStart( pManAig, 0, pPars->nFramesK + 1, pPars->nSimWords );
442 }
443
444 // select the most expressive implications
445 if ( pPars->fUseImps )
446 p->pCla->vImps = Fra_ImpDerive( p, 5000000, pPars->nMaxImps, pPars->fLatchCorr );
447
448 if ( pParams->TimeLimit != 0.0 && Abc_Clock() > TimeToStop )
449 {
450 if ( !pParams->fSilent )
451 printf( "Fra_FraigInduction(): Runtime limit exceeded.\n" );
452 goto finish;
453 }
454
455 // perform BMC (for the min number of frames)
456 Fra_BmcPerform( p, pPars->nFramesP, pPars->nFramesK+1 ); // +1 is needed to prevent non-refinement
457//Fra_ClassesPrint( p->pCla, 1 );
458// if ( p->vCex == NULL )
459// p->vCex = Vec_IntAlloc( 1000 );
460
461 p->nLitsBeg = Fra_ClassesCountLits( p->pCla );
462 p->nNodesBeg = nNodesBeg; // Aig_ManNodeNum(pManAig);
463 p->nRegsBeg = nRegsBeg; // Aig_ManRegNum(pManAig);
464
465 // dump AIG of the timeframes
466// pManAigNew = Fra_ClassesDeriveAig( p->pCla, pPars->nFramesK );
467// Aig_ManDumpBlif( pManAigNew, "frame_aig.blif", NULL, NULL );
468// Fra_ManPartitionTest2( pManAigNew );
469// Aig_ManStop( pManAigNew );
470
471 // iterate the inductive case
472 p->pCla->fRefinement = 1;
473 for ( nIter = 0; p->pCla->fRefinement; nIter++ )
474 {
475 int nLitsOld = Fra_ClassesCountLits(p->pCla);
476 int nImpsOld = p->pCla->vImps? Vec_IntSize(p->pCla->vImps) : 0;
477 int nHotsOld = p->vOneHots? Fra_OneHotCount(p, p->vOneHots) : 0;
478 abctime clk3 = Abc_Clock();
479
480 if ( pParams->TimeLimit != 0.0 && Abc_Clock() > TimeToStop )
481 {
482 if ( !pParams->fSilent )
483 printf( "Fra_FraigInduction(): Runtime limit exceeded.\n" );
484 goto finish;
485 }
486
487 // mark the classes as non-refined
488 p->pCla->fRefinement = 0;
489 // derive non-init K-timeframes while implementing e-classes
490clk2 = Abc_Clock();
491 p->pManFraig = Fra_FramesWithClasses( p );
492p->timeTrav += Abc_Clock() - clk2;
493//Aig_ManDumpBlif( p->pManFraig, "testaig.blif", NULL, NULL );
494
495 // perform AIG rewriting
496 if ( p->pPars->fRewrite )
498
499 // convert the manager to SAT solver (the last nLatches outputs are inputs)
500 if ( fUseSimpleCnf || pPars->fUseImps )
501 pCnf = Cnf_DeriveSimple( p->pManFraig, Aig_ManRegNum(p->pManFraig) );
502 else
503 pCnf = Cnf_Derive( p->pManFraig, Aig_ManRegNum(p->pManFraig) );
504// Cnf_DataTranformPolarity( pCnf, 0 );
505//Cnf_DataWriteIntoFile( pCnf, "temp.cnf", 1 );
506
507 p->pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
508 p->nSatVars = pCnf->nVars;
509 assert( p->pSat != NULL );
510 if ( p->pSat == NULL )
511 printf( "Fra_FraigInduction(): Computed CNF is not valid.\n" );
512 if ( pPars->fUseImps )
513 {
514 Fra_ImpAddToSolver( p, p->pCla->vImps, pCnf->pVarNums );
515 if ( p->pSat == NULL )
516 printf( "Fra_FraigInduction(): Adding implicationsn to CNF led to a conflict.\n" );
517 }
518
519 // set the pointers to the manager
520 Aig_ManForEachObj( p->pManFraig, pObj, i )
521 pObj->pData = p;
522
523 // prepare solver for fraiging the last timeframe
524 Fra_ManClean( p, Aig_ManObjNumMax(p->pManFraig) + Aig_ManNodeNum(p->pManAig) );
525
526 // transfer PI/LO variable numbers
527 Aig_ManForEachObj( p->pManFraig, pObj, i )
528 {
529 if ( pCnf->pVarNums[pObj->Id] == -1 )
530 continue;
531 Fra_ObjSetSatNum( pObj, pCnf->pVarNums[pObj->Id] );
532 Fra_ObjSetFaninVec( pObj, (Vec_Ptr_t *)1 );
533 }
534 Cnf_DataFree( pCnf );
535
536 // add one-hotness clauses
537 if ( p->pPars->fUse1Hot )
538 Fra_OneHotAssume( p, p->vOneHots );
539// if ( p->pManAig->vOnehots )
540// Fra_OneHotAddKnownConstraint( p, p->pManAig->vOnehots );
541
542 // report the intermediate results
543 if ( pPars->fVerbose )
544 {
545 printf( "%3d : C = %6d. Cl = %6d. L = %6d. LR = %6d. ",
546 nIter, Vec_PtrSize(p->pCla->vClasses1), Vec_PtrSize(p->pCla->vClasses),
547 Fra_ClassesCountLits(p->pCla), p->pManFraig->nAsserts );
548 if ( p->pCla->vImps )
549 printf( "I = %6d. ", Vec_IntSize(p->pCla->vImps) );
550 if ( p->pPars->fUse1Hot )
551 printf( "1h = %6d. ", Fra_OneHotCount(p, p->vOneHots) );
552 printf( "NR = %6d. ", Aig_ManNodeNum(p->pManFraig) );
553// printf( "\n" );
554 }
555
556 // perform sweeping
557 p->nSatCallsRecent = 0;
558 p->nSatCallsSkipped = 0;
559clk2 = Abc_Clock();
560 if ( p->pPars->fUse1Hot )
561 Fra_OneHotCheck( p, p->vOneHots );
562 Fra_FraigSweep( p );
563 if ( pPars->fVerbose )
564 {
565 ABC_PRT( "T", Abc_Clock() - clk3 );
566 }
567
568// Sat_SolverPrintStats( stdout, p->pSat );
569 // remove FRAIG and SAT solver
570 Aig_ManStop( p->pManFraig ); p->pManFraig = NULL;
571// printf( "Vars = %d. Clauses = %d. Learnts = %d.\n", p->pSat->size, p->pSat->clauses.size, p->pSat->learnts.size );
572 sat_solver_delete( p->pSat ); p->pSat = NULL;
573 memset( p->pMemFraig, 0, sizeof(Aig_Obj_t *) * p->nSizeAlloc * p->nFramesAll );
574// printf( "Recent SAT called = %d. Skipped = %d.\n", p->nSatCallsRecent, p->nSatCallsSkipped );
575 assert( p->vTimeouts == NULL );
576 if ( p->vTimeouts )
577 printf( "Fra_FraigInduction(): SAT solver timed out!\n" );
578 // check if refinement has happened
579// p->pCla->fRefinement = (int)(nLitsOld != Fra_ClassesCountLits(p->pCla));
580 if ( p->pCla->fRefinement &&
581 nLitsOld == Fra_ClassesCountLits(p->pCla) &&
582 nImpsOld == (p->pCla->vImps? Vec_IntSize(p->pCla->vImps) : 0) &&
583 nHotsOld == (p->vOneHots? Fra_OneHotCount(p, p->vOneHots) : 0) )
584 {
585 printf( "Fra_FraigInduction(): Internal error. The result may not verify.\n" );
586 break;
587 }
588 }
589/*
590 // verify implications using simulation
591 if ( p->pCla->vImps && Vec_IntSize(p->pCla->vImps) )
592 {
593 int Temp;
594 abctime clk = Abc_Clock();
595 if ( Temp = Fra_ImpVerifyUsingSimulation( p ) )
596 printf( "Implications failing the simulation test = %d (out of %d). ", Temp, Vec_IntSize(p->pCla->vImps) );
597 else
598 printf( "All %d implications have passed the simulation test. ", Vec_IntSize(p->pCla->vImps) );
599 ABC_PRT( "Time", Abc_Clock() - clk );
600 }
601*/
602
603 // move the classes into representatives and reduce AIG
604clk2 = Abc_Clock();
605 if ( p->pPars->fWriteImps && p->vOneHots && Fra_OneHotCount(p, p->vOneHots) )
606 {
607 extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact );
608 Aig_Man_t * pNew;
609 char * pFileName = Ioa_FileNameGenericAppend( p->pManAig->pName, "_care.aig" );
610 printf( "Care one-hotness clauses will be written into file \"%s\".\n", pFileName );
611 pManAigNew = Aig_ManDupOrdered( pManAig );
612 pNew = Fra_OneHotCreateExdc( p, p->vOneHots );
613 Ioa_WriteAiger( pNew, pFileName, 0, 1 );
614 Aig_ManStop( pNew );
615 }
616 else
617 {
618 // Fra_ClassesPrint( p->pCla, 1 );
619 Fra_ClassesSelectRepr( p->pCla );
620 Fra_ClassesCopyReprs( p->pCla, p->vTimeouts );
621 pManAigNew = Aig_ManDupRepr( pManAig, 0 );
622 }
623 // add implications to the manager
624// if ( fWriteImps && p->pCla->vImps && Vec_IntSize(p->pCla->vImps) )
625// Fra_ImpRecordInManager( p, pManAigNew );
626 // cleanup the new manager
627 Aig_ManSeqCleanup( pManAigNew );
628 // remove pointers to the dead nodes
629// Aig_ManForEachObj( pManAig, pObj, i )
630// if ( pObj->pData && Aig_ObjIsNone(pObj->pData) )
631// pObj->pData = NULL;
632// Aig_ManCountMergeRegs( pManAigNew );
633p->timeTrav += Abc_Clock() - clk2;
634p->timeTotal = Abc_Clock() - clk;
635 // get the final stats
636 p->nLitsEnd = Fra_ClassesCountLits( p->pCla );
637 p->nNodesEnd = Aig_ManNodeNum(pManAigNew);
638 p->nRegsEnd = Aig_ManRegNum(pManAigNew);
639 // free the manager
640finish:
641 Fra_ManStop( p );
642 // check the output
643// if ( Aig_ManCoNum(pManAigNew) - Aig_ManRegNum(pManAigNew) == 1 )
644// if ( Aig_ObjChild0( Aig_ManCo(pManAigNew,0) ) == Aig_ManConst0(pManAigNew) )
645// printf( "Proved output constant 0.\n" );
646 pParams->nIters = nIter;
647 return pManAigNew;
648}
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition aigRepr.c:267
Aig_Man_t * Aig_ManDupOrdered(Aig_Man_t *p)
Definition aigDup.c:277
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition aigScl.c:158
#define sat_solver
Definition cecSatG2.c:34
Cnf_Dat_t * Cnf_DeriveSimple(Aig_Man_t *p, int nOutputs)
Definition cnfWrite.c:587
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition cnfCore.c:165
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
Aig_Man_t * Fra_FramesWithClasses(Fra_Man_t *p)
Definition fraInd.c:130
ABC_NAMESPACE_IMPL_START void Fra_FraigInductionRewrite(Fra_Man_t *p)
DECLARATIONS ///.
Definition fraInd.c:48
Aig_Man_t * Fra_FraigInductionPart(Aig_Man_t *pAig, Fra_Ssw_t *pPars)
Definition fraInd.c:253
void Fra_ClassesCopyReprs(Fra_Cla_t *p, Vec_Ptr_t *vFailed)
Definition fraClass.c:114
void Fra_FraigSweep(Fra_Man_t *pManAig)
Definition fraCore.c:310
void Fra_SmlSimulate(Fra_Man_t *p, int fInit)
Definition fraSim.c:738
Vec_Int_t * Fra_OneHotCompute(Fra_Man_t *p, Fra_Sml_t *pSim)
Definition fraHot.c:134
void Fra_OneHotAssume(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:191
void Fra_ClassesPrepare(Fra_Cla_t *p, int fLatchCorr, int nMaxLevs)
Definition fraClass.c:276
Fra_Sml_t * Fra_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
Definition fraSim.c:813
Aig_Man_t * Fra_OneHotCreateExdc(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:398
Vec_Int_t * Fra_ImpDerive(Fra_Man_t *p, int nImpMaxLimit, int nImpUseLimit, int fLatchCorr)
Definition fraImp.c:321
void Fra_ManStop(Fra_Man_t *p)
Definition fraMan.c:240
Fra_Man_t * Fra_ManStart(Aig_Man_t *pManAig, Fra_Par_t *pParams)
Definition fraMan.c:104
void Fra_ImpAddToSolver(Fra_Man_t *p, Vec_Int_t *vImps, int *pSatVarNums)
Definition fraImp.c:428
void Fra_ClassesSelectRepr(Fra_Cla_t *p)
Definition fraClass.c:706
void Fra_OneHotCheck(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:229
Fra_Sml_t * Fra_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords, int fCheckMiter)
Definition fraSim.c:1027
void Fra_ManClean(Fra_Man_t *p, int nNodesMax)
Definition fraMan.c:145
int Fra_OneHotCount(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:303
void Fra_BmcPerform(Fra_Man_t *p, int nPref, int nDepth)
Definition fraBmc.c:311
void Fra_ParamsDefaultSeq(Fra_Par_t *pParams)
Definition fraMan.c:75
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
char * Ioa_FileNameGenericAppend(char *pBase, char *pSuffix)
Definition ioaUtil.c:93
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:579
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
int nVars
Definition cnf.h:59
int * pVarNums
Definition cnf.h:63
int fRewrite
Definition fra.h:102
int fUse1Hot
Definition fra.h:106
int fSilent
Definition fra.h:108
int nPartSize
Definition fra.h:94
int nFramesP
Definition fra.h:96
int nIters
Definition fra.h:109
int nMaxImps
Definition fra.h:98
int fLatchCorr
Definition fra.h:104
float TimeLimit
Definition fra.h:110
int fUseImps
Definition fra.h:101
int fVerbose
Definition fra.h:107
int fWriteImps
Definition fra.h:105
int nMaxLevs
Definition fra.h:99
int nFramesK
Definition fra.h:97
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigLatchCorrespondence()

Aig_Man_t * Fra_FraigLatchCorrespondence ( Aig_Man_t * pAig,
int nFramesP,
int nConfMax,
int fProve,
int fVerbose,
int * pnIter,
float TimeLimit )
extern

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

Synopsis [Performs choicing of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 531 of file fraLcr.c.

532{
533 int nPartSize = 200;
534 int fReprSelect = 0;
535 Fra_Lcr_t * p;
536 Fra_Sml_t * pSml;
537 Fra_Man_t * pTemp;
538 Aig_Man_t * pAigPart, * pAigTemp, * pAigNew = NULL;
539 Vec_Int_t * vPart;
540 int i, nIter;
541 abctime timeSim, clk2, clk3, clk = Abc_Clock();
542 abctime TimeToStop = TimeLimit ? TimeLimit * CLOCKS_PER_SEC + Abc_Clock() : 0;
543 if ( Aig_ManNodeNum(pAig) == 0 )
544 {
545 if ( pnIter ) *pnIter = 0;
546 // Ntl_ManFinalize() requires the following to satisfy an assertion.
547 Aig_ManReprStart(pAig,Aig_ManObjNumMax(pAig));
548 return Aig_ManDupOrdered(pAig);
549 }
550 assert( Aig_ManRegNum(pAig) > 0 );
551
552 // simulate the AIG
553clk2 = Abc_Clock();
554if ( fVerbose )
555printf( "Simulating AIG with %d nodes for %d cycles ... ", Aig_ManNodeNum(pAig), nFramesP + 32 );
556 pSml = Fra_SmlSimulateSeq( pAig, nFramesP, 32, 1, 1 );
557if ( fVerbose )
558{
559ABC_PRT( "Time", Abc_Clock() - clk2 );
560}
561timeSim = Abc_Clock() - clk2;
562
563 // check if simulation discovered non-constant-0 POs
564 if ( fProve && pSml->fNonConstOut )
565 {
566 pAig->pSeqModel = Fra_SmlGetCounterExample( pSml );
567 Fra_SmlStop( pSml );
568 return NULL;
569 }
570
571 // start the manager
572 p = Lcr_ManAlloc( pAig );
573 p->nFramesP = nFramesP;
574 p->fVerbose = fVerbose;
575 p->timeSim += timeSim;
576
577 pTemp = Fra_LcrAigPrepare( pAig );
578 pTemp->pBmc = (Fra_Bmc_t *)p;
579 pTemp->pSml = pSml;
580
581 // get preliminary info about equivalence classes
582 pTemp->pCla = p->pCla = Fra_ClassesStart( p->pAig );
583 Fra_ClassesPrepare( p->pCla, 1, 0 );
584 p->pCla->pFuncNodeIsConst = Fra_LcrNodeIsConst;
585 p->pCla->pFuncNodesAreEqual = Fra_LcrNodesAreEqual;
586 Fra_SmlStop( pTemp->pSml );
587
588 // partition the AIG for latch correspondence computation
589clk2 = Abc_Clock();
590if ( fVerbose )
591printf( "Partitioning AIG ... " );
593 p->vParts = (Vec_Ptr_t *)Aig_ManPartitionSmart( pAigPart, nPartSize, 0, NULL );
594 Fra_LcrRemapPartitions( p->vParts, p->pCla, p->pInToOutPart, p->pInToOutNum );
595 Aig_ManStop( pAigPart );
596if ( fVerbose )
597{
598ABC_PRT( "Time", Abc_Clock() - clk2 );
599p->timePart += Abc_Clock() - clk2;
600}
601
602 // get the initial stats
603 p->nLitsBeg = Fra_ClassesCountLits( p->pCla );
604 p->nNodesBeg = Aig_ManNodeNum(p->pAig);
605 p->nRegsBeg = Aig_ManRegNum(p->pAig);
606
607 // perform iterative reduction of the partitions
608 p->fRefining = 1;
609 for ( nIter = 0; p->fRefining; nIter++ )
610 {
611 p->fRefining = 0;
612 clk3 = Abc_Clock();
613 // derive AIGs for each partition
615 Vec_PtrClear( p->vFraigs );
616 Vec_PtrForEachEntry( Vec_Int_t *, p->vParts, vPart, i )
617 {
618 if ( TimeLimit != 0.0 && Abc_Clock() > TimeToStop )
619 {
620 Vec_PtrForEachEntry( Aig_Man_t *, p->vFraigs, pAigPart, i )
621 Aig_ManStop( pAigPart );
622 Aig_ManCleanMarkA( pAig );
623 Aig_ManCleanMarkB( pAig );
624 printf( "Fra_FraigLatchCorrespondence(): Runtime limit exceeded.\n" );
625 goto finish;
626 }
627clk2 = Abc_Clock();
628 pAigPart = Fra_LcrCreatePart( p, vPart );
629p->timeTrav += Abc_Clock() - clk2;
630clk2 = Abc_Clock();
631 pAigTemp = Fra_FraigEquivence( pAigPart, nConfMax, 0 );
632p->timeFraig += Abc_Clock() - clk2;
633 Vec_PtrPush( p->vFraigs, pAigTemp );
634/*
635 {
636 char Name[1000];
637 sprintf( Name, "part%04d.blif", i );
638 Aig_ManDumpBlif( pAigPart, Name, NULL, NULL );
639 }
640printf( "Finished part %4d (out of %4d). ", i, Vec_PtrSize(p->vParts) );
641ABC_PRT( "Time", Abc_Clock() - clk3 );
642*/
643
644 Aig_ManStop( pAigPart );
645 }
647 // report the intermediate results
648 if ( fVerbose )
649 {
650 printf( "%3d : Const = %6d. Class = %6d. L = %6d. Part = %3d. ",
651 nIter, Vec_PtrSize(p->pCla->vClasses1), Vec_PtrSize(p->pCla->vClasses),
652 Fra_ClassesCountLits(p->pCla), Vec_PtrSize(p->vParts) );
653 ABC_PRT( "T", Abc_Clock() - clk3 );
654 }
655 // refine the classes
656 Fra_LcrAigPrepareTwo( p->pAig, pTemp );
657 if ( Fra_ClassesRefine( p->pCla ) )
658 p->fRefining = 1;
659 if ( Fra_ClassesRefine1( p->pCla, 0, NULL ) )
660 p->fRefining = 1;
661 // clean the fraigs
662 Vec_PtrForEachEntry( Aig_Man_t *, p->vFraigs, pAigPart, i )
663 Aig_ManStop( pAigPart );
664
665 // repartition if needed
666 if ( 1 )
667 {
668clk2 = Abc_Clock();
669 Vec_VecFree( (Vec_Vec_t *)p->vParts );
671 p->vParts = (Vec_Ptr_t *)Aig_ManPartitionSmart( pAigPart, nPartSize, 0, NULL );
672 Fra_LcrRemapPartitions( p->vParts, p->pCla, p->pInToOutPart, p->pInToOutNum );
673 Aig_ManStop( pAigPart );
674p->timePart += Abc_Clock() - clk2;
675 }
676 }
677 p->nIters = nIter;
678
679 // move the classes into representatives and reduce AIG
680clk2 = Abc_Clock();
681// Fra_ClassesPrint( p->pCla, 1 );
682 if ( fReprSelect )
683 Fra_ClassesSelectRepr( p->pCla );
684 Fra_ClassesCopyReprs( p->pCla, NULL );
685 pAigNew = Aig_ManDupRepr( p->pAig, 0 );
686 Aig_ManSeqCleanup( pAigNew );
687// Aig_ManCountMergeRegs( pAigNew );
688p->timeUpdate += Abc_Clock() - clk2;
689p->timeTotal = Abc_Clock() - clk;
690 // get the final stats
691 p->nLitsEnd = Fra_ClassesCountLits( p->pCla );
692 p->nNodesEnd = Aig_ManNodeNum(pAigNew);
693 p->nRegsEnd = Aig_ManRegNum(pAigNew);
694finish:
695 ABC_FREE( pTemp );
696 Lcr_ManFree( p );
697 if ( pnIter ) *pnIter = nIter;
698 return pAigNew;
699}
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition aigUtil.c:167
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition aigUtil.c:148
Vec_Ptr_t * Aig_ManPartitionSmart(Aig_Man_t *p, int nPartSizeLimit, int fVerbose, Vec_Ptr_t **pvPartSupps)
Definition aigPart.c:686
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Fra_ClassNodesUnmark(Fra_Lcr_t *p)
Definition fraLcr.c:498
int Fra_LcrNodeIsConst(Aig_Obj_t *pObj)
Definition fraLcr.c:239
Fra_Lcr_t * Lcr_ManAlloc(Aig_Man_t *pAig)
FUNCTION DEFINITIONS ///.
Definition fraLcr.c:80
Aig_Man_t * Fra_LcrCreatePart(Fra_Lcr_t *p, Vec_Int_t *vPart)
Definition fraLcr.c:429
void Fra_LcrRemapPartitions(Vec_Ptr_t *vParts, Fra_Cla_t *pCla, int *pInToOutPart, int *pInToOutNum)
Definition fraLcr.c:347
void Fra_ClassNodesMark(Fra_Lcr_t *p)
Definition fraLcr.c:465
void Fra_LcrAigPrepareTwo(Aig_Man_t *pAig, Fra_Man_t *p)
Definition fraLcr.c:182
typedefABC_NAMESPACE_IMPL_START struct Fra_Lcr_t_ Fra_Lcr_t
DECLARATIONS ///.
Definition fraLcr.c:30
Aig_Man_t * Fra_LcrDeriveAigForPartitioning(Fra_Lcr_t *pLcr)
Definition fraLcr.c:296
void Lcr_ManFree(Fra_Lcr_t *p)
Definition fraLcr.c:131
int Fra_LcrNodesAreEqual(Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition fraLcr.c:201
Fra_Cla_t * Fra_ClassesStart(Aig_Man_t *pAig)
FUNCTION DEFINITIONS ///.
Definition fraClass.c:60
Abc_Cex_t * Fra_SmlGetCounterExample(Fra_Sml_t *p)
Definition fraSim.c:1049
Fra_Cla_t * pCla
Definition fra.h:198
Fra_Sml_t * pSml
Definition fra.h:200
int fNonConstOut
Definition fra.h:179
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigMiterAssertedOutput()

int Fra_FraigMiterAssertedOutput ( Aig_Man_t * p)
extern

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file fraCore.c.

126{
127 Aig_Obj_t * pObj, * pChild;
128 int i;
129 Aig_ManForEachPoSeq( p, pObj, i )
130 {
131 pChild = Aig_ObjChild0(pObj);
132 // check if the output is constant 0
133 if ( pChild == Aig_ManConst0(p) )
134 continue;
135 // check if the output is constant 1
136 if ( pChild == Aig_ManConst1(p) )
137 return i;
138 // check if the output can be not constant 0
139 if ( Aig_Regular(pChild)->fPhase != (unsigned)Aig_IsComplement(pChild) )
140 return i;
141 }
142 return -1;
143}
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition aig.h:444
Here is the caller graph for this function:

◆ Fra_FraigMiterStatus()

int Fra_FraigMiterStatus ( Aig_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [fraCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraCore.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 62 of file fraCore.c.

63{
64 Aig_Obj_t * pObj, * pChild;
65 int i, CountConst0 = 0, CountNonConst0 = 0, CountUndecided = 0;
66 if ( p->pData )
67 return 0;
68 Aig_ManForEachPoSeq( p, pObj, i )
69 {
70 pChild = Aig_ObjChild0(pObj);
71 // check if the output is constant 0
72 if ( pChild == Aig_ManConst0(p) )
73 {
74 CountConst0++;
75 continue;
76 }
77 // check if the output is constant 1
78 if ( pChild == Aig_ManConst1(p) )
79 {
80 CountNonConst0++;
81 continue;
82 }
83 // check if the output is a primary input
84 if ( Aig_ObjIsCi(Aig_Regular(pChild)) && Aig_ObjCioId(Aig_Regular(pChild)) < p->nTruePis )
85 {
86 CountNonConst0++;
87 continue;
88 }
89 // check if the output can be not constant 0
90 if ( Aig_Regular(pChild)->fPhase != (unsigned)Aig_IsComplement(pChild) )
91 {
92 CountNonConst0++;
93 continue;
94 }
95 CountUndecided++;
96 }
97/*
98 if ( p->pParams->fVerbose )
99 {
100 printf( "Miter has %d outputs. ", Aig_ManCoNum(p->pManAig) );
101 printf( "Const0 = %d. ", CountConst0 );
102 printf( "NonConst0 = %d. ", CountNonConst0 );
103 printf( "Undecided = %d. ", CountUndecided );
104 printf( "\n" );
105 }
106*/
107 if ( CountNonConst0 )
108 return 0;
109 if ( CountUndecided )
110 return -1;
111 return 1;
112}
Here is the caller graph for this function:

◆ Fra_FraigPerform()

Aig_Man_t * Fra_FraigPerform ( Aig_Man_t * pManAig,
Fra_Par_t * pPars )
extern

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

Synopsis [Performs fraiging of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 375 of file fraCore.c.

376{
377 Fra_Man_t * p;
378 Aig_Man_t * pManAigNew;
379 abctime clk;
380 if ( Aig_ManNodeNum(pManAig) == 0 )
381 return Aig_ManDupOrdered(pManAig);
382clk = Abc_Clock();
383 p = Fra_ManStart( pManAig, pPars );
384 p->pManFraig = Fra_ManPrepareComb( p );
385 p->pSml = Fra_SmlStart( pManAig, 0, 1, pPars->nSimWords );
386 Fra_SmlSimulate( p, 0 );
387// if ( p->pPars->fChoicing )
388// Aig_ManReprStart( p->pManFraig, Aig_ManObjNumMax(p->pManAig) );
389 // collect initial states
390 p->nLitsBeg = Fra_ClassesCountLits( p->pCla );
391 p->nNodesBeg = Aig_ManNodeNum(pManAig);
392 p->nRegsBeg = Aig_ManRegNum(pManAig);
393 // perform fraig sweep
394if ( p->pPars->fVerbose )
395Fra_ClassesPrint( p->pCla, 1 );
396 Fra_FraigSweep( p );
397 // call back the procedure to check implications
398 if ( pManAig->pImpFunc )
399 pManAig->pImpFunc( p, pManAig->pImpData );
400 // no need to filter one-hot clauses because they satisfy base case by construction
401 // finalize the fraiged manager
403 if ( p->pPars->fChoicing )
404 {
405abctime clk2 = Abc_Clock();
406 Fra_ClassesCopyReprs( p->pCla, p->vTimeouts );
407 pManAigNew = Aig_ManDupRepr( p->pManAig, 1 );
408 Aig_ManReprStart( pManAigNew, Aig_ManObjNumMax(pManAigNew) );
409 Aig_ManTransferRepr( pManAigNew, p->pManAig );
410 Aig_ManMarkValidChoices( pManAigNew );
411 Aig_ManStop( p->pManFraig );
412 p->pManFraig = NULL;
413p->timeTrav += Abc_Clock() - clk2;
414 }
415 else
416 {
417 Fra_ClassesCopyReprs( p->pCla, p->vTimeouts );
418 Aig_ManCleanup( p->pManFraig );
419 pManAigNew = p->pManFraig;
420 p->pManFraig = NULL;
421 }
422p->timeTotal = Abc_Clock() - clk;
423 // collect final stats
424 p->nLitsEnd = Fra_ClassesCountLits( p->pCla );
425 p->nNodesEnd = Aig_ManNodeNum(pManAigNew);
426 p->nRegsEnd = Aig_ManRegNum(pManAigNew);
427 Fra_ManStop( p );
428 return pManAigNew;
429}
void Aig_ManMarkValidChoices(Aig_Man_t *p)
Definition aigRepr.c:481
void Aig_ManTransferRepr(Aig_Man_t *pNew, Aig_Man_t *p)
Definition aigRepr.c:211
void Fra_FraigSweep(Fra_Man_t *p)
Definition fraCore.c:310
Aig_Man_t * Fra_ManPrepareComb(Fra_Man_t *p)
Definition fraMan.c:176
void Fra_ManFinalizeComb(Fra_Man_t *p)
Definition fraMan.c:217
void Fra_ClassesPrint(Fra_Cla_t *p, int fVeryVerbose)
Definition fraClass.c:236
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigSat()

int Fra_FraigSat ( Aig_Man_t * pMan,
ABC_INT64_T nConfLimit,
ABC_INT64_T nInsLimit,
int nLearnedStart,
int nLearnedDelta,
int nLearnedPerce,
int fFlipBits,
int fAndOuts,
int fNewSolver,
int fVerbose )
extern

ITERATORS ///.

FUNCTION DECLARATIONS ///

ITERATORS ///.

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

FileName [fraCec.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis [CEC engined based on fraiging.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraCec.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file fraCec.c.

48{
49 if ( fNewSolver )
50 {
51 extern void * Cnf_DataWriteIntoSolver2( Cnf_Dat_t * p, int nFrames, int fInit );
52 extern int Cnf_DataWriteOrClause2( void * pSat, Cnf_Dat_t * pCnf );
53
54 sat_solver2 * pSat;
55 Cnf_Dat_t * pCnf;
56 int status, RetValue = 0;
57 abctime clk = Abc_Clock();
58 Vec_Int_t * vCiIds;
59
60 assert( Aig_ManRegNum(pMan) == 0 );
61 pMan->pData = NULL;
62
63 // derive CNF
64 pCnf = Cnf_Derive( pMan, Aig_ManCoNum(pMan) );
65 // pCnf = Cnf_DeriveSimple( pMan, Aig_ManCoNum(pMan) );
66
67 if ( fFlipBits )
68 Cnf_DataTranformPolarity( pCnf, 0 );
69
70 if ( fVerbose )
71 {
72 printf( "CNF stats: Vars = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
73 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
74 }
75
76 // convert into SAT solver
77 pSat = (sat_solver2 *)Cnf_DataWriteIntoSolver2( pCnf, 1, 0 );
78 if ( pSat == NULL )
79 {
80 Cnf_DataFree( pCnf );
81 return 1;
82 }
83
84 if ( fAndOuts )
85 {
86 // assert each output independently
87 if ( !Cnf_DataWriteAndClauses( pSat, pCnf ) )
88 {
89 sat_solver2_delete( pSat );
90 Cnf_DataFree( pCnf );
91 return 1;
92 }
93 }
94 else
95 {
96 // add the OR clause for the outputs
97 if ( !Cnf_DataWriteOrClause2( pSat, pCnf ) )
98 {
99 sat_solver2_delete( pSat );
100 Cnf_DataFree( pCnf );
101 return 1;
102 }
103 }
104 vCiIds = Cnf_DataCollectPiSatNums( pCnf, pMan );
105 Cnf_DataFree( pCnf );
106
107
108 printf( "Created SAT problem with %d variable and %d clauses. ", sat_solver2_nvars(pSat), sat_solver2_nclauses(pSat) );
109 ABC_PRT( "Time", Abc_Clock() - clk );
110
111 // simplify the problem
112 clk = Abc_Clock();
113 status = sat_solver2_simplify(pSat);
114// printf( "Simplified the problem to %d variables and %d clauses. ", sat_solver2_nvars(pSat), sat_solver2_nclauses(pSat) );
115// ABC_PRT( "Time", Abc_Clock() - clk );
116 if ( status == 0 )
117 {
118 Vec_IntFree( vCiIds );
119 sat_solver2_delete( pSat );
120 // printf( "The problem is UNSATISFIABLE after simplification.\n" );
121 return 1;
122 }
123
124 // solve the miter
125 clk = Abc_Clock();
126 if ( fVerbose )
127 pSat->verbosity = 1;
128 status = sat_solver2_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, (ABC_INT64_T)0, (ABC_INT64_T)0 );
129 if ( status == l_Undef )
130 {
131 // printf( "The problem timed out.\n" );
132 RetValue = -1;
133 }
134 else if ( status == l_True )
135 {
136 // printf( "The problem is SATISFIABLE.\n" );
137 RetValue = 0;
138 }
139 else if ( status == l_False )
140 {
141 // printf( "The problem is UNSATISFIABLE.\n" );
142 RetValue = 1;
143 }
144 else
145 assert( 0 );
146
147 // Abc_Print( 1, "The number of conflicts = %6d. ", (int)pSat->stats.conflicts );
148 // Abc_PrintTime( 1, "Solving time", Abc_Clock() - clk );
149
150 // if the problem is SAT, get the counterexample
151 if ( status == l_True )
152 {
153 pMan->pData = Sat_Solver2GetModel( pSat, vCiIds->pArray, vCiIds->nSize );
154 }
155 // free the sat_solver2
156 if ( fVerbose )
157 Sat_Solver2PrintStats( stdout, pSat );
158 //sat_solver2_store_write( pSat, "trace.cnf" );
159 //sat_solver2_store_free( pSat );
160 sat_solver2_delete( pSat );
161 Vec_IntFree( vCiIds );
162 return RetValue;
163 }
164 else
165 {
166 sat_solver * pSat;
167 Cnf_Dat_t * pCnf;
168 int status, RetValue = 0;
169 abctime clk = Abc_Clock();
170 Vec_Int_t * vCiIds;
171
172 assert( Aig_ManRegNum(pMan) == 0 );
173 pMan->pData = NULL;
174
175 // derive CNF
176 pCnf = Cnf_Derive( pMan, Aig_ManCoNum(pMan) );
177 // pCnf = Cnf_DeriveSimple( pMan, Aig_ManCoNum(pMan) );
178
179 if ( fFlipBits )
180 Cnf_DataTranformPolarity( pCnf, 0 );
181
182 if ( fVerbose )
183 {
184 printf( "CNF stats: Vars = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
185 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
186 }
187
188 // convert into SAT solver
189 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
190 if ( pSat == NULL )
191 {
192 Cnf_DataFree( pCnf );
193 return 1;
194 }
195
196 if ( nLearnedStart )
197 pSat->nLearntStart = pSat->nLearntMax = nLearnedStart;
198 if ( nLearnedDelta )
199 pSat->nLearntDelta = nLearnedDelta;
200 if ( nLearnedPerce )
201 pSat->nLearntRatio = nLearnedPerce;
202 if ( fVerbose )
203 pSat->fVerbose = fVerbose;
204
205 if ( fAndOuts )
206 {
207 // assert each output independently
208 if ( !Cnf_DataWriteAndClauses( pSat, pCnf ) )
209 {
210 sat_solver_delete( pSat );
211 Cnf_DataFree( pCnf );
212 return 1;
213 }
214 }
215 else
216 {
217 // add the OR clause for the outputs
218 if ( !Cnf_DataWriteOrClause( pSat, pCnf ) )
219 {
220 sat_solver_delete( pSat );
221 Cnf_DataFree( pCnf );
222 return 1;
223 }
224 }
225 vCiIds = Cnf_DataCollectPiSatNums( pCnf, pMan );
226 Cnf_DataFree( pCnf );
227
228
229 // printf( "Created SAT problem with %d variable and %d clauses. ", sat_solver_nvars(pSat), sat_solver_nclauses(pSat) );
230 // ABC_PRT( "Time", Abc_Clock() - clk );
231
232 // simplify the problem
233 clk = Abc_Clock();
234 status = sat_solver_simplify(pSat);
235 // printf( "Simplified the problem to %d variables and %d clauses. ", sat_solver_nvars(pSat), sat_solver_nclauses(pSat) );
236 // ABC_PRT( "Time", Abc_Clock() - clk );
237 if ( status == 0 )
238 {
239 Vec_IntFree( vCiIds );
240 sat_solver_delete( pSat );
241 // printf( "The problem is UNSATISFIABLE after simplification.\n" );
242 return 1;
243 }
244
245 // solve the miter
246 clk = Abc_Clock();
247// if ( fVerbose )
248// pSat->verbosity = 1;
249 status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, (ABC_INT64_T)nInsLimit, (ABC_INT64_T)0, (ABC_INT64_T)0 );
250 if ( status == l_Undef )
251 {
252 // printf( "The problem timed out.\n" );
253 RetValue = -1;
254 }
255 else if ( status == l_True )
256 {
257 // printf( "The problem is SATISFIABLE.\n" );
258 RetValue = 0;
259 }
260 else if ( status == l_False )
261 {
262 // printf( "The problem is UNSATISFIABLE.\n" );
263 RetValue = 1;
264 }
265 else
266 assert( 0 );
267
268 // Abc_Print( 1, "The number of conflicts = %6d. ", (int)pSat->stats.conflicts );
269 // Abc_PrintTime( 1, "Solving time", Abc_Clock() - clk );
270
271 // if the problem is SAT, get the counterexample
272 if ( status == l_True )
273 {
274 pMan->pData = Sat_SolverGetModel( pSat, vCiIds->pArray, vCiIds->nSize );
275 }
276 // free the sat_solver
277 if ( fVerbose )
278 Sat_SolverPrintStats( stdout, pSat );
279 //sat_solver_store_write( pSat, "trace.cnf" );
280 //sat_solver_store_free( pSat );
281 sat_solver_delete( pSat );
282 Vec_IntFree( vCiIds );
283 return RetValue;
284 }
285}
#define l_True
Definition bmcBmcS.c:35
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_solve
Definition cecSatG2.c:45
void * Cnf_DataWriteIntoSolver2(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:595
int Cnf_DataWriteOrClause2(void *p, Cnf_Dat_t *pCnf)
Definition cnfMan.c:715
Vec_Int_t * Cnf_DataCollectPiSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
Definition cnfMan.c:104
void Cnf_DataTranformPolarity(Cnf_Dat_t *pCnf, int fTransformPos)
Definition cnfMan.c:768
int Cnf_DataWriteAndClauses(void *p, Cnf_Dat_t *pCnf)
Definition cnfMan.c:743
int Cnf_DataWriteOrClause(void *pSat, Cnf_Dat_t *pCnf)
Definition cnfMan.c:687
void sat_solver2_delete(sat_solver2 *s)
int sat_solver2_simplify(sat_solver2 *s)
Definition satSolver2.c:996
int sat_solver2_solve(sat_solver2 *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
void Sat_Solver2PrintStats(FILE *pFile, sat_solver2 *p)
Definition satUtil.c:214
struct sat_solver2_t sat_solver2
Definition satSolver2.h:44
int * Sat_Solver2GetModel(sat_solver2 *p, int *pVars, int nVars)
Definition satUtil.c:291
int sat_solver_simplify(sat_solver *s)
Definition satSolver.c:1515
int * Sat_SolverGetModel(sat_solver *p, int *pVars, int nVars)
Definition satUtil.c:270
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
Definition satUtil.c:193
int nLiterals
Definition cnf.h:60
int nClauses
Definition cnf.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigSec()

int Fra_FraigSec ( Aig_Man_t * p,
Fra_Sec_t * pParSec,
Aig_Man_t ** ppResult )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 118 of file fraSec.c.

119{
120 Ssw_Pars_t Pars2, * pPars2 = &Pars2;
121 Fra_Ssw_t Pars, * pPars = &Pars;
122 Fra_Sml_t * pSml;
123 Aig_Man_t * pNew, * pTemp;
124 int nFrames, RetValue, nIter;
125 abctime clk, clkTotal = Abc_Clock();
126 int TimeOut = 0;
127 int fLatchCorr = 0;
128 float TimeLeft = 0.0;
129 pParSec->nSMnumber = -1;
130
131 // try the miter before solving
132 pNew = Aig_ManDupSimple( p );
133 RetValue = Fra_FraigMiterStatus( pNew );
134 if ( RetValue >= 0 )
135 goto finish;
136
137 // prepare parameters
138 memset( pPars, 0, sizeof(Fra_Ssw_t) );
139 pPars->fLatchCorr = fLatchCorr;
140 pPars->fVerbose = pParSec->fVeryVerbose;
141 if ( pParSec->fVerbose )
142 {
143 printf( "Original miter: Latches = %5d. Nodes = %6d.\n",
144 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
145 }
146//Aig_ManDumpBlif( pNew, "after.blif", NULL, NULL );
147
148 // perform sequential cleanup
149clk = Abc_Clock();
150 if ( pNew->nRegs )
151 pNew = Aig_ManReduceLaches( pNew, 0 );
152 if ( pNew->nRegs )
153 pNew = Aig_ManConstReduce( pNew, 0, -1, -1, 0, 0 );
154 if ( pParSec->fVerbose )
155 {
156 printf( "Sequential cleanup: Latches = %5d. Nodes = %6d. ",
157 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
158ABC_PRT( "Time", Abc_Clock() - clk );
159 }
160 RetValue = Fra_FraigMiterStatus( pNew );
161 if ( RetValue >= 0 )
162 goto finish;
163
164 // perform phase abstraction
165clk = Abc_Clock();
166 if ( pParSec->fPhaseAbstract )
167 {
168 extern Aig_Man_t * Saig_ManPhaseAbstractAuto( Aig_Man_t * p, int fVerbose );
169 pNew->nTruePis = Aig_ManCiNum(pNew) - Aig_ManRegNum(pNew);
170 pNew->nTruePos = Aig_ManCoNum(pNew) - Aig_ManRegNum(pNew);
171 pNew = Saig_ManPhaseAbstractAuto( pTemp = pNew, 0 );
172 Aig_ManStop( pTemp );
173 if ( pParSec->fVerbose )
174 {
175 printf( "Phase abstraction: Latches = %5d. Nodes = %6d. ",
176 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
177ABC_PRT( "Time", Abc_Clock() - clk );
178 }
179 }
180
181 // perform forward retiming
182 if ( pParSec->fRetimeFirst && pNew->nRegs )
183 {
184clk = Abc_Clock();
185// pNew = Rtm_ManRetime( pTemp = pNew, 1, 1000, 0 );
186 pNew = Saig_ManRetimeForward( pTemp = pNew, 100, 0 );
187 Aig_ManStop( pTemp );
188 if ( pParSec->fVerbose )
189 {
190 printf( "Forward retiming: Latches = %5d. Nodes = %6d. ",
191 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
192ABC_PRT( "Time", Abc_Clock() - clk );
193 }
194 }
195
196 // run latch correspondence
197clk = Abc_Clock();
198 if ( pNew->nRegs )
199 {
200 pNew = Aig_ManDupOrdered( pTemp = pNew );
201// pNew = Aig_ManDupDfs( pTemp = pNew );
202 Aig_ManStop( pTemp );
203/*
204 if ( RetValue == -1 && pParSec->TimeLimit )
205 {
206 TimeLeft = (float)pParSec->TimeLimit - ((float)(Abc_Clock()-clkTotal)/(float)(CLOCKS_PER_SEC));
207 TimeLeft = Abc_MaxInt( TimeLeft, 0.0 );
208 if ( TimeLeft == 0.0 )
209 {
210 if ( !pParSec->fSilent )
211 printf( "Runtime limit exceeded.\n" );
212 RetValue = -1;
213 TimeOut = 1;
214 goto finish;
215 }
216 }
217*/
218
219// pNew = Fra_FraigLatchCorrespondence( pTemp = pNew, 0, 1000, 1, pParSec->fVeryVerbose, &nIter, TimeLeft );
220//Aig_ManDumpBlif( pNew, "ex.blif", NULL, NULL );
222 pNew = Ssw_LatchCorrespondence( pTemp = pNew, pPars2 );
223 nIter = pPars2->nIters;
224
225 // prepare parameters for scorr
226 Ssw_ManSetDefaultParams( pPars2 );
227
228 if ( pTemp->pSeqModel )
229 {
230 if ( !Saig_ManVerifyCex( pTemp, pTemp->pSeqModel ) )
231 printf( "Fra_FraigSec(): Counter-example verification has FAILED.\n" );
232 if ( Saig_ManPiNum(p) != Saig_ManPiNum(pTemp) )
233 printf( "The counter-example is invalid because of phase abstraction.\n" );
234 else
235 {
236 ABC_FREE( p->pSeqModel );
237 p->pSeqModel = Abc_CexDup( pTemp->pSeqModel, Aig_ManRegNum(p) );
238 ABC_FREE( pTemp->pSeqModel );
239 }
240 }
241 if ( pNew == NULL )
242 {
243 if ( p->pSeqModel )
244 {
245 RetValue = 0;
246 if ( !pParSec->fSilent )
247 {
248 printf( "Networks are NOT EQUIVALENT after simulation. " );
249ABC_PRT( "Time", Abc_Clock() - clkTotal );
250 }
251 if ( pParSec->fReportSolution && !pParSec->fRecursive )
252 {
253 printf( "SOLUTION: FAIL " );
254ABC_PRT( "Time", Abc_Clock() - clkTotal );
255 }
256 Aig_ManStop( pTemp );
257 return RetValue;
258 }
259 pNew = pTemp;
260 RetValue = -1;
261 TimeOut = 1;
262 goto finish;
263 }
264 Aig_ManStop( pTemp );
265
266 if ( pParSec->fVerbose )
267 {
268 printf( "Latch-corr (I=%3d): Latches = %5d. Nodes = %6d. ",
269 nIter, Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
270ABC_PRT( "Time", Abc_Clock() - clk );
271 }
272 }
273/*
274 if ( RetValue == -1 && pParSec->TimeLimit )
275 {
276 TimeLeft = (float)pParSec->TimeLimit - ((float)(Abc_Clock()-clkTotal)/(float)(CLOCKS_PER_SEC));
277 TimeLeft = Abc_MaxInt( TimeLeft, 0.0 );
278 if ( TimeLeft == 0.0 )
279 {
280 if ( !pParSec->fSilent )
281 printf( "Runtime limit exceeded.\n" );
282 RetValue = -1;
283 TimeOut = 1;
284 goto finish;
285 }
286 }
287*/
288 // perform fraiging
289 if ( pParSec->fFraiging )
290 {
291clk = Abc_Clock();
292 pNew = Fra_FraigEquivence( pTemp = pNew, 100, 0 );
293 //pNew = Fra_FraigEquivence2( pTemp = pNew, 100, 0 );
294 Aig_ManStop( pTemp );
295 if ( pParSec->fVerbose )
296 {
297 printf( "Fraiging: Latches = %5d. Nodes = %6d. ",
298 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
299ABC_PRT( "Time", Abc_Clock() - clk );
300 }
301 }
302
303 if ( pNew->nRegs == 0 )
304 RetValue = Fra_FraigCec( &pNew, 100000, 0 );
305
306 RetValue = Fra_FraigMiterStatus( pNew );
307 if ( RetValue >= 0 )
308 goto finish;
309/*
310 if ( RetValue == -1 && pParSec->TimeLimit )
311 {
312 TimeLeft = (float)pParSec->TimeLimit - ((float)(Abc_Clock()-clkTotal)/(float)(CLOCKS_PER_SEC));
313 TimeLeft = Abc_MaxInt( TimeLeft, 0.0 );
314 if ( TimeLeft == 0.0 )
315 {
316 if ( !pParSec->fSilent )
317 printf( "Runtime limit exceeded.\n" );
318 RetValue = -1;
319 TimeOut = 1;
320 goto finish;
321 }
322 }
323*/
324 // perform min-area retiming
325 if ( pParSec->fRetimeRegs && pNew->nRegs )
326 {
327// extern Aig_Man_t * Saig_ManRetimeMinArea( Aig_Man_t * p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose );
328clk = Abc_Clock();
329 pNew->nTruePis = Aig_ManCiNum(pNew) - Aig_ManRegNum(pNew);
330 pNew->nTruePos = Aig_ManCoNum(pNew) - Aig_ManRegNum(pNew);
331// pNew = Rtm_ManRetime( pTemp = pNew, 1, 1000, 0 );
332 pNew = Saig_ManRetimeMinArea( pTemp = pNew, 1000, 0, 0, 1, 0 );
333 Aig_ManStop( pTemp );
334 pNew = Aig_ManDupOrdered( pTemp = pNew );
335 Aig_ManStop( pTemp );
336 if ( pParSec->fVerbose )
337 {
338 printf( "Min-reg retiming: Latches = %5d. Nodes = %6d. ",
339 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
340ABC_PRT( "Time", Abc_Clock() - clk );
341 }
342 }
343
344 // perform seq sweeping while increasing the number of frames
345 RetValue = Fra_FraigMiterStatus( pNew );
346 if ( RetValue == -1 && pParSec->fInduction )
347 for ( nFrames = 1; nFrames <= pParSec->nFramesMax; nFrames *= 2 )
348 {
349/*
350 if ( RetValue == -1 && pParSec->TimeLimit )
351 {
352 TimeLeft = (float)pParSec->TimeLimit - ((float)(Abc_Clock()-clkTotal)/(float)(CLOCKS_PER_SEC));
353 TimeLeft = Abc_MaxInt( TimeLeft, 0.0 );
354 if ( TimeLeft == 0.0 )
355 {
356 if ( !pParSec->fSilent )
357 printf( "Runtime limit exceeded.\n" );
358 RetValue = -1;
359 TimeOut = 1;
360 goto finish;
361 }
362 }
363*/
364
365clk = Abc_Clock();
366 pPars->nFramesK = nFrames;
367 pPars->TimeLimit = TimeLeft;
368 pPars->fSilent = pParSec->fSilent;
369// pNew = Fra_FraigInduction( pTemp = pNew, pPars );
370
371 pPars2->nFramesK = nFrames;
372 pPars2->nBTLimit = pParSec->nBTLimit;
373 pPars2->nBTLimitGlobal = pParSec->nBTLimitGlobal;
374// pPars2->nBTLimit = 1000 * nFrames;
375
376 if ( RetValue == -1 && pPars2->nConflicts > pPars2->nBTLimitGlobal )
377 {
378 if ( !pParSec->fSilent )
379 printf( "Global conflict limit (%d) exceeded.\n", pPars2->nBTLimitGlobal );
380 RetValue = -1;
381 TimeOut = 1;
382 goto finish;
383 }
384
385 Aig_ManSetRegNum( pNew, pNew->nRegs );
386// pNew = Ssw_SignalCorrespondence( pTemp = pNew, pPars2 );
387 if ( Aig_ManRegNum(pNew) > 0 )
388 pNew = Ssw_SignalCorrespondence( pTemp = pNew, pPars2 );
389 else
390 pNew = Aig_ManDupSimpleDfs( pTemp = pNew );
391
392 if ( pNew == NULL )
393 {
394 pNew = pTemp;
395 RetValue = -1;
396 TimeOut = 1;
397 goto finish;
398 }
399
400// printf( "Total conflicts = %d.\n", pPars2->nConflicts );
401
402 Aig_ManStop( pTemp );
403 RetValue = Fra_FraigMiterStatus( pNew );
404 if ( pParSec->fVerbose )
405 {
406 printf( "K-step (K=%2d,I=%3d): Latches = %5d. Nodes = %6d. ",
407 nFrames, pPars2->nIters, Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
408ABC_PRT( "Time", Abc_Clock() - clk );
409 }
410 if ( RetValue != -1 )
411 break;
412
413 // perform retiming
414// if ( pParSec->fRetimeFirst && pNew->nRegs )
415 if ( pNew->nRegs )
416 {
417// extern Aig_Man_t * Saig_ManRetimeMinArea( Aig_Man_t * p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose );
418clk = Abc_Clock();
419 pNew->nTruePis = Aig_ManCiNum(pNew) - Aig_ManRegNum(pNew);
420 pNew->nTruePos = Aig_ManCoNum(pNew) - Aig_ManRegNum(pNew);
421// pNew = Rtm_ManRetime( pTemp = pNew, 1, 1000, 0 );
422 pNew = Saig_ManRetimeMinArea( pTemp = pNew, 1000, 0, 0, 1, 0 );
423 Aig_ManStop( pTemp );
424 pNew = Aig_ManDupOrdered( pTemp = pNew );
425 Aig_ManStop( pTemp );
426 if ( pParSec->fVerbose )
427 {
428 printf( "Min-reg retiming: Latches = %5d. Nodes = %6d. ",
429 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
430ABC_PRT( "Time", Abc_Clock() - clk );
431 }
432 }
433
434 if ( pNew->nRegs )
435 pNew = Aig_ManConstReduce( pNew, 0, -1, -1, 0, 0 );
436
437 // perform rewriting
438clk = Abc_Clock();
439 pNew = Aig_ManDupOrdered( pTemp = pNew );
440 Aig_ManStop( pTemp );
441// pNew = Dar_ManRewriteDefault( pTemp = pNew );
442 pNew = Dar_ManCompress2( pTemp = pNew, 1, 0, 1, 0, 0 );
443 Aig_ManStop( pTemp );
444 if ( pParSec->fVerbose )
445 {
446 printf( "Rewriting: Latches = %5d. Nodes = %6d. ",
447 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
448ABC_PRT( "Time", Abc_Clock() - clk );
449 }
450
451 // perform sequential simulation
452 if ( pNew->nRegs )
453 {
454clk = Abc_Clock();
455 pSml = Fra_SmlSimulateSeq( pNew, 0, 128 * nFrames, 1 + 16/(1+Aig_ManNodeNum(pNew)/1000), 1 );
456 if ( pParSec->fVerbose )
457 {
458 printf( "Seq simulation : Latches = %5d. Nodes = %6d. ",
459 Aig_ManRegNum(pNew), Aig_ManNodeNum(pNew) );
460ABC_PRT( "Time", Abc_Clock() - clk );
461 }
462 if ( pSml->fNonConstOut )
463 {
464 pNew->pSeqModel = Fra_SmlGetCounterExample( pSml );
465 // transfer to the original manager
466 if ( Saig_ManPiNum(p) != Saig_ManPiNum(pNew) )
467 printf( "The counter-example is invalid because of phase abstraction.\n" );
468 else
469 {
470 ABC_FREE( p->pSeqModel );
471 p->pSeqModel = Abc_CexDup( pNew->pSeqModel, Aig_ManRegNum(p) );
472 ABC_FREE( pNew->pSeqModel );
473 }
474
475 Fra_SmlStop( pSml );
476 Aig_ManStop( pNew );
477 RetValue = 0;
478 if ( !pParSec->fSilent )
479 {
480 printf( "Networks are NOT EQUIVALENT after simulation. " );
481ABC_PRT( "Time", Abc_Clock() - clkTotal );
482 }
483 if ( pParSec->fReportSolution && !pParSec->fRecursive )
484 {
485 printf( "SOLUTION: FAIL " );
486ABC_PRT( "Time", Abc_Clock() - clkTotal );
487 }
488 return RetValue;
489 }
490 Fra_SmlStop( pSml );
491 }
492 }
493
494 // get the miter status
495 RetValue = Fra_FraigMiterStatus( pNew );
496
497 // try interplation
498clk = Abc_Clock();
499 Aig_ManSetRegNum( pNew, Aig_ManRegNum(pNew) );
500 if ( pParSec->fInterpolation && RetValue == -1 && Aig_ManRegNum(pNew) > 0 )
501 {
502 Inter_ManParams_t Pars, * pPars = &Pars;
503 int Depth;
504 ABC_FREE( pNew->pSeqModel );
506// pPars->nBTLimit = 100;
507 pPars->nBTLimit = pParSec->nBTLimitInter;
508 pPars->fVerbose = pParSec->fVeryVerbose;
509 if ( Saig_ManPoNum(pNew) == 1 )
510 {
511 RetValue = Inter_ManPerformInterpolation( pNew, pPars, &Depth );
512 }
513 else if ( pParSec->fInterSeparate )
514 {
515 Abc_Cex_t * pCex = NULL;
516 Aig_Man_t * pTemp, * pAux;
517 Aig_Obj_t * pObjPo;
518 int i, Counter = 0;
519 Saig_ManForEachPo( pNew, pObjPo, i )
520 {
521 if ( Aig_ObjFanin0(pObjPo) == Aig_ManConst1(pNew) )
522 continue;
523 if ( pPars->fVerbose )
524 printf( "Solving output %2d (out of %2d):\n", i, Saig_ManPoNum(pNew) );
525 pTemp = Aig_ManDupOneOutput( pNew, i, 1 );
526 pTemp = Aig_ManScl( pAux = pTemp, 1, 1, 0, -1, -1, 0, 0 );
527 Aig_ManStop( pAux );
528 if ( Saig_ManRegNum(pTemp) > 0 )
529 {
530 RetValue = Inter_ManPerformInterpolation( pTemp, pPars, &Depth );
531 if ( pTemp->pSeqModel )
532 {
533 pCex = p->pSeqModel = Abc_CexDup( pTemp->pSeqModel, Aig_ManRegNum(p) );
534 pCex->iPo = i;
535 Aig_ManStop( pTemp );
536 break;
537 }
538 // if solved, remove the output
539 if ( RetValue == 1 )
540 {
541 Aig_ObjPatchFanin0( pNew, pObjPo, Aig_ManConst0(pNew) );
542 // printf( "Output %3d : Solved ", i );
543 }
544 else
545 {
546 Counter++;
547 // printf( "Output %3d : Undec ", i );
548 }
549 }
550 else
551 Counter++;
552// Aig_ManPrintStats( pTemp );
553 Aig_ManStop( pTemp );
554 printf( "Solving output %3d (out of %3d) using interpolation.\r", i, Saig_ManPoNum(pNew) );
555 }
556 Aig_ManCleanup( pNew );
557 if ( pCex == NULL )
558 {
559 printf( "Interpolation left %d (out of %d) outputs unsolved \n", Counter, Saig_ManPoNum(pNew) );
560 if ( Counter )
561 RetValue = -1;
562 }
563 pNew = Aig_ManDupUnsolvedOutputs( pTemp = pNew, 1 );
564 Aig_ManStop( pTemp );
565 pNew = Aig_ManScl( pTemp = pNew, 1, 1, 0, -1, -1, 0, 0 );
566 Aig_ManStop( pTemp );
567 }
568 else
569 {
570 Aig_Man_t * pNewOrpos = Saig_ManDupOrpos( pNew );
571 RetValue = Inter_ManPerformInterpolation( pNewOrpos, pPars, &Depth );
572 if ( pNewOrpos->pSeqModel )
573 {
574 Abc_Cex_t * pCex;
575 pCex = pNew->pSeqModel = pNewOrpos->pSeqModel; pNewOrpos->pSeqModel = NULL;
576 pCex->iPo = Saig_ManFindFailedPoCex( pNew, pNew->pSeqModel );
577 }
578 Aig_ManStop( pNewOrpos );
579 }
580
581 if ( pParSec->fVerbose )
582 {
583 if ( RetValue == 1 )
584 printf( "Property proved using interpolation. " );
585 else if ( RetValue == 0 )
586 printf( "Property DISPROVED in frame %d using interpolation. ", Depth );
587 else if ( RetValue == -1 )
588 printf( "Property UNDECIDED after interpolation. " );
589 else
590 assert( 0 );
591ABC_PRT( "Time", Abc_Clock() - clk );
592 }
593 }
594
595 // try reachability analysis
596 if ( pParSec->fReachability && RetValue == -1 && Aig_ManRegNum(pNew) > 0 && Aig_ManRegNum(pNew) < pParSec->nBddVarsMax )
597 {
598 Saig_ParBbr_t Pars, * pPars = &Pars;
600 pPars->TimeLimit = 0;
601 pPars->nBddMax = pParSec->nBddMax;
602 pPars->nIterMax = pParSec->nBddIterMax;
603 pPars->fPartition = 1;
604 pPars->fReorder = 1;
605 pPars->fReorderImage = 1;
606 pPars->fVerbose = 0;
607 pPars->fSilent = pParSec->fSilent;
608 pNew->nTruePis = Aig_ManCiNum(pNew) - Aig_ManRegNum(pNew);
609 pNew->nTruePos = Aig_ManCoNum(pNew) - Aig_ManRegNum(pNew);
610 RetValue = Aig_ManVerifyUsingBdds( pNew, pPars );
611 }
612
613 // try PDR
614 if ( pParSec->fUsePdr && RetValue == -1 && Aig_ManRegNum(pNew) > 0 )
615 {
616 Pdr_Par_t Pars, * pPars = &Pars;
618 pPars->nTimeOut = pParSec->nPdrTimeout;
619 pPars->fVerbose = pParSec->fVerbose;
620 if ( pParSec->fVerbose )
621 printf( "Running property directed reachability...\n" );
622 RetValue = Pdr_ManSolve( pNew, pPars );
623 if ( pNew->pSeqModel )
624 pNew->pSeqModel->iPo = Saig_ManFindFailedPoCex( pNew, pNew->pSeqModel );
625 }
626
627finish:
628 // report the miter
629 if ( RetValue == 1 )
630 {
631 if ( !pParSec->fSilent )
632 {
633 printf( "Networks are equivalent. " );
634ABC_PRT( "Time", Abc_Clock() - clkTotal );
635 }
636 if ( pParSec->fReportSolution && !pParSec->fRecursive )
637 {
638 printf( "SOLUTION: PASS " );
639ABC_PRT( "Time", Abc_Clock() - clkTotal );
640 }
641 }
642 else if ( RetValue == 0 )
643 {
644 if ( pNew->pSeqModel == NULL )
645 {
646 int i;
647 // if the CEX is not derives, it is because tricial CEX should be assumed
648 pNew->pSeqModel = Abc_CexAlloc( Aig_ManRegNum(pNew), pNew->nTruePis, 1 );
649 // if the CEX does not work, we need to change PIs to 1 because
650 // the only way it can happen is when a PO is equal to a PI...
651 if ( Saig_ManFindFailedPoCex( pNew, pNew->pSeqModel ) == -1 )
652 for ( i = 0; i < pNew->nTruePis; i++ )
653 Abc_InfoSetBit( pNew->pSeqModel->pData, i );
654 }
655 if ( !pParSec->fSilent )
656 {
657 printf( "Networks are NOT EQUIVALENT. " );
658ABC_PRT( "Time", Abc_Clock() - clkTotal );
659 }
660 if ( pParSec->fReportSolution && !pParSec->fRecursive )
661 {
662 printf( "SOLUTION: FAIL " );
663ABC_PRT( "Time", Abc_Clock() - clkTotal );
664 }
665 }
666 else
667 {
669 // save intermediate result
670 extern void Abc_FrameSetSave1( void * pAig );
673 if ( !pParSec->fSilent )
674 {
675 printf( "Networks are UNDECIDED. " );
676ABC_PRT( "Time", Abc_Clock() - clkTotal );
677 }
678 if ( pParSec->fReportSolution && !pParSec->fRecursive )
679 {
680 printf( "SOLUTION: UNDECIDED " );
681ABC_PRT( "Time", Abc_Clock() - clkTotal );
682 }
683 if ( !TimeOut && !pParSec->fSilent )
684 {
685 static int Counter = 1;
686 char pFileName[1000];
687 pParSec->nSMnumber = Counter;
688 sprintf( pFileName, "sm%02d.aig", Counter++ );
689 Ioa_WriteAiger( pNew, pFileName, 0, 0 );
690 printf( "The unsolved reduced miter is written into file \"%s\".\n", pFileName );
691 }
692 }
693 if ( pNew->pSeqModel )
694 {
695 if ( Saig_ManPiNum(p) != Saig_ManPiNum(pNew) )
696 printf( "The counter-example is invalid because of phase abstraction.\n" );
697 else
698 {
699 ABC_FREE( p->pSeqModel );
700 p->pSeqModel = Abc_CexDup( pNew->pSeqModel, Aig_ManRegNum(p) );
701 ABC_FREE( pNew->pSeqModel );
702 }
703 }
704 if ( ppResult != NULL )
705 *ppResult = Aig_ManDupSimpleDfs( pNew );
706 if ( pNew )
707 Aig_ManStop( pNew );
708 return RetValue;
709}
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigDup.c:46
Aig_Man_t * Aig_ManDupSimpleDfs(Aig_Man_t *p)
Definition aigDup.c:184
Aig_Man_t * Aig_ManReduceLaches(Aig_Man_t *p, int fVerbose)
Definition aigScl.c:455
Aig_Man_t * Aig_ManConstReduce(Aig_Man_t *p, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition aigTsim.c:498
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Definition aigObj.c:282
Aig_Man_t * Aig_ManDupUnsolvedOutputs(Aig_Man_t *p, int fAddRegs)
Definition aigDup.c:1199
Aig_Man_t * Aig_ManDupOneOutput(Aig_Man_t *p, int iPoNum, int fAddRegs)
Definition aigDup.c:1152
Aig_Man_t * Aig_ManScl(Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition aigScl.c:650
Aig_Man_t * Dar_ManCompress2(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
Definition darScript.c:235
int Fra_FraigCec(Aig_Man_t **ppAig, int nConfLimit, int fVerbose)
Definition fraCec.c:320
struct Fra_Ssw_t_ Fra_Ssw_t
Definition fra.h:54
typedefABC_NAMESPACE_HEADER_START struct Inter_ManParams_t_ Inter_ManParams_t
INCLUDES ///.
Definition int.h:48
void Inter_ManSetDefaultParams(Inter_ManParams_t *p)
MACRO DEFINITIONS ///.
Definition intCore.c:46
int Inter_ManPerformInterpolation(Aig_Man_t *pAig, Inter_ManParams_t *pPars, int *piFrame)
Definition intCore.c:79
void Abc_FrameSetSave1(void *pAig)
Definition mainFrame.c:682
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition pdrCore.c:50
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition pdr.h:40
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition pdrCore.c:1765
void Bbr_ManSetDefaultParams(Saig_ParBbr_t *p)
Definition saigDup.c:593
int Aig_ManVerifyUsingBdds(Aig_Man_t *pInit, Saig_ParBbr_t *pPars)
Definition saigDup.c:592
Aig_Man_t * Saig_ManPhaseAbstractAuto(Aig_Man_t *p, int fVerbose)
Definition saigPhase.c:965
struct Saig_ParBbr_t_ Saig_ParBbr_t
Definition saig.h:53
Aig_Man_t * Saig_ManRetimeMinArea(Aig_Man_t *p, int nMaxIters, int fForwardOnly, int fBackwardOnly, int fInitial, int fVerbose)
Definition saigRetMin.c:623
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
int Saig_ManFindFailedPoCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:436
Aig_Man_t * Saig_ManRetimeForward(Aig_Man_t *p, int nMaxIters, int fVerbose)
Definition saigRetFwd.c:213
Aig_Man_t * Saig_ManDupOrpos(Aig_Man_t *p)
DECLARATIONS ///.
Definition saigDup.c:45
int Saig_ManVerifyCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:281
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition sswCore.c:45
void Ssw_ManSetDefaultParamsLcorr(Ssw_Pars_t *p)
Definition sswCore.c:93
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition ssw.h:40
Aig_Man_t * Ssw_LatchCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition sswCore.c:545
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition sswCore.c:436
int nPdrTimeout
Definition fra.h:125
int fFraiging
Definition fra.h:129
int nBTLimit
Definition fra.h:119
int fVerbose
Definition fra.h:139
int nBddIterMax
Definition fra.h:124
int nBTLimitInter
Definition fra.h:121
int fRetimeRegs
Definition fra.h:128
int nBddMax
Definition fra.h:123
int fVeryVerbose
Definition fra.h:140
int fReportSolution
Definition fra.h:146
int fRetimeFirst
Definition fra.h:127
int fInduction
Definition fra.h:130
int fPhaseAbstract
Definition fra.h:126
int fInterpolation
Definition fra.h:131
int nSMnumber
Definition fra.h:143
int fInterSeparate
Definition fra.h:132
int nFramesMax
Definition fra.h:118
int fRecursive
Definition fra.h:145
int nBddVarsMax
Definition fra.h:122
int fReachability
Definition fra.h:133
int nBTLimitGlobal
Definition fra.h:120
int fUsePdr
Definition fra.h:137
int fSilent
Definition fra.h:138
int nBddMax
Definition saig.h:57
int fReorder
Definition saig.h:60
int fPartition
Definition saig.h:59
int fSilent
Definition saig.h:63
int fReorderImage
Definition saig.h:61
int TimeLimit
Definition saig.h:56
int fVerbose
Definition saig.h:62
int nIterMax
Definition saig.h:58
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition utilCex.c:145
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
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_FraigSweep()

void Fra_FraigSweep ( Fra_Man_t * p)
extern

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

Synopsis [Performs fraiging for the internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file fraCore.c.

311{
312// Bar_Progress_t * pProgress = NULL;
313 Aig_Obj_t * pObj, * pObjNew;
314 int i, Pos = 0;
315 int nBTracksOld;
316 // fraig latch outputs
317 Aig_ManForEachLoSeq( p->pManAig, pObj, i )
318 {
319 Fra_FraigNode( p, pObj );
320 if ( p->pPars->fUseImps )
321 Pos = Fra_ImpCheckForNode( p, p->pCla->vImps, pObj, Pos );
322 }
323 if ( p->pPars->fLatchCorr )
324 return;
325 // fraig internal nodes
326// if ( !p->pPars->fDontShowBar )
327// pProgress = Bar_ProgressStart( stdout, Aig_ManObjNumMax(p->pManAig) );
328 nBTracksOld = p->pPars->nBTLimitNode;
329 Aig_ManForEachNode( p->pManAig, pObj, i )
330 {
331// if ( pProgress )
332// Bar_ProgressUpdate( pProgress, i, NULL );
333 // derive and remember the new fraig node
334 pObjNew = Aig_And( p->pManFraig, Fra_ObjChild0Fra(pObj,p->pPars->nFramesK), Fra_ObjChild1Fra(pObj,p->pPars->nFramesK) );
335 Fra_ObjSetFraig( pObj, p->pPars->nFramesK, pObjNew );
336 Aig_Regular(pObjNew)->pData = p;
337 // quit if simulation detected a counter-example for a PO
338 if ( p->pManFraig->pData )
339 continue;
340// if ( Aig_SupportSize(p->pManAig,pObj) > 16 )
341// continue;
342 // perform fraiging
343 if ( p->pPars->nLevelMax && (int)pObj->Level > p->pPars->nLevelMax )
344 p->pPars->nBTLimitNode = 5;
345 Fra_FraigNode( p, pObj );
346 if ( p->pPars->nLevelMax && (int)pObj->Level > p->pPars->nLevelMax )
347 p->pPars->nBTLimitNode = nBTracksOld;
348 // check implications
349 if ( p->pPars->fUseImps )
350 Pos = Fra_ImpCheckForNode( p, p->pCla->vImps, pObj, Pos );
351 }
352// if ( pProgress )
353// Bar_ProgressStop( pProgress );
354 // try to prove the outputs of the miter
355 p->nNodesMiter = Aig_ManNodeNum(p->pManFraig);
356// Fra_MiterStatus( p->pManFraig );
357// if ( p->pPars->fProve && p->pManFraig->pData == NULL )
358// Fra_MiterProve( p );
359 // compress implications after processing all of them
360 if ( p->pPars->fUseImps )
361 Fra_ImpCompactArray( p->pCla->vImps );
362}
ush Pos
Definition deflate.h:88
int Fra_ImpCheckForNode(Fra_Man_t *p, Vec_Int_t *vImps, Aig_Obj_t *pNode, int Pos)
Definition fraImp.c:503
void Fra_ImpCompactArray(Vec_Int_t *vImps)
Definition fraImp.c:607
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ImpAddToSolver()

void Fra_ImpAddToSolver ( Fra_Man_t * p,
Vec_Int_t * vImps,
int * pSatVarNums )
extern

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

Synopsis [Add implication clauses to the SAT solver.]

Description [Note that implications should be checked in the first frame!]

SideEffects []

SeeAlso []

Definition at line 428 of file fraImp.c.

429{
430 sat_solver * pSat = p->pSat;
431 Aig_Obj_t * pLeft, * pRight;
432 Aig_Obj_t * pLeftF, * pRightF;
433 int pLits[2], Imp, Left, Right, i, f, status;
434 int fComplL, fComplR;
435 Vec_IntForEachEntry( vImps, Imp, i )
436 {
437 // get the corresponding nodes
438 pLeft = Aig_ManObj( p->pManAig, Fra_ImpLeft(Imp) );
439 pRight = Aig_ManObj( p->pManAig, Fra_ImpRight(Imp) );
440 // check if all the nodes are present
441 for ( f = 0; f < p->pPars->nFramesK; f++ )
442 {
443 // map these info fraig
444 pLeftF = Fra_ObjFraig( pLeft, f );
445 pRightF = Fra_ObjFraig( pRight, f );
446 if ( Aig_ObjIsNone(Aig_Regular(pLeftF)) || Aig_ObjIsNone(Aig_Regular(pRightF)) )
447 {
448 Vec_IntWriteEntry( vImps, i, 0 );
449 break;
450 }
451 }
452 if ( f < p->pPars->nFramesK )
453 continue;
454 // add constraints in each timeframe
455 for ( f = 0; f < p->pPars->nFramesK; f++ )
456 {
457 // map these info fraig
458 pLeftF = Fra_ObjFraig( pLeft, f );
459 pRightF = Fra_ObjFraig( pRight, f );
460 // get the corresponding SAT numbers
461 Left = pSatVarNums[ Aig_Regular(pLeftF)->Id ];
462 Right = pSatVarNums[ Aig_Regular(pRightF)->Id ];
463 assert( Left > 0 && Left < p->nSatVars );
464 assert( Right > 0 && Right < p->nSatVars );
465 // get the complemented attributes
466 fComplL = pLeft->fPhase ^ Aig_IsComplement(pLeftF);
467 fComplR = pRight->fPhase ^ Aig_IsComplement(pRightF);
468 // get the constraint
469 // L => R L' v R (complement = L & R')
470 pLits[0] = 2 * Left + !fComplL;
471 pLits[1] = 2 * Right + fComplR;
472 // add constraint to solver
473 if ( !sat_solver_addclause( pSat, pLits, pLits + 2 ) )
474 {
475 sat_solver_delete( pSat );
476 p->pSat = NULL;
477 return;
478 }
479 }
480 }
481 status = sat_solver_simplify(pSat);
482 if ( status == 0 )
483 {
484 sat_solver_delete( pSat );
485 p->pSat = NULL;
486 }
487// printf( "Total imps = %d. ", Vec_IntSize(vImps) );
488 Fra_ImpCompactArray( vImps );
489// printf( "Valid imps = %d. \n", Vec_IntSize(vImps) );
490}
#define sat_solver_addclause
Definition cecSatG2.c:37
void Fra_ImpCompactArray(Vec_Int_t *vImps)
Definition fraImp.c:607
unsigned int fPhase
Definition aig.h:78
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ImpCheckForNode()

int Fra_ImpCheckForNode ( Fra_Man_t * p,
Vec_Int_t * vImps,
Aig_Obj_t * pNode,
int Pos )
extern

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

Synopsis [Check implications for the node (if they are present).]

Description [Returns the new position in the array.]

SideEffects []

SeeAlso []

Definition at line 503 of file fraImp.c.

504{
505 Aig_Obj_t * pLeft, * pRight;
506 Aig_Obj_t * pLeftF, * pRightF;
507 int i, Imp, Left, Right, Max, RetValue;
508 int fComplL, fComplR;
509 Vec_IntForEachEntryStart( vImps, Imp, i, Pos )
510 {
511 if ( Imp == 0 )
512 continue;
513 Left = Fra_ImpLeft(Imp);
514 Right = Fra_ImpRight(Imp);
515 Max = Abc_MaxInt( Left, Right );
516 assert( Max >= pNode->Id );
517 if ( Max > pNode->Id )
518 return i;
519 // get the corresponding nodes
520 pLeft = Aig_ManObj( p->pManAig, Left );
521 pRight = Aig_ManObj( p->pManAig, Right );
522 // get the corresponding FRAIG nodes
523 pLeftF = Fra_ObjFraig( pLeft, p->pPars->nFramesK );
524 pRightF = Fra_ObjFraig( pRight, p->pPars->nFramesK );
525 // get the complemented attributes
526 fComplL = pLeft->fPhase ^ Aig_IsComplement(pLeftF);
527 fComplR = pRight->fPhase ^ Aig_IsComplement(pRightF);
528 // check equality
529 if ( Aig_Regular(pLeftF) == Aig_Regular(pRightF) )
530 {
531 if ( fComplL == fComplR ) // x => x - always true
532 continue;
533 assert( fComplL != fComplR );
534 // consider 4 possibilities:
535 // NOT(1) => 1 or 0 => 1 - always true
536 // 1 => NOT(1) or 1 => 0 - never true
537 // NOT(x) => x or x - not always true
538 // x => NOT(x) or NOT(x) - not always true
539 if ( Aig_ObjIsConst1(Aig_Regular(pLeftF)) && fComplL ) // proved implication
540 continue;
541 // disproved implication
542 p->pCla->fRefinement = 1;
543 Vec_IntWriteEntry( vImps, i, 0 );
544 continue;
545 }
546 // check the implication
547 // - if true, a clause is added
548 // - if false, a cex is simulated
549 // make sure the implication is refined
550 RetValue = Fra_NodesAreImp( p, Aig_Regular(pLeftF), Aig_Regular(pRightF), fComplL, fComplR );
551 if ( RetValue != 1 )
552 {
553 p->pCla->fRefinement = 1;
554 if ( RetValue == 0 )
556 if ( Vec_IntEntry(vImps, i) != 0 )
557 printf( "Fra_ImpCheckForNode(): Implication is not refined!\n" );
558 assert( Vec_IntEntry(vImps, i) == 0 );
559 }
560 }
561 return i;
562}
int Fra_NodesAreImp(Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew, int fComplL, int fComplR)
Definition fraSat.c:209
void Fra_SmlResimulate(Fra_Man_t *p)
Definition fraSim.c:703
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ImpCompactArray()

void Fra_ImpCompactArray ( Vec_Int_t * vImps)
extern

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

Synopsis [Removes empty implications.]

Description []

SideEffects []

SeeAlso []

Definition at line 607 of file fraImp.c.

608{
609 int i, k, Imp;
610 k = 0;
611 Vec_IntForEachEntry( vImps, Imp, i )
612 if ( Imp )
613 Vec_IntWriteEntry( vImps, k++, Imp );
614 Vec_IntShrink( vImps, k );
615}
Here is the caller graph for this function:

◆ Fra_ImpComputeStateSpaceRatio()

double Fra_ImpComputeStateSpaceRatio ( Fra_Man_t * p)
extern

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

Synopsis [Determines the ratio of the state space by computed implications.]

Description []

SideEffects []

SeeAlso []

Definition at line 628 of file fraImp.c.

629{
630 int nSimWords = 64;
631 Fra_Sml_t * pComb;
632 unsigned * pResult;
633 double Ratio = 0.0;
634 int Left, Right, Imp, i;
635 if ( p->pCla->vImps == NULL || Vec_IntSize(p->pCla->vImps) == 0 )
636 return Ratio;
637 // simulate the AIG manager with combinational patterns
638 pComb = Fra_SmlSimulateComb( p->pManAig, nSimWords, 0 );
639 // go through the implications and collect where they do not hold
640 pResult = Fra_ObjSim( pComb, 0 );
641 assert( pResult[0] == 0 );
642 Vec_IntForEachEntry( p->pCla->vImps, Imp, i )
643 {
644 Left = Fra_ImpLeft(Imp);
645 Right = Fra_ImpRight(Imp);
646 Sml_NodeSaveNotImpPatterns( pComb, Left, Right, pResult );
647 }
648 // count the number of ones in this area
649 Ratio = 100.0 * Fra_SmlCountOnesOne( pComb, 0 ) / (32*(pComb->nWordsTotal-pComb->nWordsPref));
650 Fra_SmlStop( pComb );
651 return Ratio;
652}
int nWordsPref
Definition fra.h:178
int nWordsTotal
Definition fra.h:177
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ImpDerive()

Vec_Int_t * Fra_ImpDerive ( Fra_Man_t * p,
int nImpMaxLimit,
int nImpUseLimit,
int fLatchCorr )
extern

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

Synopsis [Derives implication candidates.]

Description [Implication candidates have the property that (1) they hold using sequential simulation information (2) they do not hold using combinational simulation information (3) they have as high expressive power as possible (heuristically) that is, they are easy to disprove combinationally meaning they cover relatively larger sequential subspace.]

SideEffects []

SeeAlso []

Definition at line 321 of file fraImp.c.

322{
323 int nSimWords = 64;
324 Fra_Sml_t * pSeq, * pComb;
325 Vec_Int_t * vImps, * vTemp;
326 Vec_Ptr_t * vNodes;
327 int * pImpCosts, * pNodesI, * pNodesK;
328 int nImpsTotal = 0, nImpsTried = 0, nImpsNonSeq = 0, nImpsComb = 0, nImpsCollected = 0;
329 int CostMin = ABC_INFINITY, CostMax = 0;
330 int i, k, Imp, CostRange;
331 abctime clk = Abc_Clock();
332 assert( Aig_ManObjNumMax(p->pManAig) < (1 << 15) );
333 assert( nImpMaxLimit > 0 && nImpUseLimit > 0 && nImpUseLimit <= nImpMaxLimit );
334 // normalize both managers
335 pComb = Fra_SmlSimulateComb( p->pManAig, nSimWords, 0 );
336 pSeq = Fra_SmlSimulateSeq( p->pManAig, p->pPars->nFramesP, nSimWords, 1, 1 );
337 // get the nodes sorted by the number of 1s
338 vNodes = Fra_SmlSortUsingOnes( pSeq, fLatchCorr );
339 // count the total number of implications
340 for ( k = nSimWords * 32; k > 0; k-- )
341 for ( i = k - 1; i > 0; i-- )
342 for ( pNodesI = (int *)Vec_PtrEntry( vNodes, i ); *pNodesI; pNodesI++ )
343 for ( pNodesK = (int *)Vec_PtrEntry( vNodes, k ); *pNodesK; pNodesK++ )
344 nImpsTotal++;
345
346 // compute implications and their costs
347 pImpCosts = ABC_ALLOC( int, nImpMaxLimit );
348 vImps = Vec_IntAlloc( nImpMaxLimit );
349 for ( k = pSeq->nWordsTotal * 32; k > 0; k-- )
350 for ( i = k - 1; i > 0; i-- )
351 {
352 // HERE WE ARE MISSING SOME POTENTIAL IMPLICATIONS (with complement!)
353
354 for ( pNodesI = (int *)Vec_PtrEntry( vNodes, i ); *pNodesI; pNodesI++ )
355 for ( pNodesK = (int *)Vec_PtrEntry( vNodes, k ); *pNodesK; pNodesK++ )
356 {
357 nImpsTried++;
358 if ( !Sml_NodeCheckImp(pSeq, *pNodesI, *pNodesK) )
359 {
360 nImpsNonSeq++;
361 continue;
362 }
363 if ( Sml_NodeCheckImp(pComb, *pNodesI, *pNodesK) )
364 {
365 nImpsComb++;
366 continue;
367 }
368 nImpsCollected++;
369 Imp = Fra_ImpCreate( *pNodesI, *pNodesK );
370 pImpCosts[ Vec_IntSize(vImps) ] = Sml_NodeNotImpWeight(pComb, *pNodesI, *pNodesK);
371 CostMin = Abc_MinInt( CostMin, pImpCosts[ Vec_IntSize(vImps) ] );
372 CostMax = Abc_MaxInt( CostMax, pImpCosts[ Vec_IntSize(vImps) ] );
373 Vec_IntPush( vImps, Imp );
374 if ( Vec_IntSize(vImps) == nImpMaxLimit )
375 goto finish;
376 }
377 }
378finish:
379 Fra_SmlStop( pComb );
380 Fra_SmlStop( pSeq );
381
382 // select implications with the highest cost
383 CostRange = CostMin;
384 if ( Vec_IntSize(vImps) > nImpUseLimit )
385 {
386 vImps = Fra_SmlSelectMaxCost( vTemp = vImps, pImpCosts, nSimWords * 32, nImpUseLimit, &CostRange );
387 Vec_IntFree( vTemp );
388 }
389
390 // dealloc
391 ABC_FREE( pImpCosts );
392 {
393 void * pTemp = Vec_PtrEntry(vNodes, 0);
394 ABC_FREE( pTemp );
395 }
396 Vec_PtrFree( vNodes );
397 // reorder implications topologically
398 qsort( (void *)Vec_IntArray(vImps), (size_t)Vec_IntSize(vImps), sizeof(int),
399 (int (*)(const void *, const void *)) Sml_CompareMaxId );
400if ( p->pPars->fVerbose )
401{
402printf( "Implications: All = %d. Try = %d. NonSeq = %d. Comb = %d. Res = %d.\n",
403 nImpsTotal, nImpsTried, nImpsNonSeq, nImpsComb, nImpsCollected );
404printf( "Implication weight: Min = %d. Pivot = %d. Max = %d. ",
405 CostMin, CostRange, CostMax );
406ABC_PRT( "Time", Abc_Clock() - clk );
407}
408 return vImps;
409}
int Sml_CompareMaxId(unsigned short *pImp1, unsigned short *pImp2)
Definition fraImp.c:294
Vec_Ptr_t * Fra_SmlSortUsingOnes(Fra_Sml_t *p, int fLatchCorr)
Definition fraImp.c:154
Vec_Int_t * Fra_SmlSelectMaxCost(Vec_Int_t *vImps, int *pCosts, int nCostMax, int nImpLimit, int *pCostRange)
Definition fraImp.c:244
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ImpRecordInManager()

void Fra_ImpRecordInManager ( Fra_Man_t * p,
Aig_Man_t * pNew )
extern

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

Synopsis [Record proven implications in the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 705 of file fraImp.c.

706{
707 Aig_Obj_t * pLeft, * pRight, * pMiter;
708 int nPosOld, Imp, i;
709 if ( p->pCla->vImps == NULL || Vec_IntSize(p->pCla->vImps) == 0 )
710 return;
711 // go through the implication
712 nPosOld = Aig_ManCoNum(pNew);
713 Vec_IntForEachEntry( p->pCla->vImps, Imp, i )
714 {
715 pLeft = Aig_ManObj( p->pManAig, Fra_ImpLeft(Imp) );
716 pRight = Aig_ManObj( p->pManAig, Fra_ImpRight(Imp) );
717 // record the implication: L' + R
718 pMiter = Aig_Or( pNew,
719 Aig_NotCond((Aig_Obj_t *)pLeft->pData, !pLeft->fPhase),
720 Aig_NotCond((Aig_Obj_t *)pRight->pData, pRight->fPhase) );
721 Aig_ObjCreateCo( pNew, pMiter );
722 }
723 pNew->nAsserts = Aig_ManCoNum(pNew) - nPosOld;
724}
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:259
Here is the call graph for this function:

◆ Fra_ImpRefineUsingCex()

int Fra_ImpRefineUsingCex ( Fra_Man_t * p,
Vec_Int_t * vImps )
extern

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

Synopsis [Removes those implications that no longer hold.]

Description [Returns 1 if refinement has happened.]

SideEffects []

SeeAlso []

Definition at line 575 of file fraImp.c.

576{
577 Aig_Obj_t * pLeft, * pRight;
578 int Imp, i, RetValue = 0;
579 Vec_IntForEachEntry( vImps, Imp, i )
580 {
581 if ( Imp == 0 )
582 continue;
583 // get the corresponding nodes
584 pLeft = Aig_ManObj( p->pManAig, Fra_ImpLeft(Imp) );
585 pRight = Aig_ManObj( p->pManAig, Fra_ImpRight(Imp) );
586 // check if implication holds using this simulation info
587 if ( !Sml_NodeCheckImp(p->pSml, pLeft->Id, pRight->Id) )
588 {
589 Vec_IntWriteEntry( vImps, i, 0 );
590 RetValue = 1;
591 }
592 }
593 return RetValue;
594}
Here is the caller graph for this function:

◆ Fra_ImpVerifyUsingSimulation()

int Fra_ImpVerifyUsingSimulation ( Fra_Man_t * p)
extern

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

Synopsis [Returns the number of failed implications.]

Description []

SideEffects []

SeeAlso []

Definition at line 665 of file fraImp.c.

666{
667 int nFrames = 2000;
668 int nSimWords = 8;
669 Fra_Sml_t * pSeq;
670 char * pfFails;
671 int Left, Right, Imp, i, Counter;
672 if ( p->pCla->vImps == NULL || Vec_IntSize(p->pCla->vImps) == 0 )
673 return 0;
674 // simulate the AIG manager with combinational patterns
675 pSeq = Fra_SmlSimulateSeq( p->pManAig, p->pPars->nFramesP, nFrames, nSimWords, 1 );
676 // go through the implications and check how many of them do not hold
677 pfFails = ABC_ALLOC( char, Vec_IntSize(p->pCla->vImps) );
678 memset( pfFails, 0, sizeof(char) * Vec_IntSize(p->pCla->vImps) );
679 Vec_IntForEachEntry( p->pCla->vImps, Imp, i )
680 {
681 Left = Fra_ImpLeft(Imp);
682 Right = Fra_ImpRight(Imp);
683 pfFails[i] = !Sml_NodeCheckImp( pSeq, Left, Right );
684 }
685 // count how many has failed
686 Counter = 0;
687 for ( i = 0; i < Vec_IntSize(p->pCla->vImps); i++ )
688 Counter += pfFails[i];
689 ABC_FREE( pfFails );
690 Fra_SmlStop( pSeq );
691 return Counter;
692}
Here is the call graph for this function:

◆ Fra_InvariantVerify()

int Fra_InvariantVerify ( Aig_Man_t * pAig,
int nFrames,
Vec_Int_t * vClauses,
Vec_Int_t * vLits )
extern

DECLARATIONS ///.

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

FileName [fraIndVer.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis [Verification of the inductive invariant.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraIndVer.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis [Verifies the inductive invariant.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file fraIndVer.c.

47{
48 Cnf_Dat_t * pCnf;
49 sat_solver * pSat;
50 int * pStart;
51 int RetValue, Beg, End, i, k;
52 int CounterBase = 0, CounterInd = 0;
53 abctime clk = Abc_Clock();
54
55 if ( nFrames != 1 )
56 {
57 printf( "Invariant verification: Can only verify for K = 1\n" );
58 return 1;
59 }
60
61 // derive CNF
62 pCnf = Cnf_DeriveSimple( pAig, Aig_ManCoNum(pAig) );
63/*
64 // add the property
65 {
66 Aig_Obj_t * pObj;
67 int Lits[1];
68
69 pObj = Aig_ManCo( pAig, 0 );
70 Lits[0] = toLitCond( pCnf->pVarNums[pObj->Id], 1 );
71
72 Vec_IntPush( vLits, Lits[0] );
73 Vec_IntPush( vClauses, Vec_IntSize(vLits) );
74 printf( "Added the target property to the set of clauses to be inductively checked.\n" );
75 }
76*/
77 // derive initialized frames for the base case
78 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, nFrames, 1 );
79 // check clauses in the base case
80 Beg = 0;
81 pStart = Vec_IntArray( vLits );
82 Vec_IntForEachEntry( vClauses, End, i )
83 {
84 // complement the literals
85 for ( k = Beg; k < End; k++ )
86 pStart[k] = lit_neg(pStart[k]);
87 RetValue = sat_solver_solve( pSat, pStart + Beg, pStart + End, 0, 0, 0, 0 );
88 for ( k = Beg; k < End; k++ )
89 pStart[k] = lit_neg(pStart[k]);
90 Beg = End;
91 if ( RetValue == l_False )
92 continue;
93// printf( "Clause %d failed the base case.\n", i );
94 CounterBase++;
95 }
96 sat_solver_delete( pSat );
97
98 // derive initialized frames for the base case
99 pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, nFrames + 1, 0 );
100 assert( pSat->size == 2 * pCnf->nVars );
101 // add clauses to the first frame
102 Beg = 0;
103 pStart = Vec_IntArray( vLits );
104 Vec_IntForEachEntry( vClauses, End, i )
105 {
106 RetValue = sat_solver_addclause( pSat, pStart + Beg, pStart + End );
107 Beg = End;
108 if ( RetValue == 0 )
109 {
110 Cnf_DataFree( pCnf );
111 sat_solver_delete( pSat );
112 printf( "Invariant verification: SAT solver is unsat after adding a clause.\n" );
113 return 0;
114 }
115 }
116 // simplify the solver
117 if ( pSat->qtail != pSat->qhead )
118 {
119 RetValue = sat_solver_simplify(pSat);
120 assert( RetValue != 0 );
121 assert( pSat->qtail == pSat->qhead );
122 }
123
124 // check clauses in the base case
125 Beg = 0;
126 pStart = Vec_IntArray( vLits );
127 Vec_IntForEachEntry( vClauses, End, i )
128 {
129 // complement the literals
130 for ( k = Beg; k < End; k++ )
131 {
132 pStart[k] += 2 * pCnf->nVars;
133 pStart[k] = lit_neg(pStart[k]);
134 }
135 RetValue = sat_solver_solve( pSat, pStart + Beg, pStart + End, 0, 0, 0, 0 );
136 for ( k = Beg; k < End; k++ )
137 {
138 pStart[k] = lit_neg(pStart[k]);
139 pStart[k] -= 2 * pCnf->nVars;
140 }
141 Beg = End;
142 if ( RetValue == l_False )
143 continue;
144// printf( "Clause %d failed the inductive case.\n", i );
145 CounterInd++;
146 }
147 sat_solver_delete( pSat );
148 Cnf_DataFree( pCnf );
149 if ( CounterBase )
150 printf( "Invariant verification: %d clauses (out of %d) FAILED the base case.\n", CounterBase, Vec_IntSize(vClauses) );
151 if ( CounterInd )
152 printf( "Invariant verification: %d clauses (out of %d) FAILED the inductive case.\n", CounterInd, Vec_IntSize(vClauses) );
153 if ( CounterBase || CounterInd )
154 return 0;
155 printf( "Invariant verification: %d clauses verified correctly. ", Vec_IntSize(vClauses) );
156 ABC_PRT( "Time", Abc_Clock() - clk );
157 return 1;
158}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManClean()

void Fra_ManClean ( Fra_Man_t * p,
int nNodesMax )
extern

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

Synopsis [Starts the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file fraMan.c.

146{
147 int i;
148 // remove old arrays
149 for ( i = 0; i < p->nMemAlloc; i++ )
150 if ( p->pMemFanins[i] && p->pMemFanins[i] != (void *)1 )
151 Vec_PtrFree( p->pMemFanins[i] );
152 // realloc for the new size
153 if ( p->nMemAlloc < nNodesMax )
154 {
155 int nMemAllocNew = nNodesMax + 5000;
156 p->pMemFanins = ABC_REALLOC( Vec_Ptr_t *, p->pMemFanins, nMemAllocNew );
157 p->pMemSatNums = ABC_REALLOC( int, p->pMemSatNums, nMemAllocNew );
158 p->nMemAlloc = nMemAllocNew;
159 }
160 // prepare for the new run
161 memset( p->pMemFanins, 0, sizeof(Vec_Ptr_t *) * p->nMemAlloc );
162 memset( p->pMemSatNums, 0, sizeof(int) * p->nMemAlloc );
163}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManFinalizeComb()

void Fra_ManFinalizeComb ( Fra_Man_t * p)
extern

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

Synopsis [Finalizes the combinational miter after fraiging.]

Description []

SideEffects []

SeeAlso []

Definition at line 217 of file fraMan.c.

218{
219 Aig_Obj_t * pObj;
220 int i;
221 // add the POs
222 Aig_ManForEachCo( p->pManAig, pObj, i )
223 Aig_ObjCreateCo( p->pManFraig, Fra_ObjChild0Fra(pObj,0) );
224 // postprocess
225 Aig_ManCleanMarkB( p->pManFraig );
226}
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManPrepareComb()

Aig_Man_t * Fra_ManPrepareComb ( Fra_Man_t * p)
extern

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

Synopsis [Prepares the new manager to begin fraiging.]

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file fraMan.c.

177{
178 Aig_Man_t * pManFraig;
179 Aig_Obj_t * pObj;
180 int i;
181 assert( p->pManFraig == NULL );
182 // start the fraig package
183 pManFraig = Aig_ManStart( Aig_ManObjNumMax(p->pManAig) );
184 pManFraig->pName = Abc_UtilStrsav( p->pManAig->pName );
185 pManFraig->pSpec = Abc_UtilStrsav( p->pManAig->pSpec );
186 pManFraig->nRegs = p->pManAig->nRegs;
187 pManFraig->nAsserts = p->pManAig->nAsserts;
188 // set the pointers to the available fraig nodes
189 Fra_ObjSetFraig( Aig_ManConst1(p->pManAig), 0, Aig_ManConst1(pManFraig) );
190 Aig_ManForEachCi( p->pManAig, pObj, i )
191 Fra_ObjSetFraig( pObj, 0, Aig_ObjCreateCi(pManFraig) );
192 // set the pointers to the manager
193 Aig_ManForEachObj( pManFraig, pObj, i )
194 pObj->pData = p;
195 // allocate memory for mapping FRAIG nodes into SAT numbers and fanins
196 p->nMemAlloc = p->nSizeAlloc;
197 p->pMemFanins = ABC_ALLOC( Vec_Ptr_t *, p->nMemAlloc );
198 memset( p->pMemFanins, 0, sizeof(Vec_Ptr_t *) * p->nMemAlloc );
199 p->pMemSatNums = ABC_ALLOC( int, p->nMemAlloc );
200 memset( p->pMemSatNums, 0, sizeof(int) * p->nMemAlloc );
201 // make sure the satisfying assignment is node assigned
202 assert( pManFraig->pData == NULL );
203 return pManFraig;
204}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManPrint()

void Fra_ManPrint ( Fra_Man_t * p)
extern

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

Synopsis [Prints stats for the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file fraMan.c.

279{
280 double nMemory = 1.0*Aig_ManObjNumMax(p->pManAig)*(p->pSml->nWordsTotal*sizeof(unsigned)+6*sizeof(void*))/(1<<20);
281 printf( "SimWord = %d. Round = %d. Mem = %0.2f MB. LitBeg = %d. LitEnd = %d. (%6.2f %%).\n",
282 p->pPars->nSimWords, p->pSml->nSimRounds, nMemory, p->nLitsBeg, p->nLitsEnd, 100.0*p->nLitsEnd/(p->nLitsBeg?p->nLitsBeg:1) );
283 printf( "Proof = %d. Cex = %d. Fail = %d. FailReal = %d. C-lim = %d. ImpRatio = %6.2f %%\n",
284 p->nSatProof, p->nSatCallsSat, p->nSatFails, p->nSatFailsReal, p->pPars->nBTLimitNode, Fra_ImpComputeStateSpaceRatio(p) );
285 printf( "NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n",
286 p->nNodesBeg, p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/(p->nNodesBeg?p->nNodesBeg:1),
287 p->nRegsBeg, p->nRegsEnd, 100.0*(p->nRegsBeg-p->nRegsEnd)/(p->nRegsBeg?p->nRegsBeg:1) );
288 if ( p->pSat ) Sat_SolverPrintStats( stdout, p->pSat );
289 if ( p->pPars->fUse1Hot ) Fra_OneHotEstimateCoverage( p, p->vOneHots );
290 ABC_PRT( "AIG simulation ", p->pSml->timeSim );
291 ABC_PRT( "AIG traversal ", p->timeTrav );
292 if ( p->timeRwr )
293 {
294 ABC_PRT( "AIG rewriting ", p->timeRwr );
295 }
296 ABC_PRT( "SAT solving ", p->timeSat );
297 ABC_PRT( " Unsat ", p->timeSatUnsat );
298 ABC_PRT( " Sat ", p->timeSatSat );
299 ABC_PRT( " Fail ", p->timeSatFail );
300 ABC_PRT( "Class refining ", p->timeRef );
301 ABC_PRT( "TOTAL RUNTIME ", p->timeTotal );
302 if ( p->time1 ) { ABC_PRT( "time1 ", p->time1 ); }
303 if ( p->nSpeculs )
304 printf( "Speculations = %d.\n", p->nSpeculs );
305 fflush( stdout );
306}
void Fra_OneHotEstimateCoverage(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:328
double Fra_ImpComputeStateSpaceRatio(Fra_Man_t *p)
Definition fraImp.c:628
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManStart()

Fra_Man_t * Fra_ManStart ( Aig_Man_t * pManAig,
Fra_Par_t * pPars )
extern

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

Synopsis [Starts the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file fraMan.c.

105{
106 Fra_Man_t * p;
107 Aig_Obj_t * pObj;
108 int i;
109 // allocate the fraiging manager
110 p = ABC_ALLOC( Fra_Man_t, 1 );
111 memset( p, 0, sizeof(Fra_Man_t) );
112 p->pPars = pPars;
113 p->pManAig = pManAig;
114 p->nSizeAlloc = Aig_ManObjNumMax( pManAig );
115 p->nFramesAll = pPars->nFramesK + 1;
116 // allocate storage for sim pattern
117 p->nPatWords = Abc_BitWordNum( (Aig_ManCiNum(pManAig) - Aig_ManRegNum(pManAig)) * p->nFramesAll + Aig_ManRegNum(pManAig) );
118 p->pPatWords = ABC_ALLOC( unsigned, p->nPatWords );
119 p->vPiVars = Vec_PtrAlloc( 100 );
120 // equivalence classes
121 p->pCla = Fra_ClassesStart( pManAig );
122 // allocate other members
123 p->pMemFraig = ABC_ALLOC( Aig_Obj_t *, p->nSizeAlloc * p->nFramesAll );
124 memset( p->pMemFraig, 0, sizeof(Aig_Obj_t *) * p->nSizeAlloc * p->nFramesAll );
125 // set random number generator
126// srand( 0xABCABC );
127 Aig_ManRandom(1);
128 // set the pointer to the manager
129 Aig_ManForEachObj( p->pManAig, pObj, i )
130 pObj->pData = p;
131 return p;
132}
unsigned Aig_ManRandom(int fReset)
Definition aigUtil.c:1170
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ManStop()

void Fra_ManStop ( Fra_Man_t * p)
extern

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

Synopsis [Stops the fraiging manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 240 of file fraMan.c.

241{
242 if ( p->pPars->fVerbose )
243 Fra_ManPrint( p );
244 // save mapping from original nodes into FRAIG nodes
245 if ( p->pManAig )
246 {
247 if ( p->pManAig->pObjCopies )
248 ABC_FREE( p->pManAig->pObjCopies );
249 p->pManAig->pObjCopies = p->pMemFraig;
250 p->pMemFraig = NULL;
251 }
252 Fra_ManClean( p, 0 );
253 if ( p->vTimeouts ) Vec_PtrFree( p->vTimeouts );
254 if ( p->vPiVars ) Vec_PtrFree( p->vPiVars );
255 if ( p->pSat ) sat_solver_delete( p->pSat );
256 if ( p->pCla ) Fra_ClassesStop( p->pCla );
257 if ( p->pSml ) Fra_SmlStop( p->pSml );
258 if ( p->vCex ) Vec_IntFree( p->vCex );
259 if ( p->vOneHots ) Vec_IntFree( p->vOneHots );
260 ABC_FREE( p->pMemFraig );
261 ABC_FREE( p->pMemFanins );
262 ABC_FREE( p->pMemSatNums );
263 ABC_FREE( p->pPatWords );
264 ABC_FREE( p );
265}
void Fra_ManClean(Fra_Man_t *p, int nNodesMax)
Definition fraMan.c:145
void Fra_ManPrint(Fra_Man_t *p)
Definition fraMan.c:278
void Fra_ClassesStop(Fra_Cla_t *p)
Definition fraClass.c:90
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_NodeIsConst()

int Fra_NodeIsConst ( Fra_Man_t * p,
Aig_Obj_t * pNew )
extern

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

Synopsis [Runs equivalence test for one node.]

Description [Returns the fraiged node.]

SideEffects []

SeeAlso []

Definition at line 425 of file fraSat.c.

426{
427 int pLits[2], RetValue1, RetValue;
428 abctime clk;
429
430 // make sure the nodes are not complemented
431 assert( !Aig_IsComplement(pNew) );
432 assert( pNew != p->pManFraig->pConst1 );
433 p->nSatCalls++;
434
435 // make sure the solver is allocated and has enough variables
436 if ( p->pSat == NULL )
437 {
438 p->pSat = sat_solver_new();
439 p->nSatVars = 1;
440 sat_solver_setnvars( p->pSat, 1000 );
441 // var 0 is reserved for const1 node - add the clause
442 pLits[0] = toLit( 0 );
443 sat_solver_addclause( p->pSat, pLits, pLits + 1 );
444 }
445
446 // if the nodes do not have SAT variables, allocate them
447 Fra_CnfNodeAddToSolver( p, NULL, pNew );
448
449 // prepare variable activity
450 if ( p->pPars->fConeBias )
451 Fra_SetActivityFactors( p, NULL, pNew );
452
453 // solve under assumptions
454clk = Abc_Clock();
455 pLits[0] = toLitCond( Fra_ObjSatNum(pNew), pNew->fPhase );
456 RetValue1 = sat_solver_solve( p->pSat, pLits, pLits + 1,
457 (ABC_INT64_T)p->pPars->nBTLimitMiter, (ABC_INT64_T)0,
458 p->nBTLimitGlobal, p->nInsLimitGlobal );
459p->timeSat += Abc_Clock() - clk;
460 if ( RetValue1 == l_False )
461 {
462p->timeSatUnsat += Abc_Clock() - clk;
463 pLits[0] = lit_neg( pLits[0] );
464 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 1 );
465 assert( RetValue );
466 // continue solving the other implication
467 p->nSatCallsUnsat++;
468 }
469 else if ( RetValue1 == l_True )
470 {
471p->timeSatSat += Abc_Clock() - clk;
472 if ( p->pPatWords )
474 p->nSatCallsSat++;
475 return 0;
476 }
477 else // if ( RetValue1 == l_Undef )
478 {
479p->timeSatFail += Abc_Clock() - clk;
480 // mark the node as the failed node
481 pNew->fMarkB = 1;
482 p->nSatFailsReal++;
483 return -1;
484 }
485
486 // return SAT proof
487 p->nSatProof++;
488 return 1;
489}
void Fra_CnfNodeAddToSolver(Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew)
Definition fraCnf.c:238
void Fra_SmlSavePattern(Fra_Man_t *p)
Definition fraSim.c:241
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
unsigned int fMarkB
Definition aig.h:80
Here is the call graph for this function:

◆ Fra_NodesAreClause()

int Fra_NodesAreClause ( Fra_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew,
int fComplL,
int fComplR )
extern

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

Synopsis [Runs the result of test for pObj => pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file fraSat.c.

318{
319 int pLits[4], RetValue, RetValue1, nBTLimit;
320 abctime clk;//, clk2 = Abc_Clock();
321 int status;
322
323 // make sure the nodes are not complemented
324 assert( !Aig_IsComplement(pNew) );
325 assert( !Aig_IsComplement(pOld) );
326 assert( pNew != pOld );
327
328 // if at least one of the nodes is a failed node, perform adjustments:
329 // if the backtrack limit is small, simply skip this node
330 // if the backtrack limit is > 10, take the quare root of the limit
331 nBTLimit = p->pPars->nBTLimitNode;
332/*
333 if ( !p->pPars->fSpeculate && p->pPars->nFramesK == 0 && (nBTLimit > 0 && (pOld->fMarkB || pNew->fMarkB)) )
334 {
335 p->nSatFails++;
336 // fail immediately
337// return -1;
338 if ( nBTLimit <= 10 )
339 return -1;
340 nBTLimit = (int)pow(nBTLimit, 0.7);
341 }
342*/
343 p->nSatCalls++;
344
345 // make sure the solver is allocated and has enough variables
346 if ( p->pSat == NULL )
347 {
348 p->pSat = sat_solver_new();
349 p->nSatVars = 1;
350 sat_solver_setnvars( p->pSat, 1000 );
351 // var 0 is reserved for const1 node - add the clause
352 pLits[0] = toLit( 0 );
353 sat_solver_addclause( p->pSat, pLits, pLits + 1 );
354 }
355
356 // if the nodes do not have SAT variables, allocate them
357 Fra_CnfNodeAddToSolver( p, pOld, pNew );
358
359 if ( p->pSat->qtail != p->pSat->qhead )
360 {
361 status = sat_solver_simplify(p->pSat);
362 assert( status != 0 );
363 assert( p->pSat->qtail == p->pSat->qhead );
364 }
365
366 // prepare variable activity
367 if ( p->pPars->fConeBias )
368 Fra_SetActivityFactors( p, pOld, pNew );
369
370 // solve under assumptions
371 // A = 1; B = 0 OR A = 1; B = 1
372clk = Abc_Clock();
373// pLits[0] = toLitCond( Fra_ObjSatNum(pOld), 0 );
374// pLits[1] = toLitCond( Fra_ObjSatNum(pNew), pOld->fPhase == pNew->fPhase );
375 pLits[0] = toLitCond( Fra_ObjSatNum(pOld), !fComplL );
376 pLits[1] = toLitCond( Fra_ObjSatNum(pNew), !fComplR );
377//Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
378 RetValue1 = sat_solver_solve( p->pSat, pLits, pLits + 2,
379 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0,
380 p->nBTLimitGlobal, p->nInsLimitGlobal );
381p->timeSat += Abc_Clock() - clk;
382 if ( RetValue1 == l_False )
383 {
384p->timeSatUnsat += Abc_Clock() - clk;
385 pLits[0] = lit_neg( pLits[0] );
386 pLits[1] = lit_neg( pLits[1] );
387 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
388 assert( RetValue );
389 // continue solving the other implication
390 p->nSatCallsUnsat++;
391 }
392 else if ( RetValue1 == l_True )
393 {
394p->timeSatSat += Abc_Clock() - clk;
396 p->nSatCallsSat++;
397 return 0;
398 }
399 else // if ( RetValue1 == l_Undef )
400 {
401p->timeSatFail += Abc_Clock() - clk;
402 // mark the node as the failed node
403 if ( pOld != p->pManFraig->pConst1 )
404 pOld->fMarkB = 1;
405 pNew->fMarkB = 1;
406 p->nSatFailsReal++;
407 return -1;
408 }
409 // return SAT proof
410 p->nSatProof++;
411 return 1;
412}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_NodesAreEquiv()

int Fra_NodesAreEquiv ( Fra_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Runs equivalence test for the two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file fraSat.c.

49{
50 int pLits[4], RetValue, RetValue1, nBTLimit;
51 abctime clk;//, clk2 = Abc_Clock();
52 int status;
53
54 // make sure the nodes are not complemented
55 assert( !Aig_IsComplement(pNew) );
56 assert( !Aig_IsComplement(pOld) );
57 assert( pNew != pOld );
58
59 // if at least one of the nodes is a failed node, perform adjustments:
60 // if the backtrack limit is small, simply skip this node
61 // if the backtrack limit is > 10, take the quare root of the limit
62 nBTLimit = p->pPars->nBTLimitNode;
63 if ( !p->pPars->fSpeculate && p->pPars->nFramesK == 0 && (nBTLimit > 0 && (pOld->fMarkB || pNew->fMarkB)) )
64 {
65 p->nSatFails++;
66 // fail immediately
67// return -1;
68 if ( nBTLimit <= 10 )
69 return -1;
70 nBTLimit = (int)pow(nBTLimit, 0.7);
71 }
72
73 p->nSatCalls++;
74 p->nSatCallsRecent++;
75
76 // make sure the solver is allocated and has enough variables
77 if ( p->pSat == NULL )
78 {
79 p->pSat = sat_solver_new();
80 p->nSatVars = 1;
81 sat_solver_setnvars( p->pSat, 1000 );
82 // var 0 is reserved for const1 node - add the clause
83 pLits[0] = toLit( 0 );
84 sat_solver_addclause( p->pSat, pLits, pLits + 1 );
85 }
86
87 // if the nodes do not have SAT variables, allocate them
88 Fra_CnfNodeAddToSolver( p, pOld, pNew );
89
90 if ( p->pSat->qtail != p->pSat->qhead )
91 {
92 status = sat_solver_simplify(p->pSat);
93 assert( status != 0 );
94 assert( p->pSat->qtail == p->pSat->qhead );
95 }
96
97 // prepare variable activity
98 if ( p->pPars->fConeBias )
99 Fra_SetActivityFactors( p, pOld, pNew );
100
101 // solve under assumptions
102 // A = 1; B = 0 OR A = 1; B = 1
103clk = Abc_Clock();
104 pLits[0] = toLitCond( Fra_ObjSatNum(pOld), 0 );
105 pLits[1] = toLitCond( Fra_ObjSatNum(pNew), pOld->fPhase == pNew->fPhase );
106//Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
107 RetValue1 = sat_solver_solve( p->pSat, pLits, pLits + 2,
108 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0,
109 p->nBTLimitGlobal, p->nInsLimitGlobal );
110p->timeSat += Abc_Clock() - clk;
111 if ( RetValue1 == l_False )
112 {
113p->timeSatUnsat += Abc_Clock() - clk;
114 pLits[0] = lit_neg( pLits[0] );
115 pLits[1] = lit_neg( pLits[1] );
116 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
117 assert( RetValue );
118 // continue solving the other implication
119 p->nSatCallsUnsat++;
120 }
121 else if ( RetValue1 == l_True )
122 {
123p->timeSatSat += Abc_Clock() - clk;
125 p->nSatCallsSat++;
126 return 0;
127 }
128 else // if ( RetValue1 == l_Undef )
129 {
130p->timeSatFail += Abc_Clock() - clk;
131 // mark the node as the failed node
132 if ( pOld != p->pManFraig->pConst1 )
133 pOld->fMarkB = 1;
134 pNew->fMarkB = 1;
135 p->nSatFailsReal++;
136 return -1;
137 }
138
139 // if the old node was constant 0, we already know the answer
140 if ( pOld == p->pManFraig->pConst1 )
141 {
142 p->nSatProof++;
143 return 1;
144 }
145
146 // solve under assumptions
147 // A = 0; B = 1 OR A = 0; B = 0
148clk = Abc_Clock();
149 pLits[0] = toLitCond( Fra_ObjSatNum(pOld), 1 );
150 pLits[1] = toLitCond( Fra_ObjSatNum(pNew), pOld->fPhase ^ pNew->fPhase );
151 RetValue1 = sat_solver_solve( p->pSat, pLits, pLits + 2,
152 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0,
153 p->nBTLimitGlobal, p->nInsLimitGlobal );
154p->timeSat += Abc_Clock() - clk;
155 if ( RetValue1 == l_False )
156 {
157p->timeSatUnsat += Abc_Clock() - clk;
158 pLits[0] = lit_neg( pLits[0] );
159 pLits[1] = lit_neg( pLits[1] );
160 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
161 assert( RetValue );
162 p->nSatCallsUnsat++;
163 }
164 else if ( RetValue1 == l_True )
165 {
166p->timeSatSat += Abc_Clock() - clk;
168 p->nSatCallsSat++;
169 return 0;
170 }
171 else // if ( RetValue1 == l_Undef )
172 {
173p->timeSatFail += Abc_Clock() - clk;
174 // mark the node as the failed node
175 pOld->fMarkB = 1;
176 pNew->fMarkB = 1;
177 p->nSatFailsReal++;
178 return -1;
179 }
180/*
181 // check BDD proof
182 {
183 int RetVal;
184 ABC_PRT( "Sat", Abc_Clock() - clk2 );
185 clk2 = Abc_Clock();
186 RetVal = Fra_NodesAreEquivBdd( pOld, pNew );
187// printf( "%d ", RetVal );
188 assert( RetVal );
189 ABC_PRT( "Bdd", Abc_Clock() - clk2 );
190 printf( "\n" );
191 }
192*/
193 // return SAT proof
194 p->nSatProof++;
195 return 1;
196}
Here is the call graph for this function:

◆ Fra_NodesAreImp()

int Fra_NodesAreImp ( Fra_Man_t * p,
Aig_Obj_t * pOld,
Aig_Obj_t * pNew,
int fComplL,
int fComplR )
extern

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

Synopsis [Runs the result of test for pObj => pNew.]

Description []

SideEffects []

SeeAlso []

Definition at line 209 of file fraSat.c.

210{
211 int pLits[4], RetValue, RetValue1, nBTLimit;
212 abctime clk;//, clk2 = Abc_Clock();
213 int status;
214
215 // make sure the nodes are not complemented
216 assert( !Aig_IsComplement(pNew) );
217 assert( !Aig_IsComplement(pOld) );
218 assert( pNew != pOld );
219
220 // if at least one of the nodes is a failed node, perform adjustments:
221 // if the backtrack limit is small, simply skip this node
222 // if the backtrack limit is > 10, take the quare root of the limit
223 nBTLimit = p->pPars->nBTLimitNode;
224/*
225 if ( !p->pPars->fSpeculate && p->pPars->nFramesK == 0 && (nBTLimit > 0 && (pOld->fMarkB || pNew->fMarkB)) )
226 {
227 p->nSatFails++;
228 // fail immediately
229// return -1;
230 if ( nBTLimit <= 10 )
231 return -1;
232 nBTLimit = (int)pow(nBTLimit, 0.7);
233 }
234*/
235 p->nSatCalls++;
236
237 // make sure the solver is allocated and has enough variables
238 if ( p->pSat == NULL )
239 {
240 p->pSat = sat_solver_new();
241 p->nSatVars = 1;
242 sat_solver_setnvars( p->pSat, 1000 );
243 // var 0 is reserved for const1 node - add the clause
244 pLits[0] = toLit( 0 );
245 sat_solver_addclause( p->pSat, pLits, pLits + 1 );
246 }
247
248 // if the nodes do not have SAT variables, allocate them
249 Fra_CnfNodeAddToSolver( p, pOld, pNew );
250
251 if ( p->pSat->qtail != p->pSat->qhead )
252 {
253 status = sat_solver_simplify(p->pSat);
254 assert( status != 0 );
255 assert( p->pSat->qtail == p->pSat->qhead );
256 }
257
258 // prepare variable activity
259 if ( p->pPars->fConeBias )
260 Fra_SetActivityFactors( p, pOld, pNew );
261
262 // solve under assumptions
263 // A = 1; B = 0 OR A = 1; B = 1
264clk = Abc_Clock();
265// pLits[0] = toLitCond( Fra_ObjSatNum(pOld), 0 );
266// pLits[1] = toLitCond( Fra_ObjSatNum(pNew), pOld->fPhase == pNew->fPhase );
267 pLits[0] = toLitCond( Fra_ObjSatNum(pOld), fComplL );
268 pLits[1] = toLitCond( Fra_ObjSatNum(pNew), !fComplR );
269//Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
270 RetValue1 = sat_solver_solve( p->pSat, pLits, pLits + 2,
271 (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0,
272 p->nBTLimitGlobal, p->nInsLimitGlobal );
273p->timeSat += Abc_Clock() - clk;
274 if ( RetValue1 == l_False )
275 {
276p->timeSatUnsat += Abc_Clock() - clk;
277 pLits[0] = lit_neg( pLits[0] );
278 pLits[1] = lit_neg( pLits[1] );
279 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
280 assert( RetValue );
281 // continue solving the other implication
282 p->nSatCallsUnsat++;
283 }
284 else if ( RetValue1 == l_True )
285 {
286p->timeSatSat += Abc_Clock() - clk;
288 p->nSatCallsSat++;
289 return 0;
290 }
291 else // if ( RetValue1 == l_Undef )
292 {
293p->timeSatFail += Abc_Clock() - clk;
294 // mark the node as the failed node
295 if ( pOld != p->pManFraig->pConst1 )
296 pOld->fMarkB = 1;
297 pNew->fMarkB = 1;
298 p->nSatFailsReal++;
299 return -1;
300 }
301 // return SAT proof
302 p->nSatProof++;
303 return 1;
304}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotAddKnownConstraint()

void Fra_OneHotAddKnownConstraint ( Fra_Man_t * p,
Vec_Ptr_t * vOnehots )
extern

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

Synopsis [Assumes one-hot implications in the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file fraHot.c.

440{
441 Vec_Int_t * vGroup;
442 Aig_Obj_t * pObj1, * pObj2;
443 int k, i, j, Out1, Out2, pLits[2];
444 //
445 // these constrants should be added to different timeframes!
446 // (also note that PIs follow first - then registers)
447 //
448 Vec_PtrForEachEntry( Vec_Int_t *, vOnehots, vGroup, k )
449 {
450 Vec_IntForEachEntry( vGroup, Out1, i )
451 Vec_IntForEachEntryStart( vGroup, Out2, j, i+1 )
452 {
453 pObj1 = Aig_ManCi( p->pManFraig, Out1 );
454 pObj2 = Aig_ManCi( p->pManFraig, Out2 );
455 pLits[0] = toLitCond( Fra_ObjSatNum(pObj1), 1 );
456 pLits[1] = toLitCond( Fra_ObjSatNum(pObj2), 1 );
457 // add constraint to solver
458 if ( !sat_solver_addclause( p->pSat, pLits, pLits + 2 ) )
459 {
460 printf( "Fra_OneHotAddKnownConstraint(): Adding clause makes SAT solver unsat.\n" );
461 sat_solver_delete( p->pSat );
462 p->pSat = NULL;
463 return;
464 }
465 }
466 }
467}
Here is the call graph for this function:

◆ Fra_OneHotAssume()

void Fra_OneHotAssume ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Assumes one-hot implications in the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 191 of file fraHot.c.

192{
193 Aig_Obj_t * pObj1, * pObj2;
194 int i, Out1, Out2, pLits[2];
195 int nPiNum = Aig_ManCiNum(p->pManFraig) - Aig_ManRegNum(p->pManFraig);
196 assert( p->pPars->nFramesK == 1 ); // add to only one frame
197 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
198 {
199 Out1 = Vec_IntEntry( vOneHots, i );
200 Out2 = Vec_IntEntry( vOneHots, i+1 );
201 if ( Out1 == 0 && Out2 == 0 )
202 continue;
203 pObj1 = Aig_ManCi( p->pManFraig, nPiNum + Fra_LitReg(Out1) );
204 pObj2 = Aig_ManCi( p->pManFraig, nPiNum + Fra_LitReg(Out2) );
205 pLits[0] = toLitCond( Fra_ObjSatNum(pObj1), Fra_LitSign(Out1) );
206 pLits[1] = toLitCond( Fra_ObjSatNum(pObj2), Fra_LitSign(Out2) );
207 // add constraint to solver
208 if ( !sat_solver_addclause( p->pSat, pLits, pLits + 2 ) )
209 {
210 printf( "Fra_OneHotAssume(): Adding clause makes SAT solver unsat.\n" );
211 sat_solver_delete( p->pSat );
212 p->pSat = NULL;
213 return;
214 }
215 }
216}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotCheck()

void Fra_OneHotCheck ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Checks one-hot implications.]

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file fraHot.c.

230{
231 Aig_Obj_t * pObj1, * pObj2;
232 int RetValue, i, Out1, Out2;
233 int nTruePos = Aig_ManCoNum(p->pManFraig) - Aig_ManRegNum(p->pManFraig);
234 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
235 {
236 Out1 = Vec_IntEntry( vOneHots, i );
237 Out2 = Vec_IntEntry( vOneHots, i+1 );
238 if ( Out1 == 0 && Out2 == 0 )
239 continue;
240 pObj1 = Aig_ManCo( p->pManFraig, nTruePos + Fra_LitReg(Out1) );
241 pObj2 = Aig_ManCo( p->pManFraig, nTruePos + Fra_LitReg(Out2) );
242 RetValue = Fra_NodesAreClause( p, pObj1, pObj2, Fra_LitSign(Out1), Fra_LitSign(Out2) );
243 if ( RetValue != 1 )
244 {
245 p->pCla->fRefinement = 1;
246 if ( RetValue == 0 )
248 if ( Vec_IntEntry(vOneHots, i) != 0 )
249 printf( "Fra_OneHotCheck(): Clause is not refined!\n" );
250 assert( Vec_IntEntry(vOneHots, i) == 0 );
251 }
252 }
253}
int Fra_NodesAreClause(Fra_Man_t *p, Aig_Obj_t *pOld, Aig_Obj_t *pNew, int fComplL, int fComplR)
Definition fraSat.c:317
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotCompute()

Vec_Int_t * Fra_OneHotCompute ( Fra_Man_t * p,
Fra_Sml_t * pSim )
extern

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

Synopsis [Computes one-hot implications.]

Description []

SideEffects []

SeeAlso []

Definition at line 134 of file fraHot.c.

135{
136 int fSkipConstEqu = 1;
137 Vec_Int_t * vOneHots;
138 Aig_Obj_t * pObj1, * pObj2;
139 int i, k;
140 int nTruePis = Aig_ManCiNum(pSim->pAig) - Aig_ManRegNum(pSim->pAig);
141 assert( pSim->pAig == p->pManAig );
142 vOneHots = Vec_IntAlloc( 100 );
143 Aig_ManForEachLoSeq( pSim->pAig, pObj1, i )
144 {
145 if ( fSkipConstEqu && Fra_OneHotNodeIsConst(pSim, pObj1) )
146 continue;
147 assert( i-nTruePis >= 0 );
148// Aig_ManForEachLoSeq( pSim->pAig, pObj2, k )
149// Vec_PtrForEachEntryStart( Aig_Obj_t *, pSim->pAig->vPis, pObj2, k, Aig_ManCiNum(p)-Aig_ManRegNum(p) )
150 Vec_PtrForEachEntryStart( Aig_Obj_t *, pSim->pAig->vCis, pObj2, k, i+1 )
151 {
152 if ( fSkipConstEqu && Fra_OneHotNodeIsConst(pSim, pObj2) )
153 continue;
154 if ( fSkipConstEqu && Fra_OneHotNodesAreEqual( pSim, pObj1, pObj2 ) )
155 continue;
156 assert( k-nTruePis >= 0 );
157 if ( Fra_OneHotNodesAreClause( pSim, pObj1, pObj2, 1, 1 ) )
158 {
159 Vec_IntPush( vOneHots, Fra_RegToLit(i-nTruePis, 1) );
160 Vec_IntPush( vOneHots, Fra_RegToLit(k-nTruePis, 1) );
161 continue;
162 }
163 if ( Fra_OneHotNodesAreClause( pSim, pObj1, pObj2, 0, 1 ) )
164 {
165 Vec_IntPush( vOneHots, Fra_RegToLit(i-nTruePis, 0) );
166 Vec_IntPush( vOneHots, Fra_RegToLit(k-nTruePis, 1) );
167 continue;
168 }
169 if ( Fra_OneHotNodesAreClause( pSim, pObj1, pObj2, 1, 0 ) )
170 {
171 Vec_IntPush( vOneHots, Fra_RegToLit(i-nTruePis, 1) );
172 Vec_IntPush( vOneHots, Fra_RegToLit(k-nTruePis, 0) );
173 continue;
174 }
175 }
176 }
177 return vOneHots;
178}
int Fra_OneHotNodesAreEqual(Fra_Sml_t *pSeq, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
Definition fraHot.c:71
int Fra_OneHotNodesAreClause(Fra_Sml_t *pSeq, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2, int fCompl1, int fCompl2)
Definition fraHot.c:94
int Fra_OneHotNodeIsConst(Fra_Sml_t *pSeq, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition fraHot.c:49
Aig_Man_t * pAig
Definition fra.h:173
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotCount()

int Fra_OneHotCount ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Removes those implications that no longer hold.]

Description [Returns 1 if refinement has happened.]

SideEffects []

SeeAlso []

Definition at line 303 of file fraHot.c.

304{
305 int i, Out1, Out2, Counter = 0;
306 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
307 {
308 Out1 = Vec_IntEntry( vOneHots, i );
309 Out2 = Vec_IntEntry( vOneHots, i+1 );
310 if ( Out1 == 0 && Out2 == 0 )
311 continue;
312 Counter++;
313 }
314 return Counter;
315}
Here is the caller graph for this function:

◆ Fra_OneHotCreateExdc()

Aig_Man_t * Fra_OneHotCreateExdc ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Creates one-hotness EXDC.]

Description []

SideEffects []

SeeAlso []

Definition at line 398 of file fraHot.c.

399{
400 Aig_Man_t * pNew;
401 Aig_Obj_t * pObj1, * pObj2, * pObj;
402 int i, Out1, Out2, nTruePis;
403 pNew = Aig_ManStart( Vec_IntSize(vOneHots)/2 );
404// for ( i = 0; i < Aig_ManRegNum(p->pManAig); i++ )
405// Aig_ObjCreateCi(pNew);
406 Aig_ManForEachCi( p->pManAig, pObj, i )
407 Aig_ObjCreateCi(pNew);
408 nTruePis = Aig_ManCiNum(p->pManAig) - Aig_ManRegNum(p->pManAig);
409 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
410 {
411 Out1 = Vec_IntEntry( vOneHots, i );
412 Out2 = Vec_IntEntry( vOneHots, i+1 );
413 if ( Out1 == 0 && Out2 == 0 )
414 continue;
415 pObj1 = Aig_ManCi( pNew, nTruePis + Fra_LitReg(Out1) );
416 pObj2 = Aig_ManCi( pNew, nTruePis + Fra_LitReg(Out2) );
417 pObj1 = Aig_NotCond( pObj1, Fra_LitSign(Out1) );
418 pObj2 = Aig_NotCond( pObj2, Fra_LitSign(Out2) );
419 pObj = Aig_Or( pNew, pObj1, pObj2 );
420 Aig_ObjCreateCo( pNew, pObj );
421 }
422 Aig_ManCleanup(pNew);
423// printf( "Created AIG with %d nodes and %d outputs.\n", Aig_ManNodeNum(pNew), Aig_ManCoNum(pNew) );
424 return pNew;
425}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotEstimateCoverage()

void Fra_OneHotEstimateCoverage ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Estimates the coverage of state space by clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 328 of file fraHot.c.

329{
330 int nSimWords = (1<<14);
331 int nRegs = Aig_ManRegNum(p->pManAig);
332 Vec_Ptr_t * vSimInfo;
333 unsigned * pSim1, * pSim2, * pSimTot;
334 int i, w, Out1, Out2, nCovered, Counter = 0;
335 abctime clk = Abc_Clock();
336
337 // generate random sim-info at register outputs
338 vSimInfo = Vec_PtrAllocSimInfo( nRegs + 1, nSimWords );
339// srand( 0xAABBAABB );
340 Aig_ManRandom(1);
341 for ( i = 0; i < nRegs; i++ )
342 {
343 pSim1 = (unsigned *)Vec_PtrEntry( vSimInfo, i );
344 for ( w = 0; w < nSimWords; w++ )
345 pSim1[w] = Fra_ObjRandomSim();
346 }
347 pSimTot = (unsigned *)Vec_PtrEntry( vSimInfo, nRegs );
348
349 // collect simulation info
350 memset( pSimTot, 0, sizeof(unsigned) * nSimWords );
351 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
352 {
353 Out1 = Vec_IntEntry( vOneHots, i );
354 Out2 = Vec_IntEntry( vOneHots, i+1 );
355 if ( Out1 == 0 && Out2 == 0 )
356 continue;
357//printf( "(%c%d,%c%d) ",
358//Fra_LitSign(Out1)? '-': '+', Fra_LitReg(Out1),
359//Fra_LitSign(Out2)? '-': '+', Fra_LitReg(Out2) );
360 Counter++;
361 pSim1 = (unsigned *)Vec_PtrEntry( vSimInfo, Fra_LitReg(Out1) );
362 pSim2 = (unsigned *)Vec_PtrEntry( vSimInfo, Fra_LitReg(Out2) );
363 if ( Fra_LitSign(Out1) && Fra_LitSign(Out2) )
364 for ( w = 0; w < nSimWords; w++ )
365 pSimTot[w] |= pSim1[w] & pSim2[w];
366 else if ( Fra_LitSign(Out1) )
367 for ( w = 0; w < nSimWords; w++ )
368 pSimTot[w] |= pSim1[w] & ~pSim2[w];
369 else if ( Fra_LitSign(Out2) )
370 for ( w = 0; w < nSimWords; w++ )
371 pSimTot[w] |= ~pSim1[w] & pSim2[w];
372 else
373 assert( 0 );
374 }
375//printf( "\n" );
376 // count the total number of patterns contained in the don't-care
377 nCovered = 0;
378 for ( w = 0; w < nSimWords; w++ )
379 nCovered += Aig_WordCountOnes( pSimTot[w] );
380 Vec_PtrFree( vSimInfo );
381 // print the result
382 printf( "Care states ratio = %f. ", 1.0 * (nSimWords * 32 - nCovered) / (nSimWords * 32) );
383 printf( "(%d out of %d patterns) ", nSimWords * 32 - nCovered, nSimWords * 32 );
384 ABC_PRT( "Time", Abc_Clock() - clk );
385}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_OneHotRefineUsingCex()

int Fra_OneHotRefineUsingCex ( Fra_Man_t * p,
Vec_Int_t * vOneHots )
extern

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

Synopsis [Removes those implications that no longer hold.]

Description [Returns 1 if refinement has happened.]

SideEffects []

SeeAlso []

Definition at line 266 of file fraHot.c.

267{
268 Aig_Obj_t * pObj1, * pObj2;
269 int i, Out1, Out2, RetValue = 0;
270 int nPiNum = Aig_ManCiNum(p->pManAig) - Aig_ManRegNum(p->pManAig);
271 assert( p->pSml->pAig == p->pManAig );
272 for ( i = 0; i < Vec_IntSize(vOneHots); i += 2 )
273 {
274 Out1 = Vec_IntEntry( vOneHots, i );
275 Out2 = Vec_IntEntry( vOneHots, i+1 );
276 if ( Out1 == 0 && Out2 == 0 )
277 continue;
278 // get the corresponding nodes
279 pObj1 = Aig_ManCi( p->pManAig, nPiNum + Fra_LitReg(Out1) );
280 pObj2 = Aig_ManCi( p->pManAig, nPiNum + Fra_LitReg(Out2) );
281 // check if implication holds using this simulation info
282 if ( !Fra_OneHotNodesAreClause( p->pSml, pObj1, pObj2, Fra_LitSign(Out1), Fra_LitSign(Out2) ) )
283 {
284 Vec_IntWriteEntry( vOneHots, i, 0 );
285 Vec_IntWriteEntry( vOneHots, i+1, 0 );
286 RetValue = 1;
287 }
288 }
289 return RetValue;
290}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ParamsDefault()

void Fra_ParamsDefault ( Fra_Par_t * pPars)
extern

DECLARATIONS ///.

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

FileName [fraMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis [Starts the FRAIG manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraMan.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis [Sets the default solving parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file fraMan.c.

46{
47 memset( pPars, 0, sizeof(Fra_Par_t) );
48 pPars->nSimWords = 32; // the number of words in the simulation info
49 pPars->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached
50 pPars->fPatScores = 0; // enables simulation pattern scoring
51 pPars->MaxScore = 25; // max score after which resimulation is used
52 pPars->fDoSparse = 1; // skips sparse functions
53// pPars->dActConeRatio = 0.05; // the ratio of cone to be bumped
54// pPars->dActConeBumpMax = 5.0; // the largest bump of activity
55 pPars->dActConeRatio = 0.3; // the ratio of cone to be bumped
56 pPars->dActConeBumpMax = 10.0; // the largest bump of activity
57 pPars->nBTLimitNode = 100; // conflict limit at a node
58 pPars->nBTLimitMiter = 500000; // conflict limit at an output
59 pPars->nFramesK = 0; // the number of timeframes to unroll
60 pPars->fConeBias = 1;
61 pPars->fRewrite = 0;
62}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_ParamsDefaultSeq()

void Fra_ParamsDefaultSeq ( Fra_Par_t * pPars)
extern

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

Synopsis [Sets the default solving parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 75 of file fraMan.c.

76{
77 memset( pPars, 0, sizeof(Fra_Par_t) );
78 pPars->nSimWords = 1; // the number of words in the simulation info
79 pPars->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached
80 pPars->fPatScores = 0; // enables simulation pattern scoring
81 pPars->MaxScore = 25; // max score after which resimulation is used
82 pPars->fDoSparse = 1; // skips sparse functions
83 pPars->dActConeRatio = 0.3; // the ratio of cone to be bumped
84 pPars->dActConeBumpMax = 10.0; // the largest bump of activity
85 pPars->nBTLimitNode = 10000000; // conflict limit at a node
86 pPars->nBTLimitMiter = 500000; // conflict limit at an output
87 pPars->nFramesK = 1; // the number of timeframes to unroll
88 pPars->fConeBias = 0;
89 pPars->fRewrite = 0;
90 pPars->fLatchCorr = 0;
91}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SecSetDefaultParams()

void Fra_SecSetDefaultParams ( Fra_Sec_t * p)
extern

DECLARATIONS ///.

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

FileName [fraSec.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis [Performs SEC based on seq sweeping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraSec.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file fraSec.c.

53{
54 memset( p, 0, sizeof(Fra_Sec_t) );
55 p->fTryComb = 1; // try CEC call as a preprocessing step
56 p->fTryBmc = 1; // try BMC call as a preprocessing step
57 p->nFramesMax = 4; // the max number of frames used for induction
58 p->nBTLimit = 1000; // conflict limit at a node during induction
59 p->nBTLimitGlobal = 5000000; // global conflict limit during induction
60 p->nBTLimitInter = 10000; // conflict limit during interpolation
61 p->nBddVarsMax = 150; // the limit on the number of registers in BDD reachability
62 p->nBddMax = 50000; // the limit on the number of BDD nodes
63 p->nBddIterMax = 1000000; // the limit on the number of BDD iterations
64 p->fPhaseAbstract = 0; // enables phase abstraction
65 p->fRetimeFirst = 1; // enables most-forward retiming at the beginning
66 p->fRetimeRegs = 1; // enables min-register retiming at the beginning
67 p->fFraiging = 1; // enables fraiging at the beginning
68 p->fInduction = 1; // enables the use of induction (signal correspondence)
69 p->fInterpolation = 1; // enables interpolation
70 p->fInterSeparate = 0; // enables interpolation for each outputs separately
71 p->fReachability = 1; // enables BDD based reachability
72 p->fReorderImage = 1; // enables variable reordering during image computation
73 p->fStopOnFirstFail = 1; // enables stopping after first output of a miter has failed to prove
74 p->fUseNewProver = 0; // enables new prover
75 p->fUsePdr = 1; // enables PDR
76 p->nPdrTimeout = 60; // enabled PDR timeout
77 p->fSilent = 0; // disables all output
78 p->fVerbose = 0; // enables verbose reporting of statistics
79 p->fVeryVerbose = 0; // enables very verbose reporting
80 p->TimeLimit = 0; // enables the timeout
81 // internal parameters
82 p->fReportSolution = 0; // enables specialized format for reporting solution
83}
struct Fra_Sec_t_ Fra_Sec_t
Definition fra.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlCheckOutput()

int Fra_SmlCheckOutput ( Fra_Man_t * p)
extern

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

Synopsis [Returns 1 if the one of the output is already non-constant 0.]

Description []

SideEffects []

SeeAlso []

Definition at line 326 of file fraSim.c.

327{
328 Aig_Obj_t * pObj;
329 int i;
330 // make sure the reference simulation pattern does not detect the bug
331 pObj = Aig_ManCo( p->pManAig, 0 );
332 assert( Aig_ObjFanin0(pObj)->fPhase == (unsigned)Aig_ObjFaninC0(pObj) );
333 Aig_ManForEachCo( p->pManAig, pObj, i )
334 {
335 if ( !Fra_SmlNodeIsConst( Aig_ObjFanin0(pObj) ) )
336 {
337 // create the counter-example from this pattern
339 return 1;
340 }
341 }
342 return 0;
343}
int Fra_SmlNodeIsConst(Aig_Obj_t *pObj)
Definition fraSim.c:86
void Fra_SmlCheckOutputSavePattern(Fra_Man_t *p, Aig_Obj_t *pObjPo)
Definition fraSim.c:281
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlCopyCounterExample()

Abc_Cex_t * Fra_SmlCopyCounterExample ( Aig_Man_t * pAig,
Aig_Man_t * pFrames,
int * pModel )
extern

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

Synopsis [Generates seq counter-example from the combinational one.]

Description []

SideEffects []

SeeAlso []

Definition at line 1123 of file fraSim.c.

1124{
1125 Abc_Cex_t * pCex;
1126 Aig_Obj_t * pObj;
1127 int i, nFrames, nTruePis, nTruePos, iPo, iFrame;
1128 // get the number of frames
1129 assert( Aig_ManRegNum(pAig) > 0 );
1130 assert( Aig_ManRegNum(pFrames) == 0 );
1131 nTruePis = Aig_ManCiNum(pAig)-Aig_ManRegNum(pAig);
1132 nTruePos = Aig_ManCoNum(pAig)-Aig_ManRegNum(pAig);
1133 nFrames = Aig_ManCiNum(pFrames) / nTruePis;
1134 assert( nTruePis * nFrames == Aig_ManCiNum(pFrames) );
1135 assert( nTruePos * nFrames == Aig_ManCoNum(pFrames) );
1136 // find the PO that failed
1137 iPo = -1;
1138 iFrame = -1;
1139 Aig_ManForEachCo( pFrames, pObj, i )
1140 if ( pObj->Id == pModel[Aig_ManCiNum(pFrames)] )
1141 {
1142 iPo = i % nTruePos;
1143 iFrame = i / nTruePos;
1144 break;
1145 }
1146 assert( iPo >= 0 );
1147 // allocate the counter example
1148 pCex = Abc_CexAlloc( Aig_ManRegNum(pAig), nTruePis, iFrame + 1 );
1149 pCex->iPo = iPo;
1150 pCex->iFrame = iFrame;
1151
1152 // copy the bit data
1153 for ( i = 0; i < Aig_ManCiNum(pFrames); i++ )
1154 {
1155 if ( pModel[i] )
1156 Abc_InfoSetBit( pCex->pData, pCex->nRegs + i );
1157 if ( pCex->nRegs + i == pCex->nBits - 1 )
1158 break;
1159 }
1160
1161 // verify the counter example
1162 if ( !Saig_ManVerifyCex( pAig, pCex ) )
1163 {
1164 printf( "Fra_SmlGetCounterExample(): Counter-example is invalid.\n" );
1165 Abc_CexFree( pCex );
1166 pCex = NULL;
1167 }
1168 return pCex;
1169
1170}
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlGetCounterExample()

Abc_Cex_t * Fra_SmlGetCounterExample ( Fra_Sml_t * p)
extern

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

Synopsis [Creates sequential counter-example from the simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 1049 of file fraSim.c.

1050{
1051 Abc_Cex_t * pCex;
1052 Aig_Obj_t * pObj;
1053 unsigned * pSims;
1054 int iPo, iFrame, iBit, i, k;
1055
1056 // make sure the simulation manager has it
1057 assert( p->fNonConstOut );
1058
1059 // find the first output that failed
1060 iPo = -1;
1061 iBit = -1;
1062 iFrame = -1;
1063 Aig_ManForEachPoSeq( p->pAig, pObj, iPo )
1064 {
1065 if ( Fra_SmlNodeIsZero(p, pObj) )
1066 continue;
1067 pSims = Fra_ObjSim( p, pObj->Id );
1068 for ( i = p->nWordsPref; i < p->nWordsTotal; i++ )
1069 if ( pSims[i] )
1070 {
1071 iFrame = i / p->nWordsFrame;
1072 iBit = 32 * (i % p->nWordsFrame) + Aig_WordFindFirstBit( pSims[i] );
1073 break;
1074 }
1075 break;
1076 }
1077 assert( iPo < Aig_ManCoNum(p->pAig)-Aig_ManRegNum(p->pAig) );
1078 assert( iFrame < p->nFrames );
1079 assert( iBit < 32 * p->nWordsFrame );
1080
1081 // allocate the counter example
1082 pCex = Abc_CexAlloc( Aig_ManRegNum(p->pAig), Aig_ManCiNum(p->pAig) - Aig_ManRegNum(p->pAig), iFrame + 1 );
1083 pCex->iPo = iPo;
1084 pCex->iFrame = iFrame;
1085
1086 // copy the bit data
1087 Aig_ManForEachLoSeq( p->pAig, pObj, k )
1088 {
1089 pSims = Fra_ObjSim( p, pObj->Id );
1090 if ( Abc_InfoHasBit( pSims, iBit ) )
1091 Abc_InfoSetBit( pCex->pData, k );
1092 }
1093 for ( i = 0; i <= iFrame; i++ )
1094 {
1095 Aig_ManForEachPiSeq( p->pAig, pObj, k )
1096 {
1097 pSims = Fra_ObjSim( p, pObj->Id );
1098 if ( Abc_InfoHasBit( pSims, 32 * p->nWordsFrame * i + iBit ) )
1099 Abc_InfoSetBit( pCex->pData, pCex->nRegs + pCex->nPis * i + k );
1100 }
1101 }
1102 // verify the counter example
1103 if ( !Saig_ManVerifyCex( p->pAig, pCex ) )
1104 {
1105 printf( "Fra_SmlGetCounterExample(): Counter-example is invalid.\n" );
1106 Abc_CexFree( pCex );
1107 pCex = NULL;
1108 }
1109 return pCex;
1110}
int Fra_SmlNodeIsZero(Fra_Sml_t *p, Aig_Obj_t *pObj)
Definition fraSim.c:155
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlNodeCountOnes()

int Fra_SmlNodeCountOnes ( Fra_Sml_t * p,
Aig_Obj_t * pObj )
extern

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

Synopsis [Counts the number of one's in the patten of the output.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file fraSim.c.

178{
179 unsigned * pSims;
180 int i, Counter = 0;
181 pSims = Fra_ObjSim(p, pObj->Id);
182 for ( i = 0; i < p->nWordsTotal; i++ )
183 Counter += Aig_WordCountOnes( pSims[i] );
184 return Counter;
185}
Here is the caller graph for this function:

◆ Fra_SmlNodeHash()

int Fra_SmlNodeHash ( Aig_Obj_t * pObj,
int nTableSize )
extern

DECLARATIONS ///.

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

FileName [fraSim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [New FRAIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 30, 2007.]

Revision [

Id
fraSim.c,v 1.00 2007/06/30 00:00:00 alanmi Exp

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

Synopsis [Computes hash value of the node using its simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file fraSim.c.

47{
48 Fra_Man_t * p = (Fra_Man_t *)pObj->pData;
49 static int s_FPrimes[128] = {
50 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
51 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
52 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
53 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
54 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
55 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
56 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
57 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
58 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
59 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
60 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
61 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
62 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
63 };
64 unsigned * pSims;
65 unsigned uHash;
66 int i;
67// assert( p->pSml->nWordsTotal <= 128 );
68 uHash = 0;
69 pSims = Fra_ObjSim(p->pSml, pObj->Id);
70 for ( i = p->pSml->nWordsPref; i < p->pSml->nWordsTotal; i++ )
71 uHash ^= pSims[i] * s_FPrimes[i & 0x7F];
72 return uHash % nTableSize;
73}
Here is the caller graph for this function:

◆ Fra_SmlNodeIsConst()

int Fra_SmlNodeIsConst ( Aig_Obj_t * pObj)
extern

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

Synopsis [Returns 1 if simulation info is composed of all zeros.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file fraSim.c.

87{
88 Fra_Man_t * p = (Fra_Man_t *)pObj->pData;
89 unsigned * pSims;
90 int i;
91 pSims = Fra_ObjSim(p->pSml, pObj->Id);
92 for ( i = p->pSml->nWordsPref; i < p->pSml->nWordsTotal; i++ )
93 if ( pSims[i] )
94 return 0;
95 return 1;
96}
Here is the caller graph for this function:

◆ Fra_SmlNodeNotEquWeight()

int Fra_SmlNodeNotEquWeight ( Fra_Sml_t * p,
int Left,
int Right )
extern

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

Synopsis [Counts the number of 1s in the XOR of simulation data.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file fraSim.c.

134{
135 unsigned * pSimL, * pSimR;
136 int k, Counter = 0;
137 pSimL = Fra_ObjSim( p, Left );
138 pSimR = Fra_ObjSim( p, Right );
139 for ( k = p->nWordsPref; k < p->nWordsTotal; k++ )
140 Counter += Aig_WordCountOnes( pSimL[k] ^ pSimR[k] );
141 return Counter;
142}
Here is the caller graph for this function:

◆ Fra_SmlNodesAreEqual()

int Fra_SmlNodesAreEqual ( Aig_Obj_t * pObj0,
Aig_Obj_t * pObj1 )
extern

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

Synopsis [Returns 1 if simulation infos are equal.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file fraSim.c.

110{
111 Fra_Man_t * p = (Fra_Man_t *)pObj0->pData;
112 unsigned * pSims0, * pSims1;
113 int i;
114 pSims0 = Fra_ObjSim(p->pSml, pObj0->Id);
115 pSims1 = Fra_ObjSim(p->pSml, pObj1->Id);
116 for ( i = p->pSml->nWordsPref; i < p->pSml->nWordsTotal; i++ )
117 if ( pSims0[i] != pSims1[i] )
118 return 0;
119 return 1;
120}
Here is the caller graph for this function:

◆ Fra_SmlResimulate()

void Fra_SmlResimulate ( Fra_Man_t * p)
extern

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

Synopsis [Resimulates fraiging manager after finding a counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 703 of file fraSim.c.

704{
705 int nChanges;
706 abctime clk;
707 Fra_SmlAssignDist1( p->pSml, p->pPatWords );
708 Fra_SmlSimulateOne( p->pSml );
709// if ( p->pPars->fPatScores )
710// Fra_CleanPatScores( p );
711 if ( p->pPars->fProve && Fra_SmlCheckOutput(p) )
712 return;
713clk = Abc_Clock();
714 nChanges = Fra_ClassesRefine( p->pCla );
715 nChanges += Fra_ClassesRefine1( p->pCla, 1, NULL );
716 if ( p->pCla->vImps )
717 nChanges += Fra_ImpRefineUsingCex( p, p->pCla->vImps );
718 if ( p->vOneHots )
719 nChanges += Fra_OneHotRefineUsingCex( p, p->vOneHots );
720p->timeRef += Abc_Clock() - clk;
721 if ( !p->pPars->nFramesK && nChanges < 1 )
722 printf( "Error: A counter-example did not refine classes!\n" );
723// assert( nChanges >= 1 );
724//printf( "Refined classes = %5d. Changes = %4d.\n", Vec_PtrSize(p->vClasses), nChanges );
725}
void Fra_SmlAssignDist1(Fra_Sml_t *p, unsigned *pPat)
Definition fraSim.c:433
void Fra_SmlSimulateOne(Fra_Sml_t *p)
Definition fraSim.c:663
int Fra_SmlCheckOutput(Fra_Man_t *p)
Definition fraSim.c:326
int Fra_OneHotRefineUsingCex(Fra_Man_t *p, Vec_Int_t *vOneHots)
Definition fraHot.c:266
int Fra_ImpRefineUsingCex(Fra_Man_t *p, Vec_Int_t *vImps)
Definition fraImp.c:575
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlSavePattern()

void Fra_SmlSavePattern ( Fra_Man_t * p)
extern

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

Synopsis [Copy pattern from the solver into the internal storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file fraSim.c.

242{
243 Aig_Obj_t * pObj;
244 int i;
245 memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords );
246 Aig_ManForEachCi( p->pManFraig, pObj, i )
247// if ( p->pSat->model.ptr[Fra_ObjSatNum(pObj)] == l_True )
248 if ( sat_solver_var_value(p->pSat, Fra_ObjSatNum(pObj)) )
249 Abc_InfoSetBit( p->pPatWords, i );
250
251 if ( p->vCex )
252 {
253 Vec_IntClear( p->vCex );
254 for ( i = 0; i < Aig_ManCiNum(p->pManAig) - Aig_ManRegNum(p->pManAig); i++ )
255 Vec_IntPush( p->vCex, Abc_InfoHasBit( p->pPatWords, i ) );
256 for ( i = Aig_ManCiNum(p->pManFraig) - Aig_ManRegNum(p->pManFraig); i < Aig_ManCiNum(p->pManFraig); i++ )
257 Vec_IntPush( p->vCex, Abc_InfoHasBit( p->pPatWords, i ) );
258 }
259
260/*
261 printf( "Pattern: " );
262 Aig_ManForEachCi( p->pManFraig, pObj, i )
263 printf( "%d", Abc_InfoHasBit( p->pPatWords, i ) );
264 printf( "\n" );
265*/
266}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlSimulate()

void Fra_SmlSimulate ( Fra_Man_t * p,
int fInit )
extern

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

Synopsis [Performs simulation of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 738 of file fraSim.c.

739{
740 int fVerbose = 0;
741 int nChanges, nClasses;
742 abctime clk;
743 assert( !fInit || Aig_ManRegNum(p->pManAig) );
744 // start the classes
745 Fra_SmlInitialize( p->pSml, fInit );
746 Fra_SmlSimulateOne( p->pSml );
747 if ( p->pPars->fProve && Fra_SmlCheckOutput(p) )
748 return;
749 Fra_ClassesPrepare( p->pCla, p->pPars->fLatchCorr, 0 );
750// Fra_ClassesPrint( p->pCla, 0 );
751if ( fVerbose )
752printf( "Starting classes = %5d. Lits = %6d.\n", Vec_PtrSize(p->pCla->vClasses), Fra_ClassesCountLits(p->pCla) );
753
754//return;
755
756 // refine classes by walking 0/1 patterns
757 Fra_SmlSavePattern0( p, fInit );
758 Fra_SmlAssignDist1( p->pSml, p->pPatWords );
759 Fra_SmlSimulateOne( p->pSml );
760 if ( p->pPars->fProve && Fra_SmlCheckOutput(p) )
761 return;
762clk = Abc_Clock();
763 nChanges = Fra_ClassesRefine( p->pCla );
764 nChanges += Fra_ClassesRefine1( p->pCla, 1, NULL );
765p->timeRef += Abc_Clock() - clk;
766if ( fVerbose )
767printf( "Refined classes = %5d. Changes = %4d. Lits = %6d.\n", Vec_PtrSize(p->pCla->vClasses), nChanges, Fra_ClassesCountLits(p->pCla) );
768 Fra_SmlSavePattern1( p, fInit );
769 Fra_SmlAssignDist1( p->pSml, p->pPatWords );
770 Fra_SmlSimulateOne( p->pSml );
771 if ( p->pPars->fProve && Fra_SmlCheckOutput(p) )
772 return;
773clk = Abc_Clock();
774 nChanges = Fra_ClassesRefine( p->pCla );
775 nChanges += Fra_ClassesRefine1( p->pCla, 1, NULL );
776p->timeRef += Abc_Clock() - clk;
777
778if ( fVerbose )
779printf( "Refined classes = %5d. Changes = %4d. Lits = %6d.\n", Vec_PtrSize(p->pCla->vClasses), nChanges, Fra_ClassesCountLits(p->pCla) );
780 // refine classes by random simulation
781 do {
782 Fra_SmlInitialize( p->pSml, fInit );
783 Fra_SmlSimulateOne( p->pSml );
784 nClasses = Vec_PtrSize(p->pCla->vClasses);
785 if ( p->pPars->fProve && Fra_SmlCheckOutput(p) )
786 return;
787clk = Abc_Clock();
788 nChanges = Fra_ClassesRefine( p->pCla );
789 nChanges += Fra_ClassesRefine1( p->pCla, 1, NULL );
790p->timeRef += Abc_Clock() - clk;
791if ( fVerbose )
792printf( "Refined classes = %5d. Changes = %4d. Lits = %6d.\n", Vec_PtrSize(p->pCla->vClasses), nChanges, Fra_ClassesCountLits(p->pCla) );
793 } while ( (double)nChanges / nClasses > p->pPars->dSimSatur );
794
795// if ( p->pPars->fVerbose )
796// printf( "Consts = %6d. Classes = %6d. Literals = %6d.\n",
797// Vec_PtrSize(p->pCla->vClasses1), Vec_PtrSize(p->pCla->vClasses), Fra_ClassesCountLits(p->pCla) );
798// Fra_ClassesPrint( p->pCla, 0 );
799}
void Fra_SmlSavePattern1(Fra_Man_t *p, int fInit)
Definition fraSim.c:216
void Fra_SmlInitialize(Fra_Sml_t *p, int fInit)
Definition fraSim.c:400
void Fra_SmlSavePattern0(Fra_Man_t *p, int fInit)
Definition fraSim.c:200
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlSimulateComb()

Fra_Sml_t * Fra_SmlSimulateComb ( Aig_Man_t * pAig,
int nWords,
int fCheckMiter )
extern

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

Synopsis [Performs simulation of the uninitialized circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 856 of file fraSim.c.

857{
858 Fra_Sml_t * p;
859 p = Fra_SmlStart( pAig, 0, 1, nWords );
860 Fra_SmlInitialize( p, 0 );
862 if ( fCheckMiter )
863 p->fNonConstOut = Fra_SmlCheckNonConstOutputs( p );
864 return p;
865}
int nWords
Definition abcNpn.c:127
int Fra_SmlCheckNonConstOutputs(Fra_Sml_t *p)
Definition fraSim.c:642
Fra_Sml_t * Fra_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
Definition fraSim.c:813
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlSimulateCombGiven()

Fra_Sml_t * Fra_SmlSimulateCombGiven ( Aig_Man_t * pAig,
char * pFileName,
int fCheckMiter,
int fVerbose )
extern

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

Synopsis [Assigns simulation patters derived from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 987 of file fraSim.c.

988{
989 Vec_Str_t * vSimInfo;
990 Fra_Sml_t * p;
991 int nPatterns;
992 assert( Aig_ManRegNum(pAig) == 0 );
993 // read comb patterns from file
994 vSimInfo = Fra_SmlSimulateReadFile( pFileName );
995 if ( vSimInfo == NULL )
996 return NULL;
997 if ( Vec_StrSize(vSimInfo) % Aig_ManCiNum(pAig) != 0 )
998 {
999 printf( "File \"%s\": The number of binary digits (%d) is not divisible by the number of primary inputs (%d).\n",
1000 pFileName, Vec_StrSize(vSimInfo), Aig_ManCiNum(pAig) );
1001 Vec_StrFree( vSimInfo );
1002 return NULL;
1003 }
1004 p = Fra_SmlStart( pAig, 0, 1, Abc_BitWordNum(Vec_StrSize(vSimInfo) / Aig_ManCiNum(pAig)) );
1005 Fra_SmlInitializeGiven( p, vSimInfo );
1006 nPatterns = Vec_StrSize(vSimInfo) / Aig_ManCiNum(pAig);
1007 Vec_StrFree( vSimInfo );
1009 if ( fCheckMiter )
1010 p->fNonConstOut = Fra_SmlCheckNonConstOutputs( p );
1011 if ( fVerbose )
1012 Fra_SmlPrintOutputs( p, nPatterns );
1013 return p;
1014}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Fra_SmlPrintOutputs(Fra_Sml_t *p, int nPatterns)
Definition fraSim.c:954
void Fra_SmlInitializeGiven(Fra_Sml_t *p, Vec_Str_t *vSimInfo)
Definition fraSim.c:917
Vec_Str_t * Fra_SmlSimulateReadFile(char *pFileName)
Definition fraSim.c:879
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlSimulateSeq()

Fra_Sml_t * Fra_SmlSimulateSeq ( Aig_Man_t * pAig,
int nPref,
int nFrames,
int nWords,
int fCheckMiter )
extern

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

Synopsis [Performs simulation of the initialized circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 1027 of file fraSim.c.

1028{
1029 Fra_Sml_t * p;
1030 p = Fra_SmlStart( pAig, nPref, nFrames, nWords );
1031 Fra_SmlInitialize( p, 1 );
1033 if ( fCheckMiter )
1034 p->fNonConstOut = Fra_SmlCheckNonConstOutputs( p );
1035 return p;
1036}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlStart()

Fra_Sml_t * Fra_SmlStart ( Aig_Man_t * pAig,
int nPref,
int nFrames,
int nWordsFrame )
extern

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

Synopsis [Allocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 813 of file fraSim.c.

814{
815 Fra_Sml_t * p;
816 p = (Fra_Sml_t *)ABC_ALLOC( char, sizeof(Fra_Sml_t) + sizeof(unsigned) * Aig_ManObjNumMax(pAig) * (nPref + nFrames) * nWordsFrame );
817 memset( p, 0, sizeof(Fra_Sml_t) + sizeof(unsigned) * (nPref + nFrames) * nWordsFrame );
818 p->pAig = pAig;
819 p->nPref = nPref;
820 p->nFrames = nPref + nFrames;
821 p->nWordsFrame = nWordsFrame;
822 p->nWordsTotal = (nPref + nFrames) * nWordsFrame;
823 p->nWordsPref = nPref * nWordsFrame;
824 // constant 1 is initialized to 0 because we store values modulus phase (pObj->fPhase)
825 return p;
826}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fra_SmlStop()

void Fra_SmlStop ( Fra_Sml_t * p)
extern

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

Synopsis [Deallocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 839 of file fraSim.c.

840{
841 ABC_FREE( p );
842}
Here is the caller graph for this function: