summaryrefslogtreecommitdiffstats
path: root/src/opt/rwr
diff options
context:
space:
mode:
Diffstat (limited to 'src/opt/rwr')
-rw-r--r--src/opt/rwr/rwrEva.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/opt/rwr/rwrEva.c b/src/opt/rwr/rwrEva.c
index 4e5a3dc2..fc612f95 100644
--- a/src/opt/rwr/rwrEva.c
+++ b/src/opt/rwr/rwrEva.c
@@ -27,6 +27,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 );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -72,6 +73,8 @@ clk = clock();
assert( pCut != NULL );
p->timeCut += clock() - clk;
+//printf( " %d", Rwr_CutCountNumNodes(pNode, pCut) );
+
// go through the cuts
clk = clock();
for ( pCut = pCut->pNext; pCut; pCut = pCut->pNext )
@@ -104,6 +107,15 @@ clk = clock();
}
p->nCutsGood++;
+ {
+ int Counter = 0;
+ Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i )
+ if ( Abc_ObjFanoutNum(Abc_ObjRegular(pFanin)) == 1 )
+ Counter++;
+ if ( Counter > 2 )
+ continue;
+ }
+
clk2 = clock();
/*
printf( "Considering: (" );
@@ -306,6 +318,72 @@ int Rwr_CutIsBoolean( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves )
return RetValue;
}
+
+/**Function*************************************************************
+
+ Synopsis [Count the nodes in the cut space of a node.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Rwr_CutCountNumNodes_rec( Abc_Obj_t * pObj, Cut_Cut_t * pCut, Vec_Ptr_t * vNodes )
+{
+ int i;
+ for ( i = 0; i < (int)pCut->nLeaves; i++ )
+ if ( pCut->pLeaves[i] == pObj->Id )
+ {
+ // check if the node is collected
+ if ( pObj->fMarkC == 0 )
+ {
+ pObj->fMarkC = 1;
+ Vec_PtrPush( vNodes, pObj );
+ }
+ return;
+ }
+ assert( Abc_ObjIsNode(pObj) );
+ // check if the node is collected
+ if ( pObj->fMarkC == 0 )
+ {
+ pObj->fMarkC = 1;
+ Vec_PtrPush( vNodes, pObj );
+ }
+ // traverse the fanins
+ Rwr_CutCountNumNodes_rec( Abc_ObjFanin0(pObj), pCut, vNodes );
+ Rwr_CutCountNumNodes_rec( Abc_ObjFanin1(pObj), pCut, vNodes );
+}
+
+/**Function*************************************************************
+
+ Synopsis [Count the nodes in the cut space of a node.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Rwr_CutCountNumNodes( Abc_Obj_t * pObj, Cut_Cut_t * pCut )
+{
+ Vec_Ptr_t * vNodes;
+ int i, Counter;
+ // collect all nodes
+ vNodes = Vec_PtrAlloc( 100 );
+ for ( pCut = pCut->pNext; pCut; pCut = pCut->pNext )
+ Rwr_CutCountNumNodes_rec( pObj, pCut, vNodes );
+ // clean all nodes
+ Vec_PtrForEachEntry( vNodes, pObj, i )
+ pObj->fMarkC = 0;
+ // delete and return
+ Counter = Vec_PtrSize(vNodes);
+ Vec_PtrFree( vNodes );
+ return Counter;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////