Skip to content

Commit da71b08

Browse files
committed
Remove unused constraint_select_one
1 parent dc38554 commit da71b08

File tree

8 files changed

+16
-133
lines changed

8 files changed

+16
-133
lines changed

src/solvers/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ SRC = $(BOOLEFORCE_SRC) \
9999
flattening/boolbv_concatenation.cpp \
100100
flattening/boolbv_cond.cpp \
101101
flattening/boolbv_constant.cpp \
102-
flattening/boolbv_constraint_select_one.cpp \
103102
flattening/boolbv_div.cpp \
104103
flattening/boolbv_equality.cpp \
105104
flattening/boolbv_extractbit.cpp \

src/solvers/flattening/boolbv.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
182182

183183
if(expr.id()==ID_index)
184184
return convert_index(to_index_expr(expr));
185-
else if(expr.id()==ID_constraint_select_one)
186-
return convert_constraint_select_one(expr);
187185
else if(expr.id()==ID_member)
188186
return convert_member(to_member_expr(expr));
189187
else if(expr.id()==ID_with)

src/solvers/flattening/boolbv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ class boolbvt:public arrayst
140140
virtual bvt convert_bswap(const bswap_exprt &expr);
141141
virtual bvt convert_byte_extract(const byte_extract_exprt &expr);
142142
virtual bvt convert_byte_update(const byte_update_exprt &expr);
143-
virtual bvt convert_constraint_select_one(const exprt &expr);
144143
virtual bvt convert_if(const if_exprt &expr);
145144
virtual bvt convert_struct(const struct_exprt &expr);
146145
virtual bvt convert_array(const exprt &expr);

src/solvers/flattening/boolbv_constant.cpp

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Author: Daniel Kroening, [email protected]
66
77
\*******************************************************************/
88

9-
109
#include "boolbv.h"
1110

1211
bvt boolbvt::convert_constant(const constant_exprt &expr)
@@ -28,14 +27,7 @@ bvt boolbvt::convert_constant(const constant_exprt &expr)
2827

2928
forall_operands(it, expr)
3029
{
31-
const bvt &tmp=convert_bv(*it);
32-
33-
if(tmp.size()!=op_width)
34-
{
35-
error().source_location=expr.find_source_location();
36-
error() << "convert_constant: unexpected operand width" << eom;
37-
throw 0;
38-
}
30+
const bvt &tmp = convert_bv(*it, op_width);
3931

4032
for(std::size_t j=0; j<op_width; j++)
4133
bv[offset+j]=tmp[j];
@@ -80,13 +72,11 @@ bvt boolbvt::convert_constant(const constant_exprt &expr)
8072
{
8173
const std::string &binary=id2string(expr.get_value());
8274

83-
if(binary.size()!=width)
84-
{
85-
error().source_location=expr.find_source_location();
86-
error() << "wrong value length in constant: "
87-
<< expr.pretty() << eom;
88-
throw 0;
89-
}
75+
INVARIANT_WITH_DIAGNOSTICS(
76+
binary.size() == width,
77+
"constant binary value should be equal to the bitvector width",
78+
expr.find_source_location(),
79+
expr.pretty());
9080

9181
for(std::size_t i=0; i<width; i++)
9282
{
@@ -110,13 +100,11 @@ bvt boolbvt::convert_constant(const constant_exprt &expr)
110100
{
111101
const std::string &binary=id2string(expr.get_value());
112102

113-
if(binary.size()*2!=width)
114-
{
115-
error().source_location=expr.find_source_location();
116-
error() << "wrong value length in constant: "
117-
<< expr.pretty() << eom;
118-
throw 0;
119-
}
103+
INVARIANT_WITH_DIAGNOSTICS(
104+
binary.size() * 2 == width,
105+
"constant verilog value width should be half the bitvector width",
106+
expr.find_source_location(),
107+
expr.pretty());
120108

121109
for(std::size_t i=0; i<binary.size(); i++)
122110
{
@@ -146,10 +134,11 @@ bvt boolbvt::convert_constant(const constant_exprt &expr)
146134
break;
147135

148136
default:
149-
error().source_location=expr.find_source_location();
150-
error() << "unknown character in Verilog constant:"
151-
<< expr.pretty() << eom;
152-
throw 0;
137+
DATA_INVARIANT_WITH_DIAGNOSTICS(
138+
false,
139+
"verilog constant should only contain symbols 0, 1, x, z, and ?",
140+
expr.find_source_location(),
141+
expr.pretty());
153142
}
154143
}
155144

src/solvers/flattening/boolbv_constraint_select_one.cpp

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/solvers/prop/prop_conv.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -233,30 +233,6 @@ literalt prop_conv_solvert::convert_bool(const exprt &expr)
233233

234234
return prop.lselect(convert(op[0]), convert(op[1]), convert(op[2]));
235235
}
236-
else if(expr.id()==ID_constraint_select_one)
237-
{
238-
if(op.size()<2)
239-
throw "constraint_select_one takes at least two operands";
240-
241-
std::vector<literalt> op_bv;
242-
op_bv.resize(op.size());
243-
244-
unsigned i=0;
245-
forall_operands(it, expr)
246-
op_bv[i++]=convert(*it);
247-
248-
// add constraints
249-
250-
bvt b;
251-
b.reserve(op_bv.size()-1);
252-
253-
for(unsigned i=1; i<op_bv.size(); i++)
254-
b.push_back(prop.lequal(op_bv[0], op_bv[i]));
255-
256-
prop.l_set_to_true(prop.lor(b));
257-
258-
return op_bv[0];
259-
}
260236
else if(expr.id()==ID_or || expr.id()==ID_and || expr.id()==ID_xor ||
261237
expr.id()==ID_nor || expr.id()==ID_nand)
262238
{

src/solvers/smt2/smt2_conv.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,12 +1796,6 @@ void smt2_convt::convert_expr(const exprt &expr)
17961796
convert_expr(let_expr.where());
17971797
out << ')'; // let
17981798
}
1799-
else if(expr.id()==ID_constraint_select_one)
1800-
{
1801-
UNEXPECTEDCASE(
1802-
"smt2_convt::convert_expr: `"+expr.id_string()+
1803-
"' is not yet supported");
1804-
}
18051799
else if(expr.id() == ID_bswap)
18061800
{
18071801
if(expr.operands().size() != 1)

src/util/irep_ids.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ IREP_ID_ONE(predecrement)
298298
IREP_ID_ONE(integer_bits)
299299
IREP_ID_ONE(KnR)
300300
IREP_ID_TWO(C_KnR, #KnR)
301-
IREP_ID_ONE(constraint_select_one)
302301
IREP_ID_ONE(cond)
303302
IREP_ID_ONE(bv_literals)
304303
IREP_ID_ONE(isfinite)

0 commit comments

Comments
 (0)