Skip to content

Commit badff3f

Browse files
authored
Merge pull request #260 from diffblue/clock24h
ebmc: add lexicographic ranking function test
2 parents 6def7e7 + 59837a1 commit badff3f

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
clock24h.sv
3+
--property main.property.p_day --ranking-function "{23-hours,59-minutes,59-seconds}"
4+
^\[main\.property\.p_day\] .*: PROVED$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
clock24h.sv
3+
--property main.property.p_hour --ranking-function "{59-minutes,59-seconds}"
4+
^\[main\.property\.p_hour\] .*: PROVED$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
clock24h.sv
3+
--property main.property.p_minute --ranking-function "59-seconds"
4+
^\[main\.property\.p_minute\] .*: PROVED$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module main(input clk);
2+
3+
reg [7:0] seconds, minutes, hours;
4+
reg minute_tick, hour_tick, day_tick;
5+
6+
wire second_tick = 1;
7+
8+
initial begin
9+
seconds = 0;
10+
minutes = 0;
11+
hours = 0;
12+
day_tick = 0;
13+
end
14+
15+
always @(posedge clk) begin
16+
minute_tick <= 0;
17+
hour_tick <= 0;
18+
day_tick <= 0;
19+
if(second_tick) begin
20+
if(seconds == 59) begin
21+
seconds <= 0;
22+
minute_tick <= 1;
23+
if(minutes == 59) begin
24+
minutes <= 0;
25+
hour_tick <= 1;
26+
if(hours == 23) begin
27+
hours <= 0;
28+
day_tick <= 1;
29+
end else
30+
hours <= hours + 1;
31+
end else
32+
minutes <= minutes + 1;
33+
end else
34+
seconds <= seconds + 1;
35+
end
36+
end
37+
38+
// expected to pass
39+
p_minute: assert property (eventually minute_tick);
40+
p_hour: assert property (eventually hour_tick);
41+
p_day: assert property (eventually day_tick);
42+
43+
endmodule

0 commit comments

Comments
 (0)