summaryrefslogtreecommitdiffstats
path: root/src/base/main
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-01-25 10:25:34 +0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-01-25 10:25:34 +0700
commit557448400ebaf0f4666665bd8bc87954e3c2a976 (patch)
tree334a36292cd550b9542fc1c416fc6b8d42e8e457 /src/base/main
parentfde8c8b2d09d218d42d46976f9bfd426d72e075e (diff)
downloadabc-557448400ebaf0f4666665bd8bc87954e3c2a976.tar.gz
abc-557448400ebaf0f4666665bd8bc87954e3c2a976.tar.bz2
abc-557448400ebaf0f4666665bd8bc87954e3c2a976.zip
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.
Diffstat (limited to 'src/base/main')
-rw-r--r--src/base/main/main.h3
-rw-r--r--src/base/main/mainFrame.c34
2 files changed, 35 insertions, 2 deletions
diff --git a/src/base/main/main.h b/src/base/main/main.h
index 6fc2c356..7f2d11bf 100644
--- a/src/base/main/main.h
+++ b/src/base/main/main.h
@@ -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
////////////////////////////////////////////////////////////////////////
diff --git a/src/base/main/mainFrame.c b/src/base/main/mainFrame.c
index df1b385e..8c3344ff 100644
--- a/src/base/main/mainFrame.c
+++ b/src/base/main/mainFrame.c
@@ -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 ///
////////////////////////////////////////////////////////////////////////