Commit 69bbfa98 by Alan Mishchenko

Created new abstraction package from the code that was all over the place.

parent ec95f569
......@@ -23,6 +23,7 @@ MODULES := \
src/bool/bdc src/bool/deco src/bool/dec src/bool/kit src/bool/lucky \
src/proof/pdr src/proof/int src/proof/bbr src/proof/llb src/proof/live \
src/proof/cec src/proof/dch src/proof/fraig src/proof/fra src/proof/ssw \
src/proof/abs \
src/aig/aig src/aig/saig src/aig/gia src/aig/ioa src/aig/ivy src/aig/hop \
src/python
......
......@@ -3223,26 +3223,6 @@ SOURCE=.\src\aig\saig\saig.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigAbs.c
# End Source File
# Begin Source File
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
SOURCE=.\src\aig\saig\saigAbsVfa.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigBmc.c
# End Source File
# Begin Source File
......@@ -3279,18 +3259,6 @@ SOURCE=.\src\aig\saig\saigDup.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigGlaCba.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigGlaPba.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigGlaPba2.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigHaig.c
# End Source File
# Begin Source File
......@@ -3327,10 +3295,6 @@ SOURCE=.\src\aig\saig\saigPhase.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigRefSat.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigRetFwd.c
# End Source File
# Begin Source File
......@@ -3347,14 +3311,6 @@ SOURCE=.\src\aig\saig\saigScl.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigSimExt.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigSimExt2.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\saig\saigSimFast.c
# End Source File
# Begin Source File
......@@ -3403,54 +3359,6 @@ SOURCE=.\src\aig\gia\gia.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbs.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbs.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsGla.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsGla2.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsIter.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsOut.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsPth.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsRef.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsRef.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsRef2.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsRef2.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAbsVta.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaAig.c
# End Source File
# Begin Source File
......@@ -4398,6 +4306,82 @@ SOURCE=.\src\proof\ssw\sswSweep.c
SOURCE=.\src\proof\ssw\sswUnique.c
# End Source File
# End Group
# Begin Group "abs"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\proof\abs\abs.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\abs.h
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absDup.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absGla.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absGlaOld.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absIter.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absOldCex.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absOldRef.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absOldSat.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absOldSim.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absOut.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absPth.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absRef.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absRef.h
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absRef2.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absRef2.h
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absUtil.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\abs\absVta.c
# End Source File
# End Group
# End Group
# End Group
# Begin Group "Header Files"
......
......@@ -33,17 +33,14 @@
#include "misc/vec/vec.h"
#include "misc/util/utilCex.h"
#include "giaAbs.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
#define GIA_NONE 0x1FFFFFFF
#define GIA_VOID 0x0FFFFFFF
......@@ -208,41 +205,6 @@ struct Gia_ParSim_t_
int iOutFail; // index of the failed output
};
// abstraction parameters
typedef struct Gia_ParVta_t_ Gia_ParVta_t;
struct Gia_ParVta_t_
{
int nFramesMax; // maximum frames
int nFramesStart; // starting frame
int nFramesPast; // overlap frames
int nConfLimit; // conflict limit
int nLearnedMax; // max number of learned clauses
int nLearnedStart; // max number of learned clauses
int nLearnedDelta; // delta increase of learned clauses
int nLearnedPerce; // percentage of clauses to leave
int nTimeOut; // timeout in seconds
int nRatioMin; // stop when less than this % of object is abstracted
int nRatioMax; // restart when the number of abstracted object is more than this
int fUseTermVars; // use terminal variables
int fUseRollback; // use rollback to the starting number of frames
int fPropFanout; // propagate fanout implications
int fAddLayer; // refinement strategy by adding layers
int fUseSkip; // skip proving intermediate timeframes
int fUseSimple; // use simple CNF construction
int fSkipHash; // skip hashing CNF while unrolling
int fUseFullProof; // use full proof for UNSAT cores
int fDumpVabs; // dumps the abstracted model
int fDumpMabs; // dumps the original AIG with abstraction map
int fCallProver; // calls the prover
char * pFileVabs; // dumps the abstracted model into this file
int fVerbose; // verbose flag
int fVeryVerbose; // print additional information
int iFrame; // the number of frames covered
int iFrameProved; // the number of frames proved
int nFramesNoChange; // the number of last frames without changes
int nFramesNoChangeLim; // the number of last frames without changes to dump abstraction
};
static inline unsigned Gia_ObjCutSign( unsigned ObjId ) { return (1 << (ObjId & 31)); }
static inline int Gia_WordHasOneBit( unsigned uWord ) { return (uWord & (uWord-1)) == 0; }
static inline int Gia_WordHasOnePair( unsigned uWord ) { return Gia_WordHasOneBit(uWord & (uWord>>1) & 0x55555555); }
......@@ -717,26 +679,6 @@ 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 nFfToAddMax, int fTryFour, int fSensePath, int fVerbose );
extern int Gia_ManPbaPerform( Gia_Man_t * pGia, int nStart, int nFrames, int nConfLimit, int nTimeLimit, int fVerbose, int * piFrame );
extern int Gia_ManCbaPerform( Gia_Man_t * pGia, void * pPars );
extern int Gia_ManGlaCbaPerform( Gia_Man_t * pGia, void * pPars, int fNaiveCnf );
extern int Gia_ManGlaPbaPerform( Gia_Man_t * pGia, void * pPars, int fNewSolver );
extern Vec_Int_t * Gia_VtaConvertToGla( Gia_Man_t * p, Vec_Int_t * vVta );
extern Vec_Int_t * Gia_VtaConvertFromGla( Gia_Man_t * p, Vec_Int_t * vGla, int nFrames );
extern Vec_Int_t * Gia_FlaConvertToGla( Gia_Man_t * p, Vec_Int_t * vFla );
extern Vec_Int_t * Gia_GlaConvertToFla( Gia_Man_t * p, Vec_Int_t * vGla );
extern int Gia_GlaCountFlops( Gia_Man_t * p, Vec_Int_t * vGla );
extern int Gia_GlaCountNodes( Gia_Man_t * p, Vec_Int_t * vGla );
/*=== giaAbsGla.c ===========================================================*/
extern int Gia_GlaPerform( Gia_Man_t * p, Gia_ParVta_t * pPars, int fStartVta );
extern int Ga2_ManPerform( Gia_Man_t * p, Gia_ParVta_t * pPars );
/*=== giaAbsVta.c ===========================================================*/
extern void Gia_VtaSetDefaultParams( Gia_ParVta_t * p );
extern int Gia_VtaPerform( Gia_Man_t * pAig, Gia_ParVta_t * pPars );
/*=== giaAiger.c ===========================================================*/
extern int Gia_FileSize( char * pFileName );
extern Gia_Man_t * Gia_ReadAigerFromMemory( char * pContents, int nFileSize, int fSkipStrash, int fCheck );
......@@ -800,9 +742,6 @@ extern Gia_Man_t * Gia_ManMiter( Gia_Man_t * pAig0, Gia_Man_t * pAig1, i
extern Gia_Man_t * Gia_ManTransformMiter( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManChoiceMiter( Vec_Ptr_t * vGias );
extern Gia_Man_t * Gia_ManDupWithConstraints( Gia_Man_t * p, Vec_Int_t * vPoTypes );
extern Gia_Man_t * Gia_ManDupAbsFlops( Gia_Man_t * p, Vec_Int_t * vFlopClasses );
extern Gia_Man_t * Gia_ManDupAbsGates( Gia_Man_t * p, Vec_Int_t * vGateClasses );
extern void Gia_ManGlaCollect( Gia_Man_t * p, Vec_Int_t * vGateClasses, Vec_Int_t ** pvPis, Vec_Int_t ** pvPPis, Vec_Int_t ** pvFlops, Vec_Int_t ** pvNodes );
extern Gia_Man_t * Gia_ManDupCones( Gia_Man_t * p, int * pPos, int nPos, int fTrimPis );
/*=== giaEnable.c ==========================================================*/
extern void Gia_ManDetectSeqSignals( Gia_Man_t * p, int fSetReset, int fVerbose );
......
/**CFile****************************************************************
FileName [giaAbs.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbs.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef ABC__aig__gia__giaAbs_h
#define ABC__aig__gia__giaAbs_h
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
// abstraction parameters
typedef struct Gia_ParAbs_t_ Gia_ParAbs_t;
struct Gia_ParAbs_t_
{
int Algo; // the algorithm to be used
int nFramesMax; // timeframes for PBA
int nConfMax; // conflicts for PBA
int fDynamic; // dynamic unfolding for PBA
int fConstr; // use constraints
int nFramesBmc; // timeframes for BMC
int nConfMaxBmc; // conflicts for BMC
int nStableMax; // the number of stable frames to quit
int nRatio; // ratio of flops to quit
int TimeOut; // approximate timeout in seconds
int TimeOutVT; // approximate timeout in seconds
int nBobPar; // Bob's parameter
int fUseBdds; // use BDDs to refine abstraction
int fUseDprove; // use 'dprove' to refine abstraction
int fUseStart; // use starting frame
int fVerbose; // verbose output
int fVeryVerbose; // printing additional information
int Status; // the problem status
int nFramesDone; // the number of frames covered
};
extern void Gia_ManAbsSetDefaultParams( Gia_ParAbs_t * p );
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_END
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......@@ -1665,263 +1665,6 @@ Gia_Man_t * Gia_ManDupWithConstraints( Gia_Man_t * p, Vec_Int_t * vPoTypes )
/**Function*************************************************************
Synopsis [Duplicates the AIG manager recursively.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManDupAbsFlops_rec( Gia_Man_t * pNew, Gia_Obj_t * pObj )
{
if ( ~pObj->Value )
return;
assert( Gia_ObjIsAnd(pObj) );
Gia_ManDupAbsFlops_rec( pNew, Gia_ObjFanin0(pObj) );
Gia_ManDupAbsFlops_rec( pNew, Gia_ObjFanin1(pObj) );
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
}
/**Function*************************************************************
Synopsis [Performs abstraction of the AIG to preserve the included flops.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupAbsFlops( Gia_Man_t * p, Vec_Int_t * vFlopClasses )
{
Gia_Man_t * pNew, * pTemp;
Gia_Obj_t * pObj;
int i, nFlops = 0;
Gia_ManFillValue( p );
// start the new manager
pNew = Gia_ManStart( 5000 );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
// create PIs
Gia_ManConst0(p)->Value = 0;
Gia_ManForEachPi( p, pObj, i )
pObj->Value = Gia_ManAppendCi(pNew);
// create additional PIs
Gia_ManForEachRo( p, pObj, i )
if ( !Vec_IntEntry(vFlopClasses, i) )
pObj->Value = Gia_ManAppendCi(pNew);
// create ROs
Gia_ManForEachRo( p, pObj, i )
if ( Vec_IntEntry(vFlopClasses, i) )
pObj->Value = Gia_ManAppendCi(pNew);
// create POs
Gia_ManHashAlloc( pNew );
Gia_ManForEachPo( p, pObj, i )
{
Gia_ManDupAbsFlops_rec( pNew, Gia_ObjFanin0(pObj) );
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
}
// create RIs
Gia_ManForEachRi( p, pObj, i )
if ( Vec_IntEntry(vFlopClasses, i) )
{
Gia_ManDupAbsFlops_rec( pNew, Gia_ObjFanin0(pObj) );
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
nFlops++;
}
Gia_ManHashStop( pNew );
Gia_ManSetRegNum( pNew, nFlops );
// clean up
pNew = Gia_ManSeqCleanup( pTemp = pNew );
Gia_ManStop( pTemp );
return pNew;
}
/**Function*************************************************************
Synopsis [Returns the array of neighbors.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_GlaCollectAssigned( Gia_Man_t * p, Vec_Int_t * vGateClasses )
{
Vec_Int_t * vAssigned;
Gia_Obj_t * pObj;
int i, Entry;
vAssigned = Vec_IntAlloc( 1000 );
Vec_IntForEachEntry( vGateClasses, Entry, i )
{
if ( Entry == 0 )
continue;
assert( Entry > 0 );
pObj = Gia_ManObj( p, i );
Vec_IntPush( vAssigned, Gia_ObjId(p, pObj) );
if ( Gia_ObjIsAnd(pObj) )
{
Vec_IntPush( vAssigned, Gia_ObjFaninId0p(p, pObj) );
Vec_IntPush( vAssigned, Gia_ObjFaninId1p(p, pObj) );
}
else if ( Gia_ObjIsRo(p, pObj) )
Vec_IntPush( vAssigned, Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)) );
else assert( Gia_ObjIsConst0(pObj) );
}
Vec_IntUniqify( vAssigned );
return vAssigned;
}
/**Function*************************************************************
Synopsis [Collects PIs and PPIs of the abstraction.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManGlaCollect( Gia_Man_t * p, Vec_Int_t * vGateClasses, Vec_Int_t ** pvPis, Vec_Int_t ** pvPPis, Vec_Int_t ** pvFlops, Vec_Int_t ** pvNodes )
{
Vec_Int_t * vAssigned;
Gia_Obj_t * pObj;
int i;
assert( Gia_ManPoNum(p) == 1 );
assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
// create included objects and their fanins
vAssigned = Gia_GlaCollectAssigned( p, vGateClasses );
// create additional arrays
if ( pvPis ) *pvPis = Vec_IntAlloc( 100 );
if ( pvPPis ) *pvPPis = Vec_IntAlloc( 100 );
if ( pvFlops ) *pvFlops = Vec_IntAlloc( 100 );
if ( pvNodes ) *pvNodes = Vec_IntAlloc( 1000 );
Gia_ManForEachObjVec( vAssigned, p, pObj, i )
{
if ( Gia_ObjIsPi(p, pObj) )
{ if ( pvPis ) Vec_IntPush( *pvPis, Gia_ObjId(p,pObj) ); }
else if ( !Vec_IntEntry(vGateClasses, Gia_ObjId(p,pObj)) )
{ if ( pvPPis ) Vec_IntPush( *pvPPis, Gia_ObjId(p,pObj) ); }
else if ( Gia_ObjIsRo(p, pObj) )
{ if ( pvFlops ) Vec_IntPush( *pvFlops, Gia_ObjId(p,pObj) ); }
else if ( Gia_ObjIsAnd(pObj) )
{ if ( pvNodes ) Vec_IntPush( *pvNodes, Gia_ObjId(p,pObj) ); }
else assert( Gia_ObjIsConst0(pObj) );
}
Vec_IntFree( vAssigned );
}
/**Function*************************************************************
Synopsis [Duplicates the AIG manager recursively.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManDupAbsGates_rec( Gia_Man_t * pNew, Gia_Obj_t * pObj )
{
if ( ~pObj->Value )
return;
assert( Gia_ObjIsAnd(pObj) );
Gia_ManDupAbsGates_rec( pNew, Gia_ObjFanin0(pObj) );
Gia_ManDupAbsGates_rec( pNew, Gia_ObjFanin1(pObj) );
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
}
/**Function*************************************************************
Synopsis [Performs abstraction of the AIG to preserve the included gates.]
Description [The array contains 1 for those objects (const, RO, AND)
that are included in the abstraction; 0, otherwise.]
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupAbsGates( Gia_Man_t * p, Vec_Int_t * vGateClasses )
{
Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
Gia_Man_t * pNew, * pTemp;
Gia_Obj_t * pObj, * pCopy;
int i;//, nFlops = 0;
assert( Gia_ManPoNum(p) == 1 );
assert( Vec_IntSize(vGateClasses) == Gia_ManObjNum(p) );
// create additional arrays
Gia_ManGlaCollect( p, vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
// start the new manager
pNew = Gia_ManStart( 5000 );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
// create constant
Gia_ManFillValue( p );
Gia_ManConst0(p)->Value = 0;
// create PIs
Gia_ManForEachObjVec( vPis, p, pObj, i )
pObj->Value = Gia_ManAppendCi(pNew);
// create additional PIs
Gia_ManForEachObjVec( vPPis, p, pObj, i )
pObj->Value = Gia_ManAppendCi(pNew);
// create ROs
Gia_ManForEachObjVec( vFlops, p, pObj, i )
pObj->Value = Gia_ManAppendCi(pNew);
// create internal nodes
Gia_ManForEachObjVec( vNodes, p, pObj, i )
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
// Gia_ManDupAbsGates_rec( pNew, pObj );
// create PO
Gia_ManForEachPo( p, pObj, i )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
// create RIs
Gia_ManForEachObjVec( vFlops, p, pObj, i )
Gia_ObjRoToRi(p, pObj)->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ObjRoToRi(p, pObj)) );
Gia_ManSetRegNum( pNew, Vec_IntSize(vFlops) );
// clean up
pNew = Gia_ManSeqCleanup( pTemp = pNew );
// transfer copy values: (p -> pTemp -> pNew) => (p -> pNew)
if ( Gia_ManObjNum(pTemp) != Gia_ManObjNum(pNew) )
{
// printf( "Gia_ManDupAbsGates() Internal error: object mismatch.\n" );
Gia_ManForEachObj( p, pObj, i )
{
if ( !~pObj->Value )
continue;
assert( !Abc_LitIsCompl(pObj->Value) );
pCopy = Gia_ObjCopy( pTemp, pObj );
if ( !~pCopy->Value )
{
Vec_IntWriteEntry( vGateClasses, i, 0 );
pObj->Value = ~0;
continue;
}
assert( !Abc_LitIsCompl(pCopy->Value) );
pObj->Value = pCopy->Value;
}
}
Gia_ManStop( pTemp );
Vec_IntFree( vPis );
Vec_IntFree( vPPis );
Vec_IntFree( vFlops );
Vec_IntFree( vNodes );
return pNew;
}
/**Function*************************************************************
Synopsis [Copy an AIG structure related to the selected POs.]
Description []
......
......@@ -20,6 +20,7 @@
#include "gia.h"
#include "misc/tim/tim.h"
#include "proof/abs/abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -176,155 +177,6 @@ void Gia_ManPrintClasses_old( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void Gia_ManPrintFlopClasses( Gia_Man_t * p )
{
int Counter0, Counter1;
if ( p->vFlopClasses == NULL )
return;
if ( Vec_IntSize(p->vFlopClasses) != Gia_ManRegNum(p) )
{
printf( "Gia_ManPrintFlopClasses(): The number of flop map entries differs from the number of flops.\n" );
return;
}
Counter0 = Vec_IntCountEntry( p->vFlopClasses, 0 );
Counter1 = Vec_IntCountEntry( p->vFlopClasses, 1 );
printf( "Flop-level abstraction: Excluded FFs = %d Included FFs = %d (%.2f %%) ",
Counter0, Counter1, 100.0*Counter1/(Counter0 + Counter1 + 1) );
if ( Counter0 + Counter1 < Gia_ManRegNum(p) )
printf( "and there are other FF classes..." );
printf( "\n" );
}
/**Function*************************************************************
Synopsis [Prints stats for the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManPrintGateClasses( Gia_Man_t * p )
{
Vec_Int_t * vPis, * vPPis, * vFlops, * vNodes;
int nTotal;
if ( p->vGateClasses == NULL )
return;
if ( Vec_IntSize(p->vGateClasses) != Gia_ManObjNum(p) )
{
printf( "Gia_ManPrintGateClasses(): The number of flop map entries differs from the number of flops.\n" );
return;
}
// create additional arrays
Gia_ManGlaCollect( p, p->vGateClasses, &vPis, &vPPis, &vFlops, &vNodes );
nTotal = 1 + Vec_IntSize(vFlops) + Vec_IntSize(vNodes);
printf( "Gate-level abstraction: PI = %d PPI = %d FF = %d (%.2f %%) AND = %d (%.2f %%) Obj = %d (%.2f %%)\n",
Vec_IntSize(vPis), Vec_IntSize(vPPis),
Vec_IntSize(vFlops), 100.0*Vec_IntSize(vFlops)/(Gia_ManRegNum(p)+1),
Vec_IntSize(vNodes), 100.0*Vec_IntSize(vNodes)/(Gia_ManAndNum(p)+1),
nTotal, 100.0*nTotal /(Gia_ManRegNum(p)+Gia_ManAndNum(p)+1) );
Vec_IntFree( vPis );
Vec_IntFree( vPPis );
Vec_IntFree( vFlops );
Vec_IntFree( vNodes );
}
/**Function*************************************************************
Synopsis [Prints stats for the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManPrintObjClasses( Gia_Man_t * p )
{
Vec_Int_t * vSeens; // objects seen so far
Vec_Int_t * vAbs = p->vObjClasses;
int i, k, Entry, iStart, iStop = -1, nFrames;
int nObjBits, nObjMask, iObj, iFrame, nWords;
unsigned * pInfo;
int * pCountAll, * pCountUni;
if ( vAbs == NULL )
return;
nFrames = Vec_IntEntry( vAbs, 0 );
assert( Vec_IntEntry(vAbs, nFrames+1) == Vec_IntSize(vAbs) );
pCountAll = ABC_ALLOC( int, nFrames + 1 );
pCountUni = ABC_ALLOC( int, nFrames + 1 );
// start storage for seen objects
nWords = Abc_BitWordNum( nFrames );
vSeens = Vec_IntStart( Gia_ManObjNum(p) * nWords );
// get the bitmasks
nObjBits = Abc_Base2Log( Gia_ManObjNum(p) );
nObjMask = (1 << nObjBits) - 1;
assert( Gia_ManObjNum(p) <= nObjMask );
// print info about frames
printf( "Frame Core F0 F1 F2 F3 ...\n" );
for ( i = 0; i < nFrames; i++ )
{
iStart = Vec_IntEntry( vAbs, i+1 );
iStop = Vec_IntEntry( vAbs, i+2 );
memset( pCountAll, 0, sizeof(int) * (nFrames + 1) );
memset( pCountUni, 0, sizeof(int) * (nFrames + 1) );
Vec_IntForEachEntryStartStop( vAbs, Entry, k, iStart, iStop )
{
iObj = (Entry & nObjMask);
iFrame = (Entry >> nObjBits);
pInfo = (unsigned *)Vec_IntEntryP( vSeens, nWords * iObj );
if ( Abc_InfoHasBit(pInfo, iFrame) == 0 )
{
Abc_InfoSetBit( pInfo, iFrame );
pCountUni[iFrame+1]++;
pCountUni[0]++;
}
pCountAll[iFrame+1]++;
pCountAll[0]++;
}
assert( pCountAll[0] == (iStop - iStart) );
// printf( "%5d%5d ", pCountAll[0], pCountUni[0] );
printf( "%3d :", i );
printf( "%7d", pCountAll[0] );
if ( i >= 10 )
{
for ( k = 0; k < 4; k++ )
printf( "%5d", pCountAll[k+1] );
printf( " ..." );
for ( k = i-4; k <= i; k++ )
printf( "%5d", pCountAll[k+1] );
}
else
{
for ( k = 0; k <= i; k++ )
if ( k <= i )
printf( "%5d", pCountAll[k+1] );
}
// for ( k = 0; k < nFrames; k++ )
// if ( k <= i )
// printf( "%5d", pCountAll[k+1] );
printf( "\n" );
}
assert( iStop == Vec_IntSize(vAbs) );
Vec_IntFree( vSeens );
ABC_FREE( pCountAll );
ABC_FREE( pCountUni );
}
/**Function*************************************************************
Synopsis [Prints stats for the AIG.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManPrintPlacement( Gia_Man_t * p )
{
int i, nFixed = 0, nUndef = 0;
......
SRC += src/aig/gia/gia.c \
src/aig/gia/giaAbs.c \
src/aig/gia/giaAbsGla.c \
src/aig/gia/giaAbsGla2.c \
src/aig/gia/giaAbsIter.c \
src/aig/gia/giaAbsOut.c \
src/aig/gia/giaAbsPth.c \
src/aig/gia/giaAbsRef.c \
src/aig/gia/giaAbsRef2.c \
src/aig/gia/giaAbsVta.c \
src/aig/gia/giaAig.c \
src/aig/gia/giaAiger.c \
src/aig/gia/giaBidec.c \
......
SRC += src/aig/saig/saigAbs.c \
src/aig/saig/saigAbsCba.c \
src/aig/saig/saigAbsPba.c \
src/aig/saig/saigAbsStart.c \
src/aig/saig/saigAbsVfa.c \
src/aig/saig/saigBmc.c \
SRC += src/aig/saig/saigBmc.c \
src/aig/saig/saigBmc2.c \
src/aig/saig/saigBmc3.c \
src/aig/saig/saigCexMin.c \
......@@ -12,9 +7,6 @@ SRC += src/aig/saig/saigAbs.c \
src/aig/saig/saigConstr2.c \
src/aig/saig/saigDual.c \
src/aig/saig/saigDup.c \
src/aig/saig/saigGlaCba.c \
src/aig/saig/saigGlaPba.c \
src/aig/saig/saigGlaPba2.c \
src/aig/saig/saigHaig.c \
src/aig/saig/saigInd.c \
src/aig/saig/saigIoa.c \
......@@ -24,13 +16,10 @@ SRC += src/aig/saig/saigAbs.c \
src/aig/saig/saigMiter.c \
src/aig/saig/saigOutDec.c \
src/aig/saig/saigPhase.c \
src/aig/saig/saigRefSat.c \
src/aig/saig/saigRetFwd.c \
src/aig/saig/saigRetMin.c \
src/aig/saig/saigRetStep.c \
src/aig/saig/saigScl.c \
src/aig/saig/saigSimExt.c \
src/aig/saig/saigSimExt2.c \
src/aig/saig/saigSimFast.c \
src/aig/saig/saigSimMv.c \
src/aig/saig/saigSimSeq.c \
......
......@@ -27,7 +27,6 @@
////////////////////////////////////////////////////////////////////////
#include "aig/aig/aig.h"
#include "aig/gia/giaAbs.h"
ABC_NAMESPACE_HEADER_START
......@@ -35,10 +34,6 @@ ABC_NAMESPACE_HEADER_START
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
#define SAIG_ZER 1
#define SAIG_ONE 2
#define SAIG_UND 3
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
......@@ -131,20 +126,6 @@ static inline int Saig_ObjRegId( Aig_Man_t * p, Aig_Obj_t * pObj ) {
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== sswAbs.c ==========================================================*/
extern Vec_Int_t * Saig_ManClasses2Flops( Vec_Int_t * vFlopClasses );
extern Vec_Int_t * Saig_ManFlops2Classes( int nRegs, Vec_Int_t * vFlops );
extern Abc_Cex_t * Saig_ManCexRemap( Aig_Man_t * p, Aig_Man_t * pAbs, Abc_Cex_t * pCexAbs );
/*=== sswAbsCba.c ==========================================================*/
extern Vec_Int_t * Saig_ManCbaFilterFlops( Aig_Man_t * pAig, Abc_Cex_t * pAbsCex, Vec_Int_t * vFlopClasses, Vec_Int_t * vAbsFfsToAdd, int nFfsToSelect );
extern Abc_Cex_t * Saig_ManCbaFindCexCareBits( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nInputs, int fVerbose );
extern Vec_Int_t * Saig_ManCbaFilterInputs( Aig_Man_t * pAig, int iFirstFlopPi, Abc_Cex_t * pCex, int fVerbose );
extern Vec_Int_t * Saig_ManCbaPerform( Aig_Man_t * pAig, int nInputs, Saig_ParBmc_t * pPars );
/*=== sswAbsPba.c ==========================================================*/
extern Vec_Int_t * Saig_ManPbaDerive( Aig_Man_t * pAig, int nInputs, int nStart, int nFrames, int nConfLimit, int nTimeLimit, int fVerbose, int * piFrame );
/*=== sswAbsStart.c ==========================================================*/
extern int Saig_ManCexRefineStep( Aig_Man_t * p, Vec_Int_t * vFlops, Vec_Int_t * vFlopClasses, Abc_Cex_t * pCex, int nFfToAddMax, 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, int fSilent );
......@@ -203,8 +184,6 @@ extern int Saig_ManDemiterNew( Aig_Man_t * pMan );
extern Aig_Man_t * Saig_ManDecPropertyOutput( Aig_Man_t * pAig, int nLits, int fVerbose );
/*=== saigPhase.c ==========================================================*/
extern Aig_Man_t * Saig_ManPhaseAbstract( Aig_Man_t * p, Vec_Int_t * vInits, int nFrames, int nPref, int fIgnore, int fPrint, int fVerbose );
/*=== saigRefSat.c ==========================================================*/
extern Vec_Int_t * Saig_ManExtendCounterExampleTest3( Aig_Man_t * pAig, int iFirstFlopPi, Abc_Cex_t * pCex, int fVerbose );
/*=== saigRetFwd.c ==========================================================*/
extern void Saig_ManMarkAutonomous( Aig_Man_t * p );
extern Aig_Man_t * Saig_ManRetimeForward( Aig_Man_t * p, int nMaxIters, int fVerbose );
......@@ -215,11 +194,6 @@ extern Aig_Man_t * Saig_ManRetimeMinArea( Aig_Man_t * p, int nMaxIters, in
extern int Saig_ManRetimeSteps( Aig_Man_t * p, int nSteps, int fForward, int fAddBugs );
/*=== saigScl.c ==========================================================*/
extern void Saig_ManReportUselessRegisters( Aig_Man_t * pAig );
/*=== saigSimExt.c ==========================================================*/
extern Vec_Int_t * Saig_ManExtendCounterExample( Aig_Man_t * p, int iFirstPi, Abc_Cex_t * pCex, Vec_Ptr_t * vSimInfo, int fVerbose );
extern Vec_Int_t * Saig_ManExtendCounterExampleTest( Aig_Man_t * p, int iFirstPi, Abc_Cex_t * pCex, int fTryFour, int fVerbose );
/*=== saigSimExt.c ==========================================================*/
extern Vec_Int_t * Saig_ManExtendCounterExampleTest2( Aig_Man_t * p, int iFirstPi, Abc_Cex_t * pCex, int fVerbose );
/*=== saigSimMv.c ==========================================================*/
extern Vec_Ptr_t * Saig_MvManSimulate( Aig_Man_t * pAig, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose );
/*=== saigStrSim.c ==========================================================*/
......
/**CFile****************************************************************
FileName [saigAbs.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Intergrated abstraction procedure.]
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"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Transform flop map into flop list.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManClasses2Flops( Vec_Int_t * vFlopClasses )
{
Vec_Int_t * vFlops;
int i, Entry;
vFlops = Vec_IntAlloc( 100 );
Vec_IntForEachEntry( vFlopClasses, Entry, i )
if ( Entry )
Vec_IntPush( vFlops, i );
return vFlops;
}
/**Function*************************************************************
Synopsis [Transform flop list into flop map.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManFlops2Classes( int nRegs, Vec_Int_t * vFlops )
{
Vec_Int_t * vFlopClasses;
int i, Entry;
vFlopClasses = Vec_IntStart( nRegs );
Vec_IntForEachEntry( vFlops, Entry, i )
Vec_IntWriteEntry( vFlopClasses, Entry, 1 );
return vFlopClasses;
}
/**Function*************************************************************
Synopsis [Derive a new counter-example.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Saig_ManCexRemap( Aig_Man_t * p, Aig_Man_t * pAbs, Abc_Cex_t * pCexAbs )
{
Abc_Cex_t * pCex;
Aig_Obj_t * pObj;
int i, f;
if ( !Saig_ManVerifyCex( pAbs, pCexAbs ) )
printf( "Saig_ManCexRemap(): The initial counter-example is invalid.\n" );
// else
// printf( "Saig_ManCexRemap(): The initial counter-example is correct.\n" );
// start the counter-example
pCex = Abc_CexAlloc( Aig_ManRegNum(p), Saig_ManPiNum(p), pCexAbs->iFrame+1 );
pCex->iFrame = pCexAbs->iFrame;
pCex->iPo = pCexAbs->iPo;
// copy the bit data
for ( f = 0; f <= pCexAbs->iFrame; f++ )
{
Saig_ManForEachPi( pAbs, pObj, i )
{
if ( i == Saig_ManPiNum(p) )
break;
if ( Abc_InfoHasBit( pCexAbs->pData, pCexAbs->nRegs + pCexAbs->nPis * f + i ) )
Abc_InfoSetBit( pCex->pData, pCex->nRegs + pCex->nPis * f + i );
}
}
// verify the counter example
if ( !Saig_ManVerifyCex( p, pCex ) )
{
printf( "Saig_ManCexRemap(): Counter-example is invalid.\n" );
Abc_CexFree( pCex );
pCex = NULL;
}
else
{
Abc_Print( 1, "Counter-example verification is successful.\n" );
Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. \n", pCex->iPo, p->pName, pCex->iFrame );
}
return pCex;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [saigAbsVfa.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Sequential AIG package.]
Synopsis [Intergrated abstraction procedure.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: saigAbsVfa.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "saig.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
typedef struct Abs_VfaMan_t_ Abs_VfaMan_t;
struct Abs_VfaMan_t_
{
Aig_Man_t * pAig;
int nConfLimit;
int fVerbose;
// unrolling info
int iFrame;
int nFrames;
Vec_Int_t * vObj2Vec; // maps obj ID into its vec ID
Vec_Int_t * vVec2Var; // maps vec ID into its sat Var (nFrames per vec ID)
Vec_Int_t * vVar2Inf; // maps sat Var into its frame and obj ID
Vec_Int_t * vFra2Var; // maps frame number into the first variable
// SAT solver
sat_solver * pSat;
Cnf_Dat_t * pCnf;
Vec_Int_t * vAssumps;
Vec_Int_t * vCore;
};
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Adds CNF clauses for the MUX.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abs_VfaManSatMux( sat_solver * pSat, int VarF, int VarI, int VarT, int VarE )
{
int RetValue, pLits[3];
// f = ITE(i, t, e)
// i' + t' + f
// i' + t + f'
// i + e' + f
// i + e + f'
// create four clauses
pLits[0] = toLitCond(VarI, 1);
pLits[1] = toLitCond(VarT, 1);
pLits[2] = toLitCond(VarF, 0);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
pLits[0] = toLitCond(VarI, 1);
pLits[1] = toLitCond(VarT, 0);
pLits[2] = toLitCond(VarF, 1);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
pLits[0] = toLitCond(VarI, 0);
pLits[1] = toLitCond(VarE, 1);
pLits[2] = toLitCond(VarF, 0);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
pLits[0] = toLitCond(VarI, 0);
pLits[1] = toLitCond(VarE, 0);
pLits[2] = toLitCond(VarF, 1);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
// two additional clauses
// t' & e' -> f'
// t & e -> f
// t + e + f'
// t' + e' + f
assert( VarT != VarE );
pLits[0] = toLitCond(VarT, 0);
pLits[1] = toLitCond(VarE, 0);
pLits[2] = toLitCond(VarF, 1);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
pLits[0] = toLitCond(VarT, 1);
pLits[1] = toLitCond(VarE, 1);
pLits[2] = toLitCond(VarF, 0);
RetValue = sat_solver_addclause( pSat, pLits, pLits + 3 );
assert( RetValue );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abs_VfaManAddVar( Abs_VfaMan_t * p, Aig_Obj_t * pObj, int f, int * pfNew )
{
int i, SatId, VecId = Vec_IntEntry( p->vObj2Vec, Aig_ObjId(pObj) );
*pfNew = 0;
if ( VecId == -1 )
return -1;
if ( VecId == 0 )
{
VecId = Vec_IntSize( p->vVec2Var ) / p->nFrames;
for ( i = 0; i < p->nFrames; i++ )
Vec_IntPush( p->vVec2Var, 0 );
Vec_IntWriteEntry( p->vObj2Vec, Aig_ObjId(pObj), VecId );
}
SatId = Vec_IntEntry( p->vVec2Var, p->nFrames * VecId + f );
if ( SatId )
return SatId;
SatId = Vec_IntSize( p->vVar2Inf ) / 2;
// save SatId
Vec_IntWriteEntry( p->vVec2Var, p->nFrames * VecId + f, SatId );
Vec_IntPush( p->vVar2Inf, Aig_ObjId(pObj) );
Vec_IntPush( p->vVar2Inf, f );
if ( Saig_ObjIsLo( p->pAig, pObj ) ) // reserve IDs for aux vars
{
Vec_IntPush( p->vVar2Inf, -1 );
Vec_IntPush( p->vVar2Inf, f );
Vec_IntPush( p->vVar2Inf, -2 );
Vec_IntPush( p->vVar2Inf, f );
}
*pfNew = 1;
return SatId;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abs_VfaManCreateFrame_rec( Abs_VfaMan_t * p, Aig_Obj_t * pObj, int f )
{
int SatVar, fNew;
if ( Aig_ObjIsConst1(pObj) )
return -1;
SatVar = Abs_VfaManAddVar( p, pObj, f, &fNew );
if ( (SatVar > 0 && !fNew) || Saig_ObjIsPi(p->pAig, pObj) || (Aig_ObjIsCi(pObj) && f==0) )
return SatVar;
if ( Aig_ObjIsCo(pObj) )
return Abs_VfaManCreateFrame_rec( p, Aig_ObjFanin0(pObj), f );
if ( Aig_ObjIsCi(pObj) )
return Abs_VfaManCreateFrame_rec( p, Saig_ObjLoToLi(p->pAig, pObj), f-1 );
assert( Aig_ObjIsAnd(pObj) );
Abs_VfaManCreateFrame_rec( p, Aig_ObjFanin0(pObj), f );
Abs_VfaManCreateFrame_rec( p, Aig_ObjFanin1(pObj), f );
return SatVar;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abs_VfaManCreateFrame( Abs_VfaMan_t * p, int f )
{
Aig_Obj_t * pObj;
int i;
clock_t clk = clock();
Saig_ManForEachPo( p->pAig, pObj, i )
Abs_VfaManCreateFrame_rec( p, pObj, f );
Vec_IntPush( p->vFra2Var, Vec_IntSize( p->vVar2Inf ) / 2 );
printf( "Frame = %3d : ", f );
printf( "Vecs = %8d ", Vec_IntSize( p->vVec2Var ) / p->nFrames );
printf( "Vars = %8d ", Vec_IntSize( p->vVar2Inf ) / 2 );
Abc_PrintTime( 1, "Time", clock() - clk );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abs_VfaMan_t * Abs_VfaManStart( Aig_Man_t * pAig )
{
Abs_VfaMan_t * p;
int i;
p = ABC_CALLOC( Abs_VfaMan_t, 1 );
p->pAig = pAig;
p->vObj2Vec = Vec_IntStart( Aig_ManObjNumMax(pAig) );
p->vVec2Var = Vec_IntAlloc( 1 << 20 );
p->vVar2Inf = Vec_IntAlloc( 1 << 20 );
p->vFra2Var = Vec_IntStart( 1 );
// skip the first variable
Vec_IntPush( p->vVar2Inf, -3 );
Vec_IntPush( p->vVar2Inf, -3 );
for ( i = 0; i < p->nFrames; i++ )
Vec_IntPush( p->vVec2Var, -1 );
// transfer values from CNF
p->pCnf = Cnf_DeriveOther( pAig, 0 );
for ( i = 0; i < Aig_ManObjNumMax(pAig); i++ )
if ( p->pCnf->pObj2Clause[i] == -1 )
Vec_IntWriteEntry( p->vObj2Vec, i, -1 );
p->vAssumps = Vec_IntAlloc( 100 );
p->vCore = Vec_IntAlloc( 100 );
return p;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abs_VfaManStop( Abs_VfaMan_t * p )
{
Vec_IntFreeP( &p->vObj2Vec );
Vec_IntFreeP( &p->vVec2Var );
Vec_IntFreeP( &p->vVar2Inf );
Vec_IntFreeP( &p->vFra2Var );
Vec_IntFreeP( &p->vAssumps );
Vec_IntFreeP( &p->vCore );
if ( p->pCnf )
Cnf_DataFree( p->pCnf );
if ( p->pSat )
sat_solver_delete( p->pSat );
ABC_FREE( p );
}
/**Function*************************************************************
Synopsis [Perform variable frame abstraction.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abs_VfaManTest( Aig_Man_t * pAig, int nFrames, int nConfLimit, int fVerbose )
{
Abs_VfaMan_t * p;
int i;
p = Abs_VfaManStart( pAig );
p->nFrames = nFrames;
p->nConfLimit = nConfLimit;
p->fVerbose = fVerbose;
// create unrolling for the given number of frames
for ( i = 0; i < p->nFrames; i++ )
Abs_VfaManCreateFrame( p, i );
Abs_VfaManStop( p );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
......@@ -21,6 +21,7 @@
#include "ioAbc.h"
#include "base/main/mainInt.h"
#include "aig/saig/saig.h"
#include "proof/abs/abs.h"
ABC_NAMESPACE_IMPL_START
......
......@@ -105,7 +105,7 @@ Vec_Ptr_t * Nwk_ManDeriveRetimingCut( Aig_Man_t * p, int fForward, int fVerbose
#include "aig/gia/gia.h"
#include "proof/abs/abs.h"
/**Function*************************************************************
......
/**CFile****************************************************************
FileName [abs.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Abstraction package.]
Synopsis []
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: abs.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "abs.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [abs.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Abstraction package.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: abs.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef ABC__proof_abs__Abs_h
#define ABC__proof_abs__Abs_h
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
#include "aig/gia/gia.h"
#include "aig/gia/giaAig.h"
#include "aig/saig/saig.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
// abstraction parameters
typedef struct Abs_Par_t_ Abs_Par_t;
struct Abs_Par_t_
{
int nFramesMax; // maximum frames
int nFramesStart; // starting frame
int nFramesPast; // overlap frames
int nConfLimit; // conflict limit
int nLearnedMax; // max number of learned clauses
int nLearnedStart; // max number of learned clauses
int nLearnedDelta; // delta increase of learned clauses
int nLearnedPerce; // percentage of clauses to leave
int nTimeOut; // timeout in seconds
int nRatioMin; // stop when less than this % of object is abstracted
int nRatioMax; // restart when the number of abstracted object is more than this
int fUseTermVars; // use terminal variables
int fUseRollback; // use rollback to the starting number of frames
int fPropFanout; // propagate fanout implications
int fAddLayer; // refinement strategy by adding layers
int fUseSkip; // skip proving intermediate timeframes
int fUseSimple; // use simple CNF construction
int fSkipHash; // skip hashing CNF while unrolling
int fUseFullProof; // use full proof for UNSAT cores
int fDumpVabs; // dumps the abstracted model
int fDumpMabs; // dumps the original AIG with abstraction map
int fCallProver; // calls the prover
char * pFileVabs; // dumps the abstracted model into this file
int fVerbose; // verbose flag
int fVeryVerbose; // print additional information
int iFrame; // the number of frames covered
int iFrameProved; // the number of frames proved
int nFramesNoChange; // the number of last frames without changes
int nFramesNoChangeLim; // the number of last frames without changes to dump abstraction
};
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== abs.c =========================================================*/
/*=== absDup.c =========================================================*/
extern Gia_Man_t * Gia_ManDupAbsFlops( Gia_Man_t * p, Vec_Int_t * vFlopClasses );
extern Gia_Man_t * Gia_ManDupAbsGates( Gia_Man_t * p, Vec_Int_t * vGateClasses );
extern void Gia_ManGlaCollect( Gia_Man_t * p, Vec_Int_t * vGateClasses, Vec_Int_t ** pvPis, Vec_Int_t ** pvPPis, Vec_Int_t ** pvFlops, Vec_Int_t ** pvNodes );
extern void Gia_ManPrintFlopClasses( Gia_Man_t * p );
extern void Gia_ManPrintObjClasses( Gia_Man_t * p );
extern void Gia_ManPrintGateClasses( Gia_Man_t * p );
/*=== absGla.c =========================================================*/
extern int Gia_ManPerformGla( Gia_Man_t * p, Abs_Par_t * pPars );
/*=== absGlaOld.c =========================================================*/
extern int Gia_ManPerformGlaOld( Gia_Man_t * p, Abs_Par_t * pPars, int fStartVta );
/*=== absIter.c =========================================================*/
extern Gia_Man_t * Gia_ManShrinkGla( Gia_Man_t * p, int nFrameMax, int nTimeOut, int fUsePdr, int fUseSat, int fUseBdd, int fVerbose );
/*=== absVta.c =========================================================*/
extern int Gia_VtaPerform( Gia_Man_t * pAig, Abs_Par_t * pPars );
/*=== absUtil.c =========================================================*/
extern void Abs_ParSetDefaults( Abs_Par_t * p );
extern Vec_Int_t * Gia_VtaConvertToGla( Gia_Man_t * p, Vec_Int_t * vVta );
extern Vec_Int_t * Gia_VtaConvertFromGla( Gia_Man_t * p, Vec_Int_t * vGla, int nFrames );
extern Vec_Int_t * Gia_FlaConvertToGla( Gia_Man_t * p, Vec_Int_t * vFla );
extern Vec_Int_t * Gia_GlaConvertToFla( Gia_Man_t * p, Vec_Int_t * vGla );
extern int Gia_GlaCountFlops( Gia_Man_t * p, Vec_Int_t * vGla );
extern int Gia_GlaCountNodes( Gia_Man_t * p, Vec_Int_t * vGla );
/*=== absOldCex.c ==========================================================*/
extern Vec_Int_t * Saig_ManCbaFilterFlops( Aig_Man_t * pAig, Abc_Cex_t * pAbsCex, Vec_Int_t * vFlopClasses, Vec_Int_t * vAbsFfsToAdd, int nFfsToSelect );
extern Abc_Cex_t * Saig_ManCbaFindCexCareBits( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nInputs, int fVerbose );
/*=== absOldRef.c ==========================================================*/
extern int Gia_ManCexAbstractionRefine( Gia_Man_t * pGia, Abc_Cex_t * pCex, int nFfToAddMax, int fTryFour, int fSensePath, int fVerbose );
/*=== absOldSat.c ==========================================================*/
extern Vec_Int_t * Saig_ManExtendCounterExampleTest3( Aig_Man_t * pAig, int iFirstFlopPi, Abc_Cex_t * pCex, int fVerbose );
/*=== absOldSim.c ==========================================================*/
extern Vec_Int_t * Saig_ManExtendCounterExampleTest2( Aig_Man_t * p, int iFirstPi, Abc_Cex_t * pCex, int fVerbose );
ABC_NAMESPACE_HEADER_END
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
/**CFile****************************************************************
FileName [gia.c]
FileName [absGla2.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Scalable gate-level abstraction.]
......@@ -14,16 +14,16 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: gia.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absGla2.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAbsRef.h"
//#include "giaAbsRef2.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver2.h"
#include "base/main/main.h"
#include "abs.h"
#include "absRef.h"
//#include "absRef2.h"
ABC_NAMESPACE_IMPL_START
......@@ -38,7 +38,7 @@ struct Ga2_Man_t_
{
// user data
Gia_Man_t * pGia; // working AIG manager
Gia_ParVta_t * pPars; // parameters
Abs_Par_t * pPars; // parameters
// markings
Vec_Ptr_t * vCnfs; // for each object: CNF0, CNF1
// abstraction
......@@ -378,7 +378,7 @@ void Ga2_ManComputeTest( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
Ga2_Man_t * Ga2_ManStart( Gia_Man_t * pGia, Gia_ParVta_t * pPars )
Ga2_Man_t * Ga2_ManStart( Gia_Man_t * pGia, Abs_Par_t * pPars )
{
Ga2_Man_t * p;
p = ABC_CALLOC( Ga2_Man_t, 1 );
......@@ -415,7 +415,7 @@ Ga2_Man_t * Ga2_ManStart( Gia_Man_t * pGia, Gia_ParVta_t * pPars )
return p;
}
void Ga2_ManDumpStats( Gia_Man_t * pGia, Gia_ParVta_t * pPars, sat_solver2 * pSat, int iFrame, int fUseN )
void Ga2_ManDumpStats( Gia_Man_t * pGia, Abs_Par_t * pPars, sat_solver2 * pSat, int iFrame, int fUseN )
{
FILE * pFile;
char pFileName[32];
......@@ -1525,7 +1525,7 @@ void Gia_Ga2SendCancel( Ga2_Man_t * p, int fVerbose )
SeeAlso []
***********************************************************************/
int Ga2_ManPerform( Gia_Man_t * pAig, Gia_ParVta_t * pPars )
int Gia_ManPerformGla( Gia_Man_t * pAig, Abs_Par_t * pPars )
{
int fUseSecondCore = 1;
Ga2_Man_t * p;
......@@ -1866,7 +1866,7 @@ finish:
if ( p->pPars->fVerbose )
Abc_Print( 1, "\n" );
if ( !Gia_ManVerifyCex( pAig, pAig->pCexSeq, 0 ) )
Abc_Print( 1, " Gia_GlaPerform(): CEX verification has failed!\n" );
Abc_Print( 1, " Gia_ManPerformGlaOld(): CEX verification has failed!\n" );
Abc_Print( 1, "True counter-example detected in frame %d. ", f );
p->pPars->iFrame = f - 1;
Vec_IntFreeP( &pAig->vGateClasses );
......
/**CFile****************************************************************
FileName [giaAbsGla.c]
FileName [absGla.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Gate-level abstraction.]
......@@ -14,16 +14,15 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsGla.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absGla.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAig.h"
#include "giaAbsRef.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver2.h"
#include "base/main/main.h"
#include "abs.h"
#include "absRef.h"
ABC_NAMESPACE_IMPL_START
......@@ -65,7 +64,7 @@ struct Gla_Man_t_
// user data
Gia_Man_t * pGia0; // starting AIG manager
Gia_Man_t * pGia; // working AIG manager
Gia_ParVta_t* pPars; // parameters
Abs_Par_t * pPars; // parameters
// internal data
Vec_Int_t * vAbs; // abstracted objects
Gla_Obj_t * pObjRoot; // the primary output
......@@ -823,7 +822,7 @@ Gia_Man_t * Gia_ManDupMapped( Gia_Man_t * p, Vec_Int_t * vMapping )
SeeAlso []
***********************************************************************/
Gla_Man_t * Gla_ManStart( Gia_Man_t * pGia0, Gia_ParVta_t * pPars )
Gla_Man_t * Gla_ManStart( Gia_Man_t * pGia0, Abs_Par_t * pPars )
{
Gla_Man_t * p;
Aig_Man_t * pAig;
......@@ -1000,7 +999,7 @@ Gla_Man_t * Gla_ManStart( Gia_Man_t * pGia0, Gia_ParVta_t * pPars )
SeeAlso []
***********************************************************************/
Gla_Man_t * Gla_ManStart2( Gia_Man_t * pGia, Gia_ParVta_t * pPars )
Gla_Man_t * Gla_ManStart2( Gia_Man_t * pGia, Abs_Par_t * pPars )
{
Gla_Man_t * p;
Aig_Man_t * pAig;
......@@ -1637,10 +1636,10 @@ void Gia_GlaDumpAbsracted( Gla_Man_t * p, int fVerbose )
SeeAlso []
***********************************************************************/
int Gia_GlaPerform( Gia_Man_t * pAig, Gia_ParVta_t * pPars, int fStartVta )
int Gia_ManPerformGlaOld( Gia_Man_t * pAig, Abs_Par_t * pPars, int fStartVta )
{
extern int Gia_VtaPerformInt( Gia_Man_t * pAig, Gia_ParVta_t * pPars );
extern void Ga2_ManDumpStats( Gia_Man_t * pGia, Gia_ParVta_t * pPars, sat_solver2 * pSat, int iFrame, int fUseN );
extern int Gia_VtaPerformInt( Gia_Man_t * pAig, Abs_Par_t * pPars );
extern void Ga2_ManDumpStats( Gia_Man_t * pGia, Abs_Par_t * pPars, sat_solver2 * pSat, int iFrame, int fUseN );
Gla_Man_t * p;
Vec_Int_t * vPPis, * vCore;//, * vCore2 = NULL;
Abc_Cex_t * pCex = NULL;
......@@ -1925,7 +1924,7 @@ finish:
ABC_FREE( pAig->pCexSeq );
pAig->pCexSeq = pCex;
if ( !Gia_ManVerifyCex( pAig, pCex, 0 ) )
Abc_Print( 1, " Gia_GlaPerform(): CEX verification has failed!\n" );
Abc_Print( 1, " Gia_ManPerformGlaOld(): CEX verification has failed!\n" );
Abc_Print( 1, "Counter-example detected in frame %d. ", f );
p->pPars->iFrame = pCex->iFrame - 1;
Vec_IntFreeP( &pAig->vGateClasses );
......
/**CFile****************************************************************
FileName [giaIter.c]
FileName [absIter.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Iterative improvement of abstraction.]
......@@ -14,12 +14,11 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaIter.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absIter.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAig.h"
#include "abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -49,7 +48,6 @@ static inline void Gia_ObjRemFromGla( Gia_Man_t * p, Gia_Obj_t * pObj ) { Vec_In
***********************************************************************/
int Gia_IterTryImprove( Gia_Man_t * p, int nTimeOut, int iFrame0 )
{
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, int fSilent );
Gia_Man_t * pAbs = Gia_ManDupAbsGates( p, p->vGateClasses );
Aig_Man_t * pAig = Gia_ManToAigSimple( pAbs );
int nStart = 0;
......@@ -65,7 +63,7 @@ int Gia_IterTryImprove( Gia_Man_t * p, int nTimeOut, int iFrame0 )
Gia_ManStop( pAbs );
return iFrame;
}
Gia_Man_t * Gia_IterImprove( Gia_Man_t * p, int nFrameMax, int nTimeOut, int fUsePdr, int fUseSat, int fUseBdd, int fVerbose )
Gia_Man_t * Gia_ManShrinkGla( Gia_Man_t * p, int nFrameMax, int nTimeOut, int fUsePdr, int fUseSat, int fUseBdd, int fVerbose )
{
Gia_Obj_t * pObj;
int i, iFrame0, iFrame;
......
......@@ -18,9 +18,7 @@
***********************************************************************/
#include "saig.h"
#include "aig/gia/giaAig.h"
#include "aig/ioa/ioa.h"
#include "abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -582,7 +580,7 @@ void Saig_ManCbaShrink( Saig_ManCba_t * p )
}
// try reducing the frames
pManNew = Saig_ManDupWithCubes( p->pAig, p->vReg2Value );
Ioa_WriteAiger( pManNew, "aigcube.aig", 0, 0 );
// Ioa_WriteAiger( pManNew, "aigcube.aig", 0, 0 );
Aig_ManStop( pManNew );
}
......
......@@ -18,7 +18,7 @@
***********************************************************************/
#include "saig.h"
#include "abs.h"
#include "proof/ssw/ssw.h"
#include "proof/fra/fra.h"
#include "proof/bbr/bbr.h"
......@@ -37,6 +37,56 @@ ABC_NAMESPACE_IMPL_START
/**Function*************************************************************
Synopsis [Derive a new counter-example.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Saig_ManCexRemap( Aig_Man_t * p, Aig_Man_t * pAbs, Abc_Cex_t * pCexAbs )
{
Abc_Cex_t * pCex;
Aig_Obj_t * pObj;
int i, f;
if ( !Saig_ManVerifyCex( pAbs, pCexAbs ) )
printf( "Saig_ManCexRemap(): The initial counter-example is invalid.\n" );
// else
// printf( "Saig_ManCexRemap(): The initial counter-example is correct.\n" );
// start the counter-example
pCex = Abc_CexAlloc( Aig_ManRegNum(p), Saig_ManPiNum(p), pCexAbs->iFrame+1 );
pCex->iFrame = pCexAbs->iFrame;
pCex->iPo = pCexAbs->iPo;
// copy the bit data
for ( f = 0; f <= pCexAbs->iFrame; f++ )
{
Saig_ManForEachPi( pAbs, pObj, i )
{
if ( i == Saig_ManPiNum(p) )
break;
if ( Abc_InfoHasBit( pCexAbs->pData, pCexAbs->nRegs + pCexAbs->nPis * f + i ) )
Abc_InfoSetBit( pCex->pData, pCex->nRegs + pCex->nPis * f + i );
}
}
// verify the counter example
if ( !Saig_ManVerifyCex( p, pCex ) )
{
printf( "Saig_ManCexRemap(): Counter-example is invalid.\n" );
Abc_CexFree( pCex );
pCex = NULL;
}
else
{
Abc_Print( 1, "Counter-example verification is successful.\n" );
Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. \n", pCex->iPo, p->pName, pCex->iFrame );
}
return pCex;
}
/**Function*************************************************************
Synopsis [Find the first PI corresponding to the flop.]
Description []
......@@ -72,7 +122,6 @@ int Saig_ManCexFirstFlopPi( Aig_Man_t * p, Aig_Man_t * pAbs )
***********************************************************************/
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 )
{
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, int fSilent );
Vec_Int_t * vFlopsNew;
int i, Entry, RetValue;
*piRetValue = -1;
......@@ -233,71 +282,81 @@ int Saig_ManCexRefineStep( Aig_Man_t * p, Vec_Int_t * vFlops, Vec_Int_t * vFlopC
/**Function*************************************************************
Synopsis [Computes the flops to remain after abstraction.]
Synopsis [Transform flop map into flop list.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Saig_ManCexAbstractionFlops( Aig_Man_t * p, Gia_ParAbs_t * pPars )
Vec_Int_t * Gia_ManClasses2Flops( Vec_Int_t * vFlopClasses )
{
int nUseStart = 0;
Aig_Man_t * pAbs, * pTemp;
Vec_Int_t * vFlops;
int Iter;//, clk = clock(), clk2 = clock();//, iFlop;
assert( Aig_ManRegNum(p) > 0 );
if ( pPars->fVerbose )
printf( "Performing counter-example-based refinement.\n" );
Aig_ManSetCioIds( p );
vFlops = Vec_IntStartNatural( 1 );
/*
iFlop = Saig_ManFindFirstFlop( p );
assert( iFlop >= 0 );
vFlops = Vec_IntAlloc( 1 );
Vec_IntPush( vFlops, iFlop );
*/
// create the resulting AIG
pAbs = Saig_ManDupAbstraction( p, vFlops );
if ( !pPars->fVerbose )
int i, Entry;
vFlops = Vec_IntAlloc( 100 );
Vec_IntForEachEntry( vFlopClasses, Entry, i )
if ( Entry )
Vec_IntPush( vFlops, i );
return vFlops;
}
/**Function*************************************************************
Synopsis [Transform flop list into flop map.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_ManFlops2Classes( Gia_Man_t * pGia, Vec_Int_t * vFlops )
{
Vec_Int_t * vFlopClasses;
int i, Entry;
vFlopClasses = Vec_IntStart( Gia_ManRegNum(pGia) );
Vec_IntForEachEntry( vFlops, Entry, i )
Vec_IntWriteEntry( vFlopClasses, Entry, 1 );
return vFlopClasses;
}
/**Function*************************************************************
Synopsis [Refines abstraction using the latch map.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Gia_ManCexAbstractionRefine( Gia_Man_t * pGia, Abc_Cex_t * pCex, int nFfToAddMax, int fTryFour, int fSensePath, int fVerbose )
{
Aig_Man_t * pNew;
Vec_Int_t * vFlops;
if ( pGia->vFlopClasses == NULL )
{
printf( "Init : " );
Aig_ManPrintStats( pAbs );
printf( "Gia_ManCexAbstractionRefine(): Abstraction latch map is missing.\n" );
return -1;
}
printf( "Refining abstraction...\n" );
for ( Iter = 0; ; Iter++ )
pNew = Gia_ManToAig( pGia, 0 );
vFlops = Gia_ManClasses2Flops( pGia->vFlopClasses );
if ( !Saig_ManCexRefineStep( pNew, vFlops, pGia->vFlopClasses, pCex, nFfToAddMax, fTryFour, fSensePath, fVerbose ) )
{
pTemp = Saig_ManCexRefine( p, pAbs, vFlops, pPars->nFramesBmc, pPars->nConfMaxBmc, pPars->fUseBdds, pPars->fUseDprove, pPars->fVerbose, pPars->fUseStart?&nUseStart:NULL, &pPars->Status, &pPars->nFramesDone );
if ( pTemp == NULL )
{
ABC_FREE( p->pSeqModel );
p->pSeqModel = pAbs->pSeqModel;
pAbs->pSeqModel = NULL;
Aig_ManStop( pAbs );
break;
}
Aig_ManStop( pAbs );
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(p)-Aig_ManRegNum(pAbs))/Aig_ManRegNum(p) < 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;
}
pGia->pCexSeq = pNew->pSeqModel; pNew->pSeqModel = NULL;
Vec_IntFree( vFlops );
Aig_ManStop( pNew );
return 0;
}
return vFlops;
Vec_IntFree( pGia->vFlopClasses );
pGia->vFlopClasses = Gia_ManFlops2Classes( pGia, vFlops );
Vec_IntFree( vFlops );
Aig_ManStop( pNew );
return -1;
}
......
......@@ -18,8 +18,7 @@
***********************************************************************/
#include "saig.h"
#include "proof/ssw/ssw.h"
#include "abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -28,6 +27,44 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
#define SAIG_ZER 1
#define SAIG_ONE 2
#define SAIG_UND 3
static inline int Saig_ManSimInfoNot( int Value )
{
if ( Value == SAIG_ZER )
return SAIG_ONE;
if ( Value == SAIG_ONE )
return SAIG_ZER;
return SAIG_UND;
}
static inline int Saig_ManSimInfoAnd( int Value0, int Value1 )
{
if ( Value0 == SAIG_ZER || Value1 == SAIG_ZER )
return SAIG_ZER;
if ( Value0 == SAIG_ONE && Value1 == SAIG_ONE )
return SAIG_ONE;
return SAIG_UND;
}
static inline int Saig_ManSimInfoGet( Vec_Ptr_t * vSimInfo, Aig_Obj_t * pObj, int iFrame )
{
unsigned * pInfo = (unsigned *)Vec_PtrEntry( vSimInfo, Aig_ObjId(pObj) );
return 3 & (pInfo[iFrame >> 4] >> ((iFrame & 15) << 1));
}
static inline void Saig_ManSimInfoSet( Vec_Ptr_t * vSimInfo, Aig_Obj_t * pObj, int iFrame, int Value )
{
unsigned * pInfo = (unsigned *)Vec_PtrEntry( vSimInfo, Aig_ObjId(pObj) );
assert( Value >= SAIG_ZER && Value <= SAIG_UND );
Value ^= Saig_ManSimInfoGet( vSimInfo, pObj, iFrame );
pInfo[iFrame >> 4] ^= (Value << ((iFrame & 15) << 1));
}
#define SAIG_ZER_NEW 0 // 0 not visited
#define SAIG_ONE_NEW 1 // 1 not visited
#define SAIG_ZER_OLD 2 // 0 visited
......@@ -86,7 +123,7 @@ static inline void Saig_ManSimInfo2Set( Vec_Ptr_t * vSimInfo, Aig_Obj_t * pObj,
}
// performs ternary simulation
extern int Saig_ManSimDataInit( Aig_Man_t * p, Abc_Cex_t * pCex, Vec_Ptr_t * vSimInfo, Vec_Int_t * vRes );
//extern int Saig_ManSimDataInit( Aig_Man_t * p, Abc_Cex_t * pCex, Vec_Ptr_t * vSimInfo, Vec_Int_t * vRes );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
......@@ -103,6 +140,76 @@ extern int Saig_ManSimDataInit( Aig_Man_t * p, Abc_Cex_t * pCex, Vec_Ptr_t * vSi
SeeAlso []
***********************************************************************/
int Saig_ManExtendOneEval( Vec_Ptr_t * vSimInfo, Aig_Obj_t * pObj, int iFrame )
{
int Value0, Value1, Value;
Value0 = Saig_ManSimInfoGet( vSimInfo, Aig_ObjFanin0(pObj), iFrame );
if ( Aig_ObjFaninC0(pObj) )
Value0 = Saig_ManSimInfoNot( Value0 );
if ( Aig_ObjIsCo(pObj) )
{
Saig_ManSimInfoSet( vSimInfo, pObj, iFrame, Value0 );
return Value0;
}
assert( Aig_ObjIsNode(pObj) );
Value1 = Saig_ManSimInfoGet( vSimInfo, Aig_ObjFanin1(pObj), iFrame );
if ( Aig_ObjFaninC1(pObj) )
Value1 = Saig_ManSimInfoNot( Value1 );
Value = Saig_ManSimInfoAnd( Value0, Value1 );
Saig_ManSimInfoSet( vSimInfo, pObj, iFrame, Value );
return Value;
}
/**Function*************************************************************
Synopsis [Performs ternary simulation for one design.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Saig_ManSimDataInit( Aig_Man_t * p, Abc_Cex_t * pCex, Vec_Ptr_t * vSimInfo, Vec_Int_t * vRes )
{
Aig_Obj_t * pObj, * pObjLi, * pObjLo;
int i, f, Entry, iBit = 0;
Saig_ManForEachLo( p, pObj, i )
Saig_ManSimInfoSet( vSimInfo, pObj, 0, Abc_InfoHasBit(pCex->pData, iBit++)?SAIG_ONE:SAIG_ZER );
for ( f = 0; f <= pCex->iFrame; f++ )
{
Saig_ManSimInfoSet( vSimInfo, Aig_ManConst1(p), f, SAIG_ONE );
Saig_ManForEachPi( p, pObj, i )
Saig_ManSimInfoSet( vSimInfo, pObj, f, Abc_InfoHasBit(pCex->pData, iBit++)?SAIG_ONE:SAIG_ZER );
if ( vRes )
Vec_IntForEachEntry( vRes, Entry, i )
Saig_ManSimInfoSet( vSimInfo, Aig_ManCi(p, Entry), f, SAIG_UND );
Aig_ManForEachNode( p, pObj, i )
Saig_ManExtendOneEval( vSimInfo, pObj, f );
Aig_ManForEachCo( p, pObj, i )
Saig_ManExtendOneEval( vSimInfo, pObj, f );
if ( f == pCex->iFrame )
break;
Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
Saig_ManSimInfoSet( vSimInfo, pObjLo, f+1, Saig_ManSimInfoGet(vSimInfo, pObjLi, f) );
}
// make sure the output of the property failed
pObj = Aig_ManCo( p, pCex->iPo );
return Saig_ManSimInfoGet( vSimInfo, pObj, pCex->iFrame );
}
/**Function*************************************************************
Synopsis [Performs ternary simulation for one node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Saig_ManExtendOneEval2( Vec_Ptr_t * vSimInfo, Aig_Obj_t * pObj, int iFrame )
{
int Value0, Value1, Value;
......@@ -361,117 +468,6 @@ ABC_PRT( "Time", clock() - clk );
}
/**Function*************************************************************
Synopsis [Returns the array of PIs for flops that should not be absracted.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Saig_ManDeriveCex( Aig_Man_t * p, int iFirstFlopPi, Abc_Cex_t * pCex, Vec_Ptr_t * vSimInfo, int fVerbose )
{
Abc_Cex_t * pCare;
Aig_Obj_t * pObj;
Vec_Int_t * vRes, * vResInv;
int i, f, Value;
// assert( Aig_ManRegNum(p) > 0 );
assert( (unsigned *)Vec_PtrEntry(vSimInfo,1) - (unsigned *)Vec_PtrEntry(vSimInfo,0) >= Abc_BitWordNum(2*(pCex->iFrame+1)) );
// start simulation data
Value = Saig_ManSimDataInit2( p, pCex, vSimInfo );
assert( Value == SAIG_ONE_NEW );
// derive implications of constants and primary inputs
Saig_ManForEachLo( p, pObj, i )
Saig_ManSetAndDriveImplications_rec( p, pObj, 0, pCex->iFrame, vSimInfo );
for ( f = pCex->iFrame; f >= 0; f-- )
{
Saig_ManSetAndDriveImplications_rec( p, Aig_ManConst1(p), f, pCex->iFrame, vSimInfo );
for ( i = 0; i < iFirstFlopPi; i++ )
Saig_ManSetAndDriveImplications_rec( p, Aig_ManCi(p, i), f, pCex->iFrame, vSimInfo );
}
// recursively compute justification
Saig_ManExplorePaths_rec( p, Aig_ManCo(p, pCex->iPo), pCex->iFrame, pCex->iFrame, vSimInfo );
// create CEX
pCare = Abc_CexDup( pCex, pCex->nRegs );
memset( pCare->pData, 0, sizeof(unsigned) * Abc_BitWordNum(pCare->nBits) );
// select the result
vRes = Vec_IntAlloc( 1000 );
vResInv = Vec_IntAlloc( 1000 );
for ( i = iFirstFlopPi; i < Saig_ManPiNum(p); i++ )
{
int fFound = 0;
for ( f = pCex->iFrame; f >= 0; f-- )
{
Value = Saig_ManSimInfo2Get( vSimInfo, Aig_ManCi(p, i), f );
if ( Saig_ManSimInfo2IsOld( Value ) )
{
fFound = 1;
Abc_InfoSetBit( pCare->pData, pCare->nRegs + pCare->nPis * f + i );
}
}
if ( fFound )
Vec_IntPush( vRes, i );
else
Vec_IntPush( vResInv, i );
}
// resimulate to make sure it is valid
Value = Saig_ManSimDataInit( p, pCex, vSimInfo, vResInv );
assert( Value == SAIG_ONE );
Vec_IntFree( vResInv );
Vec_IntFree( vRes );
return pCare;
}
/**Function*************************************************************
Synopsis [Returns the array of PIs for flops that should not be absracted.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Saig_ManFindCexCareBitsSense( Aig_Man_t * p, Abc_Cex_t * pCex, int iFirstFlopPi, int fVerbose )
{
Abc_Cex_t * pCare;
Vec_Ptr_t * vSimInfo;
clock_t clk;
if ( Saig_ManPiNum(p) != pCex->nPis )
{
printf( "Saig_ManExtendCounterExampleTest2(): The PI count of AIG (%d) does not match that of cex (%d).\n",
Aig_ManCiNum(p), pCex->nPis );
return NULL;
}
Aig_ManFanoutStart( p );
vSimInfo = Vec_PtrAllocSimInfo( Aig_ManObjNumMax(p), Abc_BitWordNum(2*(pCex->iFrame+1)) );
Vec_PtrCleanSimInfo( vSimInfo, 0, Abc_BitWordNum(2*(pCex->iFrame+1)) );
clk = clock();
pCare = Saig_ManDeriveCex( p, iFirstFlopPi, pCex, vSimInfo, fVerbose );
if ( fVerbose )
{
// printf( "Total new PIs = %3d. Non-removable PIs = %3d. ", Saig_ManPiNum(p)-iFirstFlopPi, Vec_IntSize(vRes) );
Abc_CexPrintStats( pCex );
Abc_CexPrintStats( pCare );
ABC_PRT( "Time", clock() - clk );
}
Vec_PtrFree( vSimInfo );
Aig_ManFanoutStop( p );
return pCare;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
/**CFile****************************************************************
FileName [giaAbsOut.c]
FileName [absOut.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Abstraction refinement outside of abstraction engines.]
......@@ -14,13 +14,11 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsOut.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absOut.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAig.h"
#include "aig/saig/saig.h"
#include "abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -92,7 +90,6 @@ Abc_Cex_t * Gia_ManCexRemap( Gia_Man_t * p, Abc_Cex_t * pCexAbs, Vec_Int_t * vPi
int Gia_ManGlaRefine( Gia_Man_t * p, Abc_Cex_t * pCex, int fMinCut, int fVerbose )
{
extern void Nwk_ManDeriveMinCut( Gia_Man_t * p, int fVerbose );
// extern Abc_Cex_t * Saig_ManCbaFindCexCareBits( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nInputs, int fVerbose );
int fAddOneLayer = 1;
Abc_Cex_t * pCexNew = NULL;
Gia_Man_t * pAbs;
......@@ -431,11 +428,11 @@ int Gia_ManNewRefine( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrameStart, int iFra
pNew->vGateClasses = Vec_IntDup( p->vGateClasses );
// perform abstraction for the new AIG
{
Gia_ParVta_t Pars, * pPars = &Pars;
Gia_VtaSetDefaultParams( pPars );
Abs_Par_t Pars, * pPars = &Pars;
Abs_ParSetDefaults( pPars );
pPars->nFramesMax = pCex->iFrame - iFrameStart + 1 + iFrameExtra;
pPars->fVerbose = fVerbose;
RetValue = Ga2_ManPerform( pNew, pPars );
RetValue = Gia_ManPerformGla( pNew, pPars );
if ( RetValue == 0 ) // spurious SAT
{
Vec_IntFreeP( &pNew->vGateClasses );
......
/**CFile****************************************************************
FileName [giaAbsPth.c]
FileName [absPth.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Interface to pthreads.]
......@@ -14,7 +14,7 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsPth.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absPth.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
......
/**CFile****************************************************************
FileName [giaAbsRef.c]
FileName [absRef.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Refinement manager.]
......@@ -14,13 +14,13 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsRef.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absRef.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAbsRef.h"
#include "sat/bsat/satSolver2.h"
#include "abs.h"
#include "absRef.h"
ABC_NAMESPACE_IMPL_START
......
/**CFile****************************************************************
FileName [giaAbsRef.h]
FileName [absRef.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Refinement manager.]
......@@ -14,12 +14,12 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsRef.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absRef.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef ABC__aig__gia__giaAbsRef_h
#define ABC__aig__gia__giaAbsRef_h
#ifndef ABC__proof_abs__AbsRef_h
#define ABC__proof_abs__AbsRef_h
////////////////////////////////////////////////////////////////////////
......
/**CFile****************************************************************
FileName [giaAbsRef2.c]
FileName [absRef2.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Refinement manager.]
......@@ -14,12 +14,12 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsRef2.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absRef2.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "giaAbsRef2.h"
#include "abs.h"
#include "absRef2.h"
ABC_NAMESPACE_IMPL_START
......
/**CFile****************************************************************
FileName [giaAbsRef2.h]
FileName [absRef2.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Refinement manager.]
......@@ -14,12 +14,12 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsRef2.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absRef2.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef ABC__aig__gia__giaAbsRef2_h
#define ABC__aig__gia__giaAbsRef2_h
#ifndef ABC__proof_abs__AbsRef2_h
#define ABC__proof_abs__AbsRef2_h
////////////////////////////////////////////////////////////////////////
......
/**CFile****************************************************************
FileName [absUtil.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Abstraction package.]
Synopsis [Interface to pthreads.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: absUtil.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "abs.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [This procedure sets default parameters.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abs_ParSetDefaults( Abs_Par_t * p )
{
memset( p, 0, sizeof(Abs_Par_t) );
p->nFramesMax = 0; // maximum frames
p->nFramesStart = 0; // starting frame
p->nFramesPast = 4; // overlap frames
p->nConfLimit = 0; // conflict limit
p->nLearnedMax = 1000; // max number of learned clauses
p->nLearnedStart = 1000; // max number of learned clauses
p->nLearnedDelta = 200; // max number of learned clauses
p->nLearnedPerce = 70; // max number of learned clauses
p->nTimeOut = 0; // timeout in seconds
p->nRatioMin = 0; // stop when less than this % of object is abstracted
p->nRatioMax = 30; // restart when more than this % of object is abstracted
p->fUseTermVars = 0; // use terminal variables
p->fUseRollback = 0; // use rollback to the starting number of frames
p->fPropFanout = 1; // propagate fanouts during refinement
p->fVerbose = 0; // verbose flag
p->iFrame = -1; // the number of frames covered
p->iFrameProved = -1; // the number of frames proved
p->nFramesNoChangeLim = 1; // the number of frames without change to dump abstraction
}
/**Function*************************************************************
Synopsis [Converting VTA vector to GLA vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_VtaConvertToGla( Gia_Man_t * p, Vec_Int_t * vVta )
{
Gia_Obj_t * pObj;
Vec_Int_t * vGla;
int nObjMask, nObjs = Gia_ManObjNum(p);
int i, Entry, nFrames = Vec_IntEntry( vVta, 0 );
assert( Vec_IntEntry(vVta, nFrames+1) == Vec_IntSize(vVta) );
// get the bitmask
nObjMask = (1 << Abc_Base2Log(nObjs)) - 1;
assert( nObjs <= nObjMask );
// go through objects
vGla = Vec_IntStart( nObjs );
Vec_IntForEachEntryStart( vVta, Entry, i, nFrames+2 )
{
pObj = Gia_ManObj( p, (Entry & nObjMask) );
assert( Gia_ObjIsRo(p, pObj) || Gia_ObjIsAnd(pObj) || Gia_ObjIsConst0(pObj) );
Vec_IntAddToEntry( vGla, (Entry & nObjMask), 1 );
}
Vec_IntWriteEntry( vGla, 0, nFrames );
return vGla;
}
/**Function*************************************************************
Synopsis [Converting GLA vector to VTA vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_VtaConvertFromGla( Gia_Man_t * p, Vec_Int_t * vGla, int nFrames )
{
Vec_Int_t * vVta;
int nObjBits, nObjMask, nObjs = Gia_ManObjNum(p);
int i, k, j, Entry, Counter, nGlaSize;
//. get the GLA size
nGlaSize = Vec_IntSum(vGla);
// get the bitmask
nObjBits = Abc_Base2Log(nObjs);
nObjMask = (1 << Abc_Base2Log(nObjs)) - 1;
assert( nObjs <= nObjMask );
// go through objects
vVta = Vec_IntAlloc( 1000 );
Vec_IntPush( vVta, nFrames );
Counter = nFrames + 2;
for ( i = 0; i <= nFrames; i++, Counter += i * nGlaSize )
Vec_IntPush( vVta, Counter );
for ( i = 0; i < nFrames; i++ )
for ( k = 0; k <= i; k++ )
Vec_IntForEachEntry( vGla, Entry, j )
if ( Entry )
Vec_IntPush( vVta, (k << nObjBits) | j );
Counter = Vec_IntEntry(vVta, nFrames+1);
assert( Vec_IntEntry(vVta, nFrames+1) == Vec_IntSize(vVta) );
return vVta;
}
/**Function*************************************************************
Synopsis [Converting GLA vector to FLA vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_FlaConvertToGla_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vGla )
{
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return;
Gia_ObjSetTravIdCurrent(p, pObj);
Vec_IntWriteEntry( vGla, Gia_ObjId(p, pObj), 1 );
if ( Gia_ObjIsRo(p, pObj) )
return;
assert( Gia_ObjIsAnd(pObj) );
Gia_FlaConvertToGla_rec( p, Gia_ObjFanin0(pObj), vGla );
Gia_FlaConvertToGla_rec( p, Gia_ObjFanin1(pObj), vGla );
}
/**Function*************************************************************
Synopsis [Converting FLA vector to GLA vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_FlaConvertToGla( Gia_Man_t * p, Vec_Int_t * vFla )
{
Vec_Int_t * vGla;
Gia_Obj_t * pObj;
int i;
// mark const0 and relevant CI objects
Gia_ManIncrementTravId( p );
Gia_ObjSetTravIdCurrent(p, Gia_ManConst0(p));
Gia_ManForEachPi( p, pObj, i )
Gia_ObjSetTravIdCurrent(p, pObj);
Gia_ManForEachRo( p, pObj, i )
if ( !Vec_IntEntry(vFla, i) )
Gia_ObjSetTravIdCurrent(p, pObj);
// label all objects reachable from the PO and selected flops
vGla = Vec_IntStart( Gia_ManObjNum(p) );
Vec_IntWriteEntry( vGla, 0, 1 );
Gia_ManForEachPo( p, pObj, i )
Gia_FlaConvertToGla_rec( p, Gia_ObjFanin0(pObj), vGla );
Gia_ManForEachRi( p, pObj, i )
if ( Vec_IntEntry(vFla, i) )
Gia_FlaConvertToGla_rec( p, Gia_ObjFanin0(pObj), vGla );
return vGla;
}
/**Function*************************************************************
Synopsis [Converting GLA vector to FLA vector.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Gia_GlaConvertToFla( Gia_Man_t * p, Vec_Int_t * vGla )
{
Vec_Int_t * vFla;
Gia_Obj_t * pObj;
int i;
vFla = Vec_IntStart( Gia_ManRegNum(p) );
Gia_ManForEachRo( p, pObj, i )
if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
Vec_IntWriteEntry( vFla, i, 1 );
return vFla;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Gia_GlaCountFlops( Gia_Man_t * p, Vec_Int_t * vGla )
{
Gia_Obj_t * pObj;
int i, Count = 0;
Gia_ManForEachRo( p, pObj, i )
if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
Count++;
return Count;
}
int Gia_GlaCountNodes( Gia_Man_t * p, Vec_Int_t * vGla )
{
Gia_Obj_t * pObj;
int i, Count = 0;
Gia_ManForEachAnd( p, pObj, i )
if ( Vec_IntEntry(vGla, Gia_ObjId(p, pObj)) )
Count++;
return Count;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [giaAbsVta.c]
FileName [absVta.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Scalable AIG package.]
PackageName [Abstraction package.]
Synopsis [Variable time-frame abstraction.]
......@@ -14,13 +14,13 @@
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: giaAbsVta.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
Revision [$Id: absVta.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "gia.h"
#include "sat/bsat/satSolver2.h"
#include "base/main/main.h"
#include "abs.h"
ABC_NAMESPACE_IMPL_START
......@@ -47,7 +47,7 @@ struct Vta_Man_t_
{
// user data
Gia_Man_t * pGia; // AIG manager
Gia_ParVta_t* pPars; // parameters
Abs_Par_t * pPars; // parameters
// internal data
int nObjs; // the number of objects
int nObjsAlloc; // the number of objects allocated
......@@ -136,40 +136,6 @@ extern void Vga_ManAddClausesOne( Vta_Man_t * p, int iObj, int iFrame );
/**Function*************************************************************
Synopsis [This procedure sets default parameters.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_VtaSetDefaultParams( Gia_ParVta_t * p )
{
memset( p, 0, sizeof(Gia_ParVta_t) );
p->nFramesMax = 0; // maximum frames
p->nFramesStart = 0; // starting frame
p->nFramesPast = 4; // overlap frames
p->nConfLimit = 0; // conflict limit
p->nLearnedMax = 1000; // max number of learned clauses
p->nLearnedStart = 1000; // max number of learned clauses
p->nLearnedDelta = 200; // max number of learned clauses
p->nLearnedPerce = 70; // max number of learned clauses
p->nTimeOut = 0; // timeout in seconds
p->nRatioMin = 0; // stop when less than this % of object is abstracted
p->nRatioMax = 30; // restart when more than this % of object is abstracted
p->fUseTermVars = 0; // use terminal variables
p->fUseRollback = 0; // use rollback to the starting number of frames
p->fPropFanout = 1; // propagate fanouts during refinement
p->fVerbose = 0; // verbose flag
p->iFrame = -1; // the number of frames covered
p->iFrameProved = -1; // the number of frames proved
p->nFramesNoChangeLim = 1; // the number of frames without change to dump abstraction
}
/**Function*************************************************************
Synopsis [Converting from one array to per-frame arrays.]
Description []
......@@ -1014,7 +980,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
SeeAlso []
***********************************************************************/
Vta_Man_t * Vga_ManStart( Gia_Man_t * pGia, Gia_ParVta_t * pPars )
Vta_Man_t * Vga_ManStart( Gia_Man_t * pGia, Abs_Par_t * pPars )
{
Vta_Man_t * p;
p = ABC_CALLOC( Vta_Man_t, 1 );
......@@ -1524,7 +1490,7 @@ void Gia_VtaPrintMemory( Vta_Man_t * p )
SeeAlso []
***********************************************************************/
int Gia_VtaPerformInt( Gia_Man_t * pAig, Gia_ParVta_t * pPars )
int Gia_VtaPerformInt( Gia_Man_t * pAig, Abs_Par_t * pPars )
{
Vta_Man_t * p;
Vec_Int_t * vCore;
......@@ -1775,7 +1741,7 @@ finish:
SeeAlso []
***********************************************************************/
int Gia_VtaPerform( Gia_Man_t * pAig, Gia_ParVta_t * pPars )
int Gia_VtaPerform( Gia_Man_t * pAig, Abs_Par_t * pPars )
{
int RetValue = -1;
if ( pAig->vObjClasses == NULL && pPars->fUseRollback )
......
SRC += src/proof/abs/abs.c \
src/proof/abs/absDup.c \
src/proof/abs/absGla.c \
src/proof/abs/absGlaOld.c \
src/proof/abs/absIter.c \
src/proof/abs/absOldCex.c \
src/proof/abs/absOldRef.c \
src/proof/abs/absOldSat.c \
src/proof/abs/absOldSim.c \
src/proof/abs/absOut.c \
src/proof/abs/absPth.c \
src/proof/abs/absRef.c \
src/proof/abs/absRef2.c \
src/proof/abs/absVta.c \
src/proof/abs/absUtil.c
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