diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2006-07-01 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2006-07-01 08:01:00 -0700 |
commit | 616bb095f10c24f1f720efe89b7f39c670d114a3 (patch) | |
tree | 8761f65c9f81591008b1a59f04d473b5cae76a49 /src/opt | |
parent | 3814121784af2250e2d5f17173b209e74cb7ae45 (diff) | |
download | abc-616bb095f10c24f1f720efe89b7f39c670d114a3.tar.gz abc-616bb095f10c24f1f720efe89b7f39c670d114a3.tar.bz2 abc-616bb095f10c24f1f720efe89b7f39c670d114a3.zip |
Version abc60701
Diffstat (limited to 'src/opt')
-rw-r--r-- | src/opt/cut/cutNode.c | 31 | ||||
-rw-r--r-- | src/opt/rwr/rwrEva.c | 85 |
2 files changed, 116 insertions, 0 deletions
diff --git a/src/opt/cut/cutNode.c b/src/opt/cut/cutNode.c index b651dac9..6f7777ad 100644 --- a/src/opt/cut/cutNode.c +++ b/src/opt/cut/cutNode.c @@ -104,6 +104,36 @@ static inline void Cut_CutFilter( Cut_Man_t * p, Cut_Cut_t * pList ) /**Function************************************************************* + Synopsis [Checks equality of one cut.] + + Description [Returns 1 if the cut is removed.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Cut_CutFilterOneEqual( Cut_Man_t * p, Cut_List_t * pSuperList, Cut_Cut_t * pCut ) +{ + Cut_Cut_t * pTemp; + Cut_ListForEachCut( pSuperList->pHead[pCut->nLeaves], pTemp ) + { + // skip the non-contained cuts + if ( pCut->uSign != pTemp->uSign ) + continue; + // check containment seriously + if ( Cut_CutCheckDominance( pTemp, pCut ) ) + { + p->nCutsFilter++; + Cut_CutRecycle( p, pCut ); + return 1; + } + } + return 0; +} + +/**Function************************************************************* + Synopsis [Checks containment for one cut.] Description [Returns 1 if the cut is removed.] @@ -266,6 +296,7 @@ static inline int Cut_CutProcessTwo( Cut_Man_t * p, Cut_Cut_t * pCut0, Cut_Cut_t if ( p->pParams->fFilter ) { if ( Cut_CutFilterOne(p, pSuperList, pCut) ) +// if ( Cut_CutFilterOneEqual(p, pSuperList, pCut) ) return 0; if ( p->pParams->fSeq ) { diff --git a/src/opt/rwr/rwrEva.c b/src/opt/rwr/rwrEva.c index 9ae9c18c..4e5a3dc2 100644 --- a/src/opt/rwr/rwrEva.c +++ b/src/opt/rwr/rwrEva.c @@ -26,6 +26,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 ); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// @@ -64,6 +65,7 @@ int Rwr_NodeRewrite( Rwr_Man_t * p, Cut_Man_t * pManCut, Abc_Obj_t * pNode, int p->nNodesConsidered++; // get the required times Required = fUpdateLevel? Abc_NodeReadRequiredLevel(pNode) : ABC_INFINITY; + // get the node's cuts clk = clock(); pCut = (Cut_Cut_t *)Abc_NodeGetCutsRecursive( pManCut, pNode, 0, 0 ); @@ -77,6 +79,9 @@ clk = clock(); // consider only 4-input cuts if ( pCut->nLeaves < 4 ) continue; +// if ( pNode->Id == 82 ) +// Cut_CutPrint( pCut, 0 ), printf( "\n" ); + // get the fanin permutation uTruth = 0xFFFF & *Cut_CutReadTruth(pCut); pPerm = p->pPerms4[ p->pPerms[uTruth] ]; @@ -144,6 +149,27 @@ p->timeRes += clock() - clk; return -1; // printf( "%d", nNodesSaveCur - GainBest ); +/* + if ( GainBest > 0 ) + { + if ( Rwr_CutIsBoolean( pNode, p->vFanins ) ) + printf( "b" ); + else + { + printf( "Node %d : ", pNode->Id ); + Vec_PtrForEachEntry( p->vFanins, pFanin, i ) + printf( "%d ", Abc_ObjRegular(pFanin)->Id ); + printf( "a" ); + } + } +*/ +/* + if ( GainBest > 0 ) + if ( p->fCompl ) + printf( "c" ); + else + printf( "." ); +*/ // copy the leaves Vec_PtrForEachEntry( p->vFanins, pFanin, i ) @@ -221,6 +247,65 @@ Dec_Graph_t * Rwr_CutEvaluate( Rwr_Man_t * p, Abc_Obj_t * pRoot, Cut_Cut_t * pCu return pGraphBest; } + +/**Function************************************************************* + + Synopsis [Checks the type of the cut.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Rwr_CutIsBoolean_rec( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves, int fMarkA ) +{ + if ( Vec_PtrFind(vLeaves, pObj) >= 0 || Vec_PtrFind(vLeaves, Abc_ObjNot(pObj)) >= 0 ) + { + if ( fMarkA ) + pObj->fMarkA = 1; + else + pObj->fMarkB = 1; + return; + } + assert( !Abc_ObjIsCi(pObj) ); + Rwr_CutIsBoolean_rec( Abc_ObjFanin0(pObj), vLeaves, fMarkA ); + Rwr_CutIsBoolean_rec( Abc_ObjFanin1(pObj), vLeaves, fMarkA ); +} + +/**Function************************************************************* + + Synopsis [Checks the type of the cut.] + + Description [Returns 1(0) if the cut is Boolean (algebraic).] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Rwr_CutIsBoolean( Abc_Obj_t * pObj, Vec_Ptr_t * vLeaves ) +{ + Abc_Obj_t * pTemp; + int i, RetValue; + Vec_PtrForEachEntry( vLeaves, pTemp, i ) + { + pTemp = Abc_ObjRegular(pTemp); + assert( !pTemp->fMarkA && !pTemp->fMarkB ); + } + Rwr_CutIsBoolean_rec( Abc_ObjFanin0(pObj), vLeaves, 1 ); + Rwr_CutIsBoolean_rec( Abc_ObjFanin1(pObj), vLeaves, 0 ); + RetValue = 0; + Vec_PtrForEachEntry( vLeaves, pTemp, i ) + { + pTemp = Abc_ObjRegular(pTemp); + RetValue |= pTemp->fMarkA && pTemp->fMarkB; + pTemp->fMarkA = pTemp->fMarkB = 0; + } + return RetValue; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |