9
9
#include " normalize_property.h"
10
10
11
11
#include < util/arith_tools.h>
12
+ #include < util/mathematical_types.h>
12
13
#include < util/std_expr.h>
13
14
14
15
#include < verilog/sva_expr.h>
@@ -75,9 +76,8 @@ exprt normalize_pre_implies(implies_exprt expr)
75
76
exprt normalize_pre_sva_overlapped_implication (
76
77
sva_overlapped_implication_exprt expr)
77
78
{
78
- // Same as regular implication if lhs and rhs are not
79
- // sequences.
80
- if (!is_SVA_sequence (expr.lhs ()) && !is_SVA_sequence (expr.rhs ()))
79
+ // Same as regular implication if lhs is not a sequence.
80
+ if (!is_SVA_sequence (expr.lhs ()))
81
81
return or_exprt{not_exprt{expr.lhs ()}, expr.rhs ()};
82
82
else
83
83
return std::move (expr);
@@ -86,9 +86,9 @@ exprt normalize_pre_sva_overlapped_implication(
86
86
exprt normalize_pre_sva_non_overlapped_implication (
87
87
sva_non_overlapped_implication_exprt expr)
88
88
{
89
- // Same as a->Xb if lhs and rhs are not sequences .
90
- if (!is_SVA_sequence (expr.lhs ()) && ! is_SVA_sequence (expr. rhs ()) )
91
- return or_exprt{not_exprt{expr.lhs ()}, X_exprt {expr.rhs ()}};
89
+ // Same as a->nexttime b if lhs is not a sequence .
90
+ if (!is_SVA_sequence (expr.lhs ()))
91
+ return or_exprt{not_exprt{expr.lhs ()}, sva_nexttime_exprt {expr.rhs ()}};
92
92
else
93
93
return std::move (expr);
94
94
}
@@ -125,13 +125,14 @@ exprt normalize_pre_sva_cycle_delay(sva_cycle_delay_exprt expr)
125
125
expr.from ().is_constant () &&
126
126
numeric_cast_v<mp_integer>(to_constant_expr (expr.from ())) == 0 )
127
127
{
128
- // ##[0:$] φ --> F φ
129
- return F_exprt {expr.op ()};
128
+ // ##[0:$] φ --> s_eventually φ
129
+ return sva_s_eventually_exprt {expr.op ()};
130
130
}
131
131
else
132
132
{
133
- // ##[i:$] φ --> ##i F φ
134
- return sva_cycle_delay_exprt{expr.from (), F_exprt{expr.op ()}};
133
+ // ##[i:$] φ --> always[i:i] s_eventually φ
134
+ return sva_ranged_always_exprt{
135
+ expr.from (), expr.from (), sva_s_eventually_exprt{expr.op ()}};
135
136
}
136
137
}
137
138
else
@@ -171,11 +172,13 @@ exprt normalize_property(exprt expr)
171
172
expr = normalize_pre_sva_or (to_sva_or_expr (expr));
172
173
else if (expr.id () == ID_sva_nexttime)
173
174
{
174
- expr = X_exprt{to_sva_nexttime_expr (expr).op ()};
175
+ auto one = natural_typet{}.one_expr ();
176
+ expr = sva_ranged_always_exprt{one, one, to_sva_nexttime_expr (expr).op ()};
175
177
}
176
178
else if (expr.id () == ID_sva_s_nexttime)
177
179
{
178
- expr = X_exprt{to_sva_s_nexttime_expr (expr).op ()};
180
+ auto one = natural_typet{}.one_expr ();
181
+ expr = sva_ranged_always_exprt{one, one, to_sva_s_nexttime_expr (expr).op ()};
179
182
}
180
183
else if (expr.id () == ID_sva_indexed_nexttime)
181
184
{
@@ -195,6 +198,16 @@ exprt normalize_property(exprt expr)
195
198
expr = F_exprt{X_exprt{to_sva_cycle_delay_plus_expr (expr).op ()}};
196
199
else if (expr.id () == ID_sva_cycle_delay_star)
197
200
expr = F_exprt{to_sva_cycle_delay_star_expr (expr).op ()};
201
+ else if (expr.id () == ID_sva_sequence_concatenation)
202
+ {
203
+ auto &sequence_concatenation = to_sva_sequence_concatenation_expr (expr);
204
+ if (!is_SVA_sequence (sequence_concatenation.lhs ()))
205
+ {
206
+ // a ##0 b --> a && b if a is not a sequence
207
+ expr =
208
+ and_exprt{sequence_concatenation.lhs (), sequence_concatenation.rhs ()};
209
+ }
210
+ }
198
211
else if (expr.id () == ID_sva_if)
199
212
{
200
213
auto &sva_if_expr = to_sva_if_expr (expr);
0 commit comments