1 |
4748b215
|
hbourbou
|
-- This file has been generated by CoCoSim2.
|
2 |
|
|
|
3 |
|
|
-- Compiler: Lustre compiler 2 (ToLustre.m)
|
4 |
|
|
-- Time: 03-Dec-2018 22:16:16
|
5 |
|
|
node abs_int(x : int;)
|
6 |
|
|
returns(y : int;);
|
7 |
|
|
let
|
8 |
|
|
y = if (x >= 0) then
|
9 |
|
|
x
|
10 |
|
|
else (- x);
|
11 |
|
|
tel
|
12 |
|
|
|
13 |
|
|
node rem_int_int(x : int;
|
14 |
|
|
y : int;)
|
15 |
|
|
returns(z : int;);
|
16 |
|
|
let
|
17 |
|
|
z = if ((y = 0) or (x = 0)) then
|
18 |
|
|
0
|
19 |
|
|
else ((x mod y) - (if (((x mod y) <> 0) and (x <= 0)) then abs_int(y) else 0));
|
20 |
|
|
tel
|
21 |
|
|
|
22 |
|
|
node int_to_int8(x : int;)
|
23 |
|
|
returns(y : int;);
|
24 |
|
|
let
|
25 |
|
|
y = if (x > 127) then
|
26 |
|
|
(-128 + rem_int_int(( x - 127 - 1 ), 256))
|
27 |
|
|
else if (x < -128) then
|
28 |
|
|
(127 + rem_int_int(( x + 128 + 1 ), 256))
|
29 |
|
|
else x;
|
30 |
|
|
tel
|
31 |
|
|
|
32 |
|
|
(*
|
33 |
|
|
Original block name: Abs5_PP
|
34 |
|
|
*)
|
35 |
|
|
node Abs5_PP(In4_1 : int;)
|
36 |
|
|
returns(Out4_1 : int;);
|
37 |
|
|
var Abs3_1 : int;
|
38 |
|
|
__time_step : real;
|
39 |
|
|
__nb_step : int;
|
40 |
|
|
let
|
41 |
|
|
Abs3_1 = int_to_int8(if (In4_1 = -32768) then
|
42 |
|
|
-32768
|
43 |
|
|
else if (In4_1 >= 0) then
|
44 |
|
|
In4_1
|
45 |
|
|
else (- In4_1));
|
46 |
|
|
Out4_1 = Abs3_1;
|
47 |
|
|
__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
|
48 |
|
|
__nb_step = (0 -> ((pre __nb_step) + 1));
|
49 |
|
|
tel
|