forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
germanish2.cub
102 lines (89 loc) · 2.09 KB
/
germanish2.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
type req = Empty | Reqs | Reqe
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 inv_1 (n)
requires { Shrset[n]=True && Curcmd = Reqe }
{
Exgntd := False;
Cache[j] := case
| j = n : Invalid
| _ : Cache[j] ;
Shrset[j] := case
| j= n : False
| _ : Shrset[j]
}
transition inv_2 (n)
requires { Shrset[n]=True && Curcmd = Reqs && Exgntd=True }
{
Exgntd := False;
Cache[j] := case
| j = n : Invalid
| _ : Cache[j] ;
Shrset[j] := case
| j= n : False
| _ : Shrset[j]
}
transition gnt_shared (n)
requires { Curptr = n && Curcmd = Reqs && Exgntd = False }
{
Curcmd := Empty;
Shrset[j] := case
| j = n : True
| _ : Shrset[j] ;
Cache[j] := case
| j = n : Shared
| _ : Cache[j]
}
transition gnt_exclusive (n)
requires { Shrset[n] = False && Curcmd = Reqe && Exgntd = False &&
Curptr = n && forall_other l. Shrset[l] = False }
{
Curcmd := Empty;
Exgntd := True;
Shrset[j] := case
| j = n : True
| _ : Shrset[j] ;
Cache[j] := case
| j = n : Exclusive
| _ : Cache[j]
}