-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_arbiter2.tlsf
68 lines (56 loc) · 1.36 KB
/
simple_arbiter2.tlsf
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
INFO {
TITLE: "Simple Arbiter"
DESCRIPTION: "Parameterized Arbiter, where each request has to be eventually granted"
SEMANTICS: Mealy
TARGET: Mealy
}
GLOBAL {
PARAMETERS {
n = 2;
}
DEFINITIONS {
// ensures mutual exclusion on an n-ary bus
mutual_exclusion(bus) =
mone(bus,0,(SIZEOF bus) - 1);
// ensures that none of the signals
// bus[i] - bus[j] is HIGH
none(bus,i,j) =
&&[i <= t <= j]
!bus[t];
// ensures that at most one of the signals
// bus[i] - bus[j] is HIGH
mone(bus,i,j) =
i > j : false
i == j : true
i < j :
// either no signal of the lower half is HIGH and at
// most one signal of the upper half is HIGH
(none(bus, i, m(i,j)) && mone(bus, m(i,j) + 1, j)) ||
// or at most one signal of the lower half is HIGH
// and no signal in of the upper half is HIGH
(mone(bus, i, m(i,j)) && none(bus, m(i,j) + 1, j));
// returns the position between i and j
m(i,j) = (i + j) / 2;
}
}
MAIN {
INPUTS {
r[n]; // request signals
}
OUTPUTS {
g[n]; // grant signals
}
INVARIANTS {
// ensure mutual exclusion on the output bus
mutual_exclusion(g);
}
GUARANTEES {
// every request is eventually granted
&&[0 <= i < n]
G (r[i] -> F g[i]);
}
}
//#!SYNTCOMP
//STATUS : realizable
//REF_SIZE : 1
//#