mirror of https://github.com/YosysHQ/abc.git
Adding switch &qbf -q to quantify functional variables.
This commit is contained in:
parent
8de80e673a
commit
bae5e26fb5
|
|
@ -141,6 +141,45 @@ void Gia_QbfFree( Qbf_Man_t * p )
|
||||||
ABC_FREE( p );
|
ABC_FREE( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**Function*************************************************************
|
||||||
|
|
||||||
|
Synopsis [Create and add one cofactor.]
|
||||||
|
|
||||||
|
Description []
|
||||||
|
|
||||||
|
SideEffects []
|
||||||
|
|
||||||
|
SeeAlso []
|
||||||
|
|
||||||
|
***********************************************************************/
|
||||||
|
Gia_Man_t * Gia_QbfQuantify( Gia_Man_t * p, int nPars )
|
||||||
|
{
|
||||||
|
Gia_Man_t * pNew, * pTemp;
|
||||||
|
Gia_Obj_t * pObj;
|
||||||
|
int i, m, nMints = (1 << (Gia_ManPiNum(p) - nPars));
|
||||||
|
assert( Gia_ManPoNum(p) == 1 );
|
||||||
|
pNew = Gia_ManStart( Gia_ManObjNum(p) );
|
||||||
|
pNew->pName = Abc_UtilStrsav( p->pName );
|
||||||
|
Gia_ManHashAlloc( pNew );
|
||||||
|
Gia_ManConst0(p)->Value = 0;
|
||||||
|
for ( i = 0; i < nPars; i++ )
|
||||||
|
Gia_ManAppendCi(pNew);
|
||||||
|
for ( m = 0; m < nMints; m++ )
|
||||||
|
{
|
||||||
|
Gia_ManForEachPi( p, pObj, i )
|
||||||
|
pObj->Value = (i < nPars) ? Gia_Obj2Lit(pNew, Gia_ManPi(pNew, i)) : ((m >> (i - nPars)) & 1);
|
||||||
|
Gia_ManForEachAnd( p, pObj, i )
|
||||||
|
pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||||
|
Gia_ManForEachCo( p, pObj, i )
|
||||||
|
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
|
||||||
|
}
|
||||||
|
pNew = Gia_ManCleanup( pTemp = pNew );
|
||||||
|
Gia_ManStop( pTemp );
|
||||||
|
assert( Gia_ManPiNum(pNew) == nPars );
|
||||||
|
assert( Gia_ManPoNum(pNew) == nMints );
|
||||||
|
return pNew;
|
||||||
|
}
|
||||||
|
|
||||||
/**Function*************************************************************
|
/**Function*************************************************************
|
||||||
|
|
||||||
Synopsis [Create and add one cofactor.]
|
Synopsis [Create and add one cofactor.]
|
||||||
|
|
@ -350,7 +389,8 @@ int Gia_QbfSolve( Gia_Man_t * pGia, int nPars, int nIterLimit, int nConfLimit, i
|
||||||
Gia_QbfOnePattern( p, p->vValues );
|
Gia_QbfOnePattern( p, p->vValues );
|
||||||
assert( Vec_IntSize(p->vValues) == p->nPars );
|
assert( Vec_IntSize(p->vValues) == p->nPars );
|
||||||
// examine variables
|
// examine variables
|
||||||
// Gia_QbfLearnConstraint( p, p->vValues );
|
if ( i % 50 == 49 )
|
||||||
|
Gia_QbfLearnConstraint( p, p->vValues );
|
||||||
// Vec_IntPrintBinary( p->vValues ); printf( "\n" );
|
// Vec_IntPrintBinary( p->vValues ); printf( "\n" );
|
||||||
if ( nIterLimit && i+1 == nIterLimit ) { RetValue = -1; break; }
|
if ( nIterLimit && i+1 == nIterLimit ) { RetValue = -1; break; }
|
||||||
if ( nTimeOut && (Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = -1; break; }
|
if ( nTimeOut && (Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = -1; break; }
|
||||||
|
|
|
||||||
|
|
@ -35690,6 +35690,7 @@ usage:
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
{
|
{
|
||||||
|
extern Gia_Man_t * Gia_QbfQuantify( Gia_Man_t * p, int nPars );
|
||||||
extern void Gia_QbfDumpFile( Gia_Man_t * pGia, int nPars );
|
extern void Gia_QbfDumpFile( Gia_Man_t * pGia, int nPars );
|
||||||
extern int Gia_QbfSolve( Gia_Man_t * pGia, int nPars, int nIterLimit, int nConfLimit, int nTimeOut, int fVerbose );
|
extern int Gia_QbfSolve( Gia_Man_t * pGia, int nPars, int nIterLimit, int nConfLimit, int nTimeOut, int fVerbose );
|
||||||
int c, nPars = -1;
|
int c, nPars = -1;
|
||||||
|
|
@ -35697,9 +35698,10 @@ int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
int nConfLimit = 0;
|
int nConfLimit = 0;
|
||||||
int nTimeOut = 0;
|
int nTimeOut = 0;
|
||||||
int fDumpCnf = 0;
|
int fDumpCnf = 0;
|
||||||
|
int fQuantX = 0;
|
||||||
int fVerbose = 1;
|
int fVerbose = 1;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "PICTdvh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "PICTdqvh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -35750,6 +35752,9 @@ int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
case 'd':
|
case 'd':
|
||||||
fDumpCnf ^= 1;
|
fDumpCnf ^= 1;
|
||||||
break;
|
break;
|
||||||
|
case 'q':
|
||||||
|
fQuantX ^= 1;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
fVerbose ^= 1;
|
fVerbose ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -35779,6 +35784,18 @@ int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
Abc_Print( -1, "The number of parameter variables is invalid (should be > 0 and < PI num).\n" );
|
Abc_Print( -1, "The number of parameter variables is invalid (should be > 0 and < PI num).\n" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if ( fQuantX )
|
||||||
|
{
|
||||||
|
Gia_Man_t * pTemp;
|
||||||
|
if ( Gia_ManPiNum(pAbc->pGia) - nPars > 16 )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Cannot quantify more than 16 variables.\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pTemp = Gia_QbfQuantify( pAbc->pGia, nPars );
|
||||||
|
Abc_FrameUpdateGia( pAbc, pTemp );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if ( fDumpCnf )
|
if ( fDumpCnf )
|
||||||
Gia_QbfDumpFile( pAbc->pGia, nPars );
|
Gia_QbfDumpFile( pAbc->pGia, nPars );
|
||||||
else
|
else
|
||||||
|
|
@ -35786,13 +35803,14 @@ int Abc_CommandAbc9Qbf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: &qbf [-PICT num] [-dvh]\n" );
|
Abc_Print( -2, "usage: &qbf [-PICT num] [-dqvh]\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", nIterLimit );
|
Abc_Print( -2, "\t-I num : quit after the given iteration even if unsolved [default = %d]\n", nIterLimit );
|
||||||
Abc_Print( -2, "\t-C num : conflict limit per problem [default = %d]\n", nConfLimit );
|
Abc_Print( -2, "\t-C num : conflict limit per problem [default = %d]\n", nConfLimit );
|
||||||
Abc_Print( -2, "\t-T num : global timeout [default = %d]\n", nTimeOut );
|
Abc_Print( -2, "\t-T num : global timeout [default = %d]\n", nTimeOut );
|
||||||
Abc_Print( -2, "\t-d : toggle dumping QDIMACS file instead of solving [default = %s]\n", fDumpCnf? "yes": "no" );
|
Abc_Print( -2, "\t-d : toggle dumping QDIMACS file instead of solving [default = %s]\n", fDumpCnf? "yes": "no" );
|
||||||
|
Abc_Print( -2, "\t-q : toggle quantifying functions variables [default = %s]\n", fQuantX? "yes": "no" );
|
||||||
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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue