diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2009-01-18 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2009-01-18 08:01:00 -0800 |
commit | f936cc0680c98ffe51b3a1716c996072d5dbf76c (patch) | |
tree | 784a2a809fb6b972ec6a8e2758ab758ca590d01a /src/base/abci/abcCut.c | |
parent | c9ad5880cc61787dec6d018111b63023407ce0e6 (diff) | |
download | abc-f936cc0680c98ffe51b3a1716c996072d5dbf76c.tar.gz abc-f936cc0680c98ffe51b3a1716c996072d5dbf76c.tar.bz2 abc-f936cc0680c98ffe51b3a1716c996072d5dbf76c.zip |
Version abc90118
Diffstat (limited to 'src/base/abci/abcCut.c')
-rw-r--r-- | src/base/abci/abcCut.c | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/src/base/abci/abcCut.c b/src/base/abci/abcCut.c index d38f62d0..1c7459eb 100644 --- a/src/base/abci/abcCut.c +++ b/src/base/abci/abcCut.c @@ -39,6 +39,74 @@ static int Abc_NtkComputeArea( Abc_Ntk_t * pNtk, Cut_Man_t * p ); /**Function************************************************************* + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkCutsSubtractFanunt( Abc_Ntk_t * pNtk ) +{ + Abc_Obj_t * pObj, * pFan0, * pFan1, * pFanC; + int i, Counter = 0; + Abc_NtkForEachObj( pNtk, pObj, i ) + { + if ( !Abc_NodeIsMuxType(pObj) ) + continue; + pFanC = Abc_NodeRecognizeMux( pObj, &pFan1, &pFan0 ); + pFanC = Abc_ObjRegular(pFanC); + pFan0 = Abc_ObjRegular(pFan0); + assert( pFanC->vFanouts.nSize > 1 ); + pFanC->vFanouts.nSize--; + Counter++; + if ( Abc_NodeIsExorType(pObj) ) + { + assert( pFan0->vFanouts.nSize > 1 ); + pFan0->vFanouts.nSize--; + Counter++; + } + } + printf("Substracted %d fanouts\n", Counter ); +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkCutsAddFanunt( Abc_Ntk_t * pNtk ) +{ + Abc_Obj_t * pObj, * pFan0, * pFan1, * pFanC; + int i, Counter = 0; + Abc_NtkForEachObj( pNtk, pObj, i ) + { + if ( !Abc_NodeIsMuxType(pObj) ) + continue; + pFanC = Abc_NodeRecognizeMux( pObj, &pFan1, &pFan0 ); + pFanC = Abc_ObjRegular(pFanC); + pFan0 = Abc_ObjRegular(pFan0); + pFanC->vFanouts.nSize++; + Counter++; + if ( Abc_NodeIsExorType(pObj) ) + { + pFan0->vFanouts.nSize++; + Counter++; + } + } + printf("Added %d fanouts\n", Counter ); +} + +/**Function************************************************************* + Synopsis [Computes the cuts for the network.] Description [] @@ -61,6 +129,9 @@ Cut_Man_t * Abc_NtkCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams ) extern void Abc_NtkBalanceAttach( Abc_Ntk_t * pNtk ); extern void Abc_NtkBalanceDetach( Abc_Ntk_t * pNtk ); + if ( pParams->fAdjust ) + Abc_NtkCutsSubtractFanunt( pNtk ); + nTotal = nGood = nEqual = 0; assert( Abc_NtkIsStrash(pNtk) ); @@ -118,7 +189,7 @@ Cut_Man_t * Abc_NtkCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams ) Vec_PtrFree( vNodes ); Vec_IntFree( vChoices ); Cut_ManPrintStats( p ); -PRT( "TOTAL ", clock() - clk ); +PRT( "TOTAL", clock() - clk ); printf( "Area = %d.\n", Abc_NtkComputeArea( pNtk, p ) ); //Abc_NtkPrintCuts( p, pNtk, 0 ); // Cut_ManPrintStatsToFile( p, pNtk->pSpec, clock() - clk ); @@ -126,6 +197,8 @@ PRT( "TOTAL ", clock() - clk ); // temporary printout of stats if ( nTotal ) printf( "Total cuts = %d. Good cuts = %d. Ratio = %5.2f\n", nTotal, nGood, ((double)nGood)/nTotal ); + if ( pParams->fAdjust ) + Abc_NtkCutsAddFanunt( pNtk ); return p; } |