Skip to content

Commit 2d186f0

Browse files
authored
Merge pull request #1313 from diffblue/smv-verilog-past
Instrument `$past` when generating SMV word level
2 parents cdd707e + e33a954 commit 2d186f0

File tree

6 files changed

+45
-1
lines changed

6 files changed

+45
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
verilog5.sv
3+
--smv-word-level
4+
^INIT ebmc::\$past1@1 = FALSE$
5+
^TRANS next\(ebmc::\$past1@1\) = main\.in$
6+
^LTLSPEC G main\.in = \(X ebmc::\$past1@1\)$
7+
^EXIT=0$
8+
^SIGNAL=0$
9+
--
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module main(input clk, input in);
2+
3+
p1: assert property (in iff s_nexttime $past(in));
4+
5+
endmodule

src/ebmc/ebmc_parse_options.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Author: Daniel Kroening, kroening@kroening.com
2121
#include "ebmc_version.h"
2222
#include "format_hooks.h"
2323
#include "instrument_buechi.h"
24+
#include "instrument_past.h"
2425
#include "liveness_to_safety.h"
2526
#include "netlist.h"
2627
#include "neural_liveness.h"
@@ -234,6 +235,8 @@ int ebmc_parse_optionst::doit()
234235

235236
if(cmdline.isset("smv-word-level"))
236237
{
238+
// There is no $past in SMV.
239+
instrument_past(transition_system, properties);
237240
auto filename = cmdline.value_opt("outfile").value_or("-");
238241
output_filet output_file{filename};
239242
output_smv_word_level(

src/temporal-logic/sva_to_ltl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ exprt SVA_to_LTL(exprt expr)
272272
}
273273
else if(
274274
expr.id() == ID_and || expr.id() == ID_implies || expr.id() == ID_or ||
275-
expr.id() == ID_not)
275+
expr.id() == ID_not ||
276+
(expr.id() == ID_equal && to_equal_expr(expr).lhs().type().id() == ID_bool))
276277
{
277278
for(auto &op : expr.operands())
278279
{

unit/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SRC += smvlang/expr2smv.cpp \
88
temporal-logic/hoa.cpp \
99
temporal-logic/ltl_sva_to_string.cpp \
1010
temporal-logic/sva_sequence_match.cpp \
11+
temporal-logic/sva_to_ltl.cpp \
1112
temporal-logic/nnf.cpp \
1213
temporal-logic/trivial_sva.cpp \
1314
# Empty last line

unit/temporal-logic/sva_to_ltl.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************\
2+
3+
Module: SVA to LTL
4+
5+
Author: Daniel Kroening, dkr@amazon.com
6+
7+
\*******************************************************************/
8+
9+
#include <util/std_expr.h>
10+
11+
#include <temporal-logic/sva_to_ltl.h>
12+
#include <testing-utils/use_catch.h>
13+
14+
SCENARIO("Generating LTL from SVA")
15+
{
16+
GIVEN("A boolean formula")
17+
{
18+
auto p = symbol_exprt{"p", bool_typet{}};
19+
auto q = symbol_exprt{"q", bool_typet{}};
20+
21+
REQUIRE(SVA_to_LTL(true_exprt{}) == true_exprt{});
22+
REQUIRE(SVA_to_LTL(p) == p);
23+
REQUIRE(SVA_to_LTL(equal_exprt{p, q}) == equal_exprt{p, q});
24+
}
25+
}

0 commit comments

Comments
 (0)