Skip to content

Commit 156e76c

Browse files
authored
Merge pull request #1095 from diffblue/s_always1
implement NNF for SVA `s_always`
2 parents fea3945 + f8751f8 commit 156e76c

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

regression/verilog/SVA/s_always1.desc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
s_always1.sv
3+
--bound 20
4+
^\[main\.p0\] s_always \[0:9\] main\.x < 10: PROVED up to bound 20$
5+
^\[main\.p1\] not \(s_always \[0:9\] main\.x < 10\): REFUTED$
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring
10+
--

regression/verilog/SVA/s_always1.sv

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module main(input clk);
2+
3+
reg [31:0] x = 0;
4+
5+
always_ff @(posedge clk)
6+
x<=x+1;
7+
8+
// should pass
9+
initial p0: assert property (s_always [0:9] x<10);
10+
11+
// should fail
12+
initial p1: assert property (not s_always [0:9] x<10);
13+
14+
endmodule

src/temporal-logic/nnf.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ std::optional<exprt> negate_property_node(const exprt &expr)
8181
return sva_ranged_s_eventually_exprt{
8282
always.lower(), always.upper(), not_exprt{always.op()}};
8383
}
84+
else if(expr.id() == ID_sva_s_always)
85+
{
86+
// not s_always [x:y] p --> eventually [x:y] not p
87+
auto &s_always = to_sva_s_always_expr(expr);
88+
return sva_eventually_exprt{
89+
s_always.lower(), s_always.upper(), not_exprt{s_always.op()}};
90+
}
8491
else if(expr.id() == ID_sva_s_eventually)
8592
{
8693
// not s_eventually p --> always not p

0 commit comments

Comments
 (0)