summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2019-01-21 11:49:35 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2019-01-21 11:49:35 -0800
commitd4ce4cc982961775570ed0ef7cf14054b36f0fad (patch)
tree2811bf921de6ddfa9d0cc70d86a2efddfeb5fa87 /src
parentf421d2a113aeae86827bf218553f5569cf388b52 (diff)
downloadabc-d4ce4cc982961775570ed0ef7cf14054b36f0fad.tar.gz
abc-d4ce4cc982961775570ed0ef7cf14054b36f0fad.tar.bz2
abc-d4ce4cc982961775570ed0ef7cf14054b36f0fad.zip
Undoing some recent changes for improved CEX writing.
Diffstat (limited to 'src')
-rw-r--r--src/base/io/io.c73
-rw-r--r--src/base/main/main.h2
-rw-r--r--src/base/main/mainFrame.c4
-rw-r--r--src/base/main/mainInt.h1
-rw-r--r--src/base/wlc/wlcBlast.c33
-rw-r--r--src/base/wlc/wlcCom.c68
6 files changed, 11 insertions, 170 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c
index e7de926a..a85d64ef 100644
--- a/src/base/io/io.c
+++ b/src/base/io/io.c
@@ -2292,35 +2292,6 @@ ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void IoCommandPrintLatchName( FILE * pFile, Abc_Ntk_t * pNtk, Abc_Obj_t * pObj, char * pObjName, Abc_Cex_t * pCex, Abc_Cex_t * pCare )
-{
- int ii, NameLen = strlen(pObjName);
- // check if there is a PI with a matching name
- Abc_Obj_t * pObjPi;
- Abc_NtkForEachPi( pNtk, pObjPi, ii )
- if ( !strncmp(Abc_ObjName(pObjPi), pObjName, NameLen) && !strncmp(Abc_ObjName(pObjPi)+NameLen, "_init", 5) )
- {
- if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+ii) )
- fprintf( pFile, "%s@%d=%c\n", pObjName, 0, '0'+Abc_InfoHasBit(pCex->pData, pCare->nRegs+ii) );
- break;
- }
- if ( ii != Abc_NtkPiNum(pNtk) )
- return;
- if ( !strncmp(pObjName, "abc_reset_flop", 14) )
- return;
- fprintf( pFile, "%s@0=%c\n", pObjName, '0'+ (pObj ? !Abc_LatchIsInit0(pObj) : 0) );
-}
/**Function*************************************************************
@@ -2336,7 +2307,6 @@ void IoCommandPrintLatchName( FILE * pFile, Abc_Ntk_t * pNtk, Abc_Obj_t * pObj,
int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
{
Abc_Ntk_t * pNtk;
- Vec_Ptr_t * vNamesIn = NULL;
char * pFileName;
int c, fNames = 0;
int fMinimize = 0;
@@ -2447,7 +2417,6 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
else if ( fNames )
{
Abc_Cex_t * pCare = NULL;
- char * pObjName = NULL;
if ( fMinimize )
{
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
@@ -2475,40 +2444,14 @@ int IoCommandWriteCex( Abc_Frame_t * pAbc, int argc, char **argv )
}
fprintf( pFile, "\n");
fprintf( pFile, "# COUNTEREXAMPLE LENGTH: %u\n", pCex->iFrame+1);
- if ( (vNamesIn = Abc_FrameReadCexCiNames(pAbc)) != NULL )
- {
- // output flop values (unaffected by the minimization)
- Vec_PtrForEachEntryStart( char *, vNamesIn, pObjName, i, Abc_NtkPiNum(pNtk) )
- IoCommandPrintLatchName( pFile, pNtk, NULL, pObjName, pCex, pCare );
- // output PI values (while skipping the minimized ones)
- for ( f = 0; f <= pCex->iFrame; f++ )
- Vec_PtrForEachEntryStop( char *, vNamesIn, pObjName, i, Abc_NtkPiNum(pNtk) )
- {
- // skip names with "_init" in the end
- int NameLen = strlen(pObjName);
- if ( NameLen > 5 && !strncmp(pObjName+NameLen-5, "_init", 5) )
- continue;
- if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
- fprintf( pFile, "%s@%d=%c\n", pObjName, f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
- }
- }
- else
- {
- // output flop values (unaffected by the minimization)
- Abc_NtkForEachLatch( pNtk, pObj, i )
- IoCommandPrintLatchName( pFile, pNtk, pObj, Abc_ObjName(Abc_ObjFanout0(pObj)), pCex, pCare );
- // output PI values (while skipping the minimized ones)
- for ( f = 0; f <= pCex->iFrame; f++ )
- Abc_NtkForEachPi( pNtk, pObj, i )
- {
- // skip names with "_init" in the end
- int NameLen = strlen(Abc_ObjName(pObj));
- if ( NameLen > 5 && !strncmp(Abc_ObjName(pObj)+NameLen-5, "_init", 5) )
- continue;
- if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
- fprintf( pFile, "%s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
- }
- }
+ // output flop values (unaffected by the minimization)
+ Abc_NtkForEachLatch( pNtk, pObj, i )
+ fprintf( pFile, "%s@0=%c\n", Abc_ObjName(Abc_ObjFanout0(pObj)), '0'+!Abc_LatchIsInit0(pObj) );
+ // output PI values (while skipping the minimized ones)
+ for ( f = 0; f <= pCex->iFrame; f++ )
+ Abc_NtkForEachPi( pNtk, pObj, i )
+ if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
+ fprintf( pFile, "%s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
Abc_CexFreeP( &pCare );
}
else
diff --git a/src/base/main/main.h b/src/base/main/main.h
index f4ec90e2..2efb3358 100644
--- a/src/base/main/main.h
+++ b/src/base/main/main.h
@@ -127,8 +127,6 @@ extern ABC_DLL int Abc_FrameReadCexPiNum( Abc_Frame_t * p );
extern ABC_DLL int Abc_FrameReadCexRegNum( Abc_Frame_t * p );
extern ABC_DLL int Abc_FrameReadCexPo( Abc_Frame_t * p );
extern ABC_DLL int Abc_FrameReadCexFrame( Abc_Frame_t * p );
-extern ABC_DLL Vec_Ptr_t * Abc_FrameReadCexCiNames( Abc_Frame_t * p );
-extern ABC_DLL void Abc_FrameSetCexCiNames( Vec_Ptr_t * vNames );
extern ABC_DLL void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_FrameSetNtkStoreSize( int nStored );
diff --git a/src/base/main/mainFrame.c b/src/base/main/mainFrame.c
index 71b21eb1..1d54f4e4 100644
--- a/src/base/main/mainFrame.c
+++ b/src/base/main/mainFrame.c
@@ -83,9 +83,6 @@ int Abc_FrameReadCexPiNum( Abc_Frame_t * p ) { return s_GlobalFr
int Abc_FrameReadCexRegNum( Abc_Frame_t * p ) { return s_GlobalFrame->pCex->nRegs; }
int Abc_FrameReadCexPo( Abc_Frame_t * p ) { return s_GlobalFrame->pCex->iPo; }
int Abc_FrameReadCexFrame( Abc_Frame_t * p ) { return s_GlobalFrame->pCex->iFrame; }
-Vec_Ptr_t * Abc_FrameReadCexCiNames( Abc_Frame_t * p ) { return s_GlobalFrame->vCiNamesStore; }
-void Abc_FrameSetCexCiNames( Vec_Ptr_t * vNames ) { if ( s_GlobalFrame->vCiNamesStore ) Vec_PtrFreeFree(s_GlobalFrame->vCiNamesStore); s_GlobalFrame->vCiNamesStore = vNames; }
-
void Abc_FrameInputNdr( Abc_Frame_t * pAbc, void * pData ) { Ndr_Delete(s_GlobalFrame->pNdr); s_GlobalFrame->pNdr = pData; }
void * Abc_FrameOutputNdr( Abc_Frame_t * pAbc ) { void * pData = s_GlobalFrame->pNdr; s_GlobalFrame->pNdr = NULL; return pData; }
@@ -243,7 +240,6 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
Vec_WecFreeP( &s_GlobalFrame->vJsonObjs );
Ndr_Delete( s_GlobalFrame->pNdr );
ABC_FREE( s_GlobalFrame->pNdrArray );
- Vec_PtrFreeFree( s_GlobalFrame->vCiNamesStore );
Gia_ManStopP( &p->pGiaMiniAig );
Gia_ManStopP( &p->pGiaMiniLut );
diff --git a/src/base/main/mainInt.h b/src/base/main/mainInt.h
index b5a914e4..7317c36f 100644
--- a/src/base/main/mainInt.h
+++ b/src/base/main/mainInt.h
@@ -152,7 +152,6 @@ struct Abc_Frame_t_
int * pBoxes;
void * pNdr;
int * pNdrArray;
- Vec_Ptr_t * vCiNamesStore; // storage for CI names
Abc_Frame_Callback_BmcFrameDone_Func pFuncOnFrameDone;
};
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c
index ff7e9242..01b6e64c 100644
--- a/src/base/wlc/wlcBlast.c
+++ b/src/base/wlc/wlcBlast.c
@@ -1150,8 +1150,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
int i, k, b, iFanin, iLit, nAndPrev, * pFans0, * pFans1, * pFans2, * pFans3;
int nFFins = 0, nFFouts = 0, curPi = 0, curPo = 0, nFf2Regs = 0;
int nBitCis = 0, nBitCos = 0, fAdded = 0;
- int iFirstAddPi = -1; // remembers the first additional PI that stands for DC-flop output
- int iFirstFlop = -1; // remembers the first flop of the design
Wlc_BstPar_t Par, * pPar = &Par;
Wlc_BstParDefault( pPar );
pPar = pParIn ? pParIn : pPar;
@@ -2119,21 +2117,14 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
if ( p->pInits )
{
int Length = strlen(p->pInits);
- // remember the place in the array where the first PI begins
- iFirstAddPi = Vec_PtrSize(pNew->vNamesIn);
for ( i = 0; i < Length; i++ )
if ( p->pInits[i] == 'x' || p->pInits[i] == 'X' )
{
- //char Buffer[100];
- //sprintf( Buffer, "%s%d", "init", i );
- //Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
- // save NULL at this time - to be overwritten later
- //printf( "Adding NULL in position %d\n", Vec_PtrSize(pNew->vNamesIn) );
- Vec_PtrPush( pNew->vNamesIn, NULL );
+ char Buffer[100];
+ sprintf( Buffer, "%s%d", "init", i );
+ Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
fAdded = 1;
}
- // remember the place in the array where the first real flop is
- iFirstFlop = Vec_PtrSize(pNew->vNamesIn);
}
Wlc_NtkForEachCi( p, pObj, i )
if ( !Wlc_ObjIsPi(pObj) )
@@ -2150,7 +2141,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
}
}
-/*
Wlc_NtkForEachFf2( p, pObj, i )
{
char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
@@ -2169,7 +2159,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) );
}
}
-*/
Wlc_NtkForEachFf2( p, pObj, i )
{
char * pName = Wlc_ObjName(p, Wlc_ObjId(p, pObj));
@@ -2202,22 +2191,6 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn )
}
}
assert( Vec_PtrSize(pNew->vNamesIn) == Gia_ManCiNum(pNew) );
- // finish creating names of additional primary inputs
- if ( p->pInits )
- {
- int k = iFirstAddPi, Length = strlen(p->pInits);
- assert( iFirstAddPi >= 0 && iFirstFlop >= 0 );
- for ( i = 0; i < Length; i++ )
- if ( p->pInits[i] == 'x' || p->pInits[i] == 'X' )
- {
- char Buffer[1000];
- sprintf( Buffer, "%s_init", (char *)Vec_PtrEntry(pNew->vNamesIn, iFirstFlop+i) );
- assert( Vec_PtrEntry(pNew->vNamesIn, k) == NULL );
- Vec_PtrWriteEntry( pNew->vNamesIn, k++, Abc_UtilStrsav(Buffer) );
- //printf( "Replacing NULL in position %d\n", iFirstAddPi-Length+i );
- }
- assert( k == iFirstFlop );
- }
// create output names
pNew->vNamesOut = Vec_PtrAlloc( Gia_ManCoNum(pNew) );
Wlc_NtkForEachFf2( p, pObj, i )
diff --git a/src/base/wlc/wlcCom.c b/src/base/wlc/wlcCom.c
index 80313c7a..5e69000f 100644
--- a/src/base/wlc/wlcCom.c
+++ b/src/base/wlc/wlcCom.c
@@ -51,7 +51,6 @@ 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; }
@@ -100,7 +99,6 @@ 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********************************************************************
@@ -1124,7 +1122,6 @@ int Abc_CommandBlast( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "Finished dumping file \"pio_name_map.txt\" containing PI/PO name mapping.\n" );
}
}
- Abc_FrameSetCexCiNames( Vec_PtrDupStr(pNew->vNamesIn) );
Abc_FrameUpdateGia( pAbc, pNew );
return 0;
usage:
@@ -1796,71 +1793,6 @@ 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********************************************************************
Synopsis []