summaryrefslogtreecommitdiffstats
path: root/src/aig/dar/darCore.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-06-24 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-06-24 08:01:00 -0700
commitd6804597a397379f826810a736ccbe99bf56c497 (patch)
tree9ead35b5d0dd58628c773576765b249c87c71dda /src/aig/dar/darCore.c
parentd47752011d94805850f8713258634d1bde5e639f (diff)
downloadabc-d6804597a397379f826810a736ccbe99bf56c497.tar.gz
abc-d6804597a397379f826810a736ccbe99bf56c497.tar.bz2
abc-d6804597a397379f826810a736ccbe99bf56c497.zip
Version abc70624
Diffstat (limited to 'src/aig/dar/darCore.c')
-rw-r--r--src/aig/dar/darCore.c80
1 files changed, 74 insertions, 6 deletions
diff --git a/src/aig/dar/darCore.c b/src/aig/dar/darCore.c
index d56cca45..820b0002 100644
--- a/src/aig/dar/darCore.c
+++ b/src/aig/dar/darCore.c
@@ -42,9 +42,10 @@
int Dar_ManRewrite( Dar_Man_t * p )
{
ProgressBar * pProgress;
+ Dar_Cut_t * pCutSet;
Dar_Obj_t * pObj, * pObjNew;
int i, k, nNodesOld, nNodeBefore, nNodeAfter, Required;
- int clk = 0, clkStart = clock();
+ int clk = 0, clkStart;
// remove dangling nodes
Dar_ManCleanup( p );
// set elementary cuts for the PIs
@@ -52,6 +53,8 @@ int Dar_ManRewrite( Dar_Man_t * p )
// if ( p->pPars->fUpdateLevel )
// Dar_NtkStartReverseLevels( p );
// resynthesize each node once
+ clkStart = clock();
+ p->nNodesInit = Dar_ManNodeNum(p);
nNodesOld = Vec_PtrSize( p->vObjs );
pProgress = Extra_ProgressBarStart( stdout, nNodesOld );
Dar_ManForEachObj( p, pObj, i )
@@ -61,13 +64,30 @@ int Dar_ManRewrite( Dar_Man_t * p )
continue;
if ( i > nNodesOld )
break;
+ if ( pObj->Id == 654 )
+ {
+ int x = 0;
+ }
// compute cuts for the node
- Dar_ObjComputeCuts_rec( p, pObj );
+clk = clock();
+ pCutSet = Dar_ObjComputeCuts_rec( p, pObj );
+p->timeCuts += clock() - clk;
// go through the cuts of this node
Required = 1000000;
p->GainBest = -1;
for ( k = 1; k < (int)pObj->nCuts; k++ )
- Dar_LibEval( p, pObj, (Dar_Cut_t *)pObj->pData + k, Required );
+ {
+/*
+ if ( pObj->Id == 654 )
+ {
+ int m;
+ for ( m = 0; m < 4; m++ )
+ printf( "%d ", pCutSet[k].pLeaves[m] );
+ printf( "\n" );
+ }
+*/
+ Dar_LibEval( p, pObj, pCutSet + k, Required );
+ }
// check the best gain
if ( !(p->GainBest > 0 || p->GainBest == 0 && p->pPars->fUseZeros) )
continue;
@@ -75,13 +95,21 @@ int Dar_ManRewrite( Dar_Man_t * p )
nNodeBefore = Dar_ManNodeNum( p );
pObjNew = Dar_LibBuildBest( p );
pObjNew = Dar_NotCond( pObjNew, pObjNew->fPhase ^ pObj->fPhase );
- // remove the old nodes
+ assert( (int)Dar_Regular(pObjNew)->Level <= Required );
+ // replace the node
Dar_ObjReplace( p, pObj, pObjNew, 1 );
+ // remove the old cuts
+ pObj->pData = NULL;
// compare the gains
nNodeAfter = Dar_ManNodeNum( p );
- assert( p->GainBest == nNodeBefore - nNodeAfter );
- assert( (int)pObjNew->Level <= Required );
+ assert( p->GainBest <= nNodeBefore - nNodeAfter );
+ // count gains of this class
+ p->ClassGains[p->ClassBest] += nNodeBefore - nNodeAfter;
+
}
+p->timeTotal = clock() - clkStart;
+p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
+
Extra_ProgressBarStop( pProgress );
Dar_ManCutsFree( p );
// put the nodes into the DFS order and reassign their IDs
@@ -99,6 +127,46 @@ int Dar_ManRewrite( Dar_Man_t * p )
return 1;
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Dar_ManComputeCuts( Dar_Man_t * p )
+{
+ Dar_Obj_t * pObj;
+ int i, clk = 0, clkStart = clock();
+ int nCutsMax = 0, nCutsTotal = 0;
+ // remove dangling nodes
+ Dar_ManCleanup( p );
+ // set elementary cuts for the PIs
+ Dar_ManSetupPis( p );
+ // compute cuts for each nodes in the topological order
+ Dar_ManForEachObj( p, pObj, i )
+ {
+ if ( !Dar_ObjIsNode(pObj) )
+ continue;
+ Dar_ObjComputeCuts( p, pObj );
+ nCutsTotal += pObj->nCuts - 1;
+ nCutsMax = DAR_MAX( nCutsMax, (int)pObj->nCuts - 1 );
+ }
+ // print statistics on the number of non-trivial cuts
+ printf( "Node = %6d. Cut = %8d. Max = %3d. Ave = %.2f. Filter = %8d. Created = %8d.\n",
+ Dar_ManNodeNum(p), nCutsTotal, nCutsMax, (float)nCutsTotal/Dar_ManNodeNum(p),
+ p->nCutsFiltered, p->nCutsFiltered+nCutsTotal+Dar_ManNodeNum(p)+Dar_ManPiNum(p) );
+ PRT( "Time", clock() - clkStart );
+
+ // free the cuts
+// Dar_ManCutsFree( p );
+ return 1;
+}
+
////////////////////////////////////////////////////////////////////////