summaryrefslogtreecommitdiff
path: root/tests/source/Overflows.scade
blob: e9c3107ed1724722f6ab975a05051344c5fbe5be (plain) (blame)
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
-- Root node: Top

node BasicCount(reset : bool) returns (n : real)
  n = CountToMax(reset, 3.0);

node CountToMax(Reset : bool; Max : 'T) returns (N : 'T) where 'T numeric
var _L5 : 'T;
let
  _L5 = fby (N; 8; (0: 'T));
  N = if Reset or Max < _L5 then (0: 'T) else (1: 'T) + _L5;
tel

node CountToMaxNoReset(Max : 'T) returns (N : 'T) where 'T numeric
var _L5 : 'T;
let
  _L5 = (0: 'T) -> pre N;
  N = if Max < _L5 then (0: 'T) else (1: 'T) + _L5;
tel

node Top(Input1 : int; Input2 : real; Input3 : bool)
  returns (Output1 : int;
           Output2 : real;
           int_count, int_count1 : int;
           real_count, real_count1 : real)
let
  automaton SM1
    initial state State2
      unless
        if Input3 restart State2;
      var next : int;
      let
        next = if 100 < int_count1 then 0 else int_count1 + 1;
        int_count1 = 0 -> pre next;
      tel
    
  returns int_count1;
  
  real_count1 = (restart CountToMaxNoReset every Input3)(1000.);
  int_count = CountToMax(Input3, 1000);
  real_count = CountToMax(Input3, 1000.0);
  Output2 = Input2 * 1.0e100;
  Output1 = Input1 * 10000;
tel