2010-07-09 10:35:54 +02:00
|
|
|
node ssm(i1: bool; i2: bool; i3: bool; i4: bool)
|
|
|
|
returns (o1: bool; o2: bool; o3: bool; o4: bool)
|
|
|
|
let
|
|
|
|
automaton
|
|
|
|
state State1
|
|
|
|
do o1 = false; o2 = false; o3 = false; o4 = false
|
|
|
|
until i1 then TMP12
|
|
|
|
unless i2 then TMP11
|
|
|
|
state TMP11
|
|
|
|
do o1 = false; o2 = true; o3 = false; o4 = false;
|
|
|
|
until true then State3
|
|
|
|
state TMP12
|
|
|
|
do o1 = true; o2 = true; o3 = false; o4 = false;
|
|
|
|
until true then State2
|
|
|
|
|
|
|
|
state State3
|
|
|
|
var last end1: bool = false; last end2: bool = false;
|
|
|
|
do o1 = false; o2 = false; o3 = false; o4 = false;
|
|
|
|
automaton
|
|
|
|
state State1_1
|
|
|
|
do until i3 then State2_1
|
|
|
|
state State2_1
|
|
|
|
do end1 = true;
|
|
|
|
end;
|
|
|
|
automaton
|
|
|
|
state State1_2
|
|
|
|
do unless i4 then State2_2
|
|
|
|
state State2_2
|
|
|
|
do end2 = true
|
|
|
|
end
|
|
|
|
until end1 & end2 then State1
|
|
|
|
unless i1 then State4
|
|
|
|
| i2 then State2
|
|
|
|
state State2
|
|
|
|
var l1: bool;
|
|
|
|
do o1 = false; o2 = false; o3 = false; o4 = l1; l1 = true;
|
|
|
|
until i4 then State4
|
|
|
|
state State4
|
|
|
|
var l2: bool;
|
|
|
|
do o1 = false; o2 = false; o3 = l2; o4 = false; l2 = true;
|
2012-07-17 17:57:04 +02:00
|
|
|
until i4 then State1
|
2010-07-09 10:35:54 +02:00
|
|
|
end
|
|
|
|
tel
|
2012-07-17 17:57:04 +02:00
|
|
|
|
|
|
|
(* clock (0^(n-1)1) *)
|
|
|
|
node counter <<n:int>>() returns (b:bool)
|
|
|
|
var c:int;
|
|
|
|
let
|
|
|
|
c = 1 fby if b then 1 else c + 1;
|
|
|
|
b = (c = n);
|
|
|
|
tel
|
|
|
|
|
|
|
|
node main() returns (o1: bool; o2: bool; o3: bool; o4: bool)
|
|
|
|
var i1: bool; i2: bool; i3: bool; i4: bool;
|
|
|
|
let
|
|
|
|
i1 = counter<<7>>();
|
|
|
|
i2 = counter<<9>>();
|
|
|
|
i3 = counter<<13>>();
|
|
|
|
i4 = counter<<17>>();
|
|
|
|
(o1,o2,o3,o4) = ssm(i1,i2,i3,i4)
|
|
|
|
tel
|