@@ -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 )
13791379void 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 ) );
0 commit comments