forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
german_data.cub
262 lines (228 loc) · 6.02 KB
/
german_data.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
(*
CacheState Coherence Protocol (Steve German, 2001)
ExGntd |------| |-----------|
CurCmd | | <-- Chan1 (excl/shared req.) -- | | Invalide/
CurPtr | Home | --- Chan2 (grants or inv.) ---> | Client(i) | Shared/
InvSet | | <-- Chan3 (inv. ack) ---------- | | Exclusive
ShrSet |------| |-----------|
Data paths from Chou, Manava and Park version
*)
type state = Invalid | Shared | Exclusive
type msg = Empty | Reqs | Reqe | Inv | Invack | Gnts | Gnte
type data
var Exgntd : bool
var Curcmd : msg
var CurClient : proc
var MemData : data
var AuxData : data
var Store_data : data
array Chan1Cmd[proc] : msg
array Chan1Data[proc] : data
array Chan2Cmd[proc] : msg
array Chan2Data[proc] : data
array Chan3Cmd[proc] : msg
array Chan3Data[proc] : data
array CacheState[proc] : state
array CacheData[proc] : data
array Invset[proc] : bool
array Shrset[proc] : bool
init (z) {
Chan1Cmd[z] = Empty &&
Chan2Cmd[z] = Empty &&
Chan3Cmd[z] = Empty &&
CacheState[z] = Invalid &&
Invset[z] = False &&
Shrset[z] = False &&
Curcmd = Empty &&
Exgntd = False &&
MemData = Store_data && (* oblige de mettre ca sinon *)
AuxData = Store_data (* ca foire a cause des gardes *)
(* universelles (approx.) *)
}
(* Control *)
unsafe (z1 z2) { CacheState[z1] = Exclusive && CacheState[z2] <> Invalid }
(* Data *)
unsafe () { Exgntd = False && MemData <> AuxData }
unsafe (z) { CacheState[z] <> Invalid && CacheData[z] <> AuxData }
transition send_req_shared(n)
requires { CacheState[n] = Invalid && Chan1Cmd[n] = Empty }
{
Chan1Cmd[j] := case
| j = n : Reqs
| _ : Chan1Cmd[j];
}
transition send_req_exclusive_1(n)
requires { CacheState[n] = Invalid && Chan1Cmd[n] = Empty }
{
Chan1Cmd[j] := case
| j = n : Reqe
| _ : Chan1Cmd[j] ;
}
transition send_req_exclusive_2(n)
requires { CacheState[n] = Shared && Chan1Cmd[n] = Empty }
{
Chan1Cmd[j] := case
| j = n : Reqe
| _ : Chan1Cmd[j] ;
}
transition recv_req_shared(n)
requires { Curcmd = Empty && Chan1Cmd[n] = Reqs }
{
Curcmd := Reqs;
CurClient := n;
Invset[j] := case | _ : Shrset[j];
Chan1Cmd[j] := case
| j = n: Empty
| _ : Chan1Cmd[j];
}
transition recv_req_exclusive(n)
requires { Curcmd = Empty && Chan1Cmd[n] = Reqe }
{
Curcmd := Reqe;
CurClient := n;
Invset[j] := case | _ : Shrset[j];
Chan1Cmd[j] := case
| j = n : Empty
| _ : Chan1Cmd[j] ;
}
transition send_inv_1(n)
requires { Chan2Cmd[n] = Empty && Invset[n] = True && Curcmd = Reqe }
{
Chan2Cmd[j] := case
| j = n : Inv
| _ : Chan2Cmd[j] ;
Invset[j] := case
| j = n : False
| _ : Invset[j];
}
transition send_inv_2(n)
requires { Chan2Cmd[n] = Empty && Invset[n] = True &&
Curcmd = Reqs && Exgntd = True}
{
Chan2Cmd[j] := case
| j = n : Inv
| _ : Chan2Cmd[j] ;
Invset[j] := case
| j = n : False
| _ : Invset[j] ;
}
transition send_invack_noex(n)
requires { Chan2Cmd[n] = Inv && Chan3Cmd[n] = Empty &&
CacheState[n] <> Exclusive }
{
Chan2Cmd[j] := case
| j = n : Empty
| _ : Chan2Cmd[j] ;
Chan3Cmd[j] := case
| j = n : Invack
| _ : Chan3Cmd[j] ;
CacheState[j] := case
| j = n : Invalid
| _ : CacheState[j] ;
}
transition send_invack_ex(n)
requires { Chan2Cmd[n] = Inv && Chan3Cmd[n] = Empty &&
CacheState[n] = Exclusive }
{
Chan2Cmd[j] := case
| j = n : Empty
| _ : Chan2Cmd[j] ;
Chan3Cmd[j] := case
| j = n : Invack
| _ : Chan3Cmd[j] ;
Chan3Data[j] := case
| j = n : CacheData[n]
| _ : Chan3Data[j] ;
CacheState[j] := case
| j = n : Invalid
| _ : CacheState[j] ;
}
transition recv_invack_noex(n)
requires { Chan3Cmd[n] = Invack && Curcmd <> Empty && Exgntd = False }
{
Chan3Cmd[j] := case
| j = n : Empty
| _ : Chan3Cmd[j] ;
Shrset[j] := case
| j = n : False
| _ : Shrset[j] ;
}
transition recv_invack_ex(n)
requires { Chan3Cmd[n] = Invack && Curcmd <> Empty && Exgntd = True }
{
Exgntd := False;
Chan3Cmd[j] := case
| j = n : Empty
| _ : Chan3Cmd[j] ;
Shrset[j] := case
| j = n : False
| _ : Shrset[j] ;
MemData := Chan3Data[n];
}
transition send_gnt_shared(n)
requires { CurClient = n && Curcmd = Reqs &&
Exgntd = False && Chan2Cmd[n] = Empty }
{
Curcmd := Empty;
Chan2Cmd[j] := case
| j = n : Gnts
| _ : Chan2Cmd[j] ;
Chan2Data[j] := case
| j = n : MemData
| _ : Chan2Data[j] ;
Shrset[j] := case
| j = n : True
| _ : Shrset[j] ;
}
transition send_gnt_exclusive(n)
requires { CurClient = n && Curcmd = Reqe &&
Chan2Cmd[n] = Empty && Shrset[n] = False &&
forall_other j. Shrset[j] = False }
{
Curcmd := Empty;
Exgntd := True ;
Chan2Cmd[j] := case
| j = n : Gnte
| _ : Chan2Cmd[j] ;
Chan2Data[j] := case
| j = n : MemData
| _ : Chan2Data[j] ;
Shrset[j] := case
| j = n : True
| _ : Shrset[j] ;
}
transition recv_gnt_shared(n)
requires { Chan2Cmd[n] = Gnts }
{
CacheState[j] := case
| j = n : Shared
| _ : CacheState[j] ;
CacheData[j] := case
| j = n : Chan2Data[n]
| _ : CacheData[j] ;
Chan2Cmd[j] := case
| j = n : Empty
| _ : Chan2Cmd[j] ;
}
transition recv_gnt_exclusive(n)
requires { Chan2Cmd[n] = Gnte }
{
CacheState[j] := case
| j = n : Exclusive
| _ : CacheState[j] ;
CacheData[j] := case
| j = n : Chan2Data[n]
| _ : CacheData[j] ;
Chan2Cmd[j] := case
| j = n : Empty
| _ : Chan2Cmd[j] ;
}
transition store (n)
requires { CacheState[n] = Exclusive }
{
AuxData := Store_data;
CacheData[j] := case
| j = n : Store_data
| _ : CacheData[j];
Store_data := .;
}