Project

General

Profile

Download (1020 Bytes) Statistics
| Branch: | Tag: | Revision:
1
-- This file has been generated by CoCoSim2.
2

    
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:27:26
5
#open <conv>
6
node  abs_int(x : int;)
7
returns(y : int;);
8
let
9
	y = if (x >= 0) then
10
		x
11
	    else (- x);
12
tel
13

    
14
node  rem_int_int(x : int;
15
	y : int;)
16
returns(z : int;);
17
let
18
	z = if ((y = 0) or (x = 0)) then
19
		0
20
	    else ((x mod y) - (if (((x mod y) <> 0) and (x <= 0)) then abs_int(y) else 0));
21
tel
22

    
23
node  int_to_int8(x : int;)
24
returns(y : int;);
25
let
26
	y = if (x > 127) then
27
		(-128 + rem_int_int(( x - 127 - 1 ), 256))
28
	    else if (x < -128) then
29
		(127 + rem_int_int(( x + 128 + 1 ), 256))
30
	    else x;
31
tel
32

    
33
(*
34
Original block name: datatypeconversion3_PP
35
*)
36
node  datatypeconversion3_PP(In3_1 : real;)
37
returns(Out3_1 : int;);
38
var DataTypeConversion2_1 : int;
39
	__time_step : real;
40
	__nb_step : int;
41
let
42
	DataTypeConversion2_1 = int_to_int8(_Floor(In3_1));
43
	Out3_1 = DataTypeConversion2_1;
44
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
45
	__nb_step = (0 -> ((pre __nb_step) + 1));
46
tel
47

    
(1039-1039/1153)