@@ -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 , int * pMyu )
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 nJRatio , 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 , int * pMyu );
661+ extern word Abc_TtFindBVarsSVars ( word * p , int nVars , int nRVars , int nRails , int nLutSize , int fVerbose , int * pMyu , int nJRatio );
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 , pMyu );
664+ word Guide = pGuide ? 0 : Abc_TtFindBVarsSVars ( Vec_WrdArray (vFuncs [0 ]), Vec_IntSize (vVarIDs ), nRVars , nRails , nLutSize , fVerbose , pMyu , nJRatio );
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 , int * pMyu )
719+ word * Abc_LutCascadeDec ( char * pGuide , word * pTruth , int nVarsOrig , Vec_Int_t * vVarIDs , int nRails , int nLutSize , int nStages , int nJRatio , 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 , i ? NULL : pMyu );
727+ nRVars = Abc_LutCascadeDecStage ( pGuide , i , vFuncs , vVarIDs , nRVars , nRails , nLutSize , nJRatio , fVerbose , vCas , i ? NULL : 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 ;
@@ -835,7 +835,7 @@ Abc_Ntk_t * Abc_NtkLutCascade( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int
835835 Gia_ManStop ( pGia );
836836 return pNew ;
837837}
838- Abc_Ntk_t * Abc_NtkLutCascade2 ( Abc_Ntk_t * pNtk , int nLutSize , int nStages , int nRails , int nIters , int Seed , int fVerbose , char * pGuide )
838+ Abc_Ntk_t * Abc_NtkLutCascade2 ( Abc_Ntk_t * pNtk , int nLutSize , int nStages , int nRails , int nIters , int nJRatio , int Seed , int fVerbose , char * pGuide )
839839{
840840 extern Gia_Man_t * Abc_NtkStrashToGia ( Abc_Ntk_t * pNtk );
841841 int i , nWords = Abc_TtWordNum (Abc_NtkCiNum (pNtk ));
@@ -845,7 +845,7 @@ Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nStages, int
845845 Abc_Random (1 );
846846 for ( i = 0 ; i < Seed ; i ++ )
847847 Abc_Random (0 );
848- for ( int Iter = 0 ; Iter < nIters ; Iter ++ ) {
848+ for ( int Iter = 0 ; Iter < nIters + nJRatio ; Iter ++ ) {
849849 word * pTruth1 = Gia_ObjComputeTruthTable ( pGia , Gia_ManCo (pGia , 0 ) );
850850 Abc_TtCopy ( pCopy , pTruth1 , nWords , 0 );
851851
@@ -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 , NULL );
866+ word * pLuts = Abc_LutCascadeDec ( pGuide , pTruth1 , Abc_NtkCiNum (pNtk ), vVarIDs , nRails , nLutSize , nStages , Iter >= nIters ? 1 : 0 , fVerbose , NULL , NULL );
867867 pNew = pLuts ? Abc_NtkLutCascadeFromLuts ( pLuts , Abc_NtkCiNum (pNtk ), pNtk , nLutSize , fVerbose ) : NULL ;
868868 Vec_IntFree ( vVarIDs );
869869
@@ -1376,7 +1376,7 @@ Vec_Wrd_t * Abc_NtkLutCasReadTruths( char * pFileName, int nVarsOrig )
13761376 SeeAlso []
13771377
13781378***********************************************************************/
1379- void Abc_NtkLutCascadeFile ( char * pFileName , int nVarsOrig , int nLutSize , int nStages , int nRails , int nIters , int Seed , int fVerbose , int fVeryVerbose )
1379+ void Abc_NtkLutCascadeFile ( char * pFileName , int nVarsOrig , int nLutSize , int nStages , int nRails , int nIters , int nJRatio , int Seed , int fVerbose , int fVeryVerbose , int fPrintMyu )
13801380{
13811381 abctime clkStart = Abc_Clock ();
13821382 int i , Sum = 0 , nStageCount = 0 , MyuMin = 0 , nTotalLuts = 0 , nWords = Abc_TtWordNum (nVarsOrig );
@@ -1395,12 +1395,12 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
13951395 return ;
13961396 }
13971397
1398- printf ( "Considering %d functions having %d variables from file \"%s\".\n" , nFuncs , nVarsOrig , pFileName );
1399- word * pCopy = ABC_ALLOC ( word , nWords );
1400- int Iter = 0 , LutStats [50 ] = {0 }, StageStats [50 ] = {0 }, MyuStats [50 ] = {0 };
14011398 Abc_Random (1 );
14021399 for ( i = 0 ; i < Seed ; i ++ )
14031400 Abc_Random (0 );
1401+ printf ( "Considering %d functions having %d variables from file \"%s\".\n" , nFuncs , nVarsOrig , pFileName );
1402+ word * pCopy = ABC_ALLOC ( word , nWords );
1403+ int Iter = 0 , IterReal = 0 , LutStats [50 ] = {0 }, StageStats [50 ] = {0 }, MyuStats [50 ] = {0 };
14041404 for ( i = 0 ; i < nFuncs ; i ++ )
14051405 {
14061406 word * pTruth = Vec_WrdEntryP ( vTruths , i * nWords );
@@ -1424,11 +1424,11 @@ 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 , & MyuMin );
1427+ word * pLuts = Abc_LutCascadeDec ( NULL , pTruth , nVarsOrig , vVarIDs , nRails , nLutSize , nStages , ( int )( Iter >= nIters ), fVeryVerbose , & nStageCount , & MyuMin );
14281428 Vec_IntFree ( vVarIDs );
1429- if ( MyuMin < 50 ) MyuStats [MyuMin ]++ ;
1429+ if ( MyuMin < 50 ) MyuStats [MyuMin ]++ , IterReal ++ ;
14301430 if ( pLuts == NULL ) {
1431- if ( ++ Iter < nIters ) {
1431+ if ( ++ Iter < nIters + nJRatio ) {
14321432 i -- ;
14331433 continue ;
14341434 }
@@ -1460,10 +1460,12 @@ void Abc_NtkLutCascadeFile( char * pFileName, int nVarsOrig, int nLutSize, int n
14601460 }
14611461 ABC_FREE ( pCopy );
14621462 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 , MyuStats [i ], 100.0 * MyuStats [i ]/nFuncs /nIters );
1463+ if ( fPrintMyu ) {
1464+ printf ( "Column multiplicity statistics for %d-rail LUT cascade:\n" , nRails );
1465+ for ( i = 0 ; i < 50 ; i ++ )
1466+ if ( MyuStats [i ] )
1467+ printf ( " %2d Myu : Function count = %8d (%6.2f %%)\n" , i , MyuStats [i ], 100.0 * MyuStats [i ]/nFuncs /IterReal );
1468+ }
14671469 printf ( "Level count statistics for %d-rail LUT cascade:\n" , nRails );
14681470 for ( i = 0 ; i < 50 ; i ++ )
14691471 if ( StageStats [i ] )
0 commit comments