Skip to content

Commit 0e11776

Browse files
committed
Performance improvement.
1 parent c62bf1b commit 0e11776

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/base/abci/abcPart.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,18 +1613,18 @@ Vec_Ptr_t * Abc_NtkDeriveWinOutsAll( Abc_Ntk_t * pNtk, Vec_Ptr_t * vvNodes )
16131613
Vec_PtrPush( vvOuts, Abc_NtkDeriveWinOuts(pNtk, vNodes) );
16141614
return vvOuts;
16151615
}
1616-
void Abc_NtkPermuteLevel( Abc_Ntk_t * pNtk )
1616+
void Abc_NtkPermuteLevel( Abc_Ntk_t * pNtk, int Level )
16171617
{
1618-
Abc_Obj_t * pObj, * pFanin; int i, k;
1619-
Abc_NtkLevelReverse( pNtk );
1620-
Abc_NtkForEachNode( pNtk, pObj, i )
1621-
{
1622-
int LevelMin = 0, LevelMax = Abc_ObjLevel(pObj);
1623-
Abc_ObjForEachFanin( pObj, pFanin, k )
1624-
LevelMin = Abc_MaxInt( LevelMin, Abc_ObjLevel(pFanin) );
1618+
Abc_Obj_t * pObj, * pNext; int i, k;
1619+
Abc_NtkForEachNode( pNtk, pObj, i ) {
1620+
int LevelMin = Abc_ObjLevel(pObj), LevelMax = Level + 1;
1621+
Abc_ObjForEachFanout( pObj, pNext, k )
1622+
if ( Abc_ObjIsNode(pNext) )
1623+
LevelMax = Abc_MinInt( LevelMax, Abc_ObjLevel(pNext) );
16251624
assert( LevelMin < LevelMax );
1626-
// randomly set level between LevelMin + 1 and LevelMax
1627-
pObj->Level = LevelMin + 1 + (Abc_Random(0) % (LevelMax - LevelMin));
1625+
// randomly set level between LevelMin and LevelMax-1
1626+
pObj->Level = LevelMin + (Abc_Random(0) % (LevelMax - LevelMin));
1627+
assert( pObj->Level < LevelMax );
16281628
}
16291629
}
16301630
Vec_Int_t * Abc_NtkCollectObjectsPointedTo( Abc_Ntk_t * pNtk, int Level )
@@ -1820,7 +1820,7 @@ Vec_Ptr_t * Abc_NtkExtractPartitions( Abc_Ntk_t * pNtk, int Iter, int nSuppMax,
18201820
int LevelMax = iUseRevL ? Abc_NtkLevelR(pNtk) : Abc_NtkLevel(pNtk);
18211821
int LevelCut = Iter % 3 == 0 ? 0 : LevelMax > 8 ? 2 + (Abc_Random(0) % (LevelMax - 4)) : 0;
18221822
//printf( "Using %s cut level %d (out of %d)\n", iUseRevL ? "reverse": "direct", LevelCut, LevelMax );
1823-
//Abc_NtkPermuteLevel( pNtk );
1823+
Abc_NtkPermuteLevel( pNtk, LevelMax );
18241824
Vec_Wec_t * vStore = Vec_WecStart( LevelMax+1 );
18251825
Vec_Wec_t * vSupps = Abc_NtkCollectObjectsWithSuppLimit( pNtk, LevelCut, nSuppMax );
18261826
Vec_Ptr_t * vIns = Abc_NtkDeriveWinInsAll( vSupps, nSuppMax, pNtk );

0 commit comments

Comments
 (0)