Bug #58 ยป datatypeconversion13_PP.lus
1 |
-- This file has been generated by CoCoSim2.
|
---|---|
2 |
|
3 |
-- Compiler: Lustre compiler 2 (ToLustre.m)
|
4 |
-- Time: 06-Apr-2018 19:01:00
|
5 |
--external libraries
|
6 |
#open <conv> |
7 |
--Round towards minus infinity..
|
8 |
node _Floor (x: real) |
9 |
returns(y:int); |
10 |
let
|
11 |
y= if x < 0.0 then real_to_int(x) - 1 |
12 |
else real_to_int(x); |
13 |
tel
|
14 |
|
15 |
node int_to_uint32 (x: int) |
16 |
returns(y:int); |
17 |
let
|
18 |
y= if x > 4294967295 then 0 + rem_int_int((x - 4294967295 - 1),4294967296) |
19 |
else if x < 0 then 4294967295 + rem_int_int((x - (0) + 1),4294967296) |
20 |
else x; |
21 |
tel
|
22 |
|
23 |
node rem_int_int (x, y: int) |
24 |
returns(z:int); |
25 |
let
|
26 |
z= if (x < 0) and (y > 0) then (x mod -y) |
27 |
else (x mod y); |
28 |
tel
|
29 |
|
30 |
--Simulink code
|
31 |
|
32 |
|
33 |
-- Original block name: datatypeconversion13_PP
|
34 |
node datatypeconversion13_PP (In20_1:real;) |
35 |
returns (Out20_1:int;); |
36 |
-- Contract In progress
|
37 |
var DataTypeConversion21_1:int; |
38 |
__time_step:real; |
39 |
let
|
40 |
__time_step = 0.0 -> pre __time_step + 0.200000000000000; |
41 |
DataTypeConversion21_1 = int_to_uint32(_Floor(In20_1)); |
42 |
Out20_1 = DataTypeConversion21_1; |
43 |
|
44 |
tel
|