"-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 +=
+#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"
// not fixing the topnode.
propagate();
+ if (debug_cBitProp_messages)
+ {
+ cerr << "status:" << status <<endl;
+ cerr << "ended propagation" << endl;
+ printNodeWithFixings();
+ }
+
// is there are good reason to clear out some of them??
#if 0
// remove constants, and things with nothing fixed.
if (debug_cBitProp_messages)
{
- cout << "Number removed by bottom UP:" << fromTo.size() << endl;
+ cerr << "Number removed by bottom UP:" << fromTo.size() << endl;
}
setNodeToTrue(top);
if (debug_cBitProp_messages)
{
- cout << "starting propagation" << endl;
+ cerr << "starting propagation" << endl;
printNodeWithFixings();
- cout << "Initial Tree:" << endl;
+ cerr << "Initial Tree:" << endl;
cerr << top;
}
notHandled(const Kind& k)
{
if (READ != k && WRITE != k)
- //if (debug_cBitProp_messages)
-
+ if (debug_cBitProp_messages)
{
- cout << "!" << k << endl;
+ cerr << "!" << k << endl;
}
}
#include "Dependencies.h"
#include "NodeToFixedBitsMap.h"
#include "WorkList.h"
+#include "MultiplicationStats.h"
namespace BEEV
{
namespace constantBitP
{
- enum Direction
- {
- UPWARDS_ONLY, BOTH_WAYS
- };
-
- // This is used for very specific purposes.
- enum Type
- {
- BOOL_TYPE, VALUE_TYPE
- };
-
- // The only status that's correctly maintained at present is the conflict status.
enum Result
{
NO_CHANGE = 1, CHANGED, CONFLICT, NOT_IMPLEMENTED
class ConstantBitPropagation
{
NodeFactory *nf;
+ Simplifier *simplifier;
Result status;
WorkList *workList;
Dependencies * dependents;
- Simplifier *simplifier;
MultiplicationStatsMap* msm;
void
// propagates.
ConstantBitPropagation(BEEV::Simplifier* _sm, NodeFactory* _nf, const ASTNode & top);
- /*
- ConstantBitPropagation(BEEV::Simplifier* _sm, NodeFactory* _nf)
- {
- status = NO_CHANGE;
-
- workList = NULL;
- dependents = NULL;
- fixedMap = NULL; // ASTNodes mapped to which of their bits are fixed.
- msm = NULL;
-
- simplifier = _sm;
- nf = _nf;
- }
- ;
- */
-
-
~ConstantBitPropagation()
{
- delete fixedMap;
- delete dependents;
- delete workList;
+ clearTables();
}
;
topLevelBothWays(const BEEV::ASTNode& top);
+ void clearTables()
+ {
+ delete fixedMap;
+ fixedMap = NULL;
+ delete dependents;
+ dependents = NULL;
+ delete workList;
+ workList = NULL;
+ delete msm;
+ msm = NULL;
+ }
bool
checkAtFixedPoint(const ASTNode& n, BEEV::ASTNodeSet & visited);
}
break;
+ case BVDIV:
+ if (inputterm[0] == inputterm[1])
+ {
+ output = _bm->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])
{
case BVNOR:
case BVVARSHIFT:
case BVSRSHIFT:
- case BVDIV:
- case BVMOD:
{
ASTVec c = inputterm.GetChildren();
ASTVec o;
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
}
*/
+ //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++)