Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/solvers/flattening/boolbv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Author: Daniel Kroening, kroening@kroening.com
#include <util/config.h>
#include <util/floatbv_expr.h>
#include <util/magic.h>
#include <util/mathematical_expr.h>
#include <util/mp_arith.h>
#include <util/simplify_expr.h>
#include <util/std_expr.h>
Expand Down Expand Up @@ -233,7 +234,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
else if(expr.id()==ID_not)
return convert_not(to_not_expr(expr));
else if(expr.id()==ID_power)
return convert_power(to_binary_expr(expr));
return convert_power(to_power_expr(expr));
else if(expr.id() == ID_popcount)
return convert_popcount(to_popcount_expr(expr));
else if(expr.id() == ID_count_leading_zeros)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/flattening/boolbv.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class floatbv_typecast_exprt;
class ieee_float_op_exprt;
class overflow_result_exprt;
class popcount_exprt;
class power_exprt;
class replication_exprt;
class unary_overflow_exprt;
class union_typet;
Expand Down Expand Up @@ -198,7 +199,7 @@ class boolbvt:public arrayst
virtual bvt convert_symbol(const exprt &expr);
virtual bvt convert_bv_reduction(const unary_exprt &expr);
virtual bvt convert_not(const not_exprt &expr);
virtual bvt convert_power(const binary_exprt &expr);
virtual bvt convert_power(const power_exprt &expr);
virtual bvt convert_function_application(
const function_application_exprt &expr);
virtual bvt convert_bitreverse(const bitreverse_exprt &expr);
Expand Down
13 changes: 7 additions & 6 deletions src/solvers/flattening/boolbv_power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Author: Daniel Kroening, kroening@kroening.com

\*******************************************************************/

#include <util/mathematical_expr.h>

#include "boolbv.h"

bvt boolbvt::convert_power(const binary_exprt &expr)
bvt boolbvt::convert_power(const power_exprt &expr)
{
const typet &type = expr.type();

Expand All @@ -19,14 +20,14 @@ bvt boolbvt::convert_power(const binary_exprt &expr)
type.id()==ID_signedbv)
{
// Let's do the special case 2**x
bvt op0=convert_bv(expr.op0());
bvt op1=convert_bv(expr.op1());
bvt base = convert_bv(expr.base());
bvt exponent = convert_bv(expr.exponent());

literalt eq_2=
bv_utils.equal(op0, bv_utils.build_constant(2, op0.size()));
literalt eq_2 =
bv_utils.equal(base, bv_utils.build_constant(2, base.size()));

bvt one=bv_utils.build_constant(1, width);
bvt shift=bv_utils.shift(one, bv_utilst::shiftt::SHIFT_LEFT, op1);
bvt shift = bv_utils.shift(one, bv_utilst::shiftt::SHIFT_LEFT, exponent);

bvt nondet=prop.new_variables(width);

Expand Down
Loading