@@ -9,6 +9,7 @@ Author: Daniel Kroening, dkr@amazon.com
99#include " normalize_property.h"
1010
1111#include < util/arith_tools.h>
12+ #include < util/mathematical_types.h>
1213#include < util/std_expr.h>
1314
1415#include < verilog/sva_expr.h>
@@ -75,9 +76,8 @@ exprt normalize_pre_implies(implies_exprt expr)
7576exprt normalize_pre_sva_overlapped_implication (
7677 sva_overlapped_implication_exprt expr)
7778{
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 ()))
8181 return or_exprt{not_exprt{expr.lhs ()}, expr.rhs ()};
8282 else
8383 return std::move (expr);
@@ -86,9 +86,9 @@ exprt normalize_pre_sva_overlapped_implication(
8686exprt normalize_pre_sva_non_overlapped_implication (
8787 sva_non_overlapped_implication_exprt expr)
8888{
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 ()}};
9292 else
9393 return std::move (expr);
9494}
@@ -125,13 +125,14 @@ exprt normalize_pre_sva_cycle_delay(sva_cycle_delay_exprt expr)
125125 expr.from ().is_constant () &&
126126 numeric_cast_v<mp_integer>(to_constant_expr (expr.from ())) == 0 )
127127 {
128- // ##[0:$] φ --> F φ
129- return F_exprt {expr.op ()};
128+ // ##[0:$] φ --> s_eventually φ
129+ return sva_s_eventually_exprt {expr.op ()};
130130 }
131131 else
132132 {
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 ()}};
135136 }
136137 }
137138 else
@@ -171,11 +172,13 @@ exprt normalize_property(exprt expr)
171172 expr = normalize_pre_sva_or (to_sva_or_expr (expr));
172173 else if (expr.id () == ID_sva_nexttime)
173174 {
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 ()};
175177 }
176178 else if (expr.id () == ID_sva_s_nexttime)
177179 {
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 ()};
179182 }
180183 else if (expr.id () == ID_sva_indexed_nexttime)
181184 {
@@ -195,6 +198,16 @@ exprt normalize_property(exprt expr)
195198 expr = F_exprt{X_exprt{to_sva_cycle_delay_plus_expr (expr).op ()}};
196199 else if (expr.id () == ID_sva_cycle_delay_star)
197200 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+ }
198211 else if (expr.id () == ID_sva_if)
199212 {
200213 auto &sva_if_expr = to_sva_if_expr (expr);
0 commit comments