mirror of https://github.com/YosysHQ/abc.git
Added new Python API is_const_po( int iPoNum ), which returns 0/1 if current network is an AIG and the given PO has const 0/1 function.
This commit is contained in:
parent
fde8c8b2d0
commit
557448400e
|
|
@ -133,11 +133,10 @@ extern ABC_DLL void Abc_FrameSetCex( Abc_Cex_t * pCex );
|
|||
extern ABC_DLL void Abc_FrameSetNFrames( int nFrames );
|
||||
extern ABC_DLL void Abc_FrameSetStatus( int Status );
|
||||
|
||||
extern ABC_DLL int Abc_FrameCheckPoConst( Abc_Frame_t * p, int iPoNum );
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -648,6 +648,40 @@ void Abc_FrameSetSave2( void * pAig )
|
|||
void * Abc_FrameReadSave1() { void * pAig = Abc_FrameGetGlobalFrame()->pSave1; Abc_FrameGetGlobalFrame()->pSave1 = NULL; return pAig; }
|
||||
void * Abc_FrameReadSave2() { void * pAig = Abc_FrameGetGlobalFrame()->pSave2; Abc_FrameGetGlobalFrame()->pSave2 = NULL; return pAig; }
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Returns 0/1 if pNtkCur is an AIG and PO is 0/1; -1 otherwise.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_FrameCheckPoConst( Abc_Frame_t * p, int iPoNum )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
if ( p->pNtkCur == NULL )
|
||||
return -1;
|
||||
if ( !Abc_NtkIsStrash(p->pNtkCur) )
|
||||
return -1;
|
||||
if ( iPoNum < 0 || iPoNum >= Abc_NtkPoNum(p->pNtkCur) )
|
||||
return -1;
|
||||
pObj = Abc_NtkPo( p->pNtkCur, iPoNum );
|
||||
if ( !Abc_AigNodeIsConst(Abc_ObjFanin0(pObj)) )
|
||||
return -1;
|
||||
return !Abc_ObjFaninC0(pObj);
|
||||
}
|
||||
void Abc_FrameCheckPoConstTest( Abc_Frame_t * p )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Abc_NtkForEachPo( p->pNtkCur, pObj, i )
|
||||
printf( "%d = %d\n", i, Abc_FrameCheckPoConst(p, i) );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -195,6 +195,12 @@ int n_phases()
|
|||
return pNtk ? Abc_NtkPhaseFrameNum(pNtk) : 1;
|
||||
}
|
||||
|
||||
int is_const_po( int iPoNum )
|
||||
{
|
||||
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
|
||||
return Abc_FrameCheckPoConst( pAbc, iPoNum );
|
||||
}
|
||||
|
||||
Abc_Cex_t* _cex_get()
|
||||
{
|
||||
Abc_Frame_t* pAbc = Abc_FrameGetGlobalFrame();
|
||||
|
|
@ -626,6 +632,7 @@ int cex_po();
|
|||
int cex_frame();
|
||||
|
||||
int n_phases();
|
||||
int is_const_po( int iPoNum );
|
||||
|
||||
Abc_Cex_t* _cex_get();
|
||||
int _cex_get_vec_len();
|
||||
|
|
|
|||
Loading…
Reference in New Issue