forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
germanish5.cub
140 lines (124 loc) · 2.79 KB
/
germanish5.cub
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
type req = Empty | Reqs | Reqe | Inv | Invack | Gnts | Gnte
type cstate = Invalid | Shared | Exclusive
var Exgntd : bool
var Curcmd : req
var Curptr : proc
array Cache[proc] : cstate
array Shrset[proc] : bool
array Chan[proc] : req
init (z) { Cache[z] = Invalid && Shrset[z] = False &&
Exgntd = False && Curcmd = Empty && Chan[z]=Empty }
unsafe (z1 z2) { Cache[z1] = Exclusive && Cache[z2] = Shared }
transition send_shared (n)
requires { Chan[n] = Empty && Cache[n] = Invalid }
{
Chan[j] := case
| j = n : Reqs
| _ : Chan[j]
}
transition recv_shared (n)
requires { Curcmd = Empty && Chan[n] = Reqs }
{
Curcmd := Reqs;
Curptr := n;
Chan[j] := case
| j = n : Empty
| _ : Chan[j]
}
transition send_exclusive (n)
requires { Chan[n] = Empty && Cache[n] <> Exclusive }
{
Chan[j] := case
| j = n : Reqe
| _ : Chan[j]
}
transition recv_exclusive (n)
requires { Curcmd = Empty && Chan[n] = Reqe }
{
Curcmd := Reqe;
Curptr := n;
Chan[j] := case
| j = n : Empty
| _ : Chan[j]
}
transition sendinv_1 (n)
requires { Chan[n] = Empty && Shrset[n]=True && Curcmd = Reqe }
{
Chan[j] := case
| j = n : Inv
| _ : Chan[j]
}
transition sendinv_2 (n)
requires { Chan[n] = Empty && Shrset[n]=True &&
Curcmd = Reqs && Exgntd=True }
{
Chan[j] := case
| j = n : Inv
| _ : Chan[j]
}
transition recv_inv(n)
requires { Chan[n] = Inv }
{
Chan[j] := case
| j = n : Invack
| _ : Chan[j] ;
Cache[j] := case
| j = n : Invalid
| _ : Cache[j]
}
transition recv_invack(n)
requires { Chan[n] = Invack && Curcmd <> Empty }
{
Exgntd := False;
Chan[j] := case
| j = n : Empty
| _ : Chan[j];
Shrset[j] := case
| j = n : False
| _ : Shrset[j]
}
transition send_gnt_shared(n)
requires { Curptr = n && Curcmd = Reqs &&
Exgntd = False && Chan[n] = Empty }
{
Curcmd := Empty;
Chan[j] := case
| j = n : Gnts
| _ : Chan[j];
Shrset[j] := case
| j = n : True
| _ : Shrset[j]
}
transition send_gnt_exclusive(n)
requires { Curptr = n && Curcmd = Reqe && Chan[n] = Empty &&
forall_other j. Shrset[j] = False }
{
Curcmd := Empty;
Exgntd := True;
Chan[j] := case
| j = n : Gnte
| _ : Chan[j];
Shrset[j] := case
| j = n : True
| _ : Shrset[j]
}
transition recv_gnt_shared(n)
requires {Chan[n] = Gnts}
{
Cache[j] := case
| j = n : Shared
| _ : Cache[j];
Chan[j] := case
| j = n : Empty
| _ : Chan[j]
}
transition recv_gnt_exclusive(n)
requires { Chan[n] = Gnte }
{
Cache[j] := case
| j = n : Exclusive
| _ : Cache[j];
Chan[j] := case
| j = n : Empty
| _ : Chan[j]
}