diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2022-06-23 07:48:10 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2022-06-23 07:48:10 -0700 |
commit | 8888e8e82e189a599a340e83ac8094bdef1ceb51 (patch) | |
tree | cec4d875ea855fda94a3fe20b6745306285858db /src/map/if/ifCut.c | |
parent | 8eb651c3d380168aeb752f90f16b37fff6d39142 (diff) | |
download | abc-8888e8e82e189a599a340e83ac8094bdef1ceb51.tar.gz abc-8888e8e82e189a599a340e83ac8094bdef1ceb51.tar.bz2 abc-8888e8e82e189a599a340e83ac8094bdef1ceb51.zip |
Experiments with the mapper.
Diffstat (limited to 'src/map/if/ifCut.c')
-rw-r--r-- | src/map/if/ifCut.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index 2d6889c0..079781e0 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -1494,6 +1494,68 @@ int If_CutCountTotalFanins( If_Man_t * p ) return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutFilter2_rec( If_Man_t * p, If_Obj_t * pObj, int LevelMin ) +{ + char * pVisited = Vec_StrEntryP(p->vMarks, pObj->Id); + if ( *pVisited ) + return *pVisited; + Vec_IntPush( p->vVisited2, pObj->Id ); + if ( (int)pObj->Level <= LevelMin ) + return (*pVisited = 1); + if ( If_CutFilter2_rec( p, pObj->pFanin0, LevelMin ) == 1 ) + return (*pVisited = 1); + if ( If_CutFilter2_rec( p, pObj->pFanin1, LevelMin ) == 1 ) + return (*pVisited = 1); + return (*pVisited = 2); +} +int If_CutFilter2( If_Man_t * p, If_Obj_t * pNode, If_Cut_t * pCut ) +{ + If_Obj_t * pLeaf, * pTemp; int i, Count = 0; +// printf( "Considering node %d and cut {", pNode->Id ); +// If_CutForEachLeaf( p, pCut, pLeaf, i ) +// printf( " %d", pLeaf->Id ); +// printf( " }\n" ); + If_CutForEachLeaf( p, pCut, pLeaf, i ) + { + int k, iObj, RetValue, nLevelMin = ABC_INFINITY; + Vec_IntClear( p->vVisited2 ); + If_CutForEachLeaf( p, pCut, pTemp, k ) + { + if ( pTemp == pLeaf ) + continue; + nLevelMin = Abc_MinInt( nLevelMin, (int)pTemp->Level ); + assert( Vec_StrEntry(p->vMarks, pTemp->Id) == 0 ); + Vec_StrWriteEntry( p->vMarks, pTemp->Id, 2 ); + Vec_IntPush( p->vVisited2, pTemp->Id ); + } + RetValue = If_CutFilter2_rec( p, pLeaf, nLevelMin ); + Vec_IntForEachEntry( p->vVisited2, iObj, k ) + Vec_StrWriteEntry( p->vMarks, iObj, 0 ); + if ( RetValue == 2 ) + { + Count++; + pCut->nLeaves--; + for ( k = i; k < (int)pCut->nLeaves; k++ ) + pCut->pLeaves[k] = pCut->pLeaves[k+1]; + i--; + } + } + //if ( Count ) + // printf( "%d", Count ); + return 0; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |