]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
added vc_ExtractBit_One
authorvijay_ganesh <vijay_ganesh@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 6 Sep 2009 21:02:01 +0000 (21:02 +0000)
committervijay_ganesh <vijay_ganesh@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 6 Sep 2009 21:02:01 +0000 (21:02 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@193 e59a4935-1847-0410-ae03-e826735625c1

src/c_interface/c_interface.cpp
src/c_interface/c_interface.h

index 2a063f524726fbabb648e090f27a2b2deb5066b1..21cd30f73539a9e3782b023bf3efd3907dea29e5 100644 (file)
@@ -1268,6 +1268,38 @@ Expr vc_bvBoolExtract(VC vc, Expr ccc, int bit_num) {
   return output; 
 }
 
+Expr vc_bvBoolExtract_Zero(VC vc, Expr ccc, int bit_num) {
+  bmstar b = (bmstar)vc;
+  nodestar a = (nodestar)ccc;
+  b->BVTypeCheck(*a);
+
+  node bit = b->CreateBVConst(32,bit_num);
+  //node o = b->CreateNode(BEEV::BVGETBIT,*a,bit);  
+  node zero = b->CreateBVConst(1,0);
+  node oo = b->CreateTerm(BEEV::BVEXTRACT,1,*a,bit,bit);
+  node o = b->CreateNode(BEEV::EQ,oo,zero);
+  b->BVTypeCheck(o);
+  nodestar output = new node(o);
+  //if(cinterface_exprdelete_on) created_exprs.push_back(output);
+  return output; 
+}
+
+Expr vc_bvBoolExtract_One(VC vc, Expr ccc, int bit_num) {
+  bmstar b = (bmstar)vc;
+  nodestar a = (nodestar)ccc;
+  b->BVTypeCheck(*a);
+
+  node bit = b->CreateBVConst(32,bit_num);
+  //node o = b->CreateNode(BEEV::BVGETBIT,*a,bit);  
+  node one = b->CreateBVConst(1,1);
+  node oo = b->CreateTerm(BEEV::BVEXTRACT,1,*a,bit,bit);
+  node o = b->CreateNode(BEEV::EQ,oo,one);
+  b->BVTypeCheck(o);
+  nodestar output = new node(o);
+  //if(cinterface_exprdelete_on) created_exprs.push_back(output);
+  return output; 
+}
+
 Expr vc_bvSignExtend(VC vc, Expr ccc, int nbits) {
   bmstar b = (bmstar)vc;
   nodestar a = (nodestar)ccc;
index 0f4d1d5de1f041c3ee7e8d325cec8f37731b5af6..89ede246e2ea83eeab8446a446c3162f15ac30a6 100644 (file)
@@ -260,9 +260,14 @@ extern "C" {
   
   //accepts a bitvector and position, and returns a boolean
   //corresponding to that position. More precisely, it return the
-  //equation (x[bit_no:bit_no] = 0)
-  //FIXME  = 1 ?
-  Expr vc_bvBoolExtract(VC vc, Expr x, int bit_no);  
+  //equation (x[bit_no:bit_no] == 0)
+  Expr vc_bvBoolExtract(VC vc, Expr x, int bit_no);
+  Expr vc_bvBoolExtract_Zero(VC vc, Expr x, int bit_no);
+  
+  //accepts a bitvector and position, and returns a boolean
+  //corresponding to that position. More precisely, it return the
+  //equation (x[bit_no:bit_no] == 1)
+  Expr vc_bvBoolExtract_One(VC vc, Expr x, int bit_no);  
   Expr vc_bvSignExtend(VC vc, Expr child, int nbits);
   
   /*C pointer support:  C interface to support C memory arrays in CVCL */