summaryrefslogblamecommitdiff
path: root/tests/source/Overflows.scade
blob: e9c3107ed1724722f6ab975a05051344c5fbe5be (plain) (tree)










































                                                                         
-- 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