mirror of https://github.com/YosysHQ/abc.git
New TFI/TFO profiling code.
This commit is contained in:
parent
3aece535b9
commit
05ca4afb77
|
|
@ -630,6 +630,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p )
|
||||||
ITEM(oXOR) \
|
ITEM(oXOR) \
|
||||||
ITEM(oMUXc) \
|
ITEM(oMUXc) \
|
||||||
ITEM(oMUXd) \
|
ITEM(oMUXd) \
|
||||||
|
ITEM(oAND) \
|
||||||
ITEM(oANDn) \
|
ITEM(oANDn) \
|
||||||
ITEM(oANDp) \
|
ITEM(oANDp) \
|
||||||
ITEM(GIA_END)
|
ITEM(GIA_END)
|
||||||
|
|
@ -684,15 +685,16 @@ int Gia_ManEncodeFanin( Gia_Man_t * p, int iLit )
|
||||||
if ( Gia_ObjIsMux(p, pObj) )
|
if ( Gia_ObjIsMux(p, pObj) )
|
||||||
return iMUX;
|
return iMUX;
|
||||||
assert( Gia_ObjIsAnd(pObj) );
|
assert( Gia_ObjIsAnd(pObj) );
|
||||||
if ( Abc_LitIsCompl(iLit) )
|
return iAND;
|
||||||
return iANDn;
|
// if ( Abc_LitIsCompl(iLit) )
|
||||||
else
|
// return iANDn;
|
||||||
return iANDp;
|
// else
|
||||||
|
// return iANDp;
|
||||||
}
|
}
|
||||||
// find fanout code
|
// find fanout code
|
||||||
int Gia_ManEncodeFanout( Gia_Man_t * p, Gia_Obj_t * pObj, int i )
|
int Gia_ManEncodeFanout( Gia_Man_t * p, Gia_Obj_t * pObj, int i )
|
||||||
{
|
{
|
||||||
int iLit;
|
// int iLit;
|
||||||
if ( Gia_ObjIsPo(p, pObj) )
|
if ( Gia_ObjIsPo(p, pObj) )
|
||||||
return oPO;
|
return oPO;
|
||||||
if ( Gia_ObjIsCo(pObj) )
|
if ( Gia_ObjIsCo(pObj) )
|
||||||
|
|
@ -702,11 +704,12 @@ int Gia_ManEncodeFanout( Gia_Man_t * p, Gia_Obj_t * pObj, int i )
|
||||||
if ( Gia_ObjIsMux(p, pObj) )
|
if ( Gia_ObjIsMux(p, pObj) )
|
||||||
return i == 2 ? oMUXc : oMUXd;
|
return i == 2 ? oMUXc : oMUXd;
|
||||||
assert( Gia_ObjIsAnd(pObj) );
|
assert( Gia_ObjIsAnd(pObj) );
|
||||||
iLit = i ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj);
|
return oAND;
|
||||||
if ( Abc_LitIsCompl(iLit) )
|
// iLit = i ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj);
|
||||||
return oANDn;
|
// if ( Abc_LitIsCompl(iLit) )
|
||||||
else
|
// return oANDn;
|
||||||
return oANDp;
|
// else
|
||||||
|
// return oANDp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gia_ManProfileCollect( Gia_Man_t * p, int i, Vec_Int_t * vCode, Vec_Int_t * vCodeOffsets, Vec_Int_t * vArray )
|
void Gia_ManProfileCollect( Gia_Man_t * p, int i, Vec_Int_t * vCode, Vec_Int_t * vCodeOffsets, Vec_Int_t * vArray )
|
||||||
|
|
@ -723,7 +726,7 @@ void Gia_ManProfilePrintOne( Gia_Man_t * p, int i, Vec_Int_t * vArray )
|
||||||
int k, nFanins, nFanouts;
|
int k, nFanins, nFanouts;
|
||||||
if ( Gia_ObjIsRi(p, pObj) )
|
if ( Gia_ObjIsRi(p, pObj) )
|
||||||
return;
|
return;
|
||||||
nFanins = Gia_ObjFaninNum(p, pObj);
|
nFanins = Gia_ObjIsRo(p, pObj) ? 1 : Gia_ObjFaninNum(p, pObj);
|
||||||
nFanouts = Gia_ObjFanoutNum(p, pObj);
|
nFanouts = Gia_ObjFanoutNum(p, pObj);
|
||||||
|
|
||||||
printf( "%6d : ", i );
|
printf( "%6d : ", i );
|
||||||
|
|
@ -734,8 +737,21 @@ void Gia_ManProfilePrintOne( Gia_Man_t * p, int i, Vec_Int_t * vArray )
|
||||||
printf( " ->" );
|
printf( " ->" );
|
||||||
printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, 0)] );
|
printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, 0)] );
|
||||||
printf( " ->" );
|
printf( " ->" );
|
||||||
for ( k = 0; k < nFanouts; k++ )
|
if ( nFanouts > 0 )
|
||||||
printf( " %5s", GIA_TYPE_STRINGS[Vec_IntEntry(vArray, k + 1 + nFanins)] );
|
{
|
||||||
|
int Count = 1, Prev = Vec_IntEntry(vArray, 1 + nFanins);
|
||||||
|
for ( k = 1; k < nFanouts; k++ )
|
||||||
|
{
|
||||||
|
if ( Prev != Vec_IntEntry(vArray, k + 1 + nFanins) )
|
||||||
|
{
|
||||||
|
printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] );
|
||||||
|
Prev = Vec_IntEntry(vArray, k + 1 + nFanins);
|
||||||
|
Count = 0;
|
||||||
|
}
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
printf( " %d x %s", Count, GIA_TYPE_STRINGS[Prev] );
|
||||||
|
}
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -785,9 +801,18 @@ void Gia_ManProfileStructuresInt( Gia_Man_t * p, int nLimit, int fVerbose )
|
||||||
Vec_IntPush( vCode, Gia_ManEncodeObj(p, i) );
|
Vec_IntPush( vCode, Gia_ManEncodeObj(p, i) );
|
||||||
if ( nFanins == 3 )
|
if ( nFanins == 3 )
|
||||||
{
|
{
|
||||||
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
|
int iLit = Gia_ObjFaninLit2p(p, pObj);
|
||||||
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) );
|
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Abc_LitRegular(iLit)) );
|
||||||
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit2p(p, pObj)) );
|
if ( Abc_LitIsCompl(iLit) )
|
||||||
|
{
|
||||||
|
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
|
||||||
|
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit1p(p, pObj)) );
|
||||||
|
Vec_IntPush( vCode, Gia_ManEncodeFanin(p, Gia_ObjFaninLit0p(p, pObj)) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( nFanins == 2 )
|
else if ( nFanins == 2 )
|
||||||
{
|
{
|
||||||
|
|
@ -856,7 +881,6 @@ void Gia_ManProfileStructuresInt( Gia_Man_t * p, int nLimit, int fVerbose )
|
||||||
// print the object
|
// print the object
|
||||||
Gia_ManProfileCollect( p, Vec_IntEntry(vFirst, pPerm[i]), vCode, vCodeOffsets, vArray );
|
Gia_ManProfileCollect( p, Vec_IntEntry(vFirst, pPerm[i]), vCode, vCodeOffsets, vArray );
|
||||||
Gia_ManProfilePrintOne( p, Vec_IntEntry(vFirst, pPerm[i]), vArray );
|
Gia_ManProfilePrintOne( p, Vec_IntEntry(vFirst, pPerm[i]), vArray );
|
||||||
//printf( "\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
|
||||||
|
|
@ -26727,9 +26727,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
{
|
{
|
||||||
extern void Gia_ManMuxProfiling( Gia_Man_t * p );
|
extern void Gia_ManMuxProfiling( Gia_Man_t * p );
|
||||||
extern void Gia_ManProfileStructures( Gia_Man_t * p, int nLimit, int fVerbose );
|
extern void Gia_ManProfileStructures( Gia_Man_t * p, int nLimit, int fVerbose );
|
||||||
int c, nLimit = 0, fVerbose = 0;
|
int c, fMuxes = 0, nLimit = 0, fVerbose = 0;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Nvh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "Nmvh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -26744,6 +26744,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( nLimit < 0 )
|
if ( nLimit < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
fMuxes ^= 1;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
fVerbose ^= 1;
|
fVerbose ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -26758,16 +26761,17 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): There is no AIG.\n" );
|
Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): There is no AIG.\n" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ( nLimit == 0 )
|
if ( fMuxes )
|
||||||
Gia_ManMuxProfiling( pAbc->pGia );
|
Gia_ManMuxProfiling( pAbc->pGia );
|
||||||
else
|
else
|
||||||
Gia_ManProfileStructures( pAbc->pGia, nLimit, fVerbose );
|
Gia_ManProfileStructures( pAbc->pGia, nLimit, fVerbose );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: &profile [-N num] [-vh]\n" );
|
Abc_Print( -2, "usage: &profile [-N num] [-mvh]\n" );
|
||||||
Abc_Print( -2, "\t profile MUXes appearing in the design\n" );
|
Abc_Print( -2, "\t profile gate structures appearing in the AIG\n" );
|
||||||
Abc_Print( -2, "\t-N num : limit on class size to show [default = %d]\n", nLimit );
|
Abc_Print( -2, "\t-N num : limit on class size to show [default = %d]\n", nLimit );
|
||||||
|
Abc_Print( -2, "\t-m : toggle profiling MUX structures [default = %s]\n", fMuxes? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue