Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / test / src / kind_fmcad08 / simulation / PRODUCER_CONSUMER_2.lus @ 22fe1c93

History | View | Annotate | Download (1.16 KB)

1
node First( X : int ) returns ( First : int );
2
let
3
    First = X -> pre First;
4
tel
5

    
6
node Sofar( X : bool ) returns ( Sofar : bool );
7
let
8
    Sofar = X -> X and pre Sofar;
9
tel
10

    
11
node PRODUCER_CONSUMMER(etat1, etat2, etat3 : bool; a_init : int
12
) returns(i, b, a, o1, o2 : int);
13
var
14
	garde1, garde2, garde3 : bool;
15
let
16
	garde1 = pre i >= 1;
17
	garde2 = pre b >= 1;
18
	garde3 = pre b >= 1;
19

    
20
	i = a ->
21
	if(etat1) then if(garde1) then pre i -1 else pre i else 
22
	pre i;
23

    
24
	b = 0 -> 
25
	if(etat1) then if(garde1) then pre b+1 else pre b else 
26
	if(etat2) then if(garde2) then pre b-1 else pre b else 
27
	if(garde3) then pre b-1 else pre b;
28

    
29
	a = a_init -> pre a;
30

    
31
	o1 = 0 -> 
32
	if(etat2) then if(garde2) then pre o1+1 else pre o1 else 
33
	pre o1;
34

    
35
	o2 = 0 -> 
36
	if(etat3) then if(garde3) then pre o2+1 else pre o2 else
37
	pre o2;
38

    
39
tel
40

    
41
node top(etat1, etat2, etat3 : bool; a_init : int) returns ( OK : bool );
42
    var i, b, a, o1, o2 : int;
43
        env : bool;
44
let
45
   ( i, b, a, o1, o2 ) = PRODUCER_CONSUMMER(etat1, etat2, etat3, a_init );
46
   env = Sofar( not (etat2 and etat3) ) and
47
         ( not etat1 -> true ) and
48
         First( a_init ) > 0;
49
   OK = env => i >= 0;
50
    --%PROPERTY OK=true;
51
    --%MAIN;
52
tel