-
Notifications
You must be signed in to change notification settings - Fork 1
/
buffer.rcp
45 lines (30 loc) · 978 Bytes
/
buffer.rcp
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
channels: a, empty
enum msgvals {forward, put}
message-structure: MSG : msgvals
communication-variables:asgn : bool
agent Buffer
local: size : int, no : int
init: size == 4 && no == 0
relabel:
asgn <- false
receive-guard: TRUE
repeat: (
<(no > 0)> *! (TRUE)
(MSG := forward)[no:= no - 1]
+
<MSG ==put & (no < size) > * ?
[no:= no + 1]
)
agent Producer
local: size : int, no : int
init: size == 4 && no == 0
relabel:
asgn <- false
receive-guard: TRUE
repeat: (
<TRUE> *! (TRUE)
(MSG := put)[]
)
system = Buffer(one,TRUE) | Producer(two,TRUE) | Producer(three,TRUE)
SPEC G (<sender=two & MSG=put>true -> F <sender=one & MSG=forward>true);
SPEC G (<sender=two & MSG=put>true <-> <sender=three & MSG=forward>true);