summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-03-28 11:05:12 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-03-28 11:05:12 -0700
commit6cb3817a91d7fd14fc93fb02b80e82b5598e9f79 (patch)
tree40e27af3b53ad9cf3b7a8aff79ceff44b66e5dee /src
parentc6663b04c7bd11482f3beb50ee99ff39c839a6bc (diff)
downloadabc-6cb3817a91d7fd14fc93fb02b80e82b5598e9f79.tar.gz
abc-6cb3817a91d7fd14fc93fb02b80e82b5598e9f79.tar.bz2
abc-6cb3817a91d7fd14fc93fb02b80e82b5598e9f79.zip
Ternary simulation for multi-output miters.
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/giaUtil.c54
-rw-r--r--src/base/abci/abc.c65
-rw-r--r--src/python/pyabc.i10
3 files changed, 129 insertions, 0 deletions
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index 56aa2468..872f4086 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -1820,6 +1820,60 @@ Vec_Int_t * Gia_ManGroupProve( Gia_Man_t * pInit, char * pCommLine, int nGroupSi
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Vec_Int_t * Gia_ManPoXSim( Gia_Man_t * p, int nFrames, int fVerbose )
+{
+ Vec_Int_t * vRes;
+ Gia_Obj_t * pObj;
+ int f, k, nLeft = Gia_ManPoNum(p);
+ vRes = Vec_IntAlloc( Gia_ManPoNum(p) );
+ Vec_IntFill( vRes, Gia_ManPoNum(p), nFrames );
+ Gia_ObjTerSimSet0( Gia_ManConst0(p) );
+ Gia_ManForEachRi( p, pObj, k )
+ Gia_ObjTerSimSet0( pObj );
+ for ( f = 0; f < nFrames; f++ )
+ {
+ Gia_ManForEachPi( p, pObj, k )
+ Gia_ObjTerSimSetX( pObj );
+ Gia_ManForEachRo( p, pObj, k )
+ Gia_ObjTerSimRo( p, pObj );
+ Gia_ManForEachAnd( p, pObj, k )
+ Gia_ObjTerSimAnd( pObj );
+ Gia_ManForEachCo( p, pObj, k )
+ Gia_ObjTerSimCo( pObj );
+ if ( fVerbose )
+ {
+ Gia_ManForEachPo( p, pObj, k )
+ Gia_ObjTerSimPrint( pObj );
+ printf( "\n" );
+ }
+ Gia_ManForEachPo( p, pObj, k )
+ if ( Vec_IntEntry(vRes, k) == nFrames && Gia_ObjTerSimGetX(pObj) )
+ Vec_IntWriteEntry(vRes, k, f), nLeft--;
+ if ( nLeft == 0 )
+ break;
+ }
+ if ( fVerbose )
+ {
+ if ( nLeft == 0 )
+ printf( "Simulation converged after %d frames.\n", f+1 );
+ else
+ printf( "Simulation terminated after %d frames.\n", nFrames );
+ }
+// Vec_IntPrint( vRes );
+ return vRes;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 27ccd247..31e4a647 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -403,6 +403,7 @@ static int Abc_CommandAbc9FFTest ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9Inse ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Maxi ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Bmci ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandAbc9PoXsim ( Abc_Frame_t * pAbc, int argc, char ** argv );
//static int Abc_CommandAbc9PoPart2 ( Abc_Frame_t * pAbc, int argc, char ** argv );
//static int Abc_CommandAbc9CexCut ( Abc_Frame_t * pAbc, int argc, char ** argv );
//static int Abc_CommandAbc9CexMerge ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -970,6 +971,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&inse", Abc_CommandAbc9Inse, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&maxi", Abc_CommandAbc9Maxi, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&bmci", Abc_CommandAbc9Bmci, 0 );
+ Cmd_CommandAdd( pAbc, "ABC9", "&poxsim", Abc_CommandAbc9PoXsim, 0 );
// Cmd_CommandAdd( pAbc, "ABC9", "&popart2", Abc_CommandAbc9PoPart2, 0 );
// Cmd_CommandAdd( pAbc, "ABC9", "&cexcut", Abc_CommandAbc9CexCut, 0 );
// Cmd_CommandAdd( pAbc, "ABC9", "&cexmerge", Abc_CommandAbc9CexMerge, 0 );
@@ -33239,6 +33241,69 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9PoXsim( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern Vec_Int_t * Gia_ManPoXSim( Gia_Man_t * p, int nFrames, int fVerbose );
+ int c, nFrames = 1000, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "Fvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'F':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" );
+ goto usage;
+ }
+ nFrames = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nFrames < 0 )
+ goto usage;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9Bmci(): There is no AIG.\n" );
+ return 0;
+ }
+ if ( Gia_ManRegNum(pAbc->pGia) == 0 )
+ {
+ Abc_Print( -1, "Abc_CommandAbc9Bmci(): AIG is combinational.\n" );
+ return 0;
+ }
+ Vec_IntFreeP( &pAbc->vAbcObjIds );
+ pAbc->vAbcObjIds = Gia_ManPoXSim( pAbc->pGia, nFrames, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &poxsim [-F num] [-vh]\n" );
+ Abc_Print( -2, "\t X-valued simulation of the multi-output sequential miter\n" );
+ Abc_Print( -2, "\t-F num : the number of timeframes [default = %d]\n", nFrames );
+ Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandAbc9CexCut( Abc_Frame_t * pAbc, int argc, char ** argv )
{
return -1;
diff --git a/src/python/pyabc.i b/src/python/pyabc.i
index 1bbf624f..2b09a256 100644
--- a/src/python/pyabc.i
+++ b/src/python/pyabc.i
@@ -373,6 +373,15 @@ void _pyabc_array_push(int i)
Vec_IntPush( vObjIds, i );
}
+int pyabc_array_read_entry(int i)
+{
+ Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
+ Vec_Int_t *vObjIds = Abc_FrameReadObjIds(pAbc);
+ if( !vObjIds )
+ return -1;
+ return Vec_IntEntry( vObjIds, i );
+}
+
static PyObject* pyabc_internal_python_command_callback = 0;
void pyabc_internal_set_command_callback( PyObject* callback )
@@ -709,6 +718,7 @@ PyObject* eq_classes();
void _pyabc_array_clear();
void _pyabc_array_push(int i);
+int pyabc_array_read_entry(int i);
void pyabc_internal_set_command_callback( PyObject* callback );
void pyabc_internal_register_command( char * sGroup, char * sName, int fChanges );