Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / Simulink / src_many_files / datatypeconversion4_PP.LUSTREC.lus @ cd1faebc

History | View | Annotate | Download (1014 Bytes)

1
-- This file has been generated by CoCoSim2.
2

    
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:27:35
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_uint8(x : int;)
24
returns(y : int;);
25
let
26
	y = if (x > 255) then
27
		(0 + rem_int_int(( x - 255 - 1 ), 256))
28
	    else if (x < 0) then
29
		(255 + rem_int_int(( x + 0 + 1 ), 256))
30
	    else x;
31
tel
32

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