Skip to content

Commit 77802cf

Browse files
committed
ensure reset constraint is Boolean
This addresses the case when the argument given to --reset is not Boolean.
1 parent 618dd08 commit 77802cf

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

regression/ebmc/reset-command-line-option1/test.desc renamed to regression/ebmc/CLI/reset1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.sv
2+
reset1.sv
33
--module top --bound 10 --reset reset_n
44
^EXIT=0$
55
^SIGNAL=0$

regression/ebmc/reset-command-line-option1/main.sv renamed to regression/ebmc/CLI/reset1.sv

File renamed without changes.

regression/ebmc/CLI/reset2.desc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
reset2.sv
3+
--module top --bound 10 --reset ~reset_n
4+
^\[top\.p1\] always \(disable iff \(!top\.reset_n\) top\.data >= 0 && top\.data <= 10\): PROVED .*$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--

regression/ebmc/CLI/reset2.sv

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module top(input reset_n, clk);
2+
3+
reg [7:0] data;
4+
5+
always @(posedge clk) begin
6+
if(!reset_n)
7+
data = 0;
8+
else if(data != 10)
9+
data++;
10+
end
11+
12+
// the below holds if the design is reset properly
13+
p1: assert property (disable iff (!reset_n) data >=0 && data <= 10);
14+
15+
endmodule

src/ebmc/build_transition_system.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ int get_transition_system(
276276
exprt reset_constraint = to_expr(
277277
ns, transition_system.main_symbol->name, cmdline.get_value("reset"));
278278

279+
// we want the constraint to be boolean
280+
reset_constraint =
281+
typecast_exprt::conditional_cast(reset_constraint, bool_typet{});
282+
279283
// true in initial state
280284
transt new_trans_expr = transition_system.trans_expr;
281285
new_trans_expr.init() = and_exprt(new_trans_expr.init(), reset_constraint);

0 commit comments

Comments
 (0)