Skip to content

SVA monitor #1011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions regression/ebmc/sva-monitor/always1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CORE
always1.sv
--sva-monitor --smv-word-level
^VAR initial : boolean;$
^VAR always_activated : boolean;$
^INIT sva-monitor::initial$
^INIT !sva-monitor::always_activated$
^TRANS !next\(sva-monitor::initial\)$
^TRANS next\(sva-monitor::always_activated\) = sva-monitor::always_active$
^LTLSPEC G \(sva-monitor::always_active -> FALSE\)$
^EXIT=0$
^SIGNAL=0$
--
5 changes: 5 additions & 0 deletions regression/ebmc/sva-monitor/always1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module main(input clk);

p0: assert property (0);

endmodule
6 changes: 6 additions & 0 deletions regression/ebmc/sva-monitor/initial1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
initial1.sv
--sva-monitor --smv-word-level
^EXIT=0$
^SIGNAL=0$
--
5 changes: 5 additions & 0 deletions regression/ebmc/sva-monitor/initial1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module main(input clk);

initial p0: assert property (0);

endmodule
7 changes: 7 additions & 0 deletions regression/ebmc/sva-monitor/s_eventually1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
s_eventually1.sv
--sva-monitor --smv-word-level
^-- Verilog::main\.p0: not converted$
^EXIT=0$
^SIGNAL=0$
--
5 changes: 5 additions & 0 deletions regression/ebmc/sva-monitor/s_eventually1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module main(input clk);

p0: assert property (s_eventually 0);

endmodule
13 changes: 13 additions & 0 deletions regression/ebmc/sva-monitor/s_nexttime1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CORE
s_nexttime1.sv
--sva-monitor --smv-word-level
^VAR initial : boolean;$
^VAR delayed_active : boolean;$
^INIT sva-monitor::initial$
^INIT !sva-monitor::delayed_active$
^TRANS !next\(sva-monitor::initial\)$
^TRANS next\(sva-monitor::delayed_active\) = sva-monitor::initial$
^LTLSPEC G \(sva-monitor::delayed_active -> FALSE\)$
^EXIT=0$
^SIGNAL=0$
--
5 changes: 5 additions & 0 deletions regression/ebmc/sva-monitor/s_nexttime1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module main(input clk);

initial p0: assert property (s_nexttime 0);

endmodule
6 changes: 6 additions & 0 deletions regression/ebmc/sva-monitor/sequence1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
sequence1.sv
--sva-monitor --smv-word-level
^EXIT=0$
^SIGNAL=0$
--
10 changes: 10 additions & 0 deletions regression/ebmc/sva-monitor/sequence1.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module main(input clk);

reg [31:0] x = 0;

always_ff @(posedge clk)
x++;

initial p0: assert property (x==0 ##1 x==1 ##1 x==2);

endmodule
1 change: 1 addition & 0 deletions src/ebmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SRC = \
show_formula_solver.cpp \
show_properties.cpp \
show_trans.cpp \
sva_monitor.cpp \
transition_system.cpp \
waveform.cpp \
#empty line
Expand Down
13 changes: 9 additions & 4 deletions src/ebmc/ebmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Author: Daniel Kroening, [email protected]
#include "ranking_function.h"
#include "show_properties.h"
#include "show_trans.h"
#include "sva_monitor.h"

#include <iostream>

Expand Down Expand Up @@ -218,6 +219,13 @@ int ebmc_parse_optionst::doit()
auto properties = ebmc_propertiest::from_command_line(
cmdline, transition_system, ui_message_handler);

// possibly apply liveness-to-safety
if(cmdline.isset("liveness-to-safety"))
liveness_to_safety(transition_system, properties);

if(cmdline.isset("sva-monitor"))
sva_monitor(transition_system, properties);

if(cmdline.isset("smv-word-level"))
{
auto filename = cmdline.value_opt("outfile").value_or("-");
Expand All @@ -239,10 +247,6 @@ int ebmc_parse_optionst::doit()
return 0;
}

// possibly apply liveness-to-safety
if(cmdline.isset("liveness-to-safety"))
liveness_to_safety(transition_system, properties);

if(cmdline.isset("show-varmap"))
{
auto netlist =
Expand Down Expand Up @@ -373,6 +377,7 @@ void ebmc_parse_optionst::help()
" {y--show-properties} \t list the properties in the model\n"
" {y--property} {uid} \t check the property with given ID\n"
" {y--liveness-to-safety} \t translate liveness properties to safety properties\n"
" {y--sva-monitor} \t translate SVA properties into a monitor circuit\n"
"\n"
"Methods:\n"
" {y--k-induction} \t do k-induction with k=bound\n"
Expand Down
2 changes: 1 addition & 1 deletion src/ebmc/ebmc_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ebmc_parse_optionst:public parse_options_baset
"(random-traces)(trace-steps):(random-seed):(traces):"
"(random-trace)(random-waveform)"
"(bmc-with-assumptions)"
"(liveness-to-safety)"
"(liveness-to-safety)(sva-monitor)"
"I:D:(preprocess)(systemverilog)(vl2smv-extensions)"
"(warn-implicit-nets)",
argc,
Expand Down
4 changes: 2 additions & 2 deletions src/ebmc/output_smv_word_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ smv_invar(const exprt &expr, const namespacet &ns, std::ostream &out)
if(expr.id() == ID_and)
{
for(auto &conjunct : expr.operands())
smv_initial_states(conjunct, ns, out);
smv_invar(conjunct, ns, out);
}
else if(expr.is_true())
{
Expand All @@ -146,7 +146,7 @@ static void smv_transition_relation(
if(expr.id() == ID_and)
{
for(auto &conjunct : expr.operands())
smv_initial_states(conjunct, ns, out);
smv_transition_relation(conjunct, ns, out);
}
else if(expr.is_true())
{
Expand Down
Loading
Loading