@@ -1642,21 +1642,40 @@ int Exa3_ManExactSynthesis( Bmc_EsPar_t * pPars )
16421642 else if ( status == GLUCOSE_UNDEC )
16431643 printf ( "The solver timed out after %d sec.\n" , pPars -> RuntimeLim );
16441644 else
1645- printf ( "The problem has no solution.\n" );
1645+ printf ( "The problem has no solution.\n" ), Res = 2 ;
16461646 printf ( "Added = %d. Tried = %d. " , p -> nUsed [1 ], p -> nUsed [0 ] );
16471647 Abc_PrintTime ( 1 , "Total runtime" , Abc_Clock () - clkTotal );
1648- if ( iMint == -1 )
1648+ if ( iMint == -1 && pPars -> fDumpBlif )
16491649 Exa3_ManDumpBlif ( p , fCompl );
16501650 if ( pPars -> pSymStr )
16511651 ABC_FREE ( pPars -> pTtStr );
16521652 Exa3_ManFree ( p );
16531653 return Res ;
16541654}
1655+
1656+ char * Exa_TimeStamp ()
1657+ {
1658+ static char Buffer [100 ];
1659+ time_t ltime ;
1660+ struct tm * tm_info ;
1661+
1662+ // Get the current time
1663+ time (& ltime );
1664+ tm_info = localtime (& ltime );
1665+
1666+ // Format the time as YYYY_MM_DD__HH_MM_SS
1667+ strftime (Buffer , sizeof (Buffer ), "%Y_%m_%d__%H_%M_%S" , tm_info );
1668+
1669+ return Buffer ;
1670+ }
1671+
16551672void Exa3_ManExactSynthesisRand ( Bmc_EsPar_t * pPars )
16561673{
1657- int i , k , nDecs = 0 , nWords = Abc_TtWordNum (pPars -> nVars );
1674+ abctime clk = Abc_Clock ();
1675+ int i , k , Status , nDecs [3 ] = {0 }, nWords = Abc_TtWordNum (pPars -> nVars );
16581676 word * pFun = ABC_ALLOC ( word , nWords );
16591677 unsigned Rand0 = Abc_Random (1 );
1678+ Vec_Str_t * vUndec = Vec_StrAlloc ( 100 );
16601679 for ( i = 0 ; i < pPars -> Seed ; i ++ )
16611680 Rand0 = Abc_Random (0 );
16621681 for ( i = 0 ; i < pPars -> nRandFuncs ; i ++ ) {
@@ -1680,11 +1699,31 @@ void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars )
16801699 printf ( "\n" );
16811700 if ( pPars -> fVerbose )
16821701 printf ( "Truth table : %s\n" , pPars -> pTtStr );
1683- nDecs += Exa3_ManExactSynthesis ( pPars );
1702+ Status = Exa3_ManExactSynthesis ( pPars );
1703+ nDecs [Status ]++ ;
1704+ if ( Status == 0 ) // undecided
1705+ Vec_StrPrintF ( vUndec , "%s\n" , pPars -> pTtStr );
16841706 ABC_FREE ( pPars -> pTtStr );
16851707 }
1686- printf ( "\nDecomposable are %d (out of %d) functions (%.2f %%).\n\n" , nDecs , pPars -> nRandFuncs , 100.0 * nDecs /pPars -> nRandFuncs );
1708+ printf ( "\n" );
1709+ printf ( "Decomposable are %6d (out of %6d) functions (%6.2f %%).\n" , nDecs [1 ], pPars -> nRandFuncs , 100.0 * nDecs [1 ]/pPars -> nRandFuncs );
1710+ printf ( "Non-decomposable are %6d (out of %6d) functions (%6.2f %%).\n" , nDecs [2 ], pPars -> nRandFuncs , 100.0 * nDecs [2 ]/pPars -> nRandFuncs );
1711+ printf ( "Undecided are %6d (out of %6d) functions (%6.2f %%).\n" , nDecs [0 ], pPars -> nRandFuncs , 100.0 * nDecs [0 ]/pPars -> nRandFuncs );
16871712 ABC_FREE ( pFun );
1713+ if ( nDecs [0 ] > 0 ) {
1714+ char filename [1000 ];
1715+ sprintf ( filename , "undecided_%d_out_of_F%d_with_N%d_M%d_K%d_U%d_S%d_T%d%s__%s.txt" ,
1716+ nDecs [0 ], pPars -> nRandFuncs , pPars -> nVars , pPars -> nNodes , pPars -> nLutSize ,
1717+ pPars -> nMintNum , pPars -> Seed , pPars -> RuntimeLim , pPars -> fLutCascade ? "_r" : "" , Exa_TimeStamp () );
1718+ FILE * pFile = fopen ( filename , "wb" );
1719+ if ( pFile ) {
1720+ fwrite ( Vec_StrArray (vUndec ), 1 , Vec_StrSize (vUndec ), pFile );
1721+ fclose ( pFile );
1722+ printf ( "The resulting undecided functions were written into file \"%s\".\n" , filename );
1723+ }
1724+ }
1725+ Abc_PrintTime ( 1 , "Total time" , Abc_Clock () - clk );
1726+ Vec_StrFree ( vUndec );
16881727}
16891728
16901729
0 commit comments