mirror of https://github.com/YosysHQ/abc.git
Procedure to trasnsform counter-examples.
This commit is contained in:
parent
1779f545e3
commit
36e5badf05
|
|
@ -1237,8 +1237,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "Liveness", "kcs", Abc_CommandCS_kLiveness, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Liveness", "nck", Abc_CommandNChooseK, 0 );
|
||||
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "gen", Abc_CommandAbc9Gen, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "cfs", Abc_CommandAbc9Cfs, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&gen", Abc_CommandAbc9Gen, 0 );
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&cfs", Abc_CommandAbc9Cfs, 0 );
|
||||
|
||||
Cmd_CommandAdd( pAbc, "ABC9", "&test", Abc_CommandAbc9Test, 0 );
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1262,6 +1262,8 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
// create box library
|
||||
pBoxLib = If_LibBoxStart();
|
||||
}
|
||||
printf( "Init state: %s\n", p->pInits );
|
||||
|
||||
// blast in the topological order
|
||||
Wlc_NtkForEachObj( p, pObj, i )
|
||||
{
|
||||
|
|
@ -2108,7 +2110,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2135,7 +2137,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2153,7 +2155,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s_fo[%d]", pName, k );
|
||||
sprintf( Buffer, "%s_fo[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2167,7 +2169,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2183,7 +2185,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2204,7 +2206,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, Wlc_NtkObj(p, iFanin)->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
if ( b == 3 )
|
||||
|
|
@ -2223,7 +2225,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s_in[%d]", pName, k );
|
||||
sprintf( Buffer, "%s_in[%d]", pName, Wlc_NtkObj(p, iFanin)->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2241,7 +2243,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, Wlc_NtkObj(p, iFanin)->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2262,9 +2264,9 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
sprintf( Buffer, "%s[%d]", pName2, k );
|
||||
sprintf( Buffer, "%s[%d]", pName2, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2276,7 +2278,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2294,7 +2296,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s[%d]", pName, k );
|
||||
sprintf( Buffer, "%s[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2318,7 +2320,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s_fi[%d]", pName, k );
|
||||
sprintf( Buffer, "%s_fi[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
@ -2336,7 +2338,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
|
|||
for ( k = 0; k < nRange; k++ )
|
||||
{
|
||||
char Buffer[1000];
|
||||
sprintf( Buffer, "%s_fi[%d]", pName, k );
|
||||
sprintf( Buffer, "%s_fi[%d]", pName, pObj->Beg+k );
|
||||
Vec_PtrPush( pNew->vNamesOut, Abc_UtilStrsav(Buffer) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ static int Abc_CommandInvCheck ( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
static int Abc_CommandInvGet ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandInvPut ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandInvMin ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandCexFix ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandTest ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
||||
static inline Wlc_Ntk_t * Wlc_AbcGetNtk( Abc_Frame_t * pAbc ) { return (Wlc_Ntk_t *)pAbc->pAbcWlc; }
|
||||
|
|
@ -99,6 +100,7 @@ void Wlc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "Word level", "inv_get", Abc_CommandInvGet, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Word level", "inv_put", Abc_CommandInvPut, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Word level", "inv_min", Abc_CommandInvMin, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Word level", "cexfix", Abc_CommandCexFix, 0 );
|
||||
}
|
||||
|
||||
/**Function********************************************************************
|
||||
|
|
@ -1793,6 +1795,70 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandCexFix( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
Wlc_Ntk_t * pNtk = NULL;
|
||||
Abc_Cex_t * pCexNew;
|
||||
char * pFileName;
|
||||
int c, fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
Abc_Print( -2, "Unknown switch.\n");
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pAbc->pCex == NULL )
|
||||
{
|
||||
fprintf( pAbc->Out, "Counter-example is not available.\n" );
|
||||
goto usage;
|
||||
}
|
||||
if ( argc != globalUtilOptind + 1 )
|
||||
{
|
||||
fprintf( pAbc->Out, "File name with the original design is missing on the command line.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pFileName = argv[globalUtilOptind];
|
||||
pNtk = Wlc_ReadVer( pFileName, NULL );
|
||||
if ( pNtk == NULL )
|
||||
{
|
||||
fprintf( pAbc->Out, "Cannot parse the incoming design in Verilog.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pCexNew = Abc_CexTransformUndc( pAbc->pCex, pNtk->pInits );
|
||||
Wlc_NtkFree( pNtk );
|
||||
Abc_FrameReplaceCex( pAbc, &pCexNew );
|
||||
printf( "Replaced the current CEX by a new one generated using the original design.\n" );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: cexfix [-vh] <file>\n" );
|
||||
Abc_Print( -2, "\t updates CEX after to match the original design\n" );
|
||||
Abc_Print( -2, "\t<file> : the file with the original design\n" );
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**Function********************************************************************
|
||||
|
||||
|
|
|
|||
|
|
@ -463,16 +463,16 @@ Abc_Cex_t * Abc_CexTransformUndc( Abc_Cex_t * p, char * pInit )
|
|||
int i, f, iBit, iAddPi = 0, nAddPis = 0;
|
||||
// count how many flops got a new PI
|
||||
for ( i = 0; i < nFlops; i++ )
|
||||
nAddPis += (int)(pInit[i] == 'x');
|
||||
nAddPis += (int)(pInit[i] == 'x' || pInit[i] == 'X');
|
||||
// create new CEX
|
||||
pCex = Abc_CexAlloc( nFlops, p->nPis - nAddPis, p->iFrame + 1 );
|
||||
pCex->iPo = p->iPo;
|
||||
pCex->iFrame = p->iFrame;
|
||||
for ( iBit = 0; iBit < nFlops; iBit++ )
|
||||
{
|
||||
if ( pInit[iBit] == '1' || (pInit[iBit] == 'x' && Abc_InfoHasBit(p->pData, p->nRegs + p->nPis - nAddPis + iAddPi)) )
|
||||
if ( pInit[iBit] == '1' || ((pInit[iBit] == 'x' || pInit[iBit] == 'X') && Abc_InfoHasBit(p->pData, p->nRegs + p->nPis - nAddPis + iAddPi)) )
|
||||
Abc_InfoSetBit( pCex->pData, iBit );
|
||||
iAddPi += (int)(pInit[iBit] == 'x');
|
||||
iAddPi += (int)(pInit[iBit] == 'x' || pInit[iBit] == 'X');
|
||||
}
|
||||
assert( iAddPi == nAddPis );
|
||||
// add timeframes
|
||||
|
|
|
|||
Loading…
Reference in New Issue