Commit cc7d3e37 by Alan Mishchenko

Added dumping QDIMACS files in command 'qbf'.

parent b7cd2278
...@@ -75,39 +75,41 @@ void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int nItersMax, int fDumpCnf, int f ...@@ -75,39 +75,41 @@ void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int nItersMax, int fDumpCnf, int f
// assert( Abc_NtkPiNum(pNtk)-nPars < 32 ); // assert( Abc_NtkPiNum(pNtk)-nPars < 32 );
nInputs = Abc_NtkPiNum(pNtk) - nPars; nInputs = Abc_NtkPiNum(pNtk) - nPars;
Abc_ObjXorFaninC( Abc_NtkPo(pNtk,0), 0 );
if ( fDumpCnf ) if ( fDumpCnf )
{ {
// original problem: \exists p \forall x \exists y. M(p,x,y)
// negated problem: \forall p \exists x \exists y. !M(p,x,y)
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters ); extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
Aig_Man_t * pMan = Abc_NtkToDar( pNtk, 0, 0 ); Aig_Man_t * pMan = Abc_NtkToDar( pNtk, 0, 0 );
Cnf_Dat_t * pCnf = Cnf_DeriveSimple( pMan, 0 ); Cnf_Dat_t * pCnf = Cnf_Derive( pMan, 0 );
Vec_Int_t * vVarMap, * vForAlls, * vExists; Vec_Int_t * vVarMap, * vForAlls, * vExists;
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
char * pFileName;
int i, Entry; int i, Entry;
// create var map // create var map
vVarMap = Vec_IntStart( pCnf->nVars ); vVarMap = Vec_IntStart( pCnf->nVars );
Aig_ManForEachCi( pMan, pObj, i ) Aig_ManForEachCi( pMan, pObj, i )
if ( i >= nPars ) if ( i < nPars )
Vec_IntWriteEntry( vVarMap, pCnf->pVarNums[Aig_ObjId(pObj)], 1 ); Vec_IntWriteEntry( vVarMap, pCnf->pVarNums[Aig_ObjId(pObj)], 1 );
// create various maps // create various maps
vForAlls = Vec_IntAlloc( nPars );
vExists = Vec_IntAlloc( Abc_NtkPiNum(pNtk) - nPars ); vExists = Vec_IntAlloc( Abc_NtkPiNum(pNtk) - nPars );
vForAlls = Vec_IntAlloc( pCnf->nVars );
Vec_IntForEachEntry( vVarMap, Entry, i ) Vec_IntForEachEntry( vVarMap, Entry, i )
if ( Entry ) if ( Entry )
Vec_IntPush( vExists, i );
else
Vec_IntPush( vForAlls, i ); Vec_IntPush( vForAlls, i );
else
Vec_IntPush( vExists, i );
// generate CNF // generate CNF
Cnf_DataWriteIntoFile( pCnf, "test.qdimacs", 0, vForAlls, vExists ); pFileName = Extra_FileNameGenericAppend( pNtk->pSpec, ".qdimacs" );
Cnf_DataWriteIntoFile( pCnf, pFileName, 0, vForAlls, vExists );
Aig_ManStop( pMan ); Aig_ManStop( pMan );
Cnf_DataFree( pCnf ); Cnf_DataFree( pCnf );
Vec_IntFree( vForAlls ); Vec_IntFree( vForAlls );
Vec_IntFree( vExists ); Vec_IntFree( vExists );
Vec_IntFree( vVarMap ); Vec_IntFree( vVarMap );
Abc_ObjXorFaninC( Abc_NtkPo(pNtk,0), 0 ); printf( "The 2QBF formula was written into file \"%s\".\n", pFileName );
return; return;
} }
Abc_ObjXorFaninC( Abc_NtkPo(pNtk,0), 0 );
// 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) );
......
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