forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
germanish.cub
64 lines (53 loc) · 1.26 KB
/
germanish.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
type msg = Empty | Reqs | Reqe
type state = Invalid | Shared | Exclusive
var Exgntd : bool
var Curcmd : msg
var Curptr : proc
array Cache[proc] : state
array Shrset[proc] : bool
init (z) { Cache[z] = Invalid && Shrset[z] = False &&
Exgntd = False && Curcmd = Empty }
unsafe (z1 z2) { Cache[z1] = Exclusive && Cache[z2] = Shared }
transition req_shared (n)
requires { Curcmd = Empty && Cache[n] = Invalid }
{
Curcmd := Reqs;
Curptr := n ;
}
transition req_exclusive (n)
requires { Curcmd = Empty && Cache[n] <> Exclusive }
{
Curcmd := Reqe;
Curptr := n;
}
transition inv_1 (n)
requires { Shrset[n]=True && Curcmd = Reqe }
{
Exgntd := False;
Cache[n] := Invalid;
Shrset[n] :=False;
}
transition inv_2 (n)
requires { Shrset[n]=True && Curcmd = Reqs && Exgntd=True }
{
Exgntd := False;
Cache[n] := Invalid;
Shrset[n] := False;
}
transition gnt_shared (n)
requires { Curptr = n && Curcmd = Reqs && Exgntd = False }
{
Curcmd := Empty;
Shrset[n] := True;
Cache[n] := Shared;
}
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[n] := True;
Cache[n] := Exclusive;
}