Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / test / src / kind_fmcad08 / memory1 / FIREFLY_luke_rt_e2_3460_e3_1333.lus @ 22fe1c93

History | View | Annotate | Download (3.67 KB)

1
node First( X : int ) returns ( First : int );
2
let
3
    First = X -> pre First;
4
tel
5
node Sofar( X : bool ) returns ( Sofar : bool );
6
let
7
    Sofar = X -> X and pre Sofar;
8
tel
9
node excludes8( X1, X2, X3, X4, X5, X6, X7, X8 : bool ) returns ( excludes : bool );
10
let
11
    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
12
                  X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 or
13
              not X1 and     X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 or
14
              not X1 and not X2 and     X3 and not X4 and not X5 and not X6 and not X7 and not X8 or
15
              not X1 and not X2 and not X3 and     X4 and not X5 and not X6 and not X7 and not X8 or
16
              not X1 and not X2 and not X3 and not X4 and     X5 and not X6 and not X7 and not X8 or
17
              not X1 and not X2 and not X3 and not X4 and not X5 and     X6 and not X7 and not X8 or
18
              not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and     X7 and not X8 or
19
              not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and     X8;
20
tel
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
	garde1, garde2, garde3, garde4, garde5, garde6, garde7, garde8 : bool;
25
	mem_invalid : int;
26
let
27
	mem_invalid = i_invalid -> pre mem_invalid;
28
	garde1 = pre invalid>=1 and pre dirty=0 and pre shared=0 and pre exclusive=0 ;
29
	garde2 = pre invalid>=1 and pre dirty>=1;
30
	garde3 = pre invalid>=1 and pre shared+pre exclusive>=1;
31
	garde4 = pre exclusive>=1;
32
	garde5 = pre shared=1;
33
	garde6 = pre invalid>=1 and pre dirty=0 and pre shared=0 and pre exclusive=0;
34
	garde7 = pre invalid>=1 and pre dirty>=1;
35
	garde8 = pre invalid>=1 and pre shared+pre exclusive>=1;
36
	invalid = mem_invalid ->
37
	if(e1) then if(garde1) then pre invalid-1 else pre invalid else
38
	if(e2) then if(garde2) then pre invalid-1 else pre invalid else
39
	if(e3) then if(garde3) then pre invalid-1 else pre invalid else
40
	if(e6) then if(garde6) then pre invalid-1 else pre invalid else
41
	if(e7) then if(garde7) then pre invalid-1 else pre invalid else
42
	if(e8) then if(garde8) then pre invalid-1 else pre invalid else
43
	pre invalid;
44
	dirty = 0 -> 
45
	if(e2) then if(garde2) then pre dirty-1 else pre dirty else
46
	if(e4) then if(garde4) then pre dirty+1 else pre dirty else
47
	if(e6) then if(garde6) then 1 else pre dirty else
48
	if(e7) then if(garde7) then pre dirty-1 else pre dirty else
49
	pre dirty;
50
	exclusive = 0 -> 
51
	if(e1) then if(garde1) then pre exclusive+1 else pre exclusive else
52
	if(e3) then if(garde3) then 0 else pre exclusive else 
53
	if(e4) then if(garde4) then pre exclusive-1 else pre exclusive else
54
	if(e5) then if(garde5) then pre exclusive+1 else pre exclusive else
55
	if(e8) then if(garde8) then 0 else pre exclusive else
56
	pre exclusive;
57
	shared = 0 ->
58
	if(e2) then if(garde2) then pre shared+2 else pre shared else
59
	if(e3) then if(garde3) then pre shared -1+ pre exclusive - 1 else pre shared else
60
	if(e5) then if(garde5) then pre 0 else pre shared else
61
	if(e7) then if(garde7) then pre shared+2 else pre shared else
62
	if(e8) then if(garde8) then pre shared + pre exclusive + 1 else pre shared else
63
	pre shared;
64
tel
65
node top(e1, e2, e3, e4, e5, e6, e7, e8 : bool; i_invalid : int) 
66
	returns( OK : bool );
67
    var invalid, dirty, exclusive, shared : int;
68
        env : bool;
69
let
70
    ( invalid, dirty, exclusive, shared ) =
71
        firefly( e1, e2, e3, e4, e5, e6, e7, e8, i_invalid );
72
    env = Sofar( excludes8( e1, e2, e3, e4, e5, e6, e7, e8 ) and
73
                 i_invalid >= 0 );
74
    OK = env => invalid + dirty + exclusive + shared = First( i_invalid );
75
  --%MAIN;
76
  --%PROPERTY  OK=true;
77
tel