diff options
author | Baruch Sterin <baruchs@gmail.com> | 2011-08-02 02:13:52 -0400 |
---|---|---|
committer | Baruch Sterin <baruchs@gmail.com> | 2011-08-02 02:13:52 -0400 |
commit | 825b0b5ee3b51f09526c641ac9b030226ec09ca8 (patch) | |
tree | 6a074d80d0b0453492c71bd05fc783848b4f048e /src | |
parent | 49df91f071d6828113ded55f371e15d192304222 (diff) | |
download | abc-825b0b5ee3b51f09526c641ac9b030226ec09ca8.tar.gz abc-825b0b5ee3b51f09526c641ac9b030226ec09ca8.tar.bz2 abc-825b0b5ee3b51f09526c641ac9b030226ec09ca8.zip |
added support for getting a cex vector
Diffstat (limited to 'src')
-rw-r--r-- | src/python/pyabc.i | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/python/pyabc.i b/src/python/pyabc.i index e258575e..44a880a7 100644 --- a/src/python/pyabc.i +++ b/src/python/pyabc.i @@ -182,6 +182,39 @@ Abc_Cex_t* _cex_get() 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) { Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame(); @@ -523,6 +556,8 @@ int cex_frame(); int n_phases(); 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_free(Abc_Cex_t* pCex); int _cex_n_regs(Abc_Cex_t* pCex); @@ -571,6 +606,20 @@ class _Cex(object): def get_frame(self): 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(): cex = _cex_get() @@ -578,7 +627,7 @@ def cex_get(): if cex is None: return None - return _Cex(_cex_get()) + return _Cex(cex) def cex_put(cex): |