mirror of https://github.com/YosysHQ/abc.git
pyabc: added a function pyabc.iso_eq_classes() that retrieves the results of the "&iso" command
This commit is contained in:
parent
1d25ae3b1a
commit
b879786e73
|
|
@ -252,6 +252,44 @@ int _cex_get_frame(Abc_Cex_t* pCex)
|
||||||
return pCex->iFrame;
|
return pCex->iFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject* VecInt_To_PyList(Vec_Int_t* v)
|
||||||
|
{
|
||||||
|
PyObject* pylist = PyList_New( Vec_IntSize(v) );
|
||||||
|
|
||||||
|
int elem, i;
|
||||||
|
|
||||||
|
Vec_IntForEachEntry( v, elem, i)
|
||||||
|
{
|
||||||
|
PyList_SetItem( pylist, i, PyInt_FromLong(elem) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return pylist;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject* iso_eq_classes()
|
||||||
|
{
|
||||||
|
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
|
||||||
|
Vec_Ptr_t *vPoEquivs = Abc_FrameReadPoEquivs(pAbc);
|
||||||
|
|
||||||
|
PyObject* eq_classes;
|
||||||
|
Vec_Int_t* pEntry;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( ! vPoEquivs )
|
||||||
|
{
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
eq_classes = PyList_New( Vec_PtrSize(vPoEquivs) );
|
||||||
|
|
||||||
|
Vec_PtrForEachEntry( Vec_Int_t*, vPoEquivs, pEntry, i )
|
||||||
|
{
|
||||||
|
PyList_SetItem( eq_classes, i, VecInt_To_PyList(pEntry) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return eq_classes;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject* pyabc_internal_python_command_callback = 0;
|
static PyObject* pyabc_internal_python_command_callback = 0;
|
||||||
|
|
||||||
void pyabc_internal_set_command_callback( PyObject* callback )
|
void pyabc_internal_set_command_callback( PyObject* callback )
|
||||||
|
|
@ -571,6 +609,8 @@ int _cex_n_pis(Abc_Cex_t* pCex);
|
||||||
int _cex_get_po(Abc_Cex_t* pCex);
|
int _cex_get_po(Abc_Cex_t* pCex);
|
||||||
int _cex_get_frame(Abc_Cex_t* pCex);
|
int _cex_get_frame(Abc_Cex_t* pCex);
|
||||||
|
|
||||||
|
PyObject* iso_eq_classes();
|
||||||
|
|
||||||
void pyabc_internal_set_command_callback( PyObject* callback );
|
void pyabc_internal_set_command_callback( PyObject* callback );
|
||||||
void pyabc_internal_register_command( char * sGroup, char * sName, int fChanges );
|
void pyabc_internal_register_command( char * sGroup, char * sName, int fChanges );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue