bool UpdateSolverMap(const ASTNode& e0, const ASTNode& e1);
public:
- //FIXME: HACK_ATTACK. this vector was hacked into the code to
- //support a special request by Dawson' group. They want the
- //counterexample to be printed in the order of variables declared.
- //TO BE COMMENTED LATER (say by 1st week of march,2006)
- ASTVec _special_print_set;
-
- //prints the initial activity levels of variables
- //void PrintActivityLevels_Of_SATVars(char * init_msg, MINISAT::Solver& newS);
-
- //this function biases the activity levels of MINISAT variables.
- //void ChangeActivityLevels_Of_SATVars(MINISAT::Solver& n);
+ ASTVec ListOfDeclaredVars;
+ void printVarDeclsToStream(ostream &os);
// Constructor
BeevMgr() :
#endif
void CountersAndStats(const char * functionname);
-
- //global function which accepts an integer and looks up the
- //corresponding ASTNode and prints a string of that ASTNode
- void Convert_MINISATVar_To_ASTNode_Print(int minisat_var,
- int decision, int polarity=0);
}; // end namespace.
#endif
//vector to store the integer values
std::vector<int> out_int;
cout << "% ";
- for (ASTVec::iterator it = _special_print_set.begin(), itend = _special_print_set.end(); it != itend; it++)
+ for (ASTVec::iterator it = ListOfDeclaredVars.begin(), itend = ListOfDeclaredVars.end(); it != itend; it++)
{
if (ARRAY_TYPE == it->GetType())
{
printer::PL_Print(cout,vv, 0);
cout << endl;
} //end of Convert_MINISATVar_To_ASTNode_Print()
+
+ void BeevMgr::printVarDeclsToStream(ostream &os) {
+ for(ASTVec::iterator i = ListOfDeclaredVars.begin(),iend=ListOfDeclaredVars.end();i!=iend;i++) {
+ BEEV::ASTNode a = *i;
+ switch(a.GetType()) {
+ case BEEV::BITVECTOR_TYPE:
+ a.PL_Print(os);
+ os << " : BITVECTOR(" << a.GetValueWidth() << ");" << endl;
+ break;
+ case BEEV::ARRAY_TYPE:
+ a.PL_Print(os);
+ os << " : ARRAY " << "BITVECTOR(" << a.GetIndexWidth() << ") OF ";
+ os << "BITVECTOR(" << a.GetValueWidth() << ");" << endl;
+ break;
+ case BEEV::BOOLEAN_TYPE:
+ a.PL_Print(os);
+ os << " : BOOLEAN;" << endl;
+ break;
+ default:
+ BEEV::FatalError("vc_printDeclsToStream: Unsupported type",a);
+ break;
+ }
+ }
+ } //printVarDeclsToStream
+
+ void print_STPInput_Back(const ASTNode& asserts, const ASTNode& query) {
+ BEEV::GlobalBeevMgr->printVarDeclsToStream(cout);
+ cout << "ASSERT(";
+ asserts.PL_Print(cout);
+ cout << ");\n\n";
+ cout << "QUERY(";
+ query.PL_Print(cout);
+ cout << ");\n";
+ } //end of print_STPInput_Back()
};//end of namespace BEEV
}
;
}; //End of Class ListVecPrinter
+
+ //global function which accepts an integer and looks up the
+ //corresponding ASTNode and prints a string of that ASTNode
+ void Convert_MINISATVar_To_ASTNode_Print(int minisat_var,
+ int decision, int polarity=0);
+
+ void print_STPInput_Back(const ASTNode& asserts, const ASTNode& query);
};// end of namespace BEEV
#endif
helpstring += "-d : check counterexample\n";
helpstring += "-p : print counterexample\n";
helpstring += "-y : print counterexample in binary\n";
- helpstring += "-b : STP input read back\n";
+ helpstring += "-b : print STP input back to cout\n";
helpstring += "-x : flatten nested XORs\n";
helpstring += "-h : help\n";
helpstring += "-m : use the SMTLIB parser\n";
BEEV::ASTNode q = (*(nodestar)e);
// print variable declarations
- BEEV::ASTVec declsFromParser = (nodelist)BEEV::GlobalBeevMgr->_special_print_set;
+ BEEV::ASTVec declsFromParser = (nodelist)BEEV::GlobalBeevMgr->ListOfDeclaredVars;
for(BEEV::ASTVec::iterator it=declsFromParser.begin(),itend=declsFromParser.end(); it!=itend;it++) {
if(BEEV::BITVECTOR_TYPE == it->GetType()) {
#include "../AST/AST.h"
#include "../sat/core/Solver.h"
#include "../sat/core/SolverTypes.h"
+#include "../AST/printer/AssortedPrinters.h"
#ifdef EXT_HASH_MAP
using namespace __gnu_cxx;
helpstring += "-d : check counterexample\n";
helpstring += "-p : print counterexample\n";
helpstring += "-y : print counterexample in binary\n";
- helpstring += "-b : STP input read back\n";
+ helpstring += "-b : print STP input back to cout\n";
helpstring += "-x : flatten nested XORs\n";
helpstring += "-h : help\n";
helpstring += "-m : use the SMTLIB parser\n";
{
cvcparse((void*)AssertsQuery);
}
-
+
ASTNode asserts = (*(ASTVec*)AssertsQuery)[0];
- ASTNode query = (*(ASTVec*)AssertsQuery)[1];
- GlobalBeevMgr->TopLevelSAT(asserts, query);
-
- // if(print_STPinput_back_flag) {
- // asserts.PL_Print(cout);
- // query.PL_Print(cout);
- // }
+ ASTNode query = (*(ASTVec*)AssertsQuery)[1];
+ if(print_STPinput_back_flag) {
+ print_STPInput_Back(asserts, query);
+ return 0;
+ }
+ GlobalBeevMgr->TopLevelSAT(asserts, query);
return 0;
}//end of Main
[ \t\r\f] { /* skip whitespace */ }
0b{BITS}+ { cvclval.node = new BEEV::ASTNode(BEEV::GlobalBeevMgr->CreateBVConst(yytext+2, 2)); return BVCONST_TOK;}
0bin{BITS}+ { cvclval.node = new BEEV::ASTNode(BEEV::GlobalBeevMgr->CreateBVConst(yytext+4, 2)); return BVCONST_TOK;}
+0x{HEX}+ { cvclval.node = new BEEV::ASTNode(BEEV::GlobalBeevMgr->CreateBVConst(yytext+2, 16)); return BVCONST_TOK;}
0h{HEX}+ { cvclval.node = new BEEV::ASTNode(BEEV::GlobalBeevMgr->CreateBVConst(yytext+2, 16)); return BVCONST_TOK;}
0hex{HEX}+ { cvclval.node = new BEEV::ASTNode(BEEV::GlobalBeevMgr->CreateBVConst(yytext+4, 16)); return BVCONST_TOK;}
{DIGIT}+ { cvclval.uintval = strtoul(yytext, NULL, 10); return NUMERAL_TOK;}
//FIXME: HACK_ATTACK. this vector was hacked into the code to
//support a special request by Dawson' group. They want the
//counterexample to be printed in the order of variables declared.
- GlobalBeevMgr->_special_print_set.push_back(*i);
+ GlobalBeevMgr->ListOfDeclaredVars.push_back(*i);
}
delete $1;
}