summaryrefslogtreecommitdiffstats
path: root/src/opt/rwr
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2006-12-16 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2006-12-16 08:01:00 -0800
commitbe6a484a997a8477d4c3b03c17f798c1b0061bf1 (patch)
tree5c2e6dfa747144ba11dbdc8298ad08b19d5e49d1 /src/opt/rwr
parentae037e45038cca6f0b86abea50692399a03b01be (diff)
downloadabc-be6a484a997a8477d4c3b03c17f798c1b0061bf1.tar.gz
abc-be6a484a997a8477d4c3b03c17f798c1b0061bf1.tar.bz2
abc-be6a484a997a8477d4c3b03c17f798c1b0061bf1.zip
Version abc61216
Diffstat (limited to 'src/opt/rwr')
-rw-r--r--src/opt/rwr/rwrEva.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/opt/rwr/rwrEva.c b/src/opt/rwr/rwrEva.c
index fc612f95..4ce71a9b 100644
--- a/src/opt/rwr/rwrEva.c
+++ b/src/opt/rwr/rwrEva.c
@@ -28,6 +28,7 @@
static Dec_Graph_t * Rwr_CutEvaluate( Rwr_Man_t * p, Abc_Obj_t * pRoot, Cut_Cut_t * pCut, Vec_Ptr_t * vFaninsCur, int nNodesSaved, int LevelMax, int * pGainBest );
static int Rwr_CutIsBoolean( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves );
static int Rwr_CutCountNumNodes( Abc_Obj_t * pObj, Cut_Cut_t * pCut );
+static int Rwr_NodeGetDepth_rec( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -186,6 +187,13 @@ p->timeRes += clock() - clk;
// copy the leaves
Vec_PtrForEachEntry( p->vFanins, pFanin, i )
Dec_GraphNode(p->pGraph, i)->pFunc = pFanin;
+/*
+ printf( "(" );
+ Vec_PtrForEachEntry( p->vFanins, pFanin, i )
+ printf( " %d", Abc_ObjRegular(pFanin)->vFanouts.nSize - 1 );
+ printf( " ) " );
+*/
+// printf( "%d ", Rwr_NodeGetDepth_rec( pNode, p->vFanins ) );
p->nScores[p->pMap[uTruthBest]]++;
p->nNodesGained += GainBest;
@@ -384,6 +392,32 @@ int Rwr_CutCountNumNodes( Abc_Obj_t * pObj, Cut_Cut_t * pCut )
return Counter;
}
+
+/**Function*************************************************************
+
+ Synopsis [Returns depth of the cut.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Rwr_NodeGetDepth_rec( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves )
+{
+ Abc_Obj_t * pLeaf;
+ int i, Depth0, Depth1;
+ if ( Abc_ObjIsCi(pObj) )
+ return 0;
+ Vec_PtrForEachEntry( vLeaves, pLeaf, i )
+ if ( pObj == Abc_ObjRegular(pLeaf) )
+ return 0;
+ Depth0 = Rwr_NodeGetDepth_rec( Abc_ObjFanin0(pObj), vLeaves );
+ Depth1 = Rwr_NodeGetDepth_rec( Abc_ObjFanin1(pObj), vLeaves );
+ return 1 + ABC_MAX( Depth0, Depth1 );
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////