summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-07-06 22:47:47 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-07-06 22:47:47 -0700
commit95af979753aa48744acfcba0a3707fed31391027 (patch)
tree11fdddf89e9abb17238072c4781e0167f42d7ad6 /src/base
parent9894fc762e16c94e3908f159cd8eaaf68bc5f980 (diff)
downloadabc-95af979753aa48744acfcba0a3707fed31391027.tar.gz
abc-95af979753aa48744acfcba0a3707fed31391027.tar.bz2
abc-95af979753aa48744acfcba0a3707fed31391027.zip
Adding new Python API 'co_supp'.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abc.h1
-rw-r--r--src/base/abc/abcDfs.c51
2 files changed, 52 insertions, 0 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index 3374b453..e4136810 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -625,6 +625,7 @@ extern ABC_DLL int Abc_NtkIsDfsOrdered( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsWithBoxes( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Ptr_t * Abc_NtkSupport( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes );
+extern ABC_DLL Vec_Int_t * Abc_NtkNodeSupportInt( Abc_Ntk_t * pNtk, int iCo );
extern ABC_DLL Vec_Ptr_t * Abc_AigDfs( Abc_Ntk_t * pNtk, int fCollectAll, int fCollectCos );
extern ABC_DLL Vec_Ptr_t * Abc_AigDfsMap( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Vec_t * Abc_DfsLevelized( Abc_Obj_t * pNode, int fTfi );
diff --git a/src/base/abc/abcDfs.c b/src/base/abc/abcDfs.c
index 8784ec1a..1d15f236 100644
--- a/src/base/abc/abcDfs.c
+++ b/src/base/abc/abcDfs.c
@@ -905,6 +905,57 @@ Vec_Ptr_t * Abc_NtkNodeSupport( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNod
/**Function*************************************************************
+ Synopsis [Returns the set of CI node IDs in the support of the given node.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkNodeSupportInt_rec( Abc_Obj_t * pNode, Vec_Int_t * vNodes )
+{
+ Abc_Obj_t * pFanin;
+ int i;
+ assert( !Abc_ObjIsNet(pNode) );
+ // if this node is already visited, skip
+ if ( Abc_NodeIsTravIdCurrent( pNode ) )
+ return;
+ // mark the node as visited
+ Abc_NodeSetTravIdCurrent( pNode );
+ // collect the CI
+ if ( Abc_ObjIsCi(pNode) || (Abc_NtkIsStrash(pNode->pNtk) && Abc_ObjFaninNum(pNode) == 0) )
+ {
+ if ( Abc_ObjIsCi(pNode) )
+ Vec_IntPush( vNodes, pNode->iTemp );
+ return;
+ }
+ assert( Abc_ObjIsNode( pNode ) );
+ // visit the transitive fanin of the node
+ Abc_ObjForEachFanin( pNode, pFanin, i )
+ Abc_NtkNodeSupportInt_rec( Abc_ObjFanin0Ntk(pFanin), vNodes );
+}
+Vec_Int_t * Abc_NtkNodeSupportInt( Abc_Ntk_t * pNtk, int iCo )
+{
+ Vec_Int_t * vNodes;
+ Abc_Obj_t * pObj;
+ int i;
+ if ( iCo < 0 || iCo >= Abc_NtkCoNum(pNtk) )
+ return NULL;
+ // save node indices in the CI nodes
+ Abc_NtkForEachCi( pNtk, pObj, i )
+ pObj->iTemp = i;
+ // collect the indexes of CI nodes in the TFI of the CO node
+ Abc_NtkIncrementTravId( pNtk );
+ pObj = Abc_NtkCo( pNtk, iCo );
+ vNodes = Vec_IntAlloc( 100 );
+ Abc_NtkNodeSupportInt_rec( Abc_ObjFanin0(pObj), vNodes );
+ return vNodes;
+}
+
+/**Function*************************************************************
+
Synopsis [Computes support size of the node.]
Description []