summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2019-01-15 17:30:39 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2019-01-15 17:30:39 -0800
commit36e5badf055e28a0f6560e9e55bfc4e1df6fec79 (patch)
tree9a7f8c048fc9bd1c865b9cd571145220cfae990b /src/base
parent1779f545e3637c85b02bf4b66bf839ca27eb5355 (diff)
downloadabc-36e5badf055e28a0f6560e9e55bfc4e1df6fec79.tar.gz
abc-36e5badf055e28a0f6560e9e55bfc4e1df6fec79.tar.bz2
abc-36e5badf055e28a0f6560e9e55bfc4e1df6fec79.zip
Procedure to trasnsform counter-examples.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abci/abc.c4
-rw-r--r--src/base/wlc/wlcBlast.c30
-rw-r--r--src/base/wlc/wlcCom.c66
3 files changed, 84 insertions, 16 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 84c39e01..7adc8ca2 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -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 );
{
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index c5c351c4..37772104 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -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) );
}
}
diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c
index 90ad0671..a4fc9549 100644
--- a/src/base/wlc/wlcCom.c
+++ b/src/base/wlc/wlcCom.c
@@ -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********************************************************************