Skip to content

Commit 442200f

Browse files
authored
Merge pull request #497 from diffblue/ic3-not-supported
EBMC: give error message when unsupported property is passed to IC3
2 parents 4053ed7 + 2f3a069 commit 442200f

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
not_supported1.sv
3+
--ic3
4+
^\[main\.property\.p0\] always s_eventually main\.my_bit: FAILURE: property not supported by IC3 engine$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--

regression/ebmc/ic3/not_supported1.sv

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module main(input clk);
2+
3+
reg my_bit;
4+
5+
initial my_bit=0;
6+
7+
always @(posedge clk)
8+
my_bit = !my_bit;
9+
10+
// expected to pass
11+
p0: assert property (s_eventually my_bit);
12+
13+
endmodule

src/ic3/m1ain.cc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ Author: Eugene Goldberg, [email protected]
1212
#include <util/ui_message.h>
1313

1414
#include <ebmc/ebmc_properties.h>
15+
#include <ebmc/report_results.h>
1516

1617
#include <trans-netlist/netlist.h>
1718
#include <trans-netlist/trans_to_netlist.h>
1819

20+
#include <temporal-logic/temporal_expr.h>
21+
#include <temporal-logic/temporal_logic.h>
22+
23+
#include <verilog/sva_expr.h>
24+
1925
#include <algorithm>
2026
#include <iostream>
2127
#include <map>
@@ -48,6 +54,26 @@ int do_ic3(const cmdlinet &cmdline,
4854
return(ic3_enginet(cmdline,ui_message_handler)());
4955
} /* end of function do_ic3 */
5056

57+
bool ic3_supports_property(const exprt &expr)
58+
{
59+
if(!is_temporal_operator(expr))
60+
return false;
61+
else if(expr.id() == ID_AG)
62+
{
63+
return !has_temporal_operator(to_AG_expr(expr).op());
64+
}
65+
else if(expr.id() == ID_G)
66+
{
67+
return !has_temporal_operator(to_G_expr(expr).op());
68+
}
69+
else if(expr.id() == ID_sva_always)
70+
{
71+
return !has_temporal_operator(to_sva_always_expr(expr).op());
72+
}
73+
else
74+
return false;
75+
}
76+
5177
/*==================================
5278
5379
O P E R A T O R
@@ -87,6 +113,30 @@ int ic3_enginet::operator()()
87113
message.error() << "no properties" << messaget::eom;
88114
return 1;
89115
}
116+
117+
std::size_t number_of_properties = 0;
118+
119+
for(auto &property : properties.properties)
120+
{
121+
if(property.is_disabled())
122+
continue;
123+
124+
// Is it supported by the IC3 engine?
125+
if(!ic3_supports_property(property.normalized_expr))
126+
{
127+
property.failure("property not supported by IC3 engine");
128+
continue;
129+
}
130+
131+
number_of_properties++;
132+
}
133+
134+
if(number_of_properties == 0)
135+
{
136+
namespacet ns(transition_system.symbol_table);
137+
report_results(cmdline, properties, ns, message.get_message_handler());
138+
return 10;
139+
}
90140
}
91141
catch(const std::string &error_str)
92142
{

0 commit comments

Comments
 (0)