1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
module test_001(clk, a, a_old, b);
// test case taken from:
// http://www.reddit.com/r/yosys/comments/1wvpj6/trouble_with_assertions_and_sat_solver/
input wire clk;
input wire a;
output reg a_old = 0;
output reg b = 1;
wire assertion = (a_old != b);
always @(posedge clk) begin
a_old <= a;
b <= !a;
assert(a_old != b);
end
endmodule
module test_002(clk, a, a_old, b);
// copy from test_001 with modifications
input wire clk;
input wire a;
output reg a_old = 0;
output reg b = 0; // <-- this will fail
wire assertion = (a_old != b);
always @(posedge clk) begin
a_old <= a;
b <= !a;
assert(a_old != b);
end
endmodule
module test_003(clk, a, a_old, b);
// copy from test_001 with modifications
input wire clk;
input wire a;
output reg a_old = 0;
output reg b; // <-- this will fail
wire assertion = (a_old != b);
always @(posedge clk) begin
a_old <= a;
b <= !a;
assert(a_old != b);
end
endmodule
module test_004(clk, a, a_old, b);
// copy from test_001 with modifications
input wire clk;
input wire a;
output reg a_old = 0;
output reg b = 1;
wire assertion = (a_old != b);
always @(posedge clk) begin
a_old <= a;
b <= !a;
assert(a_old == b); // <-- this will fail
end
endmodule
module test_005(clk, a, a_old, b);
// copy from test_001 with modifications
input wire clk;
input wire a;
output reg a_old = 1; // <-- inverted, no problem
output reg b = 0;
wire assertion = (a_old != b);
always @(posedge clk) begin
a_old <= a;
b <= !a;
assert(a_old != b);
end
endmodule
|