Project

General

Profile

Download (1.02 KB) 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:26:52
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_int16(x : int;)
24
returns(y : int;);
25
let
26
	y = if (x > 32767) then
27
		(-32768 + rem_int_int(( x - 32767 - 1 ), 65536))
28
	    else if (x < -32768) then
29
		(32767 + rem_int_int(( x + 32768 + 1 ), 65536))
30
	    else x;
31
tel
32

    
33
(*
34
Original block name: datatypeconversion10_PP
35
*)
36
node  datatypeconversion10_PP(In11_1 : real;)
37
returns(Out11_1 : int;);
38
var DataTypeConversion10_1 : int;
39
	__time_step : real;
40
	__nb_step : int;
41
let
42
	DataTypeConversion10_1 = int_to_int16(_Round(In11_1));
43
	Out11_1 = DataTypeConversion10_1;
44
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
45
	__nb_step = (0 -> ((pre __nb_step) + 1));
46
tel
47

    
(1034-1034/1153)