forked from cubicle-model-checker/cubicle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflash_eager.cub
58 lines (39 loc) · 1.47 KB
/
flash_eager.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
type state = Invalid | Shared | Exclusive
type data
var Memory : data
array CacheState[proc] : state
array CacheData[proc] : data
init (p) {
CacheState[p] = Invalid
}
unsafe (p1 p2) { CacheState[p1] = Exclusive && CacheState[p2] = Exclusive }
transition atom_WB (p)
requires { CacheState[p] = Exclusive }
{ Memory := CacheData[p];
CacheState[j] := case | j = p : Invalid | _ : CacheState[j] }
transition atom_Invalidate (p)
requires { CacheState[p] <> Exclusive }
{ CacheState[j] := case | j = p : Invalid | _ : CacheState[j] }
transition atom_Get_1 (p)
requires { CacheState[p] <> Exclusive &&
forall_other i. CacheState[i] <> Exclusive }
{
CacheState[j] := case | j = p : Shared | _ : CacheState[j];
CacheData[j] := case | j = p : Memory | _ : CacheData[j]
}
transition atom_Get_2 (p1 p2)
requires { CacheState[p1] = Exclusive }
{ Memory := CacheData[p1];
CacheState[j] := case | j = p1 : Shared | j = p2 : Shared | _ : CacheState[j];
CacheData[j] := case | j = p2 : CacheData[p1] | _ : CacheData[j] }
transition atom_GetX_1 (p2)
requires { CacheState[p2] <> Exclusive &&
forall_other i. CacheState[i] <> Exclusive }
{ CacheState[j] := case | j = p2 : Exclusive | _ : CacheState[j] ;
CacheData[j] := case | j = p2 : Memory | _ : CacheData[j] }
transition atom_GetX_2 (p1 p2)
requires { CacheState[p1] = Exclusive }
{
CacheState[j] := case | j = p1 : Invalid | j = p2 : Exclusive | _ : CacheState[j];
CacheData[j] := case | j = p2 : CacheData[p1] | _ : CacheData[j]
}