Skip to content

Commit 759d10d

Browse files
committed
add support for SMT-LIB2 bvcomp
'bvcomp' compares two bitvectors and equals #b1 iff all bits are equal. This commit implements this function.
1 parent 5ae8be7 commit 759d10d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/solvers/smt2/smt2_parser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,12 @@ void smt2_parsert::setup_expressions()
871871
return binary_predicate(ID_gt, cast_bv_to_signed(operands()));
872872
};
873873

874+
expressions["bvcomp"] = [this] {
875+
auto b0 = from_integer(0, unsignedbv_typet(1));
876+
auto b1 = from_integer(1, unsignedbv_typet(1));
877+
return if_exprt(binary_predicate(ID_equal, operands()), b1, b0);
878+
};
879+
874880
expressions["bvashr"] = [this] {
875881
return cast_bv_to_unsigned(binary(ID_ashr, cast_bv_to_signed(operands())));
876882
};

0 commit comments

Comments
 (0)