Skip to content

Commit 0631311

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 a81b944 commit 0631311

File tree

8 files changed

+176
-71
lines changed

8 files changed

+176
-71
lines changed

regression/ebmc/smv-netlist/always_with_range1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ always_with_range1.sv
44
^LTLSPEC node275 & X node275 & X X node275 .*
55
^LTLSPEC G node275$
66
^LTLSPEC node275 & X node275 & X X node275 .*
7-
^LTLSPEC G \(\!node306 \| X node337\)$
7+
^LTLSPEC G \(X node306 -> node337\)$
88
^EXIT=0$
99
^SIGNAL=0$
1010
--

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ IREP_ID_ONE(verilog_null)
147147
IREP_ID_ONE(verilog_event)
148148
IREP_ID_ONE(verilog_event_trigger)
149149
IREP_ID_ONE(verilog_string)
150+
IREP_ID_ONE(verilog_sva_property)
150151
IREP_ID_ONE(verilog_sva_sequence)
151152
IREP_ID_ONE(reg)
152153
IREP_ID_ONE(macromodule)

src/temporal-logic/sva_to_ltl.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,38 @@ exprt SVA_to_LTL(exprt expr)
238238
{
239239
return expr;
240240
}
241+
else if(expr.id() == ID_sva_implies)
242+
{
243+
// maps cleanly to 'implies'
244+
auto &sva_implies = to_sva_implies_expr(expr);
245+
auto rec_lhs = SVA_to_LTL(sva_implies.lhs());
246+
auto rec_rhs = SVA_to_LTL(sva_implies.rhs());
247+
return implies_exprt{rec_rhs, rec_lhs};
248+
}
249+
else if(expr.id() == ID_sva_iff)
250+
{
251+
// maps cleanly to =
252+
auto &sva_iff = to_sva_iff_expr(expr);
253+
auto rec_lhs = SVA_to_LTL(sva_iff.lhs());
254+
auto rec_rhs = SVA_to_LTL(sva_iff.rhs());
255+
return equal_exprt{rec_rhs, rec_lhs};
256+
}
257+
else if(expr.id() == ID_sva_and)
258+
{
259+
// maps cleanly to Boolean and
260+
auto &sva_iff = to_sva_iff_expr(expr);
261+
auto rec_lhs = SVA_to_LTL(sva_iff.lhs());
262+
auto rec_rhs = SVA_to_LTL(sva_iff.rhs());
263+
return and_exprt{rec_rhs, rec_lhs};
264+
}
265+
else if(expr.id() == ID_sva_or)
266+
{
267+
// maps cleanly to Boolean or
268+
auto &sva_iff = to_sva_iff_expr(expr);
269+
auto rec_lhs = SVA_to_LTL(sva_iff.lhs());
270+
auto rec_rhs = SVA_to_LTL(sva_iff.rhs());
271+
return or_exprt{rec_rhs, rec_lhs};
272+
}
241273
else if(
242274
expr.id() == ID_and || expr.id() == ID_implies || expr.id() == ID_or ||
243275
expr.id() == ID_not)

src/verilog/sva_expr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Author: Daniel Kroening, [email protected]
1111
#include <util/arith_tools.h>
1212
#include <util/mathematical_types.h>
1313

14+
exprt sva_iff_exprt::implications() const
15+
{
16+
return sva_and_exprt{
17+
sva_implies_exprt{lhs(), rhs()}, sva_implies_exprt{rhs(), lhs()}, type()};
18+
}
19+
1420
exprt sva_cycle_delay_plus_exprt::lower() const
1521
{
1622
// same as ##[1:$]

0 commit comments

Comments
 (0)