Commit 023e92c4 by Alan Mishchenko

Improvements to Boolean matching.

parent 69827a5a
......@@ -16042,9 +16042,11 @@ usage:
***********************************************************************/
int Abc_CommandDsdTune( Abc_Frame_t * pAbc, int argc, char ** argv )
{
int c, fVerbose = 0, fFast = 0, fAdd = 0, fSpec = 0, LutSize = 0;
char * pStruct = NULL;
int c, fVerbose = 0, fFast = 0, fAdd = 0, fSpec = 0, LutSize = 0, nConfls = 10000;
If_DsdMan_t * pDsdMan = (If_DsdMan_t *)Abc_FrameReadManDsd();
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Kfasvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "KCSfasvh" ) ) != EOF )
{
switch ( c )
{
......@@ -16059,6 +16061,24 @@ int Abc_CommandDsdTune( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( LutSize < 4 || LutSize > 6 )
goto usage;
break;
case 'C':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-C\" should be followed by a floating point number.\n" );
goto usage;
}
nConfls = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
break;
case 'S':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-S\" should be followed by string.\n" );
goto usage;
}
pStruct = argv[globalUtilOptind];
globalUtilOptind++;
break;
case 'f':
fFast ^= 1;
break;
......@@ -16082,17 +16102,22 @@ int Abc_CommandDsdTune( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "The DSD manager is not started.\n" );
return 0;
}
If_DsdManTune( (If_DsdMan_t *)Abc_FrameReadManDsd(), LutSize, fFast, fAdd, fSpec, fVerbose );
if ( pStruct )
Id_DsdManTuneStr( pDsdMan, pStruct, nConfls, fVerbose );
else
If_DsdManTune( pDsdMan, LutSize, fFast, fAdd, fSpec, fVerbose );
return 0;
usage:
Abc_Print( -2, "usage: dsd_tune [-K num] [-fasvh]\n" );
Abc_Print( -2, "usage: dsd_tune [-KC num] [-fasvh] [-S str]\n" );
Abc_Print( -2, "\t tunes DSD manager for the given LUT size\n" );
Abc_Print( -2, "\t-K num : LUT size used for tuning [default = %d]\n", LutSize );
Abc_Print( -2, "\t-C num : the maximum number of conflicts [default = %d]\n", nConfls );
Abc_Print( -2, "\t-f : toggles using fast check [default = %s]\n", fFast? "yes": "no" );
Abc_Print( -2, "\t-a : toggles adding tuning to the current one [default = %s]\n", fAdd? "yes": "no" );
Abc_Print( -2, "\t-s : toggles using specialized check [default = %s]\n", fSpec? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-S str : string representing programmable cell [default = %s]\n", pStruct ? pStruct : "not used" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
......@@ -539,6 +539,7 @@ extern If_DsdMan_t * If_DsdManAlloc( int nVars, int nLutSize );
extern void If_DsdManAllocIsops( If_DsdMan_t * p, int nLutSize );
extern void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int Number, int Support, int fOccurs, int fTtDump, int fVerbose );
extern void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose );
extern void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int fVerbose );
extern void If_DsdManFree( If_DsdMan_t * p, int fVerbose );
extern void If_DsdManSave( If_DsdMan_t * p, char * pFileName );
extern If_DsdMan_t * If_DsdManLoad( char * pFileName );
......
......@@ -2253,6 +2253,71 @@ void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec
}
typedef struct Ifn_Ntk_t_ Ifn_Ntk_t;
extern Ifn_Ntk_t * Ifn_NtkParse( char * pStr );
extern int Ifn_NtkMatch( Ifn_Ntk_t * p, word * pTruth, int nVars, int nConfls, int fVerbose, int fVeryVerbose );
extern void Ifn_NtkPrint( Ifn_Ntk_t * p );
extern int Ifn_NtkLutSizeMax( Ifn_Ntk_t * p );
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int fVerbose )
{
int fVeryVerbose = 0;
ProgressBar * pProgress = NULL;
If_DsdObj_t * pObj;
word * pTruth;
int i, nVars, Value, LutSize;
abctime clk = Abc_Clock();
// parse the structure
Ifn_Ntk_t * pNtk = Ifn_NtkParse( pStruct );
LutSize = Ifn_NtkLutSizeMax(pNtk);
// print
if ( fVerbose )
{
printf( "Considering programmable cell: " );
Ifn_NtkPrint( pNtk );
printf( "Largest LUT size = %d.\n", LutSize );
}
// clean the attributes
If_DsdVecForEachObj( &p->vObjs, pObj, i )
pObj->fMark = 0;
pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(&p->vObjs) );
If_DsdVecForEachObj( &p->vObjs, pObj, i )
{
Extra_ProgressBarUpdate( pProgress, i, NULL );
nVars = If_DsdObjSuppSize(pObj);
if ( nVars <= LutSize )
continue;
pTruth = If_DsdManComputeTruth( p, Abc_Var2Lit(i, 0), NULL );
if ( fVeryVerbose )
Dau_DsdPrintFromTruth( pTruth, nVars );
if ( fVerbose )
printf( "%6d : %2d ", i, nVars );
Value = Ifn_NtkMatch( pNtk, pTruth, nVars, nConfls, fVerbose, fVeryVerbose );
if ( fVeryVerbose )
printf( "\n" );
if ( Value == 0 )
continue;
If_DsdVecObjSetMark( &p->vObjs, i );
}
Extra_ProgressBarStop( pProgress );
printf( "Finished matching %d functions. ", Vec_PtrSize(&p->vObjs) );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
if ( fVeryVerbose )
If_DsdManPrintDistrib( p );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment