Skip to content

Commit 66001c0

Browse files
committed
word-level BMC: add missing SVA expressions
1 parent 5b7e801 commit 66001c0

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

src/temporal-logic/normalize_property.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ exprt normalize_pre_sva_cycle_delay(sva_cycle_delay_exprt expr)
145145

146146
exprt normalize_property(exprt expr)
147147
{
148+
#if 0
148149
// pre-traversal
149150
if(expr.id() == ID_not)
150151
expr = normalize_pre_not(to_not_expr(expr));
@@ -261,6 +262,7 @@ exprt normalize_property(exprt expr)
261262
op = normalize_property(op);
262263

263264
// post-traversal
265+
#endif
264266

265267
return expr;
266268
}

src/temporal-logic/temporal_logic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ bool is_SVA_sequence(const exprt &expr)
7272
return id == ID_sva_and || id == ID_sva_or ||
7373
id == ID_sva_overlapped_implication ||
7474
id == ID_sva_non_overlapped_implication || id == ID_sva_cycle_delay ||
75+
id == ID_sva_cycle_delay_plus || id == ID_sva_cycle_delay_star ||
7576
id == ID_sva_sequence_concatenation ||
7677
id == ID_sva_sequence_intersect || id == ID_sva_sequence_first_match ||
77-
id == ID_sva_sequence_throughout || id == ID_sva_sequence_within;
78+
id == ID_sva_sequence_throughout || id == ID_sva_sequence_within ||
79+
id == ID_sva_strong || id == ID_sva_weak;
7880
}
7981

8082
bool is_SVA_operator(const exprt &expr)

src/trans-word-level/property.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ static obligationst property_obligations_rec(
370370
return obligationst{no_timeframes - 1, true_exprt()}; // works on NNF only
371371
}
372372
}
373+
else if(property_expr.id() == ID_sva_indexed_s_nexttime)
374+
{
375+
auto &nexttime = to_sva_indexed_s_nexttime_expr(property_expr);
376+
auto s_always = sva_ranged_always_exprt{
377+
nexttime.index(), nexttime.index(), nexttime.op()};
378+
return property_obligations_rec(s_always, current, no_timeframes);
379+
}
373380
else if(property_expr.id() == ID_sva_s_until || property_expr.id() == ID_U)
374381
{
375382
auto &p = to_binary_expr(property_expr).lhs();
@@ -552,6 +559,28 @@ static obligationst property_obligations_rec(
552559
auto equal_expr = equal_exprt{sva_iff_expr.lhs(), sva_iff_expr.rhs()};
553560
return property_obligations_rec(equal_expr, current, no_timeframes);
554561
}
562+
else if(property_expr.id() == ID_sva_not)
563+
{
564+
auto &not_expr = to_sva_not_expr(property_expr);
565+
return property_obligations_rec(not_expr.lower(), current, no_timeframes);
566+
}
567+
else if(property_expr.id() == ID_sva_implies)
568+
{
569+
auto &implies_expr = to_sva_implies_expr(property_expr);
570+
return property_obligations_rec(
571+
implies_expr.lower(), current, no_timeframes);
572+
}
573+
else if(property_expr.id() == ID_sva_iff)
574+
{
575+
auto &iff_expr = to_sva_iff_expr(property_expr);
576+
return property_obligations_rec(iff_expr.lower(), current, no_timeframes);
577+
}
578+
else if(property_expr.id() == ID_sva_case)
579+
{
580+
auto &case_expr = to_sva_case_expr(property_expr);
581+
return property_obligations_rec(
582+
case_expr.lowering(), current, no_timeframes);
583+
}
555584
else
556585
{
557586
return obligationst{

src/trans-word-level/sequence.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ std::vector<std::pair<mp_integer, exprt>> instantiate_sequence(
176176

177177
return result;
178178
}
179+
else if(expr.id() == ID_sva_strong || expr.id() == ID_sva_weak)
180+
{
181+
// not distinguished
182+
auto &op = to_unary_expr(expr).op();
183+
return instantiate_sequence(op, t, no_timeframes);
184+
}
185+
else if(
186+
expr.id() == ID_sva_cycle_delay_plus ||
187+
expr.id() == ID_sva_cycle_delay_star)
188+
{
189+
PRECONDITION(false);
190+
}
179191
else
180192
{
181193
// not a sequence, evaluate as state predicate

src/verilog/sva_expr.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,11 @@ class sva_not_exprt : public unary_predicate_exprt
657657
: unary_predicate_exprt(ID_sva_not, std::move(op))
658658
{
659659
}
660+
661+
not_exprt lower() const
662+
{
663+
return not_exprt{op()};
664+
}
660665
};
661666

662667
static inline const sva_not_exprt &to_sva_not_expr(const exprt &expr)
@@ -731,6 +736,11 @@ class sva_iff_exprt : public binary_predicate_exprt
731736
: binary_predicate_exprt(std::move(op0), ID_sva_iff, std::move(op1))
732737
{
733738
}
739+
740+
equal_exprt lower() const
741+
{
742+
return equal_exprt{lhs(), rhs()};
743+
}
734744
};
735745

736746
static inline const sva_iff_exprt &to_sva_iff_expr(const exprt &expr)
@@ -754,6 +764,11 @@ class sva_implies_exprt : public binary_predicate_exprt
754764
: binary_predicate_exprt(std::move(op0), ID_sva_implies, std::move(op1))
755765
{
756766
}
767+
768+
implies_exprt lower() const
769+
{
770+
return implies_exprt{lhs(), rhs()};
771+
}
757772
};
758773

759774
static inline const sva_implies_exprt &to_sva_implies_expr(const exprt &expr)

0 commit comments

Comments
 (0)