summaryrefslogtreecommitdiffstats
path: root/src/aig/dar
diff options
context:
space:
mode:
Diffstat (limited to 'src/aig/dar')
-rw-r--r--src/aig/dar/dar.h6
-rw-r--r--src/aig/dar/darBalance.c2
-rw-r--r--src/aig/dar/darCore.c43
-rw-r--r--src/aig/dar/darInt.h4
-rw-r--r--src/aig/dar/darLib.c16
-rw-r--r--src/aig/dar/darMan.c8
-rw-r--r--src/aig/dar/darRefact.c15
-rw-r--r--src/aig/dar/darScript.c128
8 files changed, 88 insertions, 134 deletions
diff --git a/src/aig/dar/dar.h b/src/aig/dar/dar.h
index 3106c7ad..44dd2788 100644
--- a/src/aig/dar/dar.h
+++ b/src/aig/dar/dar.h
@@ -44,6 +44,7 @@ struct Dar_RwrPar_t_
{
int nCutsMax; // the maximum number of cuts to try
int nSubgMax; // the maximum number of subgraphs to try
+ int fFanout; // support fanout representation
int fUpdateLevel; // update level
int fUseZeros; // performs zero-cost replacement
int fVerbose; // enables verbose output
@@ -79,12 +80,13 @@ extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel );
/*=== darCore.c ========================================================*/
extern void Dar_ManDefaultRwrParams( Dar_RwrPar_t * pPars );
extern int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars );
-extern Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig );
+extern Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax );
/*=== darRefact.c ========================================================*/
extern void Dar_ManDefaultRefParams( Dar_RefPar_t * pPars );
extern int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars );
/*=== darScript.c ========================================================*/
-extern Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fVerbose );
+extern Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fVerbose );
+extern Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose );
#ifdef __cplusplus
}
diff --git a/src/aig/dar/darBalance.c b/src/aig/dar/darBalance.c
index 969e5253..097f1a4d 100644
--- a/src/aig/dar/darBalance.c
+++ b/src/aig/dar/darBalance.c
@@ -53,7 +53,7 @@ Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel )
Vec_Vec_t * vStore;
int i;
// create the new manager
- pNew = Aig_ManStart();
+ pNew = Aig_ManStart( Aig_ManObjIdMax(p) + 1 );
// map the PI nodes
Aig_ManCleanData( p );
Aig_ManConst1(p)->pData = Aig_ManConst1(pNew);
diff --git a/src/aig/dar/darCore.c b/src/aig/dar/darCore.c
index 7546df0b..b74f570c 100644
--- a/src/aig/dar/darCore.c
+++ b/src/aig/dar/darCore.c
@@ -44,6 +44,7 @@ void Dar_ManDefaultRwrParams( Dar_RwrPar_t * pPars )
memset( pPars, 0, sizeof(Dar_RwrPar_t) );
pPars->nCutsMax = 8;
pPars->nSubgMax = 5; // 5 is a "magic number"
+ pPars->fFanout = 1;
pPars->fUpdateLevel = 0;
pPars->fUseZeros = 0;
pPars->fVerbose = 0;
@@ -76,7 +77,8 @@ int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars )
// remove dangling nodes
Aig_ManCleanup( pAig );
// if updating levels is requested, start fanout and timing
- Aig_ManCreateFanout( pAig );
+ if ( p->pPars->fFanout )
+ Aig_ManFanoutStart( pAig );
if ( p->pPars->fUpdateLevel )
Aig_ManStartReverseLevels( pAig, 0 );
// set elementary cuts for the PIs
@@ -85,19 +87,27 @@ int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars )
clkStart = clock();
p->nNodesInit = Aig_ManNodeNum(pAig);
nNodesOld = Vec_PtrSize( pAig->vObjs );
+
pProgress = Extra_ProgressBarStart( stdout, nNodesOld );
Aig_ManForEachObj( pAig, pObj, i )
+// pProgress = Extra_ProgressBarStart( stdout, 100 );
+// Aig_ManOrderStart( pAig );
+// Aig_ManForEachNodeInOrder( pAig, pObj )
{
+// Extra_ProgressBarUpdate( pProgress, 100*pAig->nAndPrev/pAig->nAndTotal, NULL );
+
Extra_ProgressBarUpdate( pProgress, i, NULL );
if ( !Aig_ObjIsNode(pObj) )
continue;
if ( i > nNodesOld )
break;
+
// consider freeing the cuts
// if ( (i & 0xFFF) == 0 && Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) > 100 )
// Dar_ManCutsStart( p );
// compute cuts for the node
+ p->nNodesTried++;
clk = clock();
Dar_ObjComputeCuts_rec( p, pObj );
p->timeCuts += clock() - clk;
@@ -133,7 +143,10 @@ p->timeCuts += clock() - clk;
Dar_LibEval( p, pObj, pCut, Required );
// check the best gain
if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) )
+ {
+// Aig_ObjOrderAdvance( pAig );
continue;
+ }
// remove the old cuts
Dar_ObjSetCuts( pObj, NULL );
// if we end up here, a rewriting step is accepted
@@ -149,6 +162,8 @@ p->timeCuts += clock() - clk;
// count gains of this class
p->ClassGains[p->ClassBest] += nNodeBefore - nNodeAfter;
}
+// Aig_ManOrderStop( pAig );
+
p->timeTotal = clock() - clkStart;
p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
@@ -158,9 +173,14 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
// put the nodes into the DFS order and reassign their IDs
// Aig_NtkReassignIds( p );
// fix the levels
- Aig_ManDeleteFanout( pAig );
+// Aig_ManVerifyLevel( pAig );
+ if ( p->pPars->fFanout )
+ Aig_ManFanoutStop( pAig );
if ( p->pPars->fUpdateLevel )
+ {
+// Aig_ManVerifyReverseLevel( pAig );
Aig_ManStopReverseLevels( pAig );
+ }
// stop the rewriting manager
Dar_ManStop( p );
// check
@@ -183,28 +203,25 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
SeeAlso []
***********************************************************************/
-Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig )
+Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax )
{
Dar_Man_t * p;
+ Dar_RwrPar_t Pars, * pPars = &Pars;
Aig_Obj_t * pObj;
Aig_MmFixed_t * pMemCuts;
int i, clk = 0, clkStart = clock();
- int nCutsMax = 0, nCutsTotal = 0;
- // create rewriting manager
- p = Dar_ManStart( pAig, NULL );
// remove dangling nodes
Aig_ManCleanup( pAig );
+ // create default parameters
+ Dar_ManDefaultRwrParams( pPars );
+ pPars->nCutsMax = nCutsMax;
+ // create rewriting manager
+ p = Dar_ManStart( pAig, pPars );
// set elementary cuts for the PIs
Dar_ManCutsStart( p );
// compute cuts for each nodes in the topological order
- Aig_ManForEachObj( pAig, pObj, i )
- {
- if ( !Aig_ObjIsNode(pObj) )
- continue;
+ Aig_ManForEachNode( pAig, pObj, i )
Dar_ObjComputeCuts( p, pObj );
- nCutsTotal += pObj->nCuts - 1;
- nCutsMax = AIG_MAX( nCutsMax, (int)pObj->nCuts - 1 );
- }
// free the cuts
pMemCuts = p->pMemCuts;
p->pMemCuts = NULL;
diff --git a/src/aig/dar/darInt.h b/src/aig/dar/darInt.h
index 0acd272c..b14d5c30 100644
--- a/src/aig/dar/darInt.h
+++ b/src/aig/dar/darInt.h
@@ -55,7 +55,8 @@ struct Dar_Cut_t_ // 6 words
{
unsigned uSign; // cut signature
unsigned uTruth : 16; // the truth table of the cut function
- unsigned Value : 12; // the value of the cut
+ unsigned Value : 11; // the value of the cut
+ unsigned fBest : 1; // marks the best cut
unsigned fUsed : 1; // marks the cut currently in use
unsigned nLeaves : 3; // the number of leaves
int pLeaves[4]; // the array of leaves
@@ -85,6 +86,7 @@ struct Dar_Man_t_
int nCutMemUsed; // memory used for cuts
// rewriting statistics
int nNodesInit; // the original number of nodes
+ int nNodesTried; // the number of nodes attempted
int nCutsAll; // all cut pairs
int nCutsTried; // computed cuts
int nCutsUsed; // used cuts
diff --git a/src/aig/dar/darLib.c b/src/aig/dar/darLib.c
index 72ce0cde..e159f35a 100644
--- a/src/aig/dar/darLib.c
+++ b/src/aig/dar/darLib.c
@@ -798,9 +798,13 @@ void Dar_LibEvalAssignNums( Dar_Man_t * p, int Class )
pFanin0 = Aig_NotCond( pData0->pFunc, pObj->fCompl0 );
pFanin1 = Aig_NotCond( pData1->pFunc, pObj->fCompl1 );
pData->pFunc = Aig_TableLookupTwo( p->pAig, pFanin0, pFanin1 );
- // clear the node if it is part of MFFC
- if ( pData->pFunc != NULL && Aig_ObjIsTravIdCurrent(p->pAig, pData->pFunc) )
- pData->fMffc = 1;
+ if ( pData->pFunc )
+ {
+ // update the level to be more accurate
+ pData->Level = Aig_Regular(pData->pFunc)->Level;
+ // mark the node if it is part of MFFC
+ pData->fMffc = Aig_ObjIsTravIdCurrent(p->pAig, pData->pFunc);
+ }
}
}
@@ -823,10 +827,10 @@ int Dar_LibEval_rec( Dar_LibObj_t * pObj, int Out, int nNodesSaved, int Required
return 0;
assert( pObj->Num > 3 );
pData = s_DarLib->pDatas + pObj->Num;
- if ( pData->pFunc && !pData->fMffc )
- return 0;
if ( pData->Level > Required )
return 0xff;
+ if ( pData->pFunc && !pData->fMffc )
+ return 0;
if ( pData->TravId == Out )
return 0;
pData->TravId = Out;
@@ -894,6 +898,7 @@ void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Requir
p->LevelBest = s_DarLib->pDatas[pObj->Num].Level;
p->GainBest = nNodesGained;
p->ClassBest = Class;
+ assert( p->LevelBest <= Required );
}
clk = clock() - clk;
p->ClassTimes[Class] += clk;
@@ -943,6 +948,7 @@ Aig_Obj_t * Dar_LibBuildBest_rec( Dar_Man_t * p, Dar_LibObj_t * pObj )
pFanin0 = Aig_NotCond( pFanin0, pObj->fCompl0 );
pFanin1 = Aig_NotCond( pFanin1, pObj->fCompl1 );
pData->pFunc = Aig_And( p->pAig, pFanin0, pFanin1 );
+// assert( pData->Level == (int)Aig_Regular(pData->pFunc)->Level );
return pData->pFunc;
}
diff --git a/src/aig/dar/darMan.c b/src/aig/dar/darMan.c
index ef898ea2..155d48bd 100644
--- a/src/aig/dar/darMan.c
+++ b/src/aig/dar/darMan.c
@@ -94,14 +94,14 @@ void Dar_ManPrintStats( Dar_Man_t * p )
extern void Kit_DsdPrintFromTruth( unsigned * pTruth, int nVars );
Gain = p->nNodesInit - Aig_ManNodeNum(p->pAig);
- printf( "NodesBeg = %8d. NodesEnd = %8d. Gain = %6d. (%6.2f %%). Cut mem = %d Mb\n",
- p->nNodesInit, Aig_ManNodeNum(p->pAig), Gain, 100.0*Gain/p->nNodesInit, p->nCutMemUsed );
+ printf( "Tried = %8d. Beg = %8d. End = %8d. Gain = %6d. (%6.2f %%). Cut mem = %d Mb\n",
+ p->nNodesTried, p->nNodesInit, Aig_ManNodeNum(p->pAig), Gain, 100.0*Gain/p->nNodesInit, p->nCutMemUsed );
printf( "Cuts = %8d. Tried = %8d. Used = %8d. Bad = %5d. Skipped = %5d. Ave = %.2f.\n",
p->nCutsAll, p->nCutsTried, p->nCutsUsed, p->nCutsBad, p->nCutsSkipped,
(float)p->nCutsUsed/Aig_ManNodeNum(p->pAig) );
- printf( "Bufs = %5d. BufMax = %5d. BufReplace = %6d. BufFix = %6d.\n",
- Aig_ManBufNum(p->pAig), p->pAig->nBufMax, p->pAig->nBufReplaces, p->pAig->nBufFixes );
+ printf( "Bufs = %5d. BufMax = %5d. BufReplace = %6d. BufFix = %6d. Levels = %4d.\n",
+ Aig_ManBufNum(p->pAig), p->pAig->nBufMax, p->pAig->nBufReplaces, p->pAig->nBufFixes, Aig_ManLevels(p->pAig) );
PRT( "Cuts ", p->timeCuts );
PRT( "Eval ", p->timeEval );
PRT( "Other ", p->timeOther );
diff --git a/src/aig/dar/darRefact.c b/src/aig/dar/darRefact.c
index cdfbaa01..fbd12cae 100644
--- a/src/aig/dar/darRefact.c
+++ b/src/aig/dar/darRefact.c
@@ -130,8 +130,8 @@ void Dar_ManRefPrintStats( Ref_Man_t * p )
int Gain = p->nNodesInit - Aig_ManNodeNum(p->pAig);
printf( "NodesBeg = %8d. NodesEnd = %8d. Gain = %6d. (%6.2f %%).\n",
p->nNodesInit, Aig_ManNodeNum(p->pAig), Gain, 100.0*Gain/p->nNodesInit );
- printf( "Tried = %6d. Below = %5d. Extended = %5d. Used = %5d.\n",
- p->nNodesTried, p->nNodesBelow, p->nNodesExten, p->nCutsUsed );
+ printf( "Tried = %6d. Below = %5d. Extended = %5d. Used = %5d. Levels = %4d.\n",
+ p->nNodesTried, p->nNodesBelow, p->nNodesExten, p->nCutsUsed, Aig_ManLevels(p->pAig) );
PRT( "Cuts ", p->timeCuts );
PRT( "Eval ", p->timeEval );
PRT( "Other ", p->timeOther );
@@ -358,7 +358,7 @@ int Dar_ManRefactorTryCuts( Ref_Man_t * p, Aig_Obj_t * pObj, int nNodesSaved, in
p->nCutsTried++;
// get the cut nodes
- Aig_ManCollectCut( pObj, vCut, p->vCutNodes );
+ Aig_ObjCollectCut( pObj, vCut, p->vCutNodes );
// get the truth table
pTruth = Aig_ManCutTruth( pObj, vCut, p->vCutNodes, p->vTruthElem, p->vTruthStore );
// try the positive phase
@@ -460,7 +460,7 @@ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars )
// remove dangling nodes
Aig_ManCleanup( pAig );
// if updating levels is requested, start fanout and timing
- Aig_ManCreateFanout( pAig );
+ Aig_ManFanoutStart( pAig );
if ( p->pPars->fUpdateLevel )
Aig_ManStartReverseLevels( pAig, 0 );
@@ -480,11 +480,6 @@ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars )
break;
Vec_VecClear( p->vCuts );
- if ( pObj->Id == 738 )
- {
- int x = 0;
- }
-
//printf( "\nConsidering node %d.\n", pObj->Id );
// get the bounded MFFC size
clk = clock();
@@ -558,7 +553,7 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
// put the nodes into the DFS order and reassign their IDs
// Aig_NtkReassignIds( p );
// fix the levels
- Aig_ManDeleteFanout( pAig );
+ Aig_ManFanoutStop( pAig );
if ( p->pPars->fUpdateLevel )
Aig_ManStopReverseLevels( pAig );
diff --git a/src/aig/dar/darScript.c b/src/aig/dar/darScript.c
index 8423a4e6..75076981 100644
--- a/src/aig/dar/darScript.c
+++ b/src/aig/dar/darScript.c
@@ -39,11 +39,10 @@
SeeAlso []
***********************************************************************/
-Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
+Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fVerbose )
//alias compress2 "b -l; rw -l; rf -l; b -l; rw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
{
Aig_Man_t * pTemp;
- int fBalance = 0;
Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
@@ -51,12 +50,18 @@ Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
Dar_ManDefaultRwrParams( pParsRwr );
Dar_ManDefaultRefParams( pParsRef );
+ pParsRwr->fUpdateLevel = fUpdateLevel;
+ pParsRef->fUpdateLevel = fUpdateLevel;
+
pParsRwr->fVerbose = fVerbose;
pParsRef->fVerbose = fVerbose;
// balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
- Aig_ManStop( pTemp );
+ if ( fBalance )
+ {
+// pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
+// Aig_ManStop( pTemp );
+ }
// rewrite
Dar_ManRewrite( pAig, pParsRwr );
@@ -69,8 +74,11 @@ Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
Aig_ManStop( pTemp );
// balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
+// if ( fBalance )
+ {
+ pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
Aig_ManStop( pTemp );
+ }
// rewrite
Dar_ManRewrite( pAig, pParsRwr );
@@ -86,8 +94,11 @@ Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
Aig_ManStop( pTemp );
// balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
+ if ( fBalance )
+ {
+ pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
Aig_ManStop( pTemp );
+ }
// refactor
Dar_ManRefactor( pAig, pParsRef );
@@ -100,8 +111,11 @@ Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
Aig_ManStop( pTemp );
// balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
+ if ( fBalance )
+ {
+ pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
Aig_ManStop( pTemp );
+ }
return pAig;
}
@@ -116,11 +130,10 @@ Aig_Man_t * Dar_ManCompress2_old( Aig_Man_t * pAig, int fVerbose )
SeeAlso []
***********************************************************************/
-Aig_Man_t * Dar_ManCompress2_no_z( Aig_Man_t * pAig, int fVerbose )
-//alias compress2 "b -l; rw -l; rf -l; b -l; rw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
+Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose )
+//alias rwsat "st; rw -l; b -l; rw -l; rf -l"
{
Aig_Man_t * pTemp;
- int fBalance = 0;
Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
@@ -128,71 +141,8 @@ Aig_Man_t * Dar_ManCompress2_no_z( Aig_Man_t * pAig, int fVerbose )
Dar_ManDefaultRwrParams( pParsRwr );
Dar_ManDefaultRefParams( pParsRef );
- pParsRwr->fVerbose = fVerbose;
- pParsRef->fVerbose = fVerbose;
-
- // rewrite
- Dar_ManRewrite( pAig, pParsRwr );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- // refactor
- Dar_ManRefactor( pAig, pParsRef );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- // balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
- Aig_ManStop( pTemp );
-
- // rewrite
- Dar_ManRewrite( pAig, pParsRwr );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- // refactor
- Dar_ManRefactor( pAig, pParsRef );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- // balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
- Aig_ManStop( pTemp );
-
- // rewrite
- Dar_ManRewrite( pAig, pParsRwr );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- // refactor
- Dar_ManRefactor( pAig, pParsRef );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
- return pAig;
-}
-
-/**Function*************************************************************
-
- Synopsis [Reproduces script "compress2".]
-
- Description []
-
- SideEffects [This procedure does not tighten level during restructuring.]
-
- SeeAlso []
-
-***********************************************************************/
-Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fVerbose )
-//alias compress2 "b -l; rw -l; rf -l; b -l; rw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
-{
- Aig_Man_t * pTemp;
- int fBalance = 0;
-
- Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
- Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
-
- Dar_ManDefaultRwrParams( pParsRwr );
- Dar_ManDefaultRefParams( pParsRef );
+ pParsRwr->fUpdateLevel = 0;
+ pParsRef->fUpdateLevel = 0;
pParsRwr->fVerbose = fVerbose;
pParsRef->fVerbose = fVerbose;
@@ -206,37 +156,19 @@ Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fVerbose )
Dar_ManRefactor( pAig, pParsRef );
pAig = Aig_ManDup( pTemp = pAig, 0 );
Aig_ManStop( pTemp );
-/*
- // balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
- Aig_ManStop( pTemp );
-*/
- // rewrite
- Dar_ManRewrite( pAig, pParsRwr );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
-
- pParsRwr->fUseZeros = 1;
- pParsRef->fUseZeros = 1;
-
- // rewrite
- Dar_ManRewrite( pAig, pParsRwr );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
- Aig_ManStop( pTemp );
// balance
- pAig = Dar_ManBalance( pTemp = pAig, fBalance );
- Aig_ManStop( pTemp );
-
- // refactor
- Dar_ManRefactor( pAig, pParsRef );
- pAig = Aig_ManDup( pTemp = pAig, 0 );
+ if ( fBalance )
+ {
+ pAig = Dar_ManBalance( pTemp = pAig, 0 );
Aig_ManStop( pTemp );
+ }
// rewrite
Dar_ManRewrite( pAig, pParsRwr );
pAig = Aig_ManDup( pTemp = pAig, 0 );
Aig_ManStop( pTemp );
+
return pAig;
}