forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
german.ctc.cub
169 lines (136 loc) · 3.79 KB
/
german.ctc.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
(*******************************************************************)
(* German cache coherence protocol *)
(*******************************************************************)
(* *)
(* As modeled by Ching-Tsun Chou and used in the paper C.-T. Chou, *)
(* P. K. Mannava, and S. Park, A simple method for parameterized *)
(* verification of cache coherence protocols, FMCAD 2004. *)
(*******************************************************************)
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 = AuxData
}
(* 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 store (n)
requires { CacheState[n] = Exclusive }
{
AuxData := Store_data;
CacheData[j] := case
| j = n : Store_data
| _ : CacheData[j];
Store_data := .;
}
transition sendReqs (i)
requires { Chan1Cmd[i] = Empty && CacheState[i] = Invalid }
{
Chan1Cmd[i] := Reqs;
}
transition sendReqe (i)
requires { Chan1Cmd[i] = Empty && CacheState[i] <> Exclusive }
{
Chan1Cmd[i] := Reqe;
}
transition recvReqs (i)
requires { Curcmd = Empty && Chan1Cmd[i] = Reqs }
{
Curcmd := Reqs;
CurClient := i;
Chan1Cmd[i] := Empty;
Invset[j] := case | _ : Shrset[j];
}
transition recvReqe (i)
requires { Curcmd = Empty && Chan1Cmd[i] = Reqe }
{
Curcmd := Reqe;
CurClient := i;
Chan1Cmd[i] := Empty;
Invset[j] := case | _ : Shrset[j];
}
transition sendInv (i)
requires { Chan2Cmd[i] = Empty && Invset[i] = True && Curcmd = Reqe
|| Chan2Cmd[i] = Empty && Invset[i] = True && Curcmd = Reqs &&
Exgntd = True }
{
Chan2Cmd[i] := Inv;
Invset[i] := False;
}
transition sendInvack (i)
requires { Chan2Cmd[i] = Inv && Chan3Cmd[i] = Empty }
{
Chan2Cmd[i] := Empty;
Chan3Cmd[i] := Invack;
Chan3Data[j] := case
| j = i && CacheState[i] = Exclusive : CacheData[i]
| _ : Chan3Data[j];
CacheState[i] := Invalid;
}
transition recvInvack (i)
requires { Chan3Cmd[i] = Invack && Curcmd <> Empty }
{
Chan3Cmd[i] := Empty;
Shrset[i] := False;
Exgntd := False;
MemData := case | Exgntd = True : Chan3Data[i] | _ : MemData;
}
transition sendGnts (i)
requires { Curcmd = Reqs && CurClient = i && Chan2Cmd[i] = Empty && Exgntd = False }
{
Chan2Cmd[i] := Gnts;
Chan2Data[i] := MemData;
Shrset[i] := True;
Curcmd := Empty;
}
transition sendGnte (i)
requires { Curcmd = Reqe && CurClient = i && Chan2Cmd[i] = Empty && Exgntd = False &&
Shrset[i] = False && forall_other j. Shrset[j] = False }
{
Chan2Cmd[i] := Gnte;
Chan2Data[i] := MemData;
Shrset[i] := True;
Curcmd := Empty;
Exgntd := True;
}
transition recvGnts (i)
requires { Chan2Cmd[i] = Gnts }
{
CacheState[i] := Shared;
CacheData[i] := Chan2Data[i];
Chan2Cmd[i] := Empty;
}
transition recvGnte (i)
requires { Chan2Cmd[i] = Gnte }
{
CacheState[i] := Exclusive;
CacheData[i] := Chan2Data[i];
Chan2Cmd[i] := Empty;
}