Skip to content

world-level BMC: implement two empty match rules #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions regression/verilog/SVA/empty_sequence1.bmc.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CORE
empty_sequence1.sv
--bound 5
^\[main\.p0\] 1 \[\*0\]: REFUTED$
^\[main\.p1\] \(1 \[\*0\]\) ##1 main\.x == 0: PROVED up to bound 5$
^\[main\.p2\] main\.x == 0 ##1 \(1 \[\*0\]\): PROVED up to bound 5$
^\[main\.p3\] \(1 \[\*0\]\) ##0 1: REFUTED$
^\[main\.p4\] 1 ##0 \(1 \[\*0\]\): PROVED up to bound 5$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
10 changes: 0 additions & 10 deletions regression/verilog/SVA/empty_sequence1.desc

This file was deleted.

7 changes: 6 additions & 1 deletion regression/verilog/SVA/empty_sequence1.sv
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ module main(input clk);
// The empty sequence does not match
initial p0: assert property (1[*0]);

// But can be concatenated
// But can be concatenated -- expected to pass
initial p1: assert property (1[*0] ##1 x == 0);
initial p2: assert property (x == 0 ##1 1[*0]);

// But can be concatenated -- expected to fail
initial p3: assert property (1[*0] ##0 1);
initial p4: assert property (1 ##0 1[*0]);

endmodule
19 changes: 19 additions & 0 deletions src/trans-word-level/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ sequence_matchest instantiate_sequence(
{
// now delay
const auto from = numeric_cast_v<mp_integer>(sva_cycle_delay_expr.from());
DATA_INVARIANT(from >= 0, "##n must not be negative");

auto t_rhs_from = lhs_match.end_time + from;
mp_integer t_rhs_to;
Expand All @@ -128,6 +129,24 @@ sequence_matchest instantiate_sequence(
t_rhs_to = t_rhs_from + to;
}

// Implement 1800-2017 16.9.2.1
if(lhs_match.empty_match())
{
if(from == 0)
{
// (empty ##0 seq) does not result in a match.
continue;
}
else
{
// (empty ##n seq), where n is greater than 0,
// is equivalent to (##(n-1) seq).
t_rhs_from = t_rhs_from - 1;
if(t_rhs_to != no_timeframes)
t_rhs_to = t_rhs_to - 1;
}
}

// Add a potential match for each timeframe in the range
for(mp_integer t_rhs = t_rhs_from; t_rhs <= t_rhs_to; ++t_rhs)
{
Expand Down
Loading