Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (4.82 KB)

1 4748b215 hbourbou
-- This file has been generated by CoCoSim2.
2
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:01:07
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  bool_to_int(x : bool;)
24
returns(y : int;);
25
let
26
	y = if x then
27
		1
28
	    else 0;
29
tel
30
31
node  int_to_uint8(x : int;)
32
returns(y : int;);
33
let
34
	y = if (x > 255) then
35
		(0 + rem_int_int(( x - 255 - 1 ), 256))
36
	    else if (x < 0) then
37
		(255 + rem_int_int(( x + 0 + 1 ), 256))
38
	    else x;
39
tel
40
41
(*
42
Original block name: bias_test_PP/Bias
43
*)
44
node  Bias_35_001(u_1 : real;
45
	u_2 : real;
46
	u_3 : real;
47
	u_4 : real;
48
	u_5 : real;
49
	u_6 : real;
50
	__time_step : real;
51
	__nb_step : int;)
52
returns(Out1_1 : real;
53
	Out1_2 : real;
54
	Out1_3 : real;
55
	Out1_4 : real;
56
	Out1_5 : real;
57
	Out1_6 : real;);
58
var Sum_1 : real;
59
	Sum_2 : real;
60
	Sum_3 : real;
61
	Sum_4 : real;
62
	Sum_5 : real;
63
	Sum_6 : real;
64
	bias_1 : real;
65
let
66
	Sum_1 = 0.0 + u_1 + bias_1;
67
	Sum_2 = 0.0 + u_2 + bias_1;
68
	Sum_3 = 0.0 + u_3 + bias_1;
69
	Sum_4 = 0.0 + u_4 + bias_1;
70
	Sum_5 = 0.0 + u_5 + bias_1;
71
	Sum_6 = 0.0 + u_6 + bias_1;
72
	bias_1 = 2.000000000000000;
73
	Out1_1 = Sum_1;
74
	Out1_2 = Sum_2;
75
	Out1_3 = Sum_3;
76
	Out1_4 = Sum_4;
77
	Out1_5 = Sum_5;
78
	Out1_6 = Sum_6;
79
tel
80
81
(*
82
Original block name: bias_test_PP/Bias1
83
*)
84
node  Bias1_36_001(u_1 : real;
85
	__time_step : real;
86
	__nb_step : int;)
87
returns(Out1_1 : real;
88
	Out1_2 : real;);
89
var Sum_1 : real;
90
	Sum_2 : real;
91
	bias_1 : real;
92
	bias_2 : real;
93
let
94
	Sum_1 = 0.0 + u_1 + bias_1;
95
	Sum_2 = 0.0 + u_1 + bias_2;
96
	bias_1 = 2.000000000000000;
97
	bias_2 = 4.000000000000000;
98
	Out1_1 = Sum_1;
99
	Out1_2 = Sum_2;
100
tel
101
102
(*
103
Original block name: bias_test_PP/Bias2
104
*)
105
node  Bias2_37_001(u_1 : bool;
106
	__time_step : real;
107
	__nb_step : int;)
108
returns(Out1_1 : int;
109
	Out1_2 : int;);
110
var Sum_1 : int;
111
	Sum_2 : int;
112
	bias_1 : bool;
113
	bias_2 : bool;
114
let
115
	Sum_1 = int_to_uint8(0 + bool_to_int(u_1) + bool_to_int(bias_1));
116
	Sum_2 = int_to_uint8(0 + bool_to_int(u_1) + bool_to_int(bias_2));
117
	bias_1 = true;
118
	bias_2 = false;
119
	Out1_1 = Sum_1;
120
	Out1_2 = Sum_2;
121
tel
122
123
(*
124
Original block name: bias_test_PP/Bias3
125
*)
126
node  Bias3_38_001(u_1 : real;
127
	__time_step : real;
128
	__nb_step : int;)
129
returns(Out1_1 : real;
130
	Out1_2 : real;);
131
var Sum_1 : real;
132
	Sum_2 : real;
133
	bias_1 : real;
134
	bias_2 : real;
135
let
136
	Sum_1 = 0.0 + u_1 + bias_1;
137
	Sum_2 = 0.0 + u_1 + bias_2;
138
	bias_1 = 2.000000000000000;
139
	bias_2 = 4.000000000000000;
140
	Out1_1 = Sum_1;
