lustrec / test / src / kind_fmcad08 / memory1 / FIREFLY_luke_1b.lus @ 22fe1c93
History | View | Annotate | Download (3.74 KB)
1 |
|
---|---|
2 |
node Sofar( X : bool ) returns ( Sofar : bool ); |
3 |
let |
4 |
Sofar = X -> X and pre Sofar; |
5 |
tel |
6 |
|
7 |
node excludes8( X1, X2, X3, X4, X5, X6, X7, X8 : bool ) returns ( excludes : bool ); |
8 |
let |
9 |
excludes = not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 or |
10 |
X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 or |
11 |
not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 or |
12 |
not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 or |
13 |
not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 or |
14 |
not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 or |
15 |
not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 or |
16 |
not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 or |
17 |
not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8; |
18 |
tel |
19 |
|
20 |
|
21 |
node firefly(e1, e2, e3, e4, e5, e6, e7, e8 : bool; i_invalid : int) |
22 |
returns(invalid, dirty, exclusive, shared : int); |
23 |
var |
24 |
|
25 |
garde1, garde2, garde3, garde4, garde5, garde6, garde7, garde8 : bool; |
26 |
mem_invalid : int; |
27 |
|
28 |
let |
29 |
-- assert #(e1, e2, e3, e4, e5, e6, e7, e8); |
30 |
-- assert i_invalid > 0; |
31 |
|
32 |
mem_invalid = i_invalid -> pre mem_invalid; |
33 |
|
34 |
garde1 = pre invalid>=1 and pre dirty=0 and pre shared=0 and pre exclusive=0 ; |
35 |
garde2 = pre invalid>=1 and pre dirty>=1; |
36 |
garde3 = pre invalid>=1 and pre shared+pre exclusive>=1; |
37 |
garde4 = pre exclusive>=1; |
38 |
garde5 = pre shared=1; |
39 |
garde6 = pre invalid>=1 and pre dirty=0 and pre shared=0 and pre exclusive=0; |
40 |
garde7 = pre invalid>=1 and pre dirty>=1; |
41 |
garde8 = pre invalid>=1 and pre shared+pre exclusive>=1; |
42 |
|
43 |
invalid = mem_invalid -> |
44 |
if(e1) then if(garde1) then pre invalid-1 else pre invalid else |
45 |
if(e2) then if(garde2) then pre invalid-1 else pre invalid else |
46 |
if(e3) then if(garde3) then pre invalid-1 else pre invalid else |
47 |
if(e6) then if(garde6) then pre invalid-1 else pre invalid else |
48 |
if(e7) then if(garde7) then pre invalid-1 else pre invalid else |
49 |
if(e8) then if(garde8) then pre invalid-1 else pre invalid else |
50 |
pre invalid; |
51 |
|
52 |
|
53 |
dirty = 0 -> |
54 |
if(e2) then if(garde2) then pre dirty-1 else pre dirty else |
55 |
if(e4) then if(garde4) then pre dirty+1 else pre dirty else |
56 |
if(e6) then if(garde6) then 1 else pre dirty else |
57 |
if(e7) then if(garde7) then pre dirty-1 else pre dirty else |
58 |
pre dirty; |
59 |
|
60 |
exclusive = 0 -> |
61 |
if(e1) then if(garde1) then pre exclusive+1 else pre exclusive else |
62 |
if(e3) then if(garde3) then 0 else pre exclusive else |
63 |
if(e4) then if(garde4) then pre exclusive-1 else pre exclusive else |
64 |
if(e5) then if(garde5) then pre exclusive+1 else pre exclusive else |
65 |
if(e8) then if(garde8) then 0 else pre exclusive else |
66 |
pre exclusive; |
67 |
|
68 |
shared = 0 -> |
69 |
if(e2) then if(garde2) then pre shared+2 else pre shared else |
70 |
if(e3) then if(garde3) then pre shared + pre exclusive + 1 else pre shared else |
71 |
if(e5) then if(garde5) then pre 0 else pre shared else |
72 |
if(e7) then if(garde7) then pre shared+2 else pre shared else |
73 |
if(e8) then if(garde8) then pre shared + pre exclusive + 1 else pre shared else |
74 |
pre shared; |
75 |
|
76 |
tel |
77 |
|
78 |
node top(e1, e2, e3, e4, e5, e6, e7, e8 : bool; i_invalid : int) |
79 |
returns( OK : bool ); |
80 |
var invalid, dirty, exclusive, shared : int; |
81 |
env : bool; |
82 |
let |
83 |
( invalid, dirty, exclusive, shared ) = |
84 |
firefly( e1, e2, e3, e4, e5, e6, e7, e8, i_invalid ); |
85 |
|
86 |
env = Sofar( excludes8( e1, e2, e3, e4, e5, e6, e7, e8 ) and |
87 |
i_invalid >= 0 ); |
88 |
|
89 |
OK = env => (true -> invalid + dirty + exclusive + shared = |
90 |
pre ( invalid + dirty + exclusive + shared ) ); |
91 |
|
92 |
--%PROPERTY OK=true; |
93 |
--%MAIN; |
94 |
tel |