Skip to content

Commit 5c45aed

Browse files
committed
introduce verilog_sva_property_typet
This introduces a type for Verilog SVA properties To distinguish properties from state predicates and sequences.
1 parent 9b402aa commit 5c45aed

File tree

8 files changed

+131
-68
lines changed

8 files changed

+131
-68
lines changed

src/hw_cbmc_irep_ids.h

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ IREP_ID_ONE(verilog_null)
139139
IREP_ID_ONE(verilog_event)
140140
IREP_ID_ONE(verilog_event_trigger)
141141
IREP_ID_ONE(verilog_string)
142+
IREP_ID_ONE(verilog_sva_property)
142143
IREP_ID_ONE(verilog_sva_sequence)
143144
IREP_ID_ONE(reg)
144145
IREP_ID_ONE(macromodule)

src/temporal-logic/normalize_property.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Author: Daniel Kroening, [email protected]
2323
exprt normalize_pre_sva_non_overlapped_implication(
2424
sva_non_overlapped_implication_exprt expr)
2525
{
26-
// Same as a->always[1:1] b if lhs is not a sequence.
26+
// a |=> b is the same as a -> always[1:1] b if the lhs is
27+
// not a proper sequence.
2728
if(!is_SVA_sequence_operator(expr.lhs()))
2829
{
2930
auto one = natural_typet{}.one_expr();
@@ -86,7 +87,7 @@ exprt normalize_property(exprt expr)
8687
{
8788
// top-level only
8889
if(expr.id() == ID_sva_cover)
89-
expr = sva_always_exprt{not_exprt{to_sva_cover_expr(expr).op()}};
90+
expr = sva_always_exprt{sva_not_exprt{to_sva_cover_expr(expr).op()}};
9091

9192
expr = trivial_sva(expr);
9293

src/temporal-logic/trivial_sva.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ exprt trivial_sva(exprt expr)
7171
else if(expr.id() == ID_sva_not)
7272
{
7373
// Same as regular 'not'. These do not apply to sequences.
74-
expr = not_exprt{to_sva_not_expr(expr).op()};
74+
// expr = not_exprt{to_sva_not_expr(expr).op()};
7575
}
7676
else if(expr.id() == ID_sva_if)
7777
{

src/trans-word-level/property.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,10 @@ static obligationst property_obligations_rec(
537537
return property_obligations_rec(
538538
to_typecast_expr(property_expr).op(), current, no_timeframes);
539539
}
540-
else if(property_expr.id() == ID_not)
540+
else if(property_expr.id() == ID_sva_not)
541541
{
542542
// We need NNF, try to eliminate the negation.
543-
auto &op = to_not_expr(property_expr).op();
543+
auto &op = to_sva_not_expr(property_expr).op();
544544

545545
auto op_negated_opt = negate_property_node(op);
546546

@@ -576,8 +576,8 @@ static obligationst property_obligations_rec(
576576
else
577577
{
578578
// state formula
579-
return obligationst{
580-
instantiate_property(property_expr, current, no_timeframes)};
579+
auto sampled = instantiate_property(not_exprt{op}, current, no_timeframes);
580+
return obligationst{sampled};
581581
}
582582
}
583583
else if(property_expr.id() == ID_sva_implies)

src/verilog/sva_expr.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ exprt sva_sequence_repetition_star_exprt::lower() const
118118
{
119119
auto n_expr = from_integer(n, integer_typet{});
120120
result = sva_or_exprt{
121-
std::move(result), sva_sequence_repetition_star_exprt{op(), n_expr}};
121+
std::move(result),
122+
sva_sequence_repetition_star_exprt{op(), n_expr},
123+
verilog_sva_sequence_typet{}};
122124
}
123125

124126
return result;

0 commit comments

Comments
 (0)