Commit ce38474c by Alan Mishchenko

Improving and updating the abstraction code.

parent 581daaea
......@@ -3487,7 +3487,15 @@ SOURCE=.\src\aig\saig\saigAbs.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigAbs2.c
SOURCE=.\src\aig\saig\saigAbsCba.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigAbsPba.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigAbsStart.c
# End Source File
# Begin Source File
......@@ -3539,10 +3547,6 @@ SOURCE=.\src\aig\saig\saigOutDec.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigPba.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigPhase.c
# End Source File
# Begin Source File
......@@ -3787,6 +3791,10 @@ SOURCE=.\src\aig\ssw\sswRarity.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\ssw\sswRarity2.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\ssw\sswSat.c
# End Source File
# Begin Source File
......
......@@ -34,6 +34,7 @@
#include "vec.h"
#include "utilCex.h"
#include "giaAbs.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
......@@ -195,8 +196,6 @@ extern int Gia_ManSimSimulate( Gia_Man_t * pAig, Gia_ParSim_t * pPars );
static inline int Gia_IntAbs( int n ) { return (n < 0)? -n : n; }
//static inline int Gia_Float2Int( float Val ) { return *((int *)&Val); }
//static inline float Gia_Int2Float( int Num ) { return *((float *)&Num); }
static inline int Gia_Float2Int( float Val ) { union { int x; float y; } v; v.y = Val; return v.x; }
static inline float Gia_Int2Float( int Num ) { union { int x; float y; } v; v.x = Num; return v.y; }
static inline int Gia_Base2Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ); return r; }
......@@ -597,6 +596,12 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== giaAbs.c ===========================================================*/
extern void Gia_ManCexAbstractionStart( Gia_Man_t * p, Gia_ParAbs_t * pPars );
Gia_Man_t * Gia_ManCexAbstractionDerive( Gia_Man_t * pGia );
int Gia_ManCexAbstractionRefine( Gia_Man_t * pGia, Abc_Cex_t * pCex, int fTryFour, int fSensePath, int fVerbose );
extern int Gia_ManPbaPerform( Gia_Man_t * pGia, int nFrames, int nConfLimit, int fVerbose );
extern int Gia_ManCbaPerform( Gia_Man_t * pGia, void * pPars );
/*=== giaAiger.c ===========================================================*/
extern int Gia_FileSize( char * pFileName );
extern Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fCheck );
......
SRC += src/aig/saig/saigAbs.c \
src/aig/saig/saigAbs2.c \
src/aig/saig/saigAbsCba.c \
src/aig/saig/saigAbsPba.c \
src/aig/saig/saigAbsStart.c \
src/aig/saig/saigBmc.c \
src/aig/saig/saigBmc2.c \
src/aig/saig/saigBmc3.c \
......@@ -12,7 +14,6 @@ SRC += src/aig/saig/saigAbs.c \
src/aig/saig/saigIoa.c \
src/aig/saig/saigMiter.c \
src/aig/saig/saigOutDec.c \
src/aig/saig/saigPba.c \
src/aig/saig/saigPhase.c \
src/aig/saig/saigRefSat.c \
src/aig/saig/saigRetFwd.c \
......
......@@ -124,13 +124,17 @@ static inline Aig_Obj_t * Saig_ObjLiToLo( Aig_Man_t * p, Aig_Obj_t * pObj ) {
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== sswAbs.c ==========================================================*/
extern Aig_Man_t * Saig_ManCexAbstraction( Aig_Man_t * p, Gia_ParAbs_t * pPars );
/*=== sswAbs2.c ==========================================================*/
extern Aig_Man_t * Saig_ManConCexAbstraction( Aig_Man_t * p, Gia_ParAbs_t * pPars );
/*=== sswPba.c ==========================================================*/
extern Aig_Man_t * Saig_ManProofAbstraction( Aig_Man_t * p, Gia_ParAbs_t * pPars );
extern Vec_Int_t * Saig_ManClasses2Flops( Vec_Int_t * vFlopClasses );
extern Vec_Int_t * Saig_ManFlops2Classes( int nRegs, Vec_Int_t * vFlops );
/*=== sswAbsCba.c ==========================================================*/
extern Vec_Int_t * Saig_ManCbaPerform( Aig_Man_t * pAig, Saig_ParBmc_t * pPars );
/*=== sswAbsPba.c ==========================================================*/
extern Vec_Int_t * Saig_ManPbaDerive( Aig_Man_t * pAig, int nFrames, int nConfLimit, int fVerbose );
/*=== sswAbsStart.c ==========================================================*/
extern int Saig_ManCexRefineStep( Aig_Man_t * p, Vec_Int_t * vFlops, Abc_Cex_t * pCex, int fTryFour, int fSensePath, int fVerbose );
extern Vec_Int_t * Saig_ManCexAbstractionFlops( Aig_Man_t * p, Gia_ParAbs_t * pPars );
/*=== saigBmc.c ==========================================================*/
extern int Saig_ManBmcSimple( Aig_Man_t * pAig, int nFrames, int nSizeMax, int nBTLimit, int fRewrite, int fVerbose, int * piFrame, int nCofFanLit );
extern int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFramesMax, int nNodesMax, int nTimeOut, int nConfMaxOne, int nConfMaxAll, int fVerbose, int fVerbOverwrite, int * piFrames );
......
/**CFile****************************************************************
FileName [saigAbs.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Counter-example-based abstraction with constraints.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigAbs.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
#include "ssw.h"
#include "fra.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
extern int Saig_ManFindFirstFlop( Aig_Man_t * p );
extern Aig_Man_t * Saig_ManCexRefine( Aig_Man_t * p, Aig_Man_t * pAbs, Vec_Int_t * vFlops,
int nFrames, int nConfMaxOne, int fUseBdds, int fUseDprove, int fVerbose, int * pnUseStart,
int * piRetValue, int * pnFrames );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Returns the array of constraint numbers that are violated.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManFindViolatedConstrs( Aig_Man_t * p, Abc_Cex_t * pCexAbs )
{
Vec_Int_t * vFailed;
Aig_Obj_t * pObj, * pObjRi, * pObjRo;
int * pPoMap, i, k, iBit;
pPoMap = ABC_CALLOC( int, Saig_ManPoNum(p) );
Aig_ManCleanMarkA(p);
Saig_ManForEachLo( p, pObj, i )
pObj->fMarkA = 0;
assert( pCexAbs->nBits == pCexAbs->nRegs + (pCexAbs->iFrame + 1) * pCexAbs->nPis );
for ( i = 0; i <= pCexAbs->iFrame; i++ )
{
iBit = pCexAbs->nRegs + i * pCexAbs->nPis;
Saig_ManForEachPi( p, pObj, k )
pObj->fMarkA = Aig_InfoHasBit(pCexAbs->pData, iBit++);
Aig_ManForEachNode( p, pObj, k )
pObj->fMarkA = (Aig_ObjFanin0(pObj)->fMarkA ^ Aig_ObjFaninC0(pObj)) &
(Aig_ObjFanin1(pObj)->fMarkA ^ Aig_ObjFaninC1(pObj));
Aig_ManForEachPo( p, pObj, k )
pObj->fMarkA = Aig_ObjFanin0(pObj)->fMarkA ^ Aig_ObjFaninC0(pObj);
Saig_ManForEachPo( p, pObj, k )
pPoMap[k] |= pObj->fMarkA;
Saig_ManForEachLiLo( p, pObjRi, pObjRo, k )
pObjRo->fMarkA = pObjRi->fMarkA;
}
Aig_ManCleanMarkA(p);
// collect numbers of failed constraints
vFailed = Vec_IntAlloc( Saig_ManPoNum(p) );
Saig_ManForEachPo( p, pObj, k )
if ( pPoMap[k] )
Vec_IntPush( vFailed, k );
ABC_FREE( pPoMap );
return vFailed;
}
/**Function*************************************************************
Synopsis [Computes the flops to remain after abstraction.]
Description [Updates the set of included constraints.]
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManConCexAbstractionFlops( Aig_Man_t * pInit, Gia_ParAbs_t * pPars, Vec_Int_t * vConstrs )
{
int nUseStart = 0;
Aig_Man_t * pCur, * pAbs, * pTemp;
Vec_Int_t * vFlops, * vFlopsCopy, * vConstrsToAdd;
int i, Entry, iFlop, Iter, clk = clock(), clk2 = clock();
assert( Aig_ManRegNum(pInit) > 0 );
if ( pPars->fVerbose )
printf( "Performing counter-example-based refinement with constraints.\n" );
// Aig_ManSetPioNumbers( p );
// create constrained AIG
pCur = Saig_ManDupFoldConstrs( pInit, vConstrs );
assert( Saig_ManPoNum(pCur) == 1 );
printf( "cur>>> " ); Aig_ManPrintStats( pCur );
// start the flop map
iFlop = Saig_ManFindFirstFlop( pCur );
assert( iFlop >= 0 );
// vFlops = Vec_IntStartNatural( 1 );
vFlops = Vec_IntAlloc( 1 );
Vec_IntPush( vFlops, iFlop );
// create the abstraction
pAbs = Saig_ManDeriveAbstraction( pCur, vFlops );
printf( "abs>>> " ); Aig_ManPrintStats( pAbs );
if ( !pPars->fVerbose )
{
printf( "Init : " );
Aig_ManPrintStats( pAbs );
}
printf( "Refining abstraction...\n" );
for ( Iter = 0; ; Iter++ )
{
while ( 1 )
{
vFlopsCopy = Vec_IntDup( vFlops );
pTemp = Saig_ManCexRefine( pCur, pAbs, vFlops, pPars->nFramesBmc, pPars->nConfMaxBmc, pPars->fUseBdds, pPars->fUseDprove, pPars->fVerbose, pPars->fUseStart?&nUseStart:NULL, &pPars->Status, &pPars->nFramesDone );
if ( pTemp == NULL )
{
Vec_IntFree( vFlopsCopy );
break;
}
vConstrsToAdd = Saig_ManFindViolatedConstrs( pInit, pAbs->pSeqModel );
if ( Vec_IntSize(vConstrsToAdd) == 0 )
{
Vec_IntFree( vConstrsToAdd );
Vec_IntFree( vFlopsCopy );
break;
}
// add the constraints to the base set
Vec_IntForEachEntry( vConstrsToAdd, Entry, i )
{
// assert( Vec_IntFind(vConstrs, Entry) == -1 );
Vec_IntPushUnique( vConstrs, Entry );
}
printf( "Adding %3d constraints. The total is %3d (out of %3d).\n",
Vec_IntSize(vConstrsToAdd), Vec_IntSize(vConstrs), Saig_ManPoNum(pInit)-1 );
Vec_IntFree( vConstrsToAdd );
// update the current one
Aig_ManStop( pCur );
pCur = Saig_ManDupFoldConstrs( pInit, vConstrs );
printf( "cur>>> " ); Aig_ManPrintStats( pCur );
// update the flop map
Vec_IntFree( vFlops );
vFlops = vFlopsCopy;
// Vec_IntFree( vFlopsCopy );
// vFlops = vFlops;
// update abstraction
Aig_ManStop( pAbs );
pAbs = Saig_ManDeriveAbstraction( pCur, vFlops );
printf( "abs>>> " ); Aig_ManPrintStats( pAbs );
}
Aig_ManStop( pAbs );
if ( pTemp == NULL )
break;
pAbs = pTemp;
printf( "ITER %4d : ", Iter );
if ( !pPars->fVerbose )
Aig_ManPrintStats( pAbs );
// output the intermediate result of abstraction
Ioa_WriteAiger( pAbs, "gabs.aig", 0, 0 );
// printf( "Intermediate abstracted model was written into file \"%s\".\n", "gabs.aig" );
// check if the ratio is reached
if ( 100.0*(Aig_ManRegNum(pCur)-Aig_ManRegNum(pAbs))/Aig_ManRegNum(pCur) < 1.0*pPars->nRatio )
{
printf( "Refinements is stopped because flop reduction is less than %d%%\n", pPars->nRatio );
Aig_ManStop( pAbs );
pAbs = NULL;
Vec_IntFree( vFlops );
vFlops = NULL;
break;
}
}
ABC_FREE( pInit->pSeqModel );
pInit->pSeqModel = pCur->pSeqModel;
pCur->pSeqModel = NULL;
Aig_ManStop( pCur );
return vFlops;
}
/**Function*************************************************************
Synopsis [Performs counter-example-based abstraction.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t * Saig_ManConCexAbstraction( Aig_Man_t * p, Gia_ParAbs_t * pPars )
{
Vec_Int_t * vFlops, * vConstrs;
Aig_Man_t * pCur, * pAbs = NULL;
assert( Saig_ManPoNum(p) > 1 ); // should contain constraint outputs
// start included constraints
vConstrs = Vec_IntAlloc( 100 );
// perform refinement
vFlops = Saig_ManConCexAbstractionFlops( p, pPars, vConstrs );
// write the final result
if ( vFlops )
{
pCur = Saig_ManDupFoldConstrs( p, vConstrs );
pAbs = Saig_ManDeriveAbstraction( pCur, vFlops );
Aig_ManStop( pCur );
Ioa_WriteAiger( pAbs, "gabs.aig", 0, 0 );
printf( "Final abstracted model was written into file \"%s\".\n", "gabs.aig" );
Vec_IntFree( vFlops );
}
Vec_IntFree( vConstrs );
return pAbs;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [saigAbsCba.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [CEX-based abstraction.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigAbsCba.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
#include "giaAig.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Derive unrolled timeframes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManCbaPerform( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
{
return 0;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [saigAbsPba.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Proof-based abstraction.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigAbsPba.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
#include "cnf.h"
#include "satSolver.h"
#include "giaAig.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Collect nodes in the unrolled timeframes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Saig_ManUnrollForPba_rec( Aig_Man_t * pAig, Aig_Obj_t * pObj, Vec_Int_t * vObjs, Vec_Int_t * vRoots )
{
if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
return;
Aig_ObjSetTravIdCurrent(pAig, pObj);
if ( Aig_ObjIsPo(pObj) )
Saig_ManUnrollForPba_rec( pAig, Aig_ObjFanin0(pObj), vObjs, vRoots );
else if ( Aig_ObjIsNode(pObj) )
{
Saig_ManUnrollForPba_rec( pAig, Aig_ObjFanin0(pObj), vObjs, vRoots );
Saig_ManUnrollForPba_rec( pAig, Aig_ObjFanin1(pObj), vObjs, vRoots );
}
if ( vRoots && Saig_ObjIsLo( pAig, pObj ) )
Vec_IntPush( vRoots, Aig_ObjId( Saig_ObjLoToLi(pAig, pObj) ) );
Vec_IntPush( vObjs, Aig_ObjId(pObj) );
}
/**Function*************************************************************
Synopsis [Derives unrolled timeframes for PBA.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Aig_Man_t * Saig_ManUnrollForPba( Aig_Man_t * pAig, int nFrames )
{
Aig_Man_t * pFrames; // unrolled timeframes
Vec_Vec_t * vFrameCos; // the list of COs per frame
Vec_Vec_t * vFrameObjs; // the list of objects per frame
Vec_Int_t * vRoots, * vObjs;
Aig_Obj_t * pObj, * pObjNew;
int i, f;
// collect COs and Objs visited in each frame
vFrameCos = Vec_VecStart( nFrames );
vFrameObjs = Vec_VecStart( nFrames );
for ( f = nFrames-1; f >= 0; f-- )
{
// add POs of this frame
vRoots = (Vec_Int_t *)Vec_VecEntry( vFrameCos, f );
Saig_ManForEachPo( pAig, pObj, i )
Vec_IntPush( vRoots, Aig_ObjId(pObj) );
// collect nodes starting from the roots
Aig_ManIncrementTravId( pAig );
Aig_ManForEachNodeVec( pAig, vRoots, pObj, i )
Saig_ManUnrollForPba_rec( pAig, pObj,
(Vec_Int_t *)Vec_VecEntry( vFrameObjs, f ),
(Vec_Int_t *)(f ? Vec_VecEntry(vFrameCos, f-1) : NULL) );
}
// derive unrolled timeframes
pFrames = Aig_ManStart( 10000 );
pFrames->pName = Aig_UtilStrsav( pAig->pName );
pFrames->pSpec = Aig_UtilStrsav( pAig->pSpec );
// create activation variables
Saig_ManForEachLo( pAig, pObj, i )
Aig_ObjCreatePi( pFrames );
// initialize the flops
Saig_ManForEachLo( pAig, pObj, i )
pObj->pData = Aig_Mux( pFrames, Aig_ManPi(pFrames,i), Aig_ObjCreatePi(pFrames), Aig_ManConst0(pFrames) );
// iterate through the frames
pObjNew = Aig_ManConst0(pFrames);
for ( f = 0; f < nFrames; f++ )
{
// construct
vObjs = (Vec_Int_t *)Vec_VecEntry( vFrameObjs, f );
Aig_ManForEachNodeVec( pAig, vObjs, pObj, i )
{
if ( Aig_ObjIsNode(pObj) )
pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
else if ( Aig_ObjIsPo(pObj) )
pObj->pData = Aig_ObjChild0Copy(pObj);
else if ( Saig_ObjIsPi(pAig, pObj) )
pObj->pData = Aig_ObjCreatePi( pFrames );
else if ( Aig_ObjIsConst1(pObj) )
pObj->pData = Aig_ManConst1(pFrames);
else if ( !Saig_ObjIsLo(pAig, pObj) )
assert( 0 );
}
// create output
Saig_ManForEachPo( pAig, pObj, i )
pObjNew = Aig_Or( pFrames, pObjNew, pObj->pData );
// transfer
if ( f == nFrames - 1 )
break;
vRoots = (Vec_Int_t *)Vec_VecEntry( vFrameCos, f );
Aig_ManForEachNodeVec( pAig, vRoots, pObj, i )
{
if ( Saig_ObjIsLi(pAig, pObj) )
{
int iFlopNum = Aig_ObjPioNum(pObj) - Saig_ManPoNum(pAig);
assert( iFlopNum >= 0 && iFlopNum < Aig_ManRegNum(pAig) );
Saig_ObjLiToLo(pAig, pObj)->pData = Aig_Mux( pFrames, Aig_ManPi(pFrames,iFlopNum), Aig_ObjCreatePi(pFrames), pObj->pData );
}
}
}
// cleanup
Vec_VecFree( vFrameCos );
Vec_VecFree( vFrameObjs );
// create output
Aig_ObjCreatePo( pFrames, pObjNew );
Aig_ManSetRegNum( pFrames, 0 );
// finallize
Aig_ManCleanup( pFrames );
return pFrames;
}
/**Function*************************************************************
Synopsis [Derive unrolled timeframes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManPbaDerive( Aig_Man_t * pAig, int nFrames, int nConfLimit, int fVerbose )
{
Vec_Int_t * vFlops, * vMapVar2FF, * vAssumps;
Aig_Man_t * pFrames;
sat_solver * pSat;
Cnf_Dat_t * pCnf;
Aig_Obj_t * pObj;
int nCoreLits, * pCoreLits;
int i, iVar, RetValue, clk;
// create SAT solver
clk = clock();
pFrames = Saig_ManUnrollForPba( pAig, nFrames );
if ( fVerbose )
Aig_ManPrintStats( pFrames );
pCnf = Cnf_DeriveSimple( pFrames, 0 );
pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
if ( pSat == NULL )
{
Aig_ManStop( pFrames );
Cnf_DataFree( pCnf );
return NULL;
}
if ( fVerbose )
Abc_PrintTime( 1, "Preparing", clock() - clk );
// map activation variables into flop numbers
vAssumps = Vec_IntAlloc( Aig_ManRegNum(pAig) );
vMapVar2FF = Vec_IntStartFull( pCnf->nVars );
Aig_ManForEachPi( pFrames, pObj, i )
{
if ( i >= Aig_ManRegNum(pAig) )
break;
iVar = pCnf->pVarNums[Aig_ObjId(pObj)];
Vec_IntPush( vAssumps, toLitCond(iVar, 1) );
Vec_IntWriteEntry( vMapVar2FF, iVar, i );
}
// run SAT solver
clk = clock();
RetValue = sat_solver_solve( pSat, Vec_IntArray(vAssumps), Vec_IntArray(vAssumps) + Vec_IntSize(vAssumps),
(ABC_INT64_T)nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
if ( fVerbose )
Abc_PrintTime( 1, "Solving", clock() - clk );
if ( RetValue != l_False )
{
if ( RetValue == l_True )
printf( "Saig_ManPerformPba(): Internal Error!!! The resulting problem is SAT.\n" );
else
printf( "Saig_ManPerformPba(): SAT solver timed out.\n" );
Vec_IntFree( vAssumps );
Vec_IntFree( vMapVar2FF );
sat_solver_delete( pSat );
Aig_ManStop( pFrames );
Cnf_DataFree( pCnf );
return NULL;
}
assert( RetValue == l_False ); // UNSAT
// get relevant SAT literals
nCoreLits = sat_solver_final( pSat, &pCoreLits );
assert( nCoreLits > 0 );
if ( fVerbose )
printf( "AnalizeFinal selected %d assumptions (out of %d). Conflicts = %d.\n",
nCoreLits, Vec_IntSize(vAssumps), (int)pSat->stats.conflicts );
// collect flops
vFlops = Vec_IntAlloc( nCoreLits );
for ( i = 0; i < nCoreLits; i++ )
{
iVar = Vec_IntEntry( vMapVar2FF, lit_var(pCoreLits[i]) );
assert( iVar >= 0 && iVar < Aig_ManRegNum(pAig) );
Vec_IntPush( vFlops, iVar );
}
Vec_IntSort( vFlops, 0 );
// cleanup
Vec_IntFree( vAssumps );
Vec_IntFree( vMapVar2FF );
sat_solver_delete( pSat );
Cnf_DataFree( pCnf );
Aig_ManStop( pFrames );
return vFlops;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
......@@ -294,10 +294,10 @@ Aig_Man_t * Saig_ManUnrollWithCex( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nInpu
}
// derive unrolled timeframes
pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) * (pCex->iFrame+1) );
pFrames = Aig_ManStart( 10000 );
pFrames->pName = Aig_UtilStrsav( pAig->pName );
pFrames->pSpec = Aig_UtilStrsav( pAig->pSpec );
// initialize the flops of
// initialize the flops
Saig_ManForEachLo( pAig, pObj, i )
pObj->pData = Aig_NotCond( Aig_ManConst1(pFrames), !Aig_InfoHasBit(pCex->pData, i) );
// iterate through the frames
......
......@@ -33,7 +33,6 @@
#include "gia.h"
#include "cec.h"
#include "csw.h"
#include "giaAbs.h"
#include "pdr.h"
ABC_NAMESPACE_IMPL_START
......@@ -3229,66 +3228,6 @@ ABC_PRT( "Time", clock() - clkTotal );
/**Function*************************************************************
Synopsis [Performs proof-based abstraction.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkDarCegar( Abc_Ntk_t * pNtk, Gia_ParAbs_t * pPars )
{
Abc_Ntk_t * pNtkAig;
Aig_Man_t * pMan, * pTemp;
assert( Abc_NtkIsStrash(pNtk) );
pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( pMan == NULL )
return NULL;
if ( pPars->fConstr )
{
printf( "This option is currently not implemented.\n" );
Aig_ManStop( pMan );
return NULL;
}
if ( pPars->fConstr )
{
if ( Saig_ManDetectConstrTest(pMan) )
{
printf( "Performing abstraction while dynamically adding constraints...\n" );
pMan = Saig_ManDupUnfoldConstrs( pTemp = pMan );
Aig_ManStop( pTemp );
pMan = Saig_ManConCexAbstraction( pTemp = pMan, pPars );
}
else
{
printf( "Constraints are not available. Performing abstraction w/o constraints.\n" );
pMan = Saig_ManCexAbstraction( pTemp = pMan, pPars );
}
}
else
pMan = Saig_ManCexAbstraction( pTemp = pMan, pPars );
if ( pTemp->pSeqModel )
{
ABC_FREE( pNtk->pModel );
ABC_FREE( pNtk->pSeqModel );
pNtk->pSeqModel = pTemp->pSeqModel; pTemp->pSeqModel = NULL;
}
Aig_ManStop( pTemp );
if ( pMan == NULL )
return NULL;
pNtkAig = Abc_NtkAfterTrim( pMan, pNtk );
// pNtkAig->pName = Extra_UtilStrsav(pNtk->pName);
// pNtkAig->pSpec = Extra_UtilStrsav(pNtk->pSpec);
Aig_ManStop( pMan );
return pNtkAig;
}
/**Function*************************************************************
Synopsis [Interplates two networks.]
Description []
......@@ -4316,13 +4255,7 @@ Abc_Ntk_t * Abc_NtkDarTestNtk( Abc_Ntk_t * pNtk )
pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( pMan == NULL )
return NULL;
/*
Aig_ManSetRegNum( pMan, pMan->nRegs );
pMan = Saig_ManCexAbstraction( pTemp = pMan, 5, 10000, 0, 0, 0, -1, -1, 99, fUseBdds, fUseDprove, 0, 1 );
Aig_ManStop( pTemp );
if ( pMan == NULL )
return NULL;
*/
/*
Aig_ManSetRegNum( pMan, pMan->nRegs );
pMan = Saig_ManDualRail( pTemp = pMan, 1 );
......
......@@ -560,8 +560,6 @@ int Cmd_CommandAbcPlugIn( Abc_Frame_t * pAbc, int argc, char ** argv )
pAbc->Status = Abc_ManReadStatus( pFileOut, "result:" );
// get bug-free depth
pAbc->nFrames = Abc_ManReadInteger( pFileOut, "bug-free-depth:" );
// if ( pAbc->nFrames == -1 )
// printf( "Gia_ManCexAbstractionStartNew(): Cannot read the number of frames covered by BMC.\n" );
// get abstraction
pAbc->pGia->vFlopClasses = Abc_ManReadBinary( pFileOut, "abstraction:" );
// get counter-example
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment