mirror of https://github.com/YosysHQ/abc.git
Added command &struct for profiling non-dec structures.
This commit is contained in:
parent
dfb43b2f58
commit
27be3d0185
|
|
@ -1366,6 +1366,55 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
|
||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Function*************************************************************
|
||||||
|
|
||||||
|
Synopsis [Tests decomposition structures.]
|
||||||
|
|
||||||
|
Description []
|
||||||
|
|
||||||
|
SideEffects []
|
||||||
|
|
||||||
|
SeeAlso []
|
||||||
|
|
||||||
|
***********************************************************************/
|
||||||
|
void Gia_ManTestStruct( Gia_Man_t * p )
|
||||||
|
{
|
||||||
|
int nCutMax = 7;
|
||||||
|
int LutCount[8] = {0}, LutNDecomp[8] = {0};
|
||||||
|
int i, k, iFan, nFanins, Status;
|
||||||
|
Vec_Int_t * vLeaves;
|
||||||
|
word * pTruth;
|
||||||
|
|
||||||
|
vLeaves = Vec_IntAlloc( 100 );
|
||||||
|
Gia_ObjComputeTruthTableStart( p, nCutMax );
|
||||||
|
Gia_ManForEachLut( p, i )
|
||||||
|
{
|
||||||
|
nFanins = Gia_ObjLutSize(p, i);
|
||||||
|
assert( nFanins <= 7 );
|
||||||
|
LutCount[Abc_MaxInt(nFanins, 5)]++;
|
||||||
|
if ( nFanins <= 5 )
|
||||||
|
continue;
|
||||||
|
Vec_IntClear( vLeaves );
|
||||||
|
Gia_LutForEachFanin( p, i, iFan, k )
|
||||||
|
Vec_IntPush( vLeaves, iFan );
|
||||||
|
pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, i), vLeaves );
|
||||||
|
// check if it is decomposable
|
||||||
|
Status = If_CutPerformCheck07( NULL, (unsigned *)pTruth, 7, nFanins, NULL );
|
||||||
|
if ( Status == 1 )
|
||||||
|
continue;
|
||||||
|
LutNDecomp[nFanins]++;
|
||||||
|
if ( LutNDecomp[nFanins] > 10 )
|
||||||
|
continue;
|
||||||
|
Kit_DsdPrintFromTruth( (unsigned *)pTruth, nFanins ); printf( "\n" );
|
||||||
|
}
|
||||||
|
Gia_ObjComputeTruthTableStop( p );
|
||||||
|
|
||||||
|
printf( "LUT5 = %d ", LutCount[5] );
|
||||||
|
printf( "LUT6 = %d NonDec = %d (%.2f %%) ", LutCount[6], LutNDecomp[6], 100.0 * LutNDecomp[6]/Abc_MaxInt(LutCount[6], 1) );
|
||||||
|
printf( "LUT7 = %d NonDec = %d (%.2f %%) ", LutCount[7], LutNDecomp[7], 100.0 * LutNDecomp[7]/Abc_MaxInt(LutCount[7], 1) );
|
||||||
|
printf( "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
/// END OF FILE ///
|
/// END OF FILE ///
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -1024,6 +1024,8 @@ void Jf_ObjComputeCuts( Jf_Man_t * p, Gia_Obj_t * pObj, int fEdge )
|
||||||
assert( pSto[c]->pCut[0] <= nOldSupp );
|
assert( pSto[c]->pCut[0] <= nOldSupp );
|
||||||
if ( pSto[c]->pCut[0] < nOldSupp )
|
if ( pSto[c]->pCut[0] < nOldSupp )
|
||||||
pSto[c]->Sign = Jf_CutGetSign( pSto[c]->pCut );
|
pSto[c]->Sign = Jf_CutGetSign( pSto[c]->pCut );
|
||||||
|
if ( pSto[c]->iFunc >= (1 << 22) )
|
||||||
|
printf( "Hard limit on the number of different Boolean functions (2^21) is reached. Quitting...\n" ), exit(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -374,6 +374,7 @@ static int Abc_CommandAbc9Embed ( Abc_Frame_t * pAbc, int argc, cha
|
||||||
static int Abc_CommandAbc9If ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9If ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
static int Abc_CommandAbc9If2 ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9If2 ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
static int Abc_CommandAbc9Jf ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9Jf ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
|
static int Abc_CommandAbc9Struct ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
static int Abc_CommandAbc9Speedup ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9Speedup ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
static int Abc_CommandAbc9Era ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
static int Abc_CommandAbc9Era ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||||
|
|
@ -931,6 +932,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&if", Abc_CommandAbc9If, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&if", Abc_CommandAbc9If, 0 );
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&if2", Abc_CommandAbc9If2, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&if2", Abc_CommandAbc9If2, 0 );
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&jf", Abc_CommandAbc9Jf, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&jf", Abc_CommandAbc9Jf, 0 );
|
||||||
|
Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 0 );
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 );
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&speedup", Abc_CommandAbc9Speedup, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&speedup", Abc_CommandAbc9Speedup, 0 );
|
||||||
Cmd_CommandAdd( pAbc, "ABC9", "&era", Abc_CommandAbc9Era, 0 );
|
Cmd_CommandAdd( pAbc, "ABC9", "&era", Abc_CommandAbc9Era, 0 );
|
||||||
|
|
@ -29988,6 +29990,65 @@ usage:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**Function*************************************************************
|
||||||
|
|
||||||
|
Synopsis []
|
||||||
|
|
||||||
|
Description []
|
||||||
|
|
||||||
|
SideEffects []
|
||||||
|
|
||||||
|
SeeAlso []
|
||||||
|
|
||||||
|
***********************************************************************/
|
||||||
|
int Abc_CommandAbc9Struct( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
|
{
|
||||||
|
extern void Gia_ManTestStruct( Gia_Man_t * p );
|
||||||
|
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
|
||||||
|
int c, fVerbose;
|
||||||
|
pNtk = Abc_FrameReadNtk(pAbc);
|
||||||
|
// set defaults
|
||||||
|
fVerbose = 0;
|
||||||
|
Extra_UtilGetoptReset();
|
||||||
|
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
|
||||||
|
{
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case 'v':
|
||||||
|
fVerbose ^= 1;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
goto usage;
|
||||||
|
default:
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( pAbc->pGia == NULL )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Abc_CommandAbc9Struct(): There is no AIG to map.\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ( !Gia_ManHasMapping(pAbc->pGia) )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Abc_CommandAbc9Struct(): Mapping of the AIG is not defined.\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ( Gia_ManLutSizeMax(pAbc->pGia) >= 8 )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Abc_CommandAbc9Struct(): Can only handle nodes with less than 8 inputs.\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Gia_ManTestStruct( pAbc->pGia );
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
usage:
|
||||||
|
Abc_Print( -2, "usage: &struct [-vh]\n" );
|
||||||
|
Abc_Print( -2, "\t checks decomposition structures of the current mapping\n" );
|
||||||
|
Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" );
|
||||||
|
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**Function*************************************************************
|
/**Function*************************************************************
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue