mirror of https://github.com/YosysHQ/abc.git
Added switch 'cexcut -n' to generate only one bad state.
This commit is contained in:
parent
2eb2402b01
commit
c2e467d55b
|
|
@ -677,6 +677,8 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
|
|||
#define Gia_ManForEachObjVecLit( vVec, p, pObj, fCompl, i ) \
|
||||
for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Abc_Lit2Var(Vec_IntEntry(vVec,i)))) && (((fCompl) = Abc_LitIsCompl(Vec_IntEntry(vVec,i))),1); i++ )
|
||||
#define Gia_ManForEachObjReverse( p, pObj, i ) \
|
||||
for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
|
||||
#define Gia_ManForEachObjReverse1( p, pObj, i ) \
|
||||
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
|
||||
#define Gia_ManForEachAnd( p, pObj, i ) \
|
||||
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else
|
||||
|
|
|
|||
|
|
@ -22593,9 +22593,10 @@ int Abc_CommandCexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
int iFrStart = 0;
|
||||
int iFrStop = ABC_INFINITY;
|
||||
int fCombOnly = 0;
|
||||
int fUseOne = 0;
|
||||
int fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "FGcvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "FGcnvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -22624,6 +22625,9 @@ int Abc_CommandCexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
case 'c':
|
||||
fCombOnly ^= 1;
|
||||
break;
|
||||
case 'n':
|
||||
fUseOne ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
|
|
@ -22658,7 +22662,7 @@ int Abc_CommandCexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
extern Abc_Ntk_t * Abc_NtkFromAigPhase( Aig_Man_t * pMan );
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Aig_Man_t * pAig = Abc_NtkToDar( pAbc->pNtkCur, 0, 1 );
|
||||
Aig_Man_t * pAigNew = Bmc_AigTargetStates( pAig, pAbc->pCex, iFrStart, iFrStop, fCombOnly, fVerbose );
|
||||
Aig_Man_t * pAigNew = Bmc_AigTargetStates( pAig, pAbc->pCex, iFrStart, iFrStop, fCombOnly, fUseOne, fVerbose );
|
||||
Aig_ManStop( pAig );
|
||||
if ( pAigNew == NULL )
|
||||
{
|
||||
|
|
@ -22671,6 +22675,15 @@ int Abc_CommandCexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// update the network
|
||||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkNew );
|
||||
}
|
||||
/*
|
||||
pGiaNew = Bmc_GiaTargetStates( pAbc->pGia, pAbc->pCex, iFrStart, iFrStop, fCombOnly, fUseOne, fVerbose );
|
||||
if ( pGiaNew == NULL )
|
||||
{
|
||||
Abc_Print( 1, "Command has failed.\n");
|
||||
return 0;
|
||||
}
|
||||
Abc_CommandUpdate9( pAbc, pGiaNew );
|
||||
*/
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
|
|
@ -22678,7 +22691,8 @@ usage:
|
|||
Abc_Print( -2, "\t creates logic for bad states using the current CEX\n" );
|
||||
Abc_Print( -2, "\t-F num : 0-based number of the starting frame [default = %d]\n", iFrStart );
|
||||
Abc_Print( -2, "\t-G num : 0-based number of the ending frame [default = %d]\n", iFrStop );
|
||||
Abc_Print( -2, "\t-c : toggle outputting combinational unate circuit [default = %s]\n", fCombOnly? "yes": "no" );
|
||||
Abc_Print( -2, "\t-c : toggle outputting unate combinational circuit [default = %s]\n", fCombOnly? "yes": "no" );
|
||||
Abc_Print( -2, "\t-n : toggle generating only one bad state [default = %s]\n", fUseOne? "yes": "no" );
|
||||
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
|
|
@ -28813,89 +28827,7 @@ usage:
|
|||
***********************************************************************/
|
||||
int Abc_CommandAbc9CexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
Gia_Man_t * pGiaNew;
|
||||
int c;
|
||||
int iFrStart = 0;
|
||||
int iFrStop = ABC_INFINITY;
|
||||
int fCombOnly = 0;
|
||||
int fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "FGcvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'F':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
iFrStart = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( iFrStart < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'G':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
iFrStop = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( iFrStop < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'c':
|
||||
fCombOnly ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
Abc_Print( -2, "Unknown switch.\n");
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pAbc->pCex == NULL )
|
||||
{
|
||||
Abc_Print( 1, "There is no current cex.\n");
|
||||
return 0;
|
||||
}
|
||||
if ( pAbc->pGia == NULL )
|
||||
{
|
||||
Abc_Print( 1, "There is no AIG in the &-space.\n");
|
||||
return 0;
|
||||
}
|
||||
if ( !Gia_ManVerifyCex( pAbc->pGia, pAbc->pCex, 0 ) )
|
||||
{
|
||||
Abc_Print( 1, "Current CEX does not fail AIG \"%s\" in the &-space.\n", Gia_ManName(pAbc->pGia) );
|
||||
return 0;
|
||||
}
|
||||
if ( iFrStop == ABC_INFINITY )
|
||||
iFrStop = pAbc->pCex->iFrame;
|
||||
|
||||
pGiaNew = Bmc_GiaTargetStates( pAbc->pGia, pAbc->pCex, iFrStart, iFrStop, fCombOnly, fVerbose );
|
||||
if ( pGiaNew == NULL )
|
||||
{
|
||||
Abc_Print( 1, "Command has failed.\n");
|
||||
return 0;
|
||||
}
|
||||
Abc_CommandUpdate9( pAbc, pGiaNew );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &cexcut [-FG num] [-cvh]\n" );
|
||||
Abc_Print( -2, "\t creates logic for bad states using the current CEX\n" );
|
||||
Abc_Print( -2, "\t-F num : 0-based number of the starting frame [default = %d]\n", iFrStart );
|
||||
Abc_Print( -2, "\t-G num : 0-based number of the ending frame [default = %d]\n", iFrStop );
|
||||
Abc_Print( -2, "\t-c : toggle producing combinational unate circuit [default = %s]\n", fCombOnly? "yes": "no" );
|
||||
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ extern int Saig_BmcPerform( Aig_Man_t * pAig, int nStart, int nFra
|
|||
extern void Saig_ParBmcSetDefaultParams( Saig_ParBmc_t * p );
|
||||
extern int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars );
|
||||
/*=== bmcCexCut.c ==========================================================*/
|
||||
extern Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fVerbose );
|
||||
extern Aig_Man_t * Bmc_AigTargetStates( Aig_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fVerbose );
|
||||
extern Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fGenAll, int fVerbose );
|
||||
extern Aig_Man_t * Bmc_AigTargetStates( Aig_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fGenAll, int fVerbose );
|
||||
/*=== bmcCexMin.c ==========================================================*/
|
||||
extern Abc_Cex_t * Saig_ManCexMinPerform( Aig_Man_t * pAig, Abc_Cex_t * pCex );
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ ABC_NAMESPACE_IMPL_START
|
|||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Generate GIA for target bad states.]
|
||||
Synopsis [Generate justifying assignments.]
|
||||
|
||||
Description []
|
||||
|
||||
|
|
@ -43,39 +43,215 @@ ABC_NAMESPACE_IMPL_START
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fVerbose )
|
||||
int Bmc_GiaGenerateJust_rec( Gia_Man_t * p, int iFrame, int iObj, Vec_Bit_t * vValues, Vec_Bit_t * vJustis )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int Shift = Gia_ManObjNum(p) * iFrame;
|
||||
if ( iFrame < 0 )
|
||||
return 0;
|
||||
assert( iFrame >= 0 );
|
||||
if ( Vec_BitEntry( vJustis, Shift + iObj ) )
|
||||
return 0;
|
||||
Vec_BitWriteEntry( vJustis, Shift + iObj, 1 );
|
||||
pObj = Gia_ManObj( p, iObj );
|
||||
if ( Gia_ObjIsCo(pObj) )
|
||||
return Bmc_GiaGenerateJust_rec( p, iFrame, Gia_ObjFaninId0(pObj, iObj), vValues, vJustis );
|
||||
if ( Gia_ObjIsCi(pObj) )
|
||||
return Bmc_GiaGenerateJust_rec( p, iFrame-1, Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)), vValues, vJustis );
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
if ( Vec_BitEntry( vValues, Shift + iObj ) )
|
||||
{
|
||||
Bmc_GiaGenerateJust_rec( p, iFrame, Gia_ObjFaninId0(pObj, iObj), vValues, vJustis );
|
||||
Bmc_GiaGenerateJust_rec( p, iFrame, Gia_ObjFaninId1(pObj, iObj), vValues, vJustis );
|
||||
}
|
||||
else if ( Vec_BitEntry( vValues, Shift + Gia_ObjFaninId0(pObj, iObj) ) == Gia_ObjFaninC0(pObj) )
|
||||
Bmc_GiaGenerateJust_rec( p, iFrame, Gia_ObjFaninId0(pObj, iObj), vValues, vJustis );
|
||||
else if ( Vec_BitEntry( vValues, Shift + Gia_ObjFaninId1(pObj, iObj) ) == Gia_ObjFaninC1(pObj) )
|
||||
Bmc_GiaGenerateJust_rec( p, iFrame, Gia_ObjFaninId1(pObj, iObj), vValues, vJustis );
|
||||
else assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
void Bmc_GiaGenerateJustNonRec( Gia_Man_t * p, int iFrame, Vec_Bit_t * vValues, Vec_Bit_t * vJustis )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i, k, Shift = Gia_ManObjNum(p) * iFrame;
|
||||
for ( i = iFrame; i >= 0; i--, Shift -= Gia_ManObjNum(p) )
|
||||
{
|
||||
Gia_ManForEachObjReverse( p, pObj, k )
|
||||
{
|
||||
if ( k == 0 || Gia_ObjIsPi(p, pObj) )
|
||||
continue;
|
||||
if ( !Vec_BitEntry( vJustis, Shift + k ) )
|
||||
continue;
|
||||
if ( Gia_ObjIsAnd(pObj) )
|
||||
{
|
||||
if ( Vec_BitEntry( vValues, Shift + k ) )
|
||||
{
|
||||
Vec_BitWriteEntry( vJustis, Shift + Gia_ObjFaninId0(pObj, k), 1 );
|
||||
Vec_BitWriteEntry( vJustis, Shift + Gia_ObjFaninId1(pObj, k), 1 );
|
||||
}
|
||||
else if ( Vec_BitEntry( vValues, Shift + Gia_ObjFaninId0(pObj, k) ) == Gia_ObjFaninC0(pObj) )
|
||||
Vec_BitWriteEntry( vJustis, Shift + Gia_ObjFaninId0(pObj, k), 1 );
|
||||
else if ( Vec_BitEntry( vValues, Shift + Gia_ObjFaninId1(pObj, k) ) == Gia_ObjFaninC1(pObj) )
|
||||
Vec_BitWriteEntry( vJustis, Shift + Gia_ObjFaninId1(pObj, k), 1 );
|
||||
else assert( 0 );
|
||||
}
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
Vec_BitWriteEntry( vJustis, Shift + Gia_ObjFaninId0(pObj, k), 1 );
|
||||
else if ( Gia_ObjIsCi(pObj) && i )
|
||||
Vec_BitWriteEntry( vJustis, Shift - Gia_ManObjNum(p) + Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)), 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
void Bmc_GiaGenerateJust( Gia_Man_t * p, Abc_Cex_t * pCex, Vec_Bit_t ** pvValues, Vec_Bit_t ** pvJustis )
|
||||
{
|
||||
Vec_Bit_t * vValues = Vec_BitStart( Gia_ManObjNum(p) * (pCex->iFrame + 1) );
|
||||
Vec_Bit_t * vJustis = Vec_BitStart( Gia_ManObjNum(p) * (pCex->iFrame + 1) );
|
||||
Gia_Obj_t * pObj;
|
||||
int i, k, iBit = 0, fCompl0, fCompl1, fJusti0, fJusti1, Shift;
|
||||
|
||||
Gia_ManCleanMark0(p);
|
||||
Gia_ManCleanMark1(p);
|
||||
Gia_ManForEachRi( p, pObj, k )
|
||||
pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
|
||||
for ( Shift = i = 0; i <= pCex->iFrame; i++, Shift += Gia_ManObjNum(p) )
|
||||
{
|
||||
Gia_ManForEachObj( p, pObj, k )
|
||||
{
|
||||
if ( Gia_ObjIsAnd(pObj) )
|
||||
{
|
||||
fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
|
||||
fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
|
||||
fJusti0 = Gia_ObjFanin0(pObj)->fMark1;
|
||||
fJusti1 = Gia_ObjFanin1(pObj)->fMark1;
|
||||
pObj->fMark0 = fCompl0 & fCompl1;
|
||||
if ( pObj->fMark0 )
|
||||
pObj->fMark1 = fJusti0 & fJusti1;
|
||||
else if ( !fCompl0 && !fCompl1 )
|
||||
pObj->fMark1 = fJusti0 | fJusti1;
|
||||
else if ( !fCompl0 )
|
||||
pObj->fMark1 = fJusti0;
|
||||
else if ( !fCompl1 )
|
||||
pObj->fMark1 = fJusti1;
|
||||
else assert( 0 );
|
||||
}
|
||||
else if ( Gia_ObjIsCi(pObj) )
|
||||
{
|
||||
if ( Gia_ObjIsPi(p, pObj) )
|
||||
{
|
||||
pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
|
||||
pObj->fMark1 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->fMark0 = Gia_ObjRoToRi(p, pObj)->fMark0;
|
||||
pObj->fMark1 = Gia_ObjRoToRi(p, pObj)->fMark1;
|
||||
}
|
||||
}
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
{
|
||||
pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
|
||||
pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
|
||||
}
|
||||
else if ( Gia_ObjIsConst0(pObj) )
|
||||
pObj->fMark1 = 1;
|
||||
else assert( 0 );
|
||||
if ( pObj->fMark0 )
|
||||
Vec_BitWriteEntry( vValues, Shift + k, 1 );
|
||||
if ( pObj->fMark1 )
|
||||
Vec_BitWriteEntry( vJustis, Shift + k, 1 );
|
||||
}
|
||||
}
|
||||
assert( iBit == pCex->nBits );
|
||||
Gia_ManCleanMark0(p);
|
||||
Gia_ManCleanMark1(p);
|
||||
// perform backward traversal to mark just nodes
|
||||
pObj = Gia_ManPo( p, pCex->iPo );
|
||||
assert( Vec_BitEntry(vJustis, Gia_ManObjNum(p) * pCex->iFrame + Gia_ObjId(p, pObj)) == 0 );
|
||||
// Bmc_GiaGenerateJust_rec( p, pCex->iFrame, Gia_ObjId(p, pObj), vValues, vJustis );
|
||||
Vec_BitWriteEntry(vJustis, Gia_ManObjNum(p) * pCex->iFrame + Gia_ObjId(p, pObj), 1);
|
||||
Bmc_GiaGenerateJustNonRec( p, pCex->iFrame, vValues, vJustis );
|
||||
assert( Vec_BitEntry(vJustis, Gia_ManObjNum(p) * pCex->iFrame + Gia_ObjId(p, pObj)) == 1 );
|
||||
|
||||
// return the result
|
||||
*pvValues = vValues;
|
||||
*pvJustis = vJustis;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Bmc_GiaGenerateGiaOne( Gia_Man_t * p, Abc_Cex_t * pCex, Vec_Bit_t ** pvInits, int iFrBeg, int iFrEnd )
|
||||
{
|
||||
Vec_Bit_t * vValues;
|
||||
Vec_Bit_t * vJustis;
|
||||
Gia_Man_t * pNew;
|
||||
Gia_Obj_t * pObj;
|
||||
int k, Cube = 1, Counter = 0;
|
||||
Bmc_GiaGenerateJust( p, pCex, &vValues, &vJustis );
|
||||
// collect flop values in frame iFrBeg
|
||||
*pvInits = Vec_BitStart( Gia_ManRegNum(p) );
|
||||
Gia_ManForEachRo( p, pObj, k )
|
||||
if ( Vec_BitEntry(vValues, Gia_ManObjNum(p) * iFrBeg + Gia_ObjId(p, pObj)) )
|
||||
Vec_BitWriteEntry( *pvInits, k, 1 );
|
||||
// create GIA with justified values in iFrEnd
|
||||
pNew = Gia_ManStart( 2 * Gia_ManRegNum(p) + 2 );
|
||||
pNew->pName = Abc_UtilStrsav( p->pName );
|
||||
Gia_ManForEachRo( p, pObj, k )
|
||||
{
|
||||
int Literal = Gia_ManAppendCi(pNew);
|
||||
if ( !Vec_BitEntry(vJustis, Gia_ManObjNum(p) * iFrEnd + Gia_ObjId(p, pObj)) )
|
||||
continue;
|
||||
if ( Vec_BitEntry(vValues, Gia_ManObjNum(p) * iFrEnd + Gia_ObjId(p, pObj)) )
|
||||
Cube = Gia_ManAppendAnd( pNew, Cube, Literal );
|
||||
else
|
||||
Cube = Gia_ManAppendAnd( pNew, Cube, Abc_LitNot(Literal) );
|
||||
Counter++;
|
||||
}
|
||||
// printf( "Only %d flops (out of %d) belong to the care set.\n", Counter, Gia_ManRegNum(p) );
|
||||
Gia_ManAppendCo( pNew, Cube );
|
||||
Vec_BitFree( vValues );
|
||||
Vec_BitFree( vJustis );
|
||||
return pNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Bmc_GiaGenerateGiaAll( Gia_Man_t * p, Abc_Cex_t * pCex, Vec_Bit_t ** pvInits, int iFrBeg, int iFrEnd )
|
||||
{
|
||||
Gia_Man_t * pNew, * pTemp;
|
||||
Gia_Obj_t * pObj, * pObjRo, * pObjRi;
|
||||
Vec_Bit_t * vInitNew;
|
||||
int i, k, iBit = 0, fCompl0, fCompl1;
|
||||
|
||||
if ( iFrBeg < 0 )
|
||||
{ printf( "Starting frame is less than 0.\n" ); return NULL; }
|
||||
if ( iFrEnd < 0 )
|
||||
{ printf( "Stopping frame is less than 0.\n" ); return NULL; }
|
||||
if ( iFrBeg > pCex->iFrame )
|
||||
{ printf( "Starting frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
|
||||
if ( iFrEnd > pCex->iFrame )
|
||||
{ printf( "Stopping frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
|
||||
if ( iFrBeg > iFrEnd )
|
||||
{ printf( "Starting frame (%d) should be less than stopping frame (%d).\n", iFrBeg, iFrEnd ); return NULL; }
|
||||
assert( iFrBeg >= 0 && iFrBeg <= pCex->iFrame );
|
||||
assert( iFrEnd >= 0 && iFrEnd <= pCex->iFrame );
|
||||
assert( iFrBeg < iFrEnd );
|
||||
|
||||
// skip trough the first iFrEnd frames
|
||||
Gia_ManCleanMark0(p);
|
||||
Gia_ManForEachRo( p, pObj, k )
|
||||
pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
|
||||
vInitNew = Vec_BitStart( Gia_ManRegNum(p) );
|
||||
*pvInits = Vec_BitStart( Gia_ManRegNum(p) );
|
||||
for ( i = 0; i < iFrEnd; i++ )
|
||||
{
|
||||
// remember values in frame iFrBeg
|
||||
if ( i == iFrBeg )
|
||||
Gia_ManForEachRo( p, pObjRo, k )
|
||||
if ( pObjRo->fMark0 )
|
||||
Vec_BitWriteEntry( vInitNew, k, 1 );
|
||||
Vec_BitWriteEntry( *pvInits, k, 1 );
|
||||
// simulate other values
|
||||
Gia_ManForEachPi( p, pObj, k )
|
||||
pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
|
||||
|
|
@ -140,6 +316,44 @@ Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, in
|
|||
// cleanup
|
||||
pNew = Gia_ManCleanup( pTemp = pNew );
|
||||
Gia_ManStop( pTemp );
|
||||
return pNew;
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Generate GIA for target bad states.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fUseOne, int fVerbose )
|
||||
{
|
||||
Gia_Man_t * pNew, * pTemp;
|
||||
Vec_Bit_t * vInitNew;
|
||||
|
||||
if ( iFrBeg < 0 )
|
||||
{ printf( "Starting frame is less than 0.\n" ); return NULL; }
|
||||
if ( iFrEnd < 0 )
|
||||
{ printf( "Stopping frame is less than 0.\n" ); return NULL; }
|
||||
if ( iFrBeg > pCex->iFrame )
|
||||
{ printf( "Starting frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
|
||||
if ( iFrEnd > pCex->iFrame )
|
||||
{ printf( "Stopping frame is more than the last frame of CEX (%d).\n", pCex->iFrame ); return NULL; }
|
||||
if ( iFrBeg > iFrEnd )
|
||||
{ printf( "Starting frame (%d) should be less than stopping frame (%d).\n", iFrBeg, iFrEnd ); return NULL; }
|
||||
assert( iFrBeg >= 0 && iFrBeg <= pCex->iFrame );
|
||||
assert( iFrEnd >= 0 && iFrEnd <= pCex->iFrame );
|
||||
assert( iFrBeg < iFrEnd );
|
||||
|
||||
if ( fUseOne )
|
||||
pNew = Bmc_GiaGenerateGiaOne( p, pCex, &vInitNew, iFrBeg, iFrEnd );
|
||||
else
|
||||
pNew = Bmc_GiaGenerateGiaAll( p, pCex, &vInitNew, iFrBeg, iFrEnd );
|
||||
|
||||
if ( !fCombOnly )
|
||||
{
|
||||
|
|
@ -167,7 +381,7 @@ Gia_Man_t * Bmc_GiaTargetStates( Gia_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, in
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Aig_Man_t * Bmc_AigTargetStates( Aig_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fVerbose )
|
||||
Aig_Man_t * Bmc_AigTargetStates( Aig_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, int iFrEnd, int fCombOnly, int fUseOne, int fVerbose )
|
||||
{
|
||||
Aig_Man_t * pAig;
|
||||
Gia_Man_t * pGia, * pRes;
|
||||
|
|
@ -178,9 +392,9 @@ Aig_Man_t * Bmc_AigTargetStates( Aig_Man_t * p, Abc_Cex_t * pCex, int iFrBeg, in
|
|||
Gia_ManStop( pGia );
|
||||
return NULL;
|
||||
}
|
||||
pRes = Bmc_GiaTargetStates( pGia, pCex, iFrBeg, iFrEnd, fCombOnly, fVerbose );
|
||||
pAig = Gia_ManToAigSimple( pRes );
|
||||
pRes = Bmc_GiaTargetStates( pGia, pCex, iFrBeg, iFrEnd, fCombOnly, fUseOne, fVerbose );
|
||||
Gia_ManStop( pGia );
|
||||
pAig = Gia_ManToAigSimple( pRes );
|
||||
Gia_ManStop( pRes );
|
||||
return pAig;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue