Updating cost function in &save/&load.

This commit is contained in:
Alan Mishchenko 2021-05-08 14:00:32 -07:00
parent 174f27d981
commit 13a0bb97b5
2 changed files with 31 additions and 8 deletions

View File

@ -5059,6 +5059,10 @@ SOURCE=.\src\aig\gia\giaMini.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaMinLut.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaMuxes.c
# End Source File
# Begin Source File

View File

@ -39,6 +39,8 @@ ABC_NAMESPACE_IMPL_START
extern int Kit_TruthToGia( Gia_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory, Vec_Int_t * vLeaves, int fHash );
extern int Abc_RecToGia3( Gia_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vLeaves, int fHash );
extern void Gia_ManPrintGetMuxFanins( Gia_Man_t * p, Gia_Obj_t * pObj, int * pFanins );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
@ -219,20 +221,37 @@ void Gia_ManLutParams( Gia_Man_t * p, int * pnCurLuts, int * pnCurEdges, int * p
int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
*pnCurLuts = 0;
*pnCurEdges = 0;
*pnCurLevels = 0;
Gia_ManForEachLut( p, i )
{
int Level = 0;
if ( Gia_ObjLutIsMux(p, i) )
{
int pFanins[3];
if ( Gia_ObjLutSize(p, i) == 3 )
{
Gia_ManPrintGetMuxFanins( p, Gia_ManObj(p, i), pFanins );
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[0]]+1 );
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[1]] );
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[pFanins[2]] );
}
else if ( Gia_ObjLutSize(p, i) == 2 )
{
pObj = Gia_ManObj( p, i );
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId0(pObj, i)] );
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[Gia_ObjFaninId1(pObj, i)] );
}
*pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
*pnCurEdges++;
//nMuxF++;
continue;
}
(*pnCurLuts)++;
(*pnCurEdges) += Gia_ObjLutSize(p, i);
Gia_LutForEachFanin( p, i, iFan, k )
if ( Level < pLevels[iFan] )
Level = pLevels[iFan];
pLevels[i] = Level + 1;
pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
pLevels[i]++;
*pnCurLevels = Abc_MaxInt( *pnCurLevels, pLevels[i] );
}
*pnCurLevels = 0;
Gia_ManForEachCo( p, pObj, k )
if ( *pnCurLevels < pLevels[Gia_ObjFaninId0p(p, pObj)] )
*pnCurLevels = pLevels[Gia_ObjFaninId0p(p, pObj)];
ABC_FREE( pLevels );
}
}