summaryrefslogtreecommitdiffstats
path: root/src/temp/ivy/ivyDfs.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2006-07-23 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2006-07-23 08:01:00 -0700
commit7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee (patch)
tree9d31935cf6c27b36c3ceb57cb5cffe2577a569a7 /src/temp/ivy/ivyDfs.c
parent616bb095f10c24f1f720efe89b7f39c670d114a3 (diff)
downloadabc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.tar.gz
abc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.tar.bz2
abc-7e8e03206c56e7cd9d0d9fbb447c785c400ff3ee.zip
Version abc60723
Diffstat (limited to 'src/temp/ivy/ivyDfs.c')
-rw-r--r--src/temp/ivy/ivyDfs.c74
1 files changed, 25 insertions, 49 deletions
diff --git a/src/temp/ivy/ivyDfs.c b/src/temp/ivy/ivyDfs.c
index 2dc3bac8..fb938c42 100644
--- a/src/temp/ivy/ivyDfs.c
+++ b/src/temp/ivy/ivyDfs.c
@@ -69,17 +69,14 @@ Vec_Int_t * Ivy_ManDfs( Ivy_Man_t * p )
Vec_Int_t * vNodes;
Ivy_Obj_t * pObj;
int i;
+ assert( Ivy_ManLatchNum(p) == 0 );
// make sure the nodes are not marked
Ivy_ManForEachObj( p, pObj, i )
assert( !pObj->fMarkA && !pObj->fMarkB );
// collect the nodes
vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) );
- if ( Ivy_ManLatchNum(p) > 0 )
- Ivy_ManForEachCo( p, pObj, i )
- Ivy_ManDfs_rec( Ivy_ObjFanin0(pObj), vNodes );
- else
- Ivy_ManForEachPo( p, pObj, i )
- Ivy_ManDfs_rec( Ivy_ObjFanin0(pObj), vNodes );
+ Ivy_ManForEachPo( p, pObj, i )
+ Ivy_ManDfs_rec( Ivy_ObjFanin0(pObj), vNodes );
// unmark the collected nodes
Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
Ivy_ObjClearMarkA(pObj);
@@ -90,34 +87,7 @@ Vec_Int_t * Ivy_ManDfs( Ivy_Man_t * p )
/**Function*************************************************************
- Synopsis [Collects nodes in the DFS order.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Ivy_ManDfsExt_rec( Ivy_Obj_t * pObj, Vec_Int_t * vNodes )
-{
- Vec_Int_t * vFanins;
- int i, Fanin;
- if ( !Ivy_ObjIsNodeExt(pObj) || Ivy_ObjIsMarkA(pObj) )
- return;
- // mark the node as visited
- Ivy_ObjSetMarkA(pObj);
- // traverse the fanins
- vFanins = Ivy_ObjGetFanins( pObj );
- Vec_IntForEachEntry( vFanins, Fanin, i )
- Ivy_ManDfsExt_rec( Ivy_ObjObj(pObj, Ivy_EdgeId(Fanin)), vNodes );
- // add the node
- Vec_IntPush( vNodes, pObj->Id );
-}
-
-/**Function*************************************************************
-
- Synopsis [Collects nodes in the DFS order.]
+ Synopsis [Collects AND/EXOR nodes in the DFS order from CIs to COs.]
Description []
@@ -126,25 +96,31 @@ void Ivy_ManDfsExt_rec( Ivy_Obj_t * pObj, Vec_Int_t * vNodes )
SeeAlso []
***********************************************************************/
-Vec_Int_t * Ivy_ManDfsExt( Ivy_Man_t * p )
+Vec_Int_t * Ivy_ManDfsSeq( Ivy_Man_t * p, Vec_Int_t ** pvLatches )
{
- Vec_Int_t * vNodes;
- Ivy_Obj_t * pObj, * pFanin;
+ Vec_Int_t * vNodes, * vLatches;
+ Ivy_Obj_t * pObj;
int i;
- assert( p->fExtended );
- assert( Ivy_ManLatchNum(p) == 0 );
- // make sure network does not have buffers
- vNodes = Vec_IntAlloc( 10 );
+ assert( Ivy_ManLatchNum(p) > 0 );
+ // make sure the nodes are not marked
+ Ivy_ManForEachObj( p, pObj, i )
+ assert( !pObj->fMarkA && !pObj->fMarkB );
+ // collect the latches
+ vLatches = Vec_IntAlloc( Ivy_ManLatchNum(p) );
+ Ivy_ManForEachLatch( p, pObj, i )
+ Vec_IntPush( vLatches, pObj->Id );
+ // collect the nodes
+ vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) );
Ivy_ManForEachPo( p, pObj, i )
- {
- pFanin = Ivy_ManObj( p, Ivy_EdgeId( Ivy_ObjReadFanin(pObj,0) ) );
- Ivy_ManDfsExt_rec( pFanin, vNodes );
- }
+ Ivy_ManDfs_rec( Ivy_ObjFanin0(pObj), vNodes );
+ Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
+ Ivy_ManDfs_rec( Ivy_ObjFanin0(pObj), vNodes );
+ // unmark the collected nodes
Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
Ivy_ObjClearMarkA(pObj);
// make sure network does not have dangling nodes
- // the network may have dangling nodes if some fanins of ESOPs do not appear in cubes
-// assert( p->nNodes == Vec_PtrSize(vNodes) );
+ assert( Vec_IntSize(vNodes) == Ivy_ManNodeNum(p) + Ivy_ManBufNum(p) );
+ *pvLatches = vLatches;
return vNodes;
}
@@ -249,7 +225,7 @@ Vec_Int_t * Ivy_ManRequiredLevels( Ivy_Man_t * p )
int i, k, Level, LevelMax;
assert( p->vRequired == NULL );
// start the required times
- vLevelsR = Vec_IntStart( Ivy_ManObjIdNext(p) );
+ vLevelsR = Vec_IntStart( Ivy_ManObjIdMax(p) + 1 );
// iterate through the nodes in the reverse order
vNodes = Ivy_ManLevelize( p );
Vec_VecForEachEntryReverseReverse( vNodes, pObj, i, k )
@@ -262,7 +238,7 @@ Vec_Int_t * Ivy_ManRequiredLevels( Ivy_Man_t * p )
}
Vec_VecFree( vNodes );
// convert it into the required times
- LevelMax = Ivy_ManReadLevels( p );
+ LevelMax = Ivy_ManLevels( p );
//printf( "max %5d\n",LevelMax );
Ivy_ManForEachObj( p, pObj, i )
{