Skip to content

Commit e77063c

Browse files
authored
Merge pull request #614 from diffblue/bmc-sva-sequence
add word-level BMC encoding for SVA sequences
2 parents 19025a8 + d5edadc commit e77063c

File tree

9 files changed

+180
-66
lines changed

9 files changed

+180
-66
lines changed

regression/ebmc/ring_buffer_bdd/ring_buffer.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module ring_buffer(input clk, input read, input write);
1919
wire full=count==15;
2020
wire empty=count==0;
2121

22-
assume property (empty |-> !read);
23-
assume property (full |-> !write);
22+
assume property (empty -> !read);
23+
assume property (full -> !write);
2424

2525
assert property (((writeptr-readptr)&'b1111)==count);
2626

regression/ebmc/ring_buffer_induction/ring_buffer.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module ring_buffer(input clk, input read, input write);
1919
wire full=count==15;
2020
wire empty=count==0;
2121

22-
assume property (empty |-> !read);
23-
assume property (full |-> !write);
22+
assume property (empty -> !read);
23+
assume property (full -> !write);
2424

2525
assert property (((writeptr-readptr)&'b1111)==count);
2626

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
sequence_implication1.sv
33
--bound 20
44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
^warning: ignoring
88
--
9-
The sequence implication operator does not pick up the end of the chain
10-
sequence on the left hand side.

regression/verilog/SVA/sequence_implication1.sv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ module main(input clk);
1212
// checks that 1 2 is followed by 0
1313
assert property (@(posedge clk) counter == 1 ##1 counter == 2 |-> ##1 counter == 0);
1414

15+
// same with non-overlapping implication
16+
assert property (@(posedge clk) counter == 1 ##1 counter == 2 |=> counter == 0);
17+
1518
endmodule : main

src/temporal-logic/normalize_property.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,6 @@ exprt normalize_pre_implies(implies_exprt expr)
6161
return or_exprt{not_exprt{expr.lhs()}, expr.rhs()};
6262
}
6363

64-
exprt normalize_pre_sva_overlapped_implication(
65-
sva_overlapped_implication_exprt expr)
66-
{
67-
// same as regular implication
68-
return or_exprt{not_exprt{expr.lhs()}, expr.rhs()};
69-
}
70-
71-
exprt normalize_pre_sva_non_overlapped_implication(
72-
sva_non_overlapped_implication_exprt expr)
73-
{
74-
// same as a->Xb
75-
return or_exprt{not_exprt{expr.lhs()}, X_exprt{expr.rhs()}};
76-
}
77-
7864
exprt normalize_pre_sva_cycle_delay(sva_cycle_delay_exprt expr)
7965
{
8066
if(expr.is_unbounded())
@@ -105,12 +91,6 @@ exprt normalize_property(exprt expr)
10591
expr = normalize_pre_implies(to_implies_expr(expr));
10692
else if(expr.id() == ID_sva_cover)
10793
expr = G_exprt{not_exprt{to_sva_cover_expr(expr).op()}};
108-
else if(expr.id() == ID_sva_overlapped_implication)
109-
expr = normalize_pre_sva_overlapped_implication(
110-
to_sva_overlapped_implication_expr(expr));
111-
else if(expr.id() == ID_sva_non_overlapped_implication)
112-
expr = normalize_pre_sva_non_overlapped_implication(
113-
to_sva_non_overlapped_implication_expr(expr));
11494
else if(expr.id() == ID_sva_nexttime)
11595
{
11696
if(!to_sva_nexttime_expr(expr).is_indexed())

src/temporal-logic/normalize_property.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Author: Daniel Kroening, [email protected]
1616
/// ¬(a ∨ b) --> ¬a ∧ ¬b
1717
/// ¬(a ∧ b) --> ¬a ∨ ¬b
1818
/// (a -> b) --> ¬a ∨ b
19-
/// sva_overlapped_implication --> ¬a ∨ b
20-
/// sva_non_overlapped_implication --> ¬a ∨ Xb
2119
/// sva_nexttime φ --> Xφ
2220
/// sva_s_nexttime φ --> Xφ
2321
/// sva_if --> ? :

src/temporal-logic/temporal_logic.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ Author: Daniel Kroening, [email protected]
1212

1313
bool is_temporal_operator(const exprt &expr)
1414
{
15-
return is_CTL_operator(expr) || is_LTL_operator(expr) || expr.id() == ID_A ||
16-
expr.id() == ID_E || expr.id() == ID_sva_always ||
17-
expr.id() == ID_sva_always || expr.id() == ID_sva_ranged_always ||
18-
expr.id() == ID_sva_nexttime || expr.id() == ID_sva_s_nexttime ||
19-
expr.id() == ID_sva_non_overlapped_implication ||
20-
expr.id() == ID_sva_until || expr.id() == ID_sva_s_until ||
21-
expr.id() == ID_sva_until_with || expr.id() == ID_sva_s_until_with ||
22-
expr.id() == ID_sva_eventually || expr.id() == ID_sva_s_eventually ||
23-
expr.id() == ID_sva_cycle_delay ||
15+
return is_CTL_operator(expr) || is_LTL_operator(expr) ||
16+
is_SVA_sequence(expr) || expr.id() == ID_A || expr.id() == ID_E ||
17+
expr.id() == ID_sva_always || expr.id() == ID_sva_always ||
18+
expr.id() == ID_sva_ranged_always || expr.id() == ID_sva_nexttime ||
19+
expr.id() == ID_sva_s_nexttime || expr.id() == ID_sva_until ||
20+
expr.id() == ID_sva_s_until || expr.id() == ID_sva_until_with ||
21+
expr.id() == ID_sva_s_until_with || expr.id() == ID_sva_eventually ||
22+
expr.id() == ID_sva_s_eventually || expr.id() == ID_sva_cycle_delay ||
2423
expr.id() == ID_sva_overlapped_followed_by ||
2524
expr.id() == ID_sva_nonoverlapped_followed_by;
2625
}
@@ -66,3 +65,15 @@ bool is_LTL(const exprt &expr)
6665

6766
return !has_subexpr(expr, non_LTL_operator);
6867
}
68+
69+
bool is_SVA_sequence(const exprt &expr)
70+
{
71+
auto id = expr.id();
72+
// Note that ID_sva_overlapped_followed_by and ID_sva_nonoverlapped_followed_by
73+
// are property expressions, not sequence expressions.
74+
return id == ID_sva_overlapped_implication ||
75+
id == ID_sva_non_overlapped_implication || id == ID_sva_cycle_delay ||
76+
id == ID_sva_sequence_concatenation ||
77+
id == ID_sva_sequence_intersect || id == ID_sva_sequence_first_match ||
78+
id == ID_sva_sequence_throughout || id == ID_sva_sequence_within;
79+
}

src/temporal-logic/temporal_logic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ bool is_LTL(const exprt &);
3636
/// as its root
3737
bool is_LTL_operator(const exprt &);
3838

39+
/// Returns true iff the given expression is an SVA sequence expression
40+
bool is_SVA_sequence(const exprt &);
41+
3942
#endif

0 commit comments

Comments
 (0)