141
	Out1_2 = Sum_2;
142
tel
143
144
(*
145
Original block name: bias_test_PP/Bias4
146
*)
147
node  Bias4_39_001(u_1 : int;
148
	u_2 : int;
149
	u_3 : int;
150
	__time_step : real;
151
	__nb_step : int;)
152
returns(Out1_1 : real;
153
	Out1_2 : real;
154
	Out1_3 : real;);
155
var Sum_1 : real;
156
	Sum_2 : real;
157
	Sum_3 : real;
158
	bias_1 : real;
159
let
160
	Sum_1 = 0.0 + int_to_real(u_1) + bias_1;
161
	Sum_2 = 0.0 + int_to_real(u_2) + bias_1;
162
	Sum_3 = 0.0 + int_to_real(u_3) + bias_1;
163
	bias_1 = 6.000000000000000;
164
	Out1_1 = Sum_1;
165
	Out1_2 = Sum_2;
166
	Out1_3 = Sum_3;
167
tel
168
169
(*
170
Original block name: bias_test_PP
171
*)
172
node  bias_test_PP(In1_1 : real;
173
	In2_1 : bool;
174
	In3_1 : real;
175
	In4_1 : int;
176
	In4_2 : int;
177
	In4_3 : int;)
178
returns(Out1_1 : real;
179
	Out1_2 : real;
180
	Out1_3 : real;
181
	Out1_4 : real;
182
	Out1_5 : real;
183
	Out1_6 : real;
184
	Out2_1 : real;
185
	Out2_2 : real;
186
	Out3_1 : int;
187
	Out3_2 : int;
188
	Out4_1 : real;
189
	Out4_2 : real;
190
	Out5_1 : real;
191
	Out5_2 : real;
192
	Out5_3 : real;);
193
var Bias_1 : real;
194
	Bias_2 : real;
195
	Bias_3 : real;
196
	Bias_4 : real;
197
	Bias_5 : real;
198
	Bias_6 : real;
199
	Bias1_1 : real;
200
	Bias1_2 : real;
201
	Bias2_1 : int;
202
	Bias2_2 : int;
203
	Bias3_1 : real;
204
	Bias3_2 : real;
205
	Bias4_1 : real;
206
	Bias4_2 : real;
207
	Bias4_3 : real;
208
	Constant_1 : real;
209
	Constant_2 : real;
210
	Constant_3 : real;
211
	Constant_4 : real;
212
	Constant_5 : real;
213
	Constant_6 : real;
214
	__time_step : real;
215
	__nb_step : int;
216
let
217
	(Bias_1, Bias_2, Bias_3, Bias_4, Bias_5, Bias_6) = Bias_35_001(Constant_1, Constant_2, Constant_3, Constant_4, Constant_5, Constant_6, __time_step, __nb_step);
218
	(Bias1_1, Bias1_2) = Bias1_36_001(In1_1, __time_step, __nb_step);
219
	(Bias2_1, Bias2_2) = Bias2_37_001(In2_1, __time_step, __nb_step);
220
	(Bias3_1, Bias3_2) = Bias3_38_001(In3_1, __time_step, __nb_step);
221
	(Bias4_1, Bias4_2, Bias4_3) = Bias4_39_001(In4_1, In4_2, In4_3, __time_step, __nb_step);
222
	Constant_1 = 2.000000000000000;
223
	Constant_2 = 4.000000000000000;
224
	Constant_3 = 7.000000000000000;
225
	Constant_4 = 3.000000000000000;
226
	Constant_5 = 5.000000000000000;
227
	Constant_6 = 9.000000000000000;
228
	Out1_1 = Bias_1;
229
	Out1_2 = Bias_2;
230
	Out1_3 = Bias_3;
231
	Out1_4 = Bias_4;
232
	Out1_5 = Bias_5;
233
	Out1_6 = Bias_6;
234
	Out2_1 = Bias1_1;
235
	Out2_2 = Bias1_2;
236
	Out3_1 = Bias2_1;
237
	Out3_2 = Bias2_2;
238
	Out4_1 = Bias3_1;
239
	Out4_2 = Bias3_2;
240
	Out5_1 = Bias4_1;
241
	Out5_2 = Bias4_2;
242
	Out5_3 = Bias4_3;
243
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
244
	__nb_step = (0 -> ((pre __nb_step) + 1));
245
tel