Skip to content

implement NNF for SVA s_always #1095

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions regression/verilog/SVA/s_always1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
s_always1.sv
--bound 20
^\[main\.p0\] s_always \[0:9\] main\.x < 10: PROVED up to bound 20$
^\[main\.p1\] not \(s_always \[0:9\] main\.x < 10\): REFUTED$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
14 changes: 14 additions & 0 deletions regression/verilog/SVA/s_always1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module main(input clk);

reg [31:0] x = 0;

always_ff @(posedge clk)
x<=x+1;

// should pass
initial p0: assert property (s_always [0:9] x<10);

// should fail
initial p1: assert property (not s_always [0:9] x<10);

endmodule
7 changes: 7 additions & 0 deletions src/temporal-logic/nnf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ std::optional<exprt> negate_property_node(const exprt &expr)
return sva_ranged_s_eventually_exprt{
always.lower(), always.upper(), not_exprt{always.op()}};
}
else if(expr.id() == ID_sva_s_always)
{
// not s_always [x:y] p --> eventually [x:y] not p
auto &s_always = to_sva_s_always_expr(expr);
return sva_eventually_exprt{
s_always.lower(), s_always.upper(), not_exprt{s_always.op()}};
}
else if(expr.id() == ID_sva_s_eventually)
{
// not s_eventually p --> always not p
Expand Down
Loading