mirror of https://github.com/YosysHQ/abc.git
Improvements to the QBF solver.
This commit is contained in:
parent
a8e1ba40b9
commit
f7fd329787
|
|
@ -11016,14 +11016,16 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
|
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
|
||||||
int c;
|
int c;
|
||||||
int nPars;
|
int nPars;
|
||||||
|
int nIters;
|
||||||
int fVerbose;
|
int fVerbose;
|
||||||
|
|
||||||
extern void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int fVerbose );
|
extern void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int nIters, int fVerbose );
|
||||||
// set defaults
|
// set defaults
|
||||||
nPars = -1;
|
nPars = -1;
|
||||||
|
nIters = -1;
|
||||||
fVerbose = 1;
|
fVerbose = 1;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Pvh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "PIvh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -11038,6 +11040,17 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( nPars < 0 )
|
if ( nPars < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
if ( globalUtilOptind >= argc )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" );
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
nIters = atoi(argv[globalUtilOptind]);
|
||||||
|
globalUtilOptind++;
|
||||||
|
if ( nIters < 0 )
|
||||||
|
goto usage;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
fVerbose ^= 1;
|
fVerbose ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -11068,19 +11081,20 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ( Abc_NtkIsStrash(pNtk) )
|
if ( Abc_NtkIsStrash(pNtk) )
|
||||||
Abc_NtkQbf( pNtk, nPars, fVerbose );
|
Abc_NtkQbf( pNtk, nPars, nIters, fVerbose );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pNtk = Abc_NtkStrash( pNtk, 0, 1, 0 );
|
pNtk = Abc_NtkStrash( pNtk, 0, 1, 0 );
|
||||||
Abc_NtkQbf( pNtk, nPars, fVerbose );
|
Abc_NtkQbf( pNtk, nPars, nIters, fVerbose );
|
||||||
Abc_NtkDelete( pNtk );
|
Abc_NtkDelete( pNtk );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: qbf [-P num] [-vh]\n" );
|
Abc_Print( -2, "usage: qbf [-PI num] [-vh]\n" );
|
||||||
Abc_Print( -2, "\t solves QBF problem EpVxM(p,x)\n" );
|
Abc_Print( -2, "\t solves QBF problem EpVxM(p,x)\n" );
|
||||||
Abc_Print( -2, "\t-P num : number of parameters p (should be the first PIs) [default = %d]\n", nPars );
|
Abc_Print( -2, "\t-P num : number of parameters p (should be the first PIs) [default = %d]\n", nPars );
|
||||||
|
Abc_Print( -2, "\t-I num : quit after the given iteration even if unsolved [default = %d]\n", nIters );
|
||||||
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -442,8 +442,8 @@ void Abc_GenFpga( char * pFileName, int nLutSize, int nLuts, int nVars )
|
||||||
fprintf( pFile, ".inputs" );
|
fprintf( pFile, ".inputs" );
|
||||||
for ( i = 0; i < nParsLut; i++ )
|
for ( i = 0; i < nParsLut; i++ )
|
||||||
{
|
{
|
||||||
if ( i % (1 << nLutSize) == 0 && i != (nLuts - 1) * (1 << nLutSize) )
|
// if ( i % (1 << nLutSize) == 0 && i != (nLuts - 1) * (1 << nLutSize) )
|
||||||
continue;
|
// continue;
|
||||||
fprintf( pFile, " pl%02d", i );
|
fprintf( pFile, " pl%02d", i );
|
||||||
}
|
}
|
||||||
fprintf( pFile, "\n" );
|
fprintf( pFile, "\n" );
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ static void Abc_NtkVectorClearVars( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues, int
|
||||||
static void Abc_NtkVectorPrintPars( Vec_Int_t * vPiValues, int nPars );
|
static void Abc_NtkVectorPrintPars( Vec_Int_t * vPiValues, int nPars );
|
||||||
static void Abc_NtkVectorPrintVars( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues, int nPars );
|
static void Abc_NtkVectorPrintVars( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues, int nPars );
|
||||||
|
|
||||||
|
extern int Abc_NtkDSat( Abc_Ntk_t * pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fAlignPol, int fAndOuts, int fVerbose );
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
/// FUNCTION DEFINITIONS ///
|
/// FUNCTION DEFINITIONS ///
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -58,7 +60,7 @@ static void Abc_NtkVectorPrintVars( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues, int
|
||||||
SeeAlso []
|
SeeAlso []
|
||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int fVerbose )
|
void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int nItersMax, int fVerbose )
|
||||||
{
|
{
|
||||||
Abc_Ntk_t * pNtkVer, * pNtkSyn, * pNtkSyn2, * pNtkTemp;
|
Abc_Ntk_t * pNtkVer, * pNtkSyn, * pNtkSyn2, * pNtkTemp;
|
||||||
Vec_Int_t * vPiValues;
|
Vec_Int_t * vPiValues;
|
||||||
|
|
@ -74,6 +76,15 @@ void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int fVerbose )
|
||||||
|
|
||||||
// initialize the synthesized network with 0000-combination
|
// initialize the synthesized network with 0000-combination
|
||||||
vPiValues = Vec_IntStart( Abc_NtkPiNum(pNtk) );
|
vPiValues = Vec_IntStart( Abc_NtkPiNum(pNtk) );
|
||||||
|
|
||||||
|
// create random init value
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
srand( time(NULL) );
|
||||||
|
for ( i = nPars; i < Abc_NtkPiNum(pNtk); i++ )
|
||||||
|
Vec_IntWriteEntry( vPiValues, i, rand() & 1 );
|
||||||
|
}
|
||||||
|
|
||||||
Abc_NtkVectorClearPars( vPiValues, nPars );
|
Abc_NtkVectorClearPars( vPiValues, nPars );
|
||||||
pNtkSyn = Abc_NtkMiterCofactor( pNtk, vPiValues );
|
pNtkSyn = Abc_NtkMiterCofactor( pNtk, vPiValues );
|
||||||
if ( fVerbose )
|
if ( fVerbose )
|
||||||
|
|
@ -147,6 +158,8 @@ clkV = clock() - clkV;
|
||||||
ABC_PRT( "Syn", clkS );
|
ABC_PRT( "Syn", clkS );
|
||||||
// ABC_PRT( "Ver", clkV );
|
// ABC_PRT( "Ver", clkV );
|
||||||
}
|
}
|
||||||
|
if ( nIters+1 == nItersMax )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
Abc_NtkDelete( pNtkSyn );
|
Abc_NtkDelete( pNtkSyn );
|
||||||
// report the results
|
// report the results
|
||||||
|
|
@ -159,6 +172,8 @@ clkV = clock() - clkV;
|
||||||
}
|
}
|
||||||
else if ( nIters == nIterMax )
|
else if ( nIters == nIterMax )
|
||||||
printf( "Unsolved after %d interations. ", nIters );
|
printf( "Unsolved after %d interations. ", nIters );
|
||||||
|
else if ( nIters == nItersMax )
|
||||||
|
printf( "Quit after %d interatios. ", nItersMax );
|
||||||
else
|
else
|
||||||
printf( "Implementation does not exist. " );
|
printf( "Implementation does not exist. " );
|
||||||
ABC_PRT( "Total runtime", clock() - clkTotal );
|
ABC_PRT( "Total runtime", clock() - clkTotal );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue