We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cce1ce commit c36014fCopy full SHA for c36014f
regression/ebmc/smv/smv_iff1.desc
@@ -0,0 +1,7 @@
1
+CORE
2
+smv_iff1.smv
3
+
4
+^file .* line 9: Expected expression of type `boolean', but got expression `x', which is of type `0..10'$
5
+^EXIT=2$
6
+^SIGNAL=0$
7
+--
regression/ebmc/smv/smv_iff1.smv
@@ -0,0 +1,9 @@
+MODULE main
+VAR x : 0..10;
+ASSIGN init(x) := 1;
+ next(x) := x;
8
+-- type error: lhs is not Boolean
9
+SPEC x <-> (x != 0)
regression/ebmc/smv/smv_iff2.desc
+smv_iff2.smv
+--bdd
+^\[.*\] \(AG x != 5\) <-> \(x != 5 & AX AG x != 5\): PROVED$
+^EXIT=0$
regression/ebmc/smv/smv_iff2.smv
@@ -0,0 +1,14 @@
+ASSIGN
+ init(x) := 1;
+ next(x) :=
+ case
10
+ x>=3 : 3;
11
+ TRUE: x+1;
12
+ esac;
13
14
+SPEC AG x != 5 <-> (x != 5 & AX AG x != 5)
src/ebmc/bdd_engine.cpp
@@ -673,6 +673,10 @@ bdd_enginet::BDD bdd_enginet::CTL(const exprt &expr)
673
result = result | CTL(op);
674
return result;
675
}
676
+ else if(expr.id() == ID_equal && to_equal_expr(expr).lhs().type().id() == ID_bool)
677
+ {
678
+ return (!(CTL(to_binary_expr(expr).lhs())) ^ CTL(to_binary_expr(expr).rhs()));
679
+ }
680
else if(expr.id() == ID_EX)
681
{
682
return EX(CTL(to_EX_expr(expr).op()));
@@ -891,7 +895,8 @@ void bdd_enginet::get_atomic_propositions(const exprt &expr)
891
895
892
896
if(
893
897
expr.id() == ID_and || expr.id() == ID_or || expr.id() == ID_not ||
894
- expr.id() == ID_implies || is_temporal_operator(expr))
898
+ expr.id() == ID_implies || (expr.id() == ID_equal && to_equal_expr(expr).lhs().type().id() == ID_bool) ||
899
+ is_temporal_operator(expr))
900
901
for(const auto & op : expr.operands())
902
if(op.type().id() == ID_bool)
src/hw_cbmc_irep_ids.h
@@ -15,6 +15,8 @@ IREP_ID_ONE(F)
15
IREP_ID_ONE(E)
16
IREP_ID_ONE(G)
17
IREP_ID_ONE(X)
18
+IREP_ID_ONE(smv_iff)
19
+IREP_ID_TWO(C_smv_iff, "#smv_iff")
20
IREP_ID_ONE(sva_accept_on)
21
IREP_ID_ONE(sva_reject_on)
22
IREP_ID_ONE(sva_sync_accept_on)
@@ -215,7 +217,7 @@ IREP_ID_ONE(verilog_ref)
215
217
IREP_ID_ONE(verilog_reg)
216
218
IREP_ID_ONE(verilog_integer)
219
IREP_ID_ONE(verilog_time)
-IREP_ID_ONE(iff)
220
+IREP_ID_ONE(verilog_iff)
221
IREP_ID_ONE(offset)
222
IREP_ID_ONE(xnor)
223
IREP_ID_ONE(specify)
src/smvlang/expr2smv.cpp
@@ -449,7 +449,12 @@ bool expr2smvt::convert(
449
return convert_binary(src, dest, src.id_string(), precedence=11);
450
451
else if(src.id()==ID_equal)
452
- return convert_binary(src, dest, "=", precedence=11);
453
+ if(src.get_bool(ID_C_smv_iff))
454
+ return convert_binary(src, dest, "<->", precedence=16);
455
+ else
456
+ return convert_binary(src, dest, "=", precedence=11);
457
458
459
else if(src.id()==ID_notequal)
460
return convert_binary(src, dest, "!=", precedence=11);
@@ -466,9 +471,6 @@ bool expr2smvt::convert(
466
471
else if(src.id()==ID_implies)
467
472
return convert_binary(src, dest, "->", precedence=2);
468
473
469
- else if(src.id()==ID_iff)
470
- return convert_binary(src, dest, "<->", precedence=3);
-
474
else if(
475
src.id() == ID_AG || src.id() == ID_EG || src.id() == ID_AF ||
476
src.id() == ID_EF || src.id() == ID_AX || src.id() == ID_EX ||
src/smvlang/parser.y
@@ -455,7 +455,7 @@ term : variable_name
| term DIVIDE_Token term { binary_arith($$, $1, ID_div, $3); }
| term PLUS_Token term { binary_arith($$, $1, ID_plus, $3); }
| term MINUS_Token term { binary_arith($$, $1, ID_minus, $3); }
- | term EQUIV_Token term { binary($$, $1, ID_equal, $3, bool_typet{}); }
+ | term EQUIV_Token term { binary($$, $1, ID_smv_iff, $3, bool_typet{}); }
| term IMPLIES_Token term { binary($$, $1, ID_implies, $3, bool_typet{}); }
| term XOR_Token term { j_binary($$, $1, ID_xor, $3, bool_typet{}); }
461
| term OR_Token term { j_binary($$, $1, ID_or, $3, bool_typet{}); }
src/smvlang/smv_typecheck.cpp
@@ -681,12 +681,17 @@ void smv_typecheckt::typecheck(
683
684
- else if(expr.id()==ID_and ||
685
- expr.id()==ID_or ||
686
- expr.id()==ID_xor ||
687
- expr.id()==ID_not)
+ else if(
+ expr.id() == ID_and || expr.id() == ID_or || expr.id() == ID_xor ||
+ expr.id() == ID_not)
688
+ typecheck_op(expr, bool_typet(), mode);
689
690
+ else if(expr.id() == ID_smv_iff)
691
692
typecheck_op(expr, bool_typet(), mode);
693
+ expr.set(ID_C_smv_iff, true);
694
+ expr.id(ID_equal);
695
696
else if(expr.id()==ID_nondet_symbol)
697
src/verilog/expr2verilog.cpp
@@ -1337,7 +1337,7 @@ expr2verilogt::resultt expr2verilogt::convert_rec(const exprt &src)
1337
return convert_binary(
1338
to_multi_ary_expr(src), "->", precedence = verilog_precedencet::IMPLIES);
1339
1340
+ else if(src.id()==ID_verilog_iff)
1341
1342
to_multi_ary_expr(src), "<->", precedence = verilog_precedencet::IMPLIES);
1343
0 commit comments