Skip to content

Commit 45ccadd

Browse files
kroeningtautschnig
authored andcommitted
world-level BMC: implement two empty match rules
This implements two SVA empty match rules in the word-level BMC encoding.
1 parent ac36b83 commit 45ccadd

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
empty_sequence1.sv
3+
--bound 5
4+
^\[main\.p0\] 1 \[\*0\]: REFUTED$
5+
^\[main\.p1\] \(1 \[\*0\]\) ##1 main\.x == 0: PROVED up to bound 5$
6+
^\[main\.p2\] main\.x == 0 ##1 \(1 \[\*0\]\): PROVED up to bound 5$
7+
^\[main\.p3\] \(1 \[\*0\]\) ##0 1: REFUTED$
8+
^\[main\.p4\] 1 ##0 \(1 \[\*0\]\): PROVED up to bound 5$
9+
^EXIT=10$
10+
^SIGNAL=0$
11+
--
12+
^warning: ignoring
13+
--

regression/verilog/SVA/empty_sequence1.desc

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

regression/verilog/SVA/empty_sequence1.sv

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ module main(input clk);
88
// The empty sequence does not match
99
initial p0: assert property (1[*0]);
1010

11-
// But can be concatenated
11+
// But can be concatenated -- expected to pass
1212
initial p1: assert property (1[*0] ##1 x == 0);
13+
initial p2: assert property (x == 0 ##1 1[*0]);
14+
15+
// But can be concatenated -- expected to fail
16+
initial p3: assert property (1[*0] ##0 1);
17+
initial p4: assert property (1 ##0 1[*0]);
1318

1419
endmodule

src/trans-word-level/sequence.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ sequence_matchest instantiate_sequence(
109109
{
110110
// now delay
111111
const auto from = numeric_cast_v<mp_integer>(sva_cycle_delay_expr.from());
112+
DATA_INVARIANT(from >= 0, "##n must not be negative");
112113

113114
auto t_rhs_from = lhs_match.end_time + from;
114115
mp_integer t_rhs_to;
@@ -128,6 +129,24 @@ sequence_matchest instantiate_sequence(
128129
t_rhs_to = t_rhs_from + to;
129130
}
130131

132+
// Implement 1800-2017 16.9.2.1
133+
if(lhs_match.empty_match())
134+
{
135+
if(from == 0)
136+
{
137+
// (empty ##0 seq) does not result in a match.
138+
continue;
139+
}
140+
else
141+
{
142+
// (empty ##n seq), where n is greater than 0,
143+
// is equivalent to (##(n-1) seq).
144+
t_rhs_from = t_rhs_from - 1;
145+
if(t_rhs_to != no_timeframes)
146+
t_rhs_to = t_rhs_to - 1;
147+
}
148+
}
149+
131150
// Add a potential match for each timeframe in the range
132151
for(mp_integer t_rhs = t_rhs_from; t_rhs <= t_rhs_to; ++t_rhs)
133152
{

0 commit comments

Comments
 (0)