]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Simplifyin BVSX to CONCAT if the topmost bit of the thing being extended is known.
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 29 May 2010 05:04:50 +0000 (05:04 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 29 May 2010 05:04:50 +0000 (05:04 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@800 e59a4935-1847-0410-ae03-e826735625c1

src/simplifier/simplifier.cpp
src/simplifier/simplifier.h

index 21a6031982c29ff82a1438a2b6e805acf2732827..9f234957f2eadfcdb4ef567f5e286c7ce3ef4cc2 100644 (file)
@@ -2158,9 +2158,22 @@ namespace BEEV
           if (a0.GetValueWidth() == len)
             {
               //nothing to signextend
-              return a0;
+              output =  a0;
+              break;
             }
 
+          // If the msb is known. Then puts 0's or the 1's infront.
+          if (mostSignificantConstants(a0) > 0)
+          {
+                 if (getConstantBit(a0,0) == 0)
+                         output = _bm->CreateTerm(BVCONCAT, len, _bm->CreateZeroConst(len-a0.GetValueWidth()), a0);
+                 else
+                         output = _bm->CreateTerm(BVCONCAT, len, _bm->CreateMaxConst(len-a0.GetValueWidth()), a0);
+
+                 break;
+          }
+
+
           switch (a0.GetKind())
             {
             case BVCONST:
index bda86df8ab4f7e40ddb516ed40ab4a80d10a3425..9b64944ed5ef6811bb7bc09bc96995abcebf175b 100644 (file)
@@ -46,6 +46,7 @@ namespace BEEV
     //Ptr to STP Manager
     STPMgr * _bm;
 
+    NodeFactory * nf;
   public:
       
     /****************************************************************
@@ -61,6 +62,7 @@ namespace BEEV
       ASTTrue  = bm->CreateNode(TRUE);
       ASTFalse = bm->CreateNode(FALSE);
       ASTUndefined = bm->CreateNode(UNDEFINED);
+      nf = bm->defaultNodeFactory;
     }
       
     ~Simplifier()