summaryrefslogtreecommitdiffstats
path: root/src/aig/ntk/ntkUtil.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-03-27 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-03-27 08:01:00 -0700
commit416ffc117ab7d0ea2ec3b8aaeb4724f25031db7a (patch)
tree0d9c55c15e42c128a10a4da9be6140fa736a3249 /src/aig/ntk/ntkUtil.c
parente258fcb2cd0cb0bca2bb077b2e5954b7be02b1c3 (diff)
downloadabc-416ffc117ab7d0ea2ec3b8aaeb4724f25031db7a.tar.gz
abc-416ffc117ab7d0ea2ec3b8aaeb4724f25031db7a.tar.bz2
abc-416ffc117ab7d0ea2ec3b8aaeb4724f25031db7a.zip
Version abc80327
Diffstat (limited to 'src/aig/ntk/ntkUtil.c')
-rw-r--r--src/aig/ntk/ntkUtil.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/aig/ntk/ntkUtil.c b/src/aig/ntk/ntkUtil.c
index 543d1a60..931a26ee 100644
--- a/src/aig/ntk/ntkUtil.c
+++ b/src/aig/ntk/ntkUtil.c
@@ -95,36 +95,25 @@ int Ntk_ManGetTotalFanins( Ntk_Man_t * pNtk )
return nFanins;
}
+
/**Function*************************************************************
- Synopsis [Computes the number of logic levels not counting PIs/POs.]
+ Synopsis []
- Description [Assumes topological ordering of the nodes.]
+ Description []
SideEffects []
SeeAlso []
***********************************************************************/
-int Ntk_ManLevel( Ntk_Man_t * pNtk )
+int Ntk_ManPiNum( Ntk_Man_t * pNtk )
{
- Ntk_Obj_t * pObj, * pFanin;
- int i, k, LevelMax;
- Ntk_ManForEachPi( pNtk, pObj, i )
- Ntk_ObjSetLevel( pObj, 0 );
- Ntk_ManForEachNode( pNtk, pObj, i )
- {
- LevelMax = 0;
- Ntk_ObjForEachFanin( pObj, pFanin, k )
- if ( LevelMax < Ntk_ObjLevel(pFanin) )
- LevelMax = Ntk_ObjLevel(pFanin);
- Ntk_ObjSetLevel( pFanin, LevelMax+1 );
- }
- LevelMax = 0;
- Ntk_ManForEachPo( pNtk, pObj, i )
- if ( LevelMax < Ntk_ObjLevel(pObj) )
- LevelMax = Ntk_ObjLevel(pObj);
- return LevelMax;
+ Ntk_Obj_t * pNode;
+ int i, Counter = 0;
+ Ntk_ManForEachCi( pNtk, pNode, i )
+ Counter += Ntk_ObjIsPi( pNode );
+ return Counter;
}
/**Function*************************************************************
@@ -138,18 +127,18 @@ int Ntk_ManLevel( Ntk_Man_t * pNtk )
SeeAlso []
***********************************************************************/
-int Ntk_ManPiNum( Ntk_Man_t * pNtk )
+int Ntk_ManPoNum( Ntk_Man_t * pNtk )
{
Ntk_Obj_t * pNode;
int i, Counter = 0;
- Ntk_ManForEachPi( pNtk, pNode, i )
- Counter++;
+ Ntk_ManForEachCo( pNtk, pNode, i )
+ Counter += Ntk_ObjIsPo( pNode );
return Counter;
}
/**Function*************************************************************
- Synopsis []
+ Synopsis [Reads the number of BDD nodes.]
Description []
@@ -158,13 +147,22 @@ int Ntk_ManPiNum( Ntk_Man_t * pNtk )
SeeAlso []
***********************************************************************/
-int Ntk_ManPoNum( Ntk_Man_t * pNtk )
+int Ntk_ManGetAigNodeNum( Ntk_Man_t * pNtk )
{
Ntk_Obj_t * pNode;
- int i, Counter = 0;
- Ntk_ManForEachPo( pNtk, pNode, i )
- Counter++;
- return Counter;
+ int i, nNodes = 0;
+ Ntk_ManForEachNode( pNtk, pNode, i )
+ {
+ if ( pNode->pFunc == NULL )
+ {
+ printf( "Ntk_ManGetAigNodeNum(): Local AIG of node %d is not assigned.\n", pNode->Id );
+ continue;
+ }
+ if ( Ntk_ObjFaninNum(pNode) < 2 )
+ continue;
+ nNodes += Hop_DagSize( pNode->pFunc );
+ }
+ return nNodes;
}
////////////////////////////////////////////////////////////////////////