@@ -14,6 +14,7 @@ Author: Daniel Kroening, dkr@amazon.com
1414#include < verilog/sva_expr.h>
1515
1616#include " temporal_expr.h"
17+ #include " temporal_logic.h"
1718
1819exprt normalize_pre_not (not_exprt expr)
1920{
@@ -61,6 +62,51 @@ exprt normalize_pre_implies(implies_exprt expr)
6162 return or_exprt{not_exprt{expr.lhs ()}, expr.rhs ()};
6263}
6364
65+ exprt normalize_pre_sva_overlapped_implication (
66+ sva_overlapped_implication_exprt expr)
67+ {
68+ // Same as regular implication if lhs and rhs are not
69+ // sequences.
70+ if (!is_SVA_sequence (expr.lhs ()) && !is_SVA_sequence (expr.rhs ()))
71+ return or_exprt{not_exprt{expr.lhs ()}, expr.rhs ()};
72+ else
73+ return std::move (expr);
74+ }
75+
76+ exprt normalize_pre_sva_non_overlapped_implication (
77+ sva_non_overlapped_implication_exprt expr)
78+ {
79+ // Same as a->Xb if lhs and rhs are not sequences.
80+ if (!is_SVA_sequence (expr.lhs ()) && !is_SVA_sequence (expr.rhs ()))
81+ return or_exprt{not_exprt{expr.lhs ()}, X_exprt{expr.rhs ()}};
82+ else
83+ return std::move (expr);
84+ }
85+
86+ exprt normalize_pre_sva_not (sva_not_exprt expr)
87+ {
88+ // Same as regular 'not'. These do not apply to sequences.
89+ return not_exprt{expr.op ()};
90+ }
91+
92+ exprt normalize_pre_sva_and (sva_and_exprt expr)
93+ {
94+ // Same as a ∧ b if lhs and rhs are not sequences.
95+ if (!is_SVA_sequence (expr.lhs ()) && !is_SVA_sequence (expr.rhs ()))
96+ return and_exprt{expr.lhs (), expr.rhs ()};
97+ else
98+ return std::move (expr);
99+ }
100+
101+ exprt normalize_pre_sva_or (sva_or_exprt expr)
102+ {
103+ // Same as a ∧ b if lhs or rhs are not sequences.
104+ if (!is_SVA_sequence (expr.lhs ()) && !is_SVA_sequence (expr.rhs ()))
105+ return or_exprt{expr.lhs (), expr.rhs ()};
106+ else
107+ return std::move (expr);
108+ }
109+
64110exprt normalize_pre_sva_cycle_delay (sva_cycle_delay_exprt expr)
65111{
66112 if (expr.is_unbounded ())
@@ -91,6 +137,18 @@ exprt normalize_property(exprt expr)
91137 expr = normalize_pre_implies (to_implies_expr (expr));
92138 else if (expr.id () == ID_sva_cover)
93139 expr = G_exprt{not_exprt{to_sva_cover_expr (expr).op ()}};
140+ else if (expr.id () == ID_sva_overlapped_implication)
141+ expr = normalize_pre_sva_overlapped_implication (
142+ to_sva_overlapped_implication_expr (expr));
143+ else if (expr.id () == ID_sva_non_overlapped_implication)
144+ expr = normalize_pre_sva_non_overlapped_implication (
145+ to_sva_non_overlapped_implication_expr (expr));
146+ else if (expr.id () == ID_sva_and)
147+ expr = normalize_pre_sva_and (to_sva_and_expr (expr));
148+ else if (expr.id () == ID_sva_not)
149+ expr = normalize_pre_sva_not (to_sva_not_expr (expr));
150+ else if (expr.id () == ID_sva_or)
151+ expr = normalize_pre_sva_or (to_sva_or_expr (expr));
94152 else if (expr.id () == ID_sva_nexttime)
95153 {
96154 if (!to_sva_nexttime_expr (expr).is_indexed ())
0 commit comments