8
8
9
9
#include " completeness_threshold.h"
10
10
11
+ #include < util/arith_tools.h>
12
+
11
13
#include < temporal-logic/ltl.h>
12
14
#include < temporal-logic/temporal_logic.h>
13
15
#include < verilog/sva_expr.h>
@@ -25,10 +27,41 @@ bool has_low_completeness_threshold(const exprt &expr)
25
27
// X p
26
28
return !has_temporal_operator (to_X_expr (expr).op ());
27
29
}
28
- else if (expr.id () == ID_sva_nexttime)
30
+ else if (
31
+ expr.id () == ID_sva_nexttime || expr.id () == ID_sva_s_nexttime ||
32
+ expr.id () == ID_sva_s_nexttime)
33
+ {
34
+ // these are rewritten to always/s_always by normalize_property
35
+ PRECONDITION (false );
36
+ }
37
+ else if (expr.id () == ID_sva_ranged_always)
29
38
{
30
- // nexttime p
31
- return !has_temporal_operator (to_sva_nexttime_expr (expr).op ());
39
+ auto &always_expr = to_sva_ranged_always_expr (expr);
40
+ if (has_temporal_operator (always_expr.op ()))
41
+ return false ;
42
+ else if (always_expr.upper ().is_constant ())
43
+ {
44
+ auto lower_int = numeric_cast_v<mp_integer>(always_expr.lower ());
45
+ auto upper_int =
46
+ numeric_cast_v<mp_integer>(to_constant_expr (always_expr.upper ()));
47
+ return lower_int >= 0 && lower_int <= 1 && upper_int >= 0 &&
48
+ upper_int <= 1 ;
49
+ }
50
+ else
51
+ return false ;
52
+ }
53
+ else if (expr.id () == ID_sva_s_always)
54
+ {
55
+ auto &s_always_expr = to_sva_s_always_expr (expr);
56
+ if (has_temporal_operator (s_always_expr.op ()))
57
+ return false ;
58
+ else
59
+ {
60
+ auto lower_int = numeric_cast_v<mp_integer>(s_always_expr.lower ());
61
+ auto upper_int = numeric_cast_v<mp_integer>(s_always_expr.upper ());
62
+ return lower_int >= 0 && lower_int <= 1 && upper_int >= 0 &&
63
+ upper_int <= 1 ;
64
+ }
32
65
}
33
66
else
34
67
return false ;
0 commit comments