mirror of https://github.com/YosysHQ/abc.git
Ternary simulation for multi-output miters.
This commit is contained in:
parent
c6663b04c7
commit
6cb3817a91
|
|
@ -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 ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
@ -33228,6 +33230,69 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
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 []
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Reference in New Issue