Skip to content

Commit ddeb32d

Browse files
authored
Merge pull request #1159 from diffblue/sequence-implication-fix
world-level BMC: fix for `|->` and `|=>` for empty matches
2 parents 7c5d09b + e19dfbf commit ddeb32d

File tree

5 files changed

+53
-2
lines changed

5 files changed

+53
-2
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Verilog: fix for named generate blocks
55
* Verilog: $onehot and $onehot0 are now elaboration-time constant
66
* SystemVerilog: fix for #-# and #=# for empty matches
7+
* SystemVerilog: fix for |-> and |=> for empty matches
78
* LTL/SVA to Buechi with --buechi
89

910
# EBMC 5.6
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
sequence_implication3.sv
3+
--module main --bdd
4+
^\[main\.p0\] \(1 \[\*0\]\) \|=> main\.x == 1: REFUTED$
5+
^\[main\.p1\] \(1 \[\*0\]\) \|=> main\.x == 0: PROVED$
6+
^\[main\.p2\] \(1 \[\*0\]\) \|-> 0: PROVED$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
sequence_implication3.sv
3+
--module main --bound 2
4+
^\[main\.p0\] \(1 \[\*0\]\) \|=> main\.x == 1: REFUTED$
5+
^\[main\.p1\] \(1 \[\*0\]\) \|=> main\.x == 0: PROVED up to bound 2$
6+
^\[main\.p2\] \(1 \[\*0\]\) \|-> 0: PROVED up to bound 2$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module main(input clk);
2+
3+
reg [31:0] x;
4+
5+
initial x=0;
6+
7+
// 0, 1, ...
8+
always @(posedge clk)
9+
x<=x+1;
10+
11+
// expected to fail: the rhs is evaluated in time frame 0
12+
initial p0: assert property (1[*0] |=> x==1);
13+
14+
// expected to pass: the rhs is evaluated in time frame 0
15+
initial p1: assert property (1[*0] |=> x==0);
16+
17+
// expected to pass: the lhs is an empty match, and the implication
18+
// passes vacuously
19+
initial p2: assert property (1[*0] |-> 0);
20+
21+
endmodule

src/trans-word-level/property.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,21 @@ static obligationst property_obligations_rec(
606606
current,
607607
no_timeframes);
608608

609+
const bool overlapped = property_expr.id() == ID_sva_overlapped_implication;
610+
609611
obligationst result;
610612

611613
for(auto &lhs_match_point : lhs_match_points)
612614
{
613-
// The RHS of the non-overlapped implication starts one timeframe later
614-
auto t_rhs = property_expr.id() == ID_sva_non_overlapped_implication
615+
if(lhs_match_point.empty_match() && overlapped)
616+
{
617+
// does not yield an obligation
618+
continue;
619+
}
620+
621+
// The RHS of the non-overlapped implication starts one timeframe later,
622+
// unless the LHS is an empty match.
623+
auto t_rhs = !overlapped && !lhs_match_point.empty_match()
615624
? lhs_match_point.end_time + 1
616625
: lhs_match_point.end_time;
617626

0 commit comments

Comments
 (0)