Commit 825b0b5e by Baruch Sterin

added support for getting a cex vector

parent 49df91f0
...@@ -182,6 +182,39 @@ Abc_Cex_t* _cex_get() ...@@ -182,6 +182,39 @@ Abc_Cex_t* _cex_get()
return Abc_CexDup( pCex, -1 ); return Abc_CexDup( pCex, -1 );
} }
int _cex_get_vec_len()
{
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
Vec_Ptr_t* vCexVec = Abc_FrameReadCexVec(pAbc);
if( ! vCexVec )
{
return 0;
}
return Vec_PtrSize(vCexVec);
}
Abc_Cex_t* _cex_get_vec(int i)
{
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
Vec_Ptr_t* vCexVec = Abc_FrameReadCexVec(pAbc);
if( ! vCexVec )
{
return NULL;
}
Abc_Cex_t* pCex = Vec_PtrEntry( vCexVec, i );
if ( ! pCex )
{
return NULL;
}
return Abc_CexDup( pCex, -1 );
}
void _cex_put(Abc_Cex_t* pCex) void _cex_put(Abc_Cex_t* pCex)
{ {
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame(); Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
...@@ -523,6 +556,8 @@ int cex_frame(); ...@@ -523,6 +556,8 @@ int cex_frame();
int n_phases(); int n_phases();
Abc_Cex_t* _cex_get(); Abc_Cex_t* _cex_get();
int _cex_get_vec_len();
Abc_Cex_t* _cex_get_vec(int i);
void _cex_put(Abc_Cex_t* pCex); void _cex_put(Abc_Cex_t* pCex);
void _cex_free(Abc_Cex_t* pCex); void _cex_free(Abc_Cex_t* pCex);
int _cex_n_regs(Abc_Cex_t* pCex); int _cex_n_regs(Abc_Cex_t* pCex);
...@@ -571,6 +606,20 @@ class _Cex(object): ...@@ -571,6 +606,20 @@ class _Cex(object):
def get_frame(self): def get_frame(self):
return _cex_get_frame(self.pCex) return _cex_get_frame(self.pCex)
def cex_get_vector():
res = []
for i in xrange(_cex_get_vec_len()):
cex = _cex_get_vec(i)
if cex is None:
res.append(None)
else:
res.append(_Cex(cex))
return res
def cex_get(): def cex_get():
cex = _cex_get() cex = _cex_get()
...@@ -578,7 +627,7 @@ def cex_get(): ...@@ -578,7 +627,7 @@ def cex_get():
if cex is None: if cex is None:
return None return None
return _Cex(_cex_get()) return _Cex(cex)
def cex_put(cex): def cex_put(cex):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment