-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathH_mesi_protocol.smv
159 lines (138 loc) · 4.8 KB
/
H_mesi_protocol.smv
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
MODULE CPU(BUS-LINE, CACHE-LINE,DONE)
VAR
master : boolean;
request : {none, write, read};
bus-line : {idle, read, read-rdx, invalidate};
done : {none, wait, finish};
state : {invalid, shared, exclusive, modified, i2m, i2e, i2s, s2m};
DEFINE
--readable := ((state = shared) | (state = exclusive) | (state = modified));
--writable := ((state = exclusive) | (state = modified));
ASSIGN
init(request) := none;
next(request) :=
case
master : {none, write, read};
TRUE : request;
esac;
init(done) := none;
next(done) :=
case
done = finish : none;
done = wait :
case
state = i2m : finish;
state = i2e : finish;
state = i2s : finish;
state = s2m : finish;
TRUE : done;
esac;
done = none & !(request = none) : wait;
TRUE : done;
esac;
init(bus-line) := idle;
next(bus-line) :=
case
master :
case
state = invalid & request = write : read-rdx;
state = shared & request = write : invalidate;
TRUE : bus-line;
esac;
done = finish : idle;
TRUE : bus-line;
esac;
init(state) := invalid;
next(state) :=
case
master :
case
-- invalid
state = invalid & request = write : i2m; --modified -- read-rdx
state = invalid & request = read : -- read
case
CACHE-LINE = invalid : i2e;
TRUE : i2s;
esac;
-- shared
state = shared & request = write : s2m; -- invalidate
state = shared & request = read : shared; -- X
-- exclusive
state = exclusive & request = write : modified; -- X
state = exclusive & request = read : exclusive; -- X
-- modified
state = modified & request = write : modified; -- X
state = modified & request = read : modified; -- X
-- transition finish
state = i2m : modified;
state = i2e : exclusive;
state = i2s : shared;
state = s2m : modified;
TRUE : state;
esac;
-- BUS-LINE
-- shared
state = shared & BUS-LINE = read : shared;
state = shared & BUS-LINE = read-rdx : invalid;
state = shared & BUS-LINE = invalidate : invalid;
-- exclusive
state = exclusive & BUS-LINE = read : shared;
state = exclusive & BUS-LINE = read-rdx : invalid;
state = exclusive & BUS-LINE = invalidate : invalid;
-- modified
state = modified & BUS-LINE = read : shared;
state = modified & BUS-LINE = read-rdx : invalid;
state = modified & BUS-LINE = invalidate : invalid;
TRUE : state;
esac;
MODULE main
VAR
BUS-LINE : {idle, read, read-rdx, invalidate};
CACHE-LINE : {invalid, shared, exclusive, modified};
DONE : {none, wait, finish};
cpu1 : CPU(BUS-LINE, CACHE-LINE, DONE);
cpu2 : CPU(BUS-LINE, CACHE-LINE, DONE);
ASSIGN
DONE :=
case
!(cpu1.done = none) : cpu1.done;
!(cpu2.done = none) : cpu2.done;
TRUE : none;
esac;
cpu1.master :=
case
DONE = finish : {FALSE,TRUE};
TRUE : cpu1.master;
esac;
cpu2.master :=
case
cpu1.master : FALSE;
TRUE : {FALSE,TRUE};
esac;
BUS-LINE :=
case
cpu2.bus-line = idle : cpu1.bus-line;
cpu1.bus-line = idle : cpu2.bus-line;
TRUE : {idle, read, read-rdx, invalidate};
esac;
CACHE-LINE :=
case
cpu1.state = shared | cpu2.state = shared : shared;
cpu1.state = exclusive | cpu2.state = exclusive : exclusive;
cpu1.state = modified | cpu2.state = modified : modified;
TRUE : invalid;
esac;
--SPEC
--AG EF (cpu1.readable)
--SPEC
--AG EF (cpu1.writable)
--SPEC
--AG !(cpu1.writable & cpu2.writable)
SPEC AG !(EF (cpu1.state = modified & cpu2.state = modified))
SPEC AG !(EF (cpu1.state = modified & cpu2.state = exclusive))
SPEC AG !(EF (cpu1.state = exclusive & cpu2.state = modified))
SPEC AG !(EF (cpu1.state = modified & cpu2.state = shared))
SPEC AG !(EF (cpu1.state = shared & cpu2.state = modified))
SPEC AG !(EF (cpu1.state = exclusive & cpu2.state = exclusive))
SPEC AG !(EF (cpu1.state = exclusive & cpu2.state = shared))
SPEC AG !(EF (cpu1.state = shared & cpu2.state = exclusive))