-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgerman_pfs.cub
executable file
·168 lines (122 loc) · 3.92 KB
/
german_pfs.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
(*
SOURCE: pfs distribution
*)
type state = Invalid | Shared | Exclusive
type msg1 = Empty1 | Reqs | Reqe
type msg2 = Empty2 | Inv | Gnts | Gnte
type msg3 = Empty3 | Invack
var Exgntd : bool
var Curcmd : msg1
var Flag : bool
array Cache[proc] : state
array Chan1[proc] : msg1
array Chan2[proc] : msg2
array Chan3[proc] : msg3
array Curptr[proc] : bool
array Shrset[proc] : bool
array Invset[proc] : bool
init (z) {
Cache[z] = Invalid &&
Chan1[z] = Empty1 &&
Chan2[z] = Empty2 &&
Chan3[z] = Empty3 &&
Curptr[z] = False &&
Shrset[z] = False &&
Invset[z] = False &&
Exgntd = False &&
Curcmd = Empty1 &&
Flag = False }
(* unsafe (z1 z2) { Cache[z1] = Exclusive && Cache[z2] = Shared } *)
(*unsafe (z1 z2) { Cache[z1] = Exclusive && Cache[z2] = Exclusive }*)
unsafe (z1 z2) { Cache[z1] = Exclusive && Cache[z2] <> Invalid }
transition t1(x)
requires { Curcmd = Reqs && Exgntd = False && Chan2[x] = Empty2 &&
Curptr[x] = True && Flag = False }
{ Curcmd := Empty1 ;
Chan2[j] := case | j = x : Gnts | _ : Chan2[j] ;
Shrset[j] := case | j = x : True | _ : Shrset[j] ;
}
transition t2(x)
requires { Shrset[x] = False && Curcmd = Reqe && Chan2[x] = Empty2 &&
Curptr[x] = True && Flag = False &&
forall_other j. Shrset[j] = False}
{ Curcmd := Empty1 ; Exgntd := True ;
Chan2[j] := case | j = x : Gnte | _ : Chan2[j] ;
Shrset[j] := case | j = x : True | _ : Shrset[j] ;
}
transition t3(x)
requires { Curcmd = Empty1 && Chan1[x] = Reqs && Flag = False }
{
Flag := True ;
(* Invset := Shrset ; *)
Invset[j] := case | _ : Shrset[j];
Curcmd := Reqs;
Chan1[j] := case | j = x : Empty1 | _ : Chan1[j] ;
Curptr[j] := case | j = x : True | _ : False
}
transition t3bis(x)
requires { Curcmd = Empty1 && Chan1[x] = Reqe && Flag = False }
{ Flag := True ;
(* Invset := Shrset ; *)
Invset[j] := case | _ : Shrset[j];
Curcmd := Reqe;
Chan1[j] := case | j = x : Empty1 | _ : Chan1[j] ;
Curptr[j] := case | j = x : True | _ : False
}
transition t4(x)
requires { Flag = True && Shrset[x] = False }
{ Invset[j] := case | j = x : False | _ : Invset[j] }
transition t5(x)
requires { Flag = True && Shrset[x] = True }
{ Invset[j] := case | j = x : True | _ : Invset[j] }
transition t6(x)
requires { Flag = True && Invset[x] = Shrset[x]
&& forall_other j. Invset[j] = Shrset[j] }
{ Flag := False }
transition t7(x)
requires { Curcmd = Reqs && Exgntd = True && Invset[x] = True &&
Chan2[x] = Empty2 && Flag = False }
{
Chan2[j] := case | j = x : Inv | _ : Chan2[j] ;
Invset[j] := case | j = x : False | _ : Invset[j] ;
}
transition t8(x)
requires { Curcmd = Reqe && Invset[x] = True && Chan2[x] = Empty2 && Flag = False }
{
Chan2[j] := case | j = x : Inv | _ : Chan2[j] ;
Invset[j] := case | j = x : False | _ : Invset[j] ;
}
transition t9(x)
requires { Curcmd <> Empty1 && Chan3[x] = Invack && Flag = False }
{ Exgntd := False;
Chan3[j] := case | j = x : Empty3 | _ : Chan3[j] ;
Shrset[j] := case | j = x : False | _ : Shrset[j]
}
transition t10(x)
requires { Cache[x] = Invalid && Chan1[x] = Empty1 && Flag = False }
{
Cache[j] := case | j = x : Invalid | _ : Cache[j] ;
Chan1[j] := case | j = x : Reqs | _ : Chan1[j] ;
}
transition t11(x)
requires { Cache[x] <> Exclusive && Chan1[x] = Empty1 && Flag = False }
{ Chan1[j] := case | j = x : Reqe | _ : Chan1[j] }
transition t12(x)
requires { Chan2[x] = Inv && Chan3[x] = Empty3 && Flag = False }
{
Cache[j] := case | j = x : Invalid | _ : Cache[j] ;
Chan2[j] := case | j = x : Empty2 | _ : Chan2[j] ;
Chan3[j] := case | j = x : Invack | _ : Chan3[j]
}
transition t13(x)
requires { Chan2[x] = Gnts && Flag = False }
{
Cache[j] := case | j = x : Shared | _ : Cache[j] ;
Chan2[j] := case | j = x : Empty2 | _ : Chan2[j]
}
transition t14(x)
requires { Chan2[x] = Gnte && Flag = False }
{
Cache[j] := case | j = x : Exclusive | _ : Cache[j] ;
Chan2[j] := case | j = x : Empty2 | _ : Chan2[j]
}