Skip to content

Commit 470ee8c

Browse files
committed
word-level BMC: add missing SVA expressions
1 parent a363d90 commit 470ee8c

File tree

6 files changed

+80
-3
lines changed

6 files changed

+80
-3
lines changed

src/ebmc/bmc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ void bmc(
4747
continue;
4848

4949
// Is it supported by the BMC engine?
50-
if(!bmc_supports_property(property.normalized_expr))
50+
if(!bmc_supports_property(property.original_expr))
5151
{
5252
property.failure("property not supported by BMC engine");
5353
continue;
5454
}
5555

5656
::property(
57-
property.normalized_expr,
57+
property.original_expr,
5858
property.timeframe_handles,
5959
message_handler,
6060
solver,

src/temporal-logic/nnf.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ std::optional<exprt> negate_property_node(const exprt &expr)
136136
auto not_b = not_exprt{followed_by.property()};
137137
return sva_non_overlapped_implication_exprt{followed_by.lhs(), not_b};
138138
}
139+
else if(expr.id() == ID_sva_not)
140+
{
141+
return to_sva_not_expr(expr).op();
142+
}
139143
else
140144
return {};
141145
}

src/temporal-logic/temporal_logic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ 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 ||
7778
id == ID_sva_sequence_throughout || id == ID_sva_sequence_within ||
7879
id == ID_sva_sequence_goto_repetition ||
7980
id == ID_sva_sequence_consecutive_repetition ||
8081
id == ID_sva_sequence_non_consecutive_repetition ||
8182
id == ID_sva_sequence_repetition_star ||
82-
id == ID_sva_sequence_repetition_plus;
83+
id == ID_sva_sequence_repetition_plus ||
84+
id == ID_sva_strong || id == ID_sva_weak;
8385
}
8486

8587
bool is_SVA_operator(const exprt &expr)

src/trans-word-level/property.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,13 @@ static obligationst property_obligations_rec(
399399
return obligationst{no_timeframes - 1, true_exprt()}; // works on NNF only
400400
}
401401
}
402+
else if(property_expr.id() == ID_sva_indexed_s_nexttime)
403+
{
404+
auto &nexttime = to_sva_indexed_s_nexttime_expr(property_expr);
405+
auto s_always = sva_ranged_always_exprt{
406+
nexttime.index(), nexttime.index(), nexttime.op()};
407+
return property_obligations_rec(s_always, current, no_timeframes);
408+
}
402409
else if(property_expr.id() == ID_sva_s_until || property_expr.id() == ID_U)
403410
{
404411
auto &p = to_binary_expr(property_expr).lhs();
@@ -625,6 +632,43 @@ static obligationst property_obligations_rec(
625632
}
626633
return obligationst{t, disjunction(disjuncts)};
627634
}
635+
else if(property_expr.id() == ID_sva_not)
636+
{
637+
auto &not_expr = to_sva_not_expr(property_expr);
638+
return property_obligations_rec(not_expr.lower(), current, no_timeframes);
639+
}
640+
else if(property_expr.id() == ID_sva_implies)
641+
{
642+
auto &implies_expr = to_sva_implies_expr(property_expr);
643+
return property_obligations_rec(
644+
implies_expr.lower(), current, no_timeframes);
645+
}
646+
else if(property_expr.id() == ID_sva_iff)
647+
{
648+
auto &iff_expr = to_sva_iff_expr(property_expr);
649+
return property_obligations_rec(iff_expr.lower(), current, no_timeframes);
650+
}
651+
else if(property_expr.id() == ID_sva_case)
652+
{
653+
auto &case_expr = to_sva_case_expr(property_expr);
654+
return property_obligations_rec(
655+
case_expr.lowering(), current, no_timeframes);
656+
}
657+
else if(property_expr.id() == ID_sva_accept_on || property_expr.id() == ID_sva_sync_accept_on)
658+
{
659+
auto &sva_abort_expr = to_sva_abort_expr(property_expr);
660+
auto lowering = or_exprt{sva_abort_expr.condition(), sva_abort_expr.property()};
661+
return property_obligations_rec(
662+
lowering, current, no_timeframes);
663+
}
664+
else if(property_expr.id() == ID_sva_reject_on || property_expr.id() == ID_sva_sync_reject_on)
665+
{
666+
auto &sva_abort_expr = to_sva_abort_expr(property_expr);
667+
auto lowering = and_exprt{
668+
not_exprt{sva_abort_expr.condition()}, sva_abort_expr.property()};
669+
return property_obligations_rec(
670+
lowering, current, no_timeframes);
671+
}
628672
else
629673
{
630674
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)