Skip to content

Commit 692b0c6

Browse files
committed
Printout of column multiplicity statistics.
1 parent 75adf12 commit 692b0c6

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

src/base/abci/abc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7771,7 +7771,7 @@ int Abc_CommandRunScript( Abc_Frame_t * pAbc, int argc, char ** argv )
77717771
strcat( pCommLine, pNumber );
77727772
strcat( pCommLine, pSpot+1 );
77737773
if ( fVerbose )
7774-
printf( "Iteration %3d : %s\n", c, pCommLine );
7774+
printf( "ITERATION %3d : %s\n", c, pCommLine );
77757775
if ( Cmd_CommandExecute(Abc_FrameGetGlobalFrame(), pCommLine) ) {
77767776
Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pCommLine );
77777777
goto usage;

src/base/abci/abcCas.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,12 @@ void Abc_LutCascadeDerive( word * p, int nVars, int nBVars, int Myu, word * pRem
656656
}
657657

658658
// performs decomposition of one stage
659-
static inline int Abc_LutCascadeDecStage( char * pGuide, int Iter, Vec_Wrd_t * vFuncs[3], Vec_Int_t * vVarIDs, int nRVars, int nRails, int nLutSize, int fVerbose, Vec_Wrd_t * vCas )
659+
static inline int Abc_LutCascadeDecStage( char * pGuide, int Iter, Vec_Wrd_t * vFuncs[3], Vec_Int_t * vVarIDs, int nRVars, int nRails, int nLutSize, int fVerbose, Vec_Wrd_t * vCas, int * pMyu )
660660
{
661-
extern word Abc_TtFindBVarsSVars( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose );
661+
extern word Abc_TtFindBVarsSVars( word * p, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu );
662662
assert( Vec_IntSize(vVarIDs) > nLutSize );
663663
assert( Vec_IntSize(vVarIDs) <= 24 );
664-
word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose );
664+
word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars( Vec_WrdArray(vFuncs[0]), Vec_IntSize(vVarIDs), nRVars, nRails, nLutSize, fVerbose, pMyu );
665665
if ( !pGuide && !Guide ) {
666666
if ( fVerbose )
667667
printf( "The function is not decomposable with %d rails.\n", nRails );
@@ -716,15 +716,15 @@ static inline int Abc_LutCascadeDecStage( char * pGuide, int Iter, Vec_Wrd_t * v
716716
Vec_IntShrink( vVarIDs, nFVars+nSVars+nEVars );
717717
return nEVars;
718718
}
719-
word * Abc_LutCascadeDec( char * pGuide, word * pTruth, int nVarsOrig, Vec_Int_t * vVarIDs, int nRails, int nLutSize, int nStages, int fVerbose, int * pnStages )
719+
word * Abc_LutCascadeDec( char * pGuide, word * pTruth, int nVarsOrig, Vec_Int_t * vVarIDs, int nRails, int nLutSize, int nStages, int fVerbose, int * pnStages, int * pMyu )
720720
{
721721
word * pRes = NULL; int i, nRVars = 0, nVars = Vec_IntSize(vVarIDs);
722722
Vec_Wrd_t * vFuncs[3] = { Vec_WrdStart(Abc_TtWordNum(nVars)), Vec_WrdAlloc(0), Vec_WrdAlloc(0) };
723723
Abc_TtCopy( Vec_WrdArray(vFuncs[0]), pTruth, Abc_TtWordNum(nVars), 0 );
724724
Vec_Wrd_t * vCas = Vec_WrdAlloc( 100 ); Vec_WrdPush( vCas, nVarsOrig );
725725
if ( pnStages ) *pnStages = 0;
726726
for ( i = 0; Vec_IntSize(vVarIDs) > nLutSize; i++ ) {
727-
nRVars = Abc_LutCascadeDecStage( pGuide, i, vFuncs, vVarIDs, nRVars, nRails, nLutSize, fVerbose, vCas );
727+
nRVars = Abc_LutCascadeDecStage( pGuide, i, vFuncs, vVarIDs, nRVars, nRails, nLutSize, fVerbose, vCas, pMyu );
728728
if ( i+2 > nStages ) {
729729
printf( "The length of the cascade (%d) exceeds the max allowed number of stages (%d).\n", i+2, nStages );
730730
nRVars = -1;
@@ -863,7 +863,7 @@ Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int
863863
printf( ".\n" );
864864
}
865865

866-
word * pLuts = Abc_LutCascadeDec( pGuide, pTruth1, Abc_NtkCiNum(pNtk), vVarIDs, nRails, nLutSize, nStages, fVerbose, NULL );
866+
word * pLuts = Abc_LutCascadeDec( pGuide, pTruth1, Abc_NtkCiNum(pNtk), vVarIDs, nRails, nLutSize, nStages, fVerbose, NULL, NULL );
867867
pNew = pLuts ? Abc_NtkLutCascadeFromLuts( pLuts, Abc_NtkCiNum(pNtk), pNtk, nLutSize, fVerbose ) : NULL;
868868
Vec_IntFree( vVarIDs );
869869

@@ -1379,7 +1379,7 @@ Vec_Wrd_t * Abc_NtkLutCasReadTruths( char * pFileName, int nVarsOrig )
13791379
void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int nStages, int nRails, int nIters, int Seed, int fVerbose, int fVeryVerbose )
13801380
{
13811381
abctime clkStart = Abc_Clock();
1382-
int i, Sum = 0, nStageCount, nTotalLuts = 0, nWords = Abc_TtWordNum(nVarsOrig);
1382+
int i, Sum = 0, nStageCount = 0, MyuMin = 0, nTotalLuts = 0, nWords = Abc_TtWordNum(nVarsOrig);
13831383
Vec_Wrd_t * vTruths = NULL;
13841384
if ( strstr(pFileName, ".txt") )
13851385
vTruths = Abc_NtkLutCasReadTruths( pFileName, nVarsOrig );
@@ -1397,7 +1397,7 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
13971397

13981398
printf( "Considering %d functions having %d variables from file \"%s\".\n", nFuncs, nVarsOrig, pFileName );
13991399
word * pCopy = ABC_ALLOC( word, nWords );
1400-
int Iter = 0, LutStats[100] = {0}, StageStats[100] = {0};
1400+
int Iter = 0, LutStats[50] = {0}, StageStats[50] = {0}, MyuStats[50] = {0};
14011401
Abc_Random(1);
14021402
for ( i = 0; i < Seed; i++ )
14031403
Abc_Random(0);
@@ -1409,7 +1409,7 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14091409
if ( fVeryVerbose )
14101410
printf( "\n" );
14111411
if ( fVerbose || fVeryVerbose )
1412-
printf( "Function %3d : ", i );
1412+
printf( "Function %4d : ", i );
14131413
if ( fVeryVerbose )
14141414
Abc_TtPrintHexRev( stdout, pTruth, nVarsOrig ), printf( "\n" );
14151415
//continue;
@@ -1424,7 +1424,7 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14241424
printf( "Decomposing %d-var function into %d-rail cascade of %d-LUTs.\n", nVars, nRails, nLutSize );
14251425
}
14261426

1427-
word * pLuts = Abc_LutCascadeDec( NULL, pTruth, nVarsOrig, vVarIDs, nRails, nLutSize, nStages, fVeryVerbose, &nStageCount );
1427+
word * pLuts = Abc_LutCascadeDec( NULL, pTruth, nVarsOrig, vVarIDs, nRails, nLutSize, nStages, fVeryVerbose, &nStageCount, &MyuMin );
14281428
Vec_IntFree( vVarIDs );
14291429
if ( pLuts == NULL ) {
14301430
if ( ++Iter < nIters ) {
@@ -1439,8 +1439,10 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14391439
Iter = 0;
14401440
Sum++;
14411441
nTotalLuts += Abc_LutCascadeCount(pLuts);
1442-
LutStats[Abc_LutCascadeCount(pLuts)]++;
1443-
StageStats[nStageCount]++;
1442+
if ( Abc_LutCascadeCount(pLuts) < 50 )
1443+
LutStats[Abc_LutCascadeCount(pLuts)]++;
1444+
if ( nStageCount < 50) StageStats[nStageCount]++;
1445+
if ( MyuMin < 50 ) MyuStats[MyuMin]++;
14441446
word * pTruth2 = Abc_LutCascadeTruth( pLuts, nVarsOrig );
14451447
if ( fVeryVerbose )
14461448
Abc_LutCascadePrint( pLuts );
@@ -1458,12 +1460,16 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14581460
}
14591461
ABC_FREE( pCopy );
14601462
Vec_WrdFree( vTruths );
1463+
printf( "Column multiplicity statistics for %d-rail LUT cascade:\n", nRails );
1464+
for ( i = 0; i < 50; i++ )
1465+
if ( MyuStats[i] )
1466+
printf( " %2d Myu : Function count = %8d (%6.2f %%)\n", i, StageStats[i], 100.0*StageStats[i]/nFuncs );
14611467
printf( "Level count statistics for %d-rail LUT cascade:\n", nRails );
1462-
for ( i = 0; i < 100; i++ )
1468+
for ( i = 0; i < 50; i++ )
14631469
if ( StageStats[i] )
14641470
printf( " %2d level : Function count = %8d (%6.2f %%)\n", i, StageStats[i], 100.0*StageStats[i]/nFuncs );
14651471
printf( "LUT count statistics for %d-rail LUT cascade:\n", nRails );
1466-
for ( i = 0; i < 100; i++ )
1472+
for ( i = 0; i < 50; i++ )
14671473
if ( LutStats[i] )
14681474
printf( " %2d LUT%d : Function count = %8d (%6.2f %%)\n", i, nLutSize, LutStats[i], 100.0*LutStats[i]/nFuncs );
14691475
printf( "Non-decomp : Function count = %8d (%6.2f %%)\n", nFuncs-Sum, 100.0*(nFuncs-Sum)/Abc_MaxInt(1, nFuncs) );

src/misc/util/utilBSet.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ word * Abc_LutCascade2( word * pFunc, int nVars, int nLutSize, int nLuts, int nR
996996
SeeAlso []
997997
998998
***********************************************************************/
999-
word Abc_TtFindBVarsSVars( word * pTruth, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose )
999+
word Abc_TtFindBVarsSVars( word * pTruth, int nVars, int nRVars, int nRails, int nLutSize, int fVerbose, int * pMyu )
10001000
{
10011001
Abc_BSEval_t * p = Abc_BSEvalAlloc();
10021002
int nPermVars = nVars-nRVars;
@@ -1026,6 +1026,7 @@ word Abc_TtFindBVarsSVars( word * pTruth, int nVars, int nRVars, int nRails, int
10261026
//printf("Function before: "); Abc_TtPrintHexRev( stdout, pCopy, nVars ); printf( "\n" );
10271027
int MyuMin = Abc_BSEvalBest( p, pCopy, pBest, nVars, nRVars, nVars-nLutSize, 0, pPermBest, 0 );
10281028
//printf("Function before: "); Abc_TtPrintHexRev( stdout, pCopy, nVars ); printf( "\n" );
1029+
if ( pMyu ) *pMyu = MyuMin;
10291030

10301031
if ( fVerbose ) {
10311032
printf( "Best perm: " );

src/sat/bmc/bmcMaj.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars )
16741674
}
16751675
pPars->pTtStr = ABC_CALLOC( char, pPars->nVars > 2 ? (1 << (pPars->nVars-2)) + 1 : 2 );
16761676
Extra_PrintHexadecimalString( pPars->pTtStr, (unsigned *)pFun, pPars->nVars );
1677-
printf( "\nIteration %d : ", i );
1677+
printf( "\nFunction %4d : ", i );
16781678
if ( pPars->nMintNum )
16791679
printf( "Random function has %d positive minterms.", pPars->nMintNum );
16801680
printf( "\n" );
@@ -1683,7 +1683,7 @@ void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars )
16831683
nDecs += Exa3_ManExactSynthesis( pPars );
16841684
ABC_FREE( pPars->pTtStr );
16851685
}
1686-
printf( "\nDecomposable are %d (out of %d) functions (%.2f %%).\n", nDecs, pPars->nRandFuncs, 100.0*nDecs/pPars->nRandFuncs );
1686+
printf( "\nDecomposable are %d (out of %d) functions (%.2f %%).\n\n", nDecs, pPars->nRandFuncs, 100.0*nDecs/pPars->nRandFuncs );
16871687
ABC_FREE( pFun );
16881688
}
16891689

0 commit comments

Comments
 (0)