Skip to content

convert s_until and s_until_with to LTL #1085

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
Apr 24, 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
8 changes: 8 additions & 0 deletions regression/ebmc/smv-netlist/s_until1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
s_until1.sv
--smv-netlist
^LTLSPEC \(\!node144\) U node151$
^LTLSPEC \(1\) U node158$
^EXIT=0$
^SIGNAL=0$
--
18 changes: 18 additions & 0 deletions regression/ebmc/smv-netlist/s_until1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module main(input clk);

// count up from 0 to 10
reg [7:0] counter = 0;

always_ff @(posedge clk)
if(counter == 10)
counter = 0;
else
counter = counter + 1;

// expected to pass
initial p0: assert property ($past(counter)<=counter s_until counter==10);

// expected to fail
initial p1: assert property (1 s_until counter==11);

endmodule
8 changes: 8 additions & 0 deletions regression/verilog/SVA/s_until1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
s_until1.sv
--bound 11
^\[.*\] \$past\(main\.counter\) <= main\.counter s_until main\.counter == 10: PROVED up to bound 11$
^\[.*\] 1 s_until main\.counter == 11: REFUTED$
^EXIT=10$
^SIGNAL=0$
--
18 changes: 18 additions & 0 deletions regression/verilog/SVA/s_until1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module main(input clk);

// count up from 0 to 10
reg [7:0] counter = 0;

always_ff @(posedge clk)
if(counter == 10)
counter = 0;
else
counter = counter + 1;

// expected to pass
initial p0: assert property ($past(counter)<=counter s_until counter==10);

// expected to fail
initial p1: assert property (1 s_until counter==11);

endmodule
21 changes: 21 additions & 0 deletions src/temporal-logic/temporal_logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,27 @@ std::optional<exprt> SVA_to_LTL(exprt expr)
else
return {};
}
else if(expr.id() == ID_sva_s_until)
{
auto &until = to_sva_s_until_expr(expr);
auto rec_lhs = SVA_to_LTL(until.lhs());
auto rec_rhs = SVA_to_LTL(until.rhs());
if(rec_lhs.has_value() && rec_rhs.has_value())
return U_exprt{rec_lhs.value(), rec_rhs.value()};
else
return {};
}
else if(expr.id() == ID_sva_s_until_with)
{
// This is release with swapped operands
auto &until_with = to_sva_s_until_with_expr(expr);
auto rec_lhs = SVA_to_LTL(until_with.lhs());
auto rec_rhs = SVA_to_LTL(until_with.rhs());
if(rec_lhs.has_value() && rec_rhs.has_value())
return R_exprt{rec_rhs.value(), rec_lhs.value()}; // swapped
else
return {};
}
else if(!has_temporal_operator(expr))
{
return expr;
Expand Down
Loading