From: trevor_hansen Date: Wed, 7 Jul 2010 13:17:57 +0000 (+0000) Subject: Simplify (bvdiv x x ) to one. Likewise for the other multiplication like operations. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=3687628da66800a4a63cd5ea9e758be50bde9053;p=francis%2Fstp.git Simplify (bvdiv x x ) to one. Likewise for the other multiplication like operations. Other changes are for constant bit propagation (aren't active yet). git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@935 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/src/main/main.cpp b/src/main/main.cpp index 04098e7..1893f57 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -106,8 +106,12 @@ int main(int argc, char ** argv) { "-c : construct counterexample\n"; helpstring += "-d : check counterexample\n"; + +#ifdef WITHCBITP helpstring += "--disable-cbitp : disable constant bit propagation\n"; +#endif WITHCBITP + helpstring += "-e : expand finite-for construct\n"; helpstring += diff --git a/src/simplifier/constantBitP/ConstantBitPropagation.cpp b/src/simplifier/constantBitP/ConstantBitPropagation.cpp index 493d7fc..b048e70 100644 --- a/src/simplifier/constantBitP/ConstantBitPropagation.cpp +++ b/src/simplifier/constantBitP/ConstantBitPropagation.cpp @@ -1,11 +1,10 @@ +#include "ConstantBitPropagation.h" #include "../../AST/AST.h" #include "../../extlib-constbv/constantbv.h" #include "../../printer/printers.h" -#include "ConstantBitPropagation.h" #include "../../AST/NodeFactory/NodeFactory.h" #include "../../simplifier/simplifier.h" #include "ConstantBitP_Utility.h" -#include "MultiplicationStats.h" #ifdef WITHCBITP #include "ConstantBitP_TransferFunctions.h" @@ -166,6 +165,13 @@ namespace simplifier // not fixing the topnode. propagate(); + if (debug_cBitProp_messages) + { + cerr << "status:" << status <CreateOneConst(inputValueWidth); + break; + } + output = inputterm; + break; + + case BVMOD: + if (inputterm[0] == inputterm[1]) + { + output = _bm->CreateZeroConst(inputValueWidth); + break; + } + output = inputterm; + break; - case BVXOR: + case BVXOR: { if (inputterm.Degree() ==2 && inputterm[0] == inputterm[1]) { @@ -2592,8 +2609,6 @@ namespace BEEV case BVNOR: case BVVARSHIFT: case BVSRSHIFT: - case BVDIV: - case BVMOD: { ASTVec c = inputterm.GetChildren(); ASTVec o; @@ -2670,9 +2685,25 @@ namespace BEEV break; } case SBVREM: - case SBVDIV: case SBVMOD: { + if (inputterm[0] == inputterm[1]) + { + output = _bm->CreateZeroConst(inputValueWidth); + break; + } + + // run on. + } + case SBVDIV: + { + if (inputterm[0] == inputterm[1]) + { + output = _bm->CreateOneConst(inputValueWidth); + break; + } + + ASTVec c = inputterm.GetChildren(); ASTVec o; for (ASTVec::iterator diff --git a/src/to-sat/AIG/ToSATAIG.cpp b/src/to-sat/AIG/ToSATAIG.cpp index ad8c8f4..88c21df 100644 --- a/src/to-sat/AIG/ToSATAIG.cpp +++ b/src/to-sat/AIG/ToSATAIG.cpp @@ -40,6 +40,9 @@ namespace BEEV } */ + //Clear out all the constant bit stuff before sending the SAT. + cb->clearTables(); + bm->GetRunTimes()->start(RunTimes::SendingToSAT); for (int i = 0; i < cnfData->nVars; i++)