Project

General

Profile

« Previous | Next » 

Revision b56f648d

Added by Hamza Bourbouh over 7 years ago

add clocks folder to tests

View differences:

regression_tests/lustre_files/success/CMakeLists.txt
5 5
add_subdirectory(kind_fmcad08)
6 6
add_subdirectory(adrien)
7 7
add_subdirectory(automata)
8
add_subdirectory(clocks)
regression_tests/lustre_files/success/automata/CMakeLists.txt
2 2

  
3 3
add_subdirectory(with_properties)
4 4
add_subdirectory(without_properties)
5

  
6

  
5 7
add_custom_target(automata COMMAND ${CMAKE_CTEST_COMMAND} -R automata)
regression_tests/lustre_files/success/clocks/CMakeLists.txt
1
cmake_minimum_required(VERSION 2.8.4)
2
include(FindUnixCommands)
3

  
4

  
5

  
6

  
7

  
8
#take all lustre files
9
set(GLOBAL_LUSTRE_FILES "")
10
LUSTREFILES(LFILES ${CMAKE_CURRENT_SOURCE_DIR} )
11
list(APPEND GLOBAL_LUSTRE_FILES ${LFILES})
12
FOREACH(lfile ${LFILES})
13
	get_filename_component(L ${lfile} NAME_WE)
14
	set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${L}")
15
	file(COPY ${lfile}   DESTINATION  ${LUSTRE_OUTPUT_DIR})
16
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}.lusi)
17
	file(COPY  ${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
18
	else()
19
		message("generate ${L}.lusi \n")
20
		Lustre_Compile(LUS_FILE ${lfile}
21
				NODE ""
22
				OPTS "-lusi")				
23
		set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
24
		execute_process(RESULT_VARIABLE res 
25
					COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}__${LUS_OPTS_CUT}} 
26
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
27
		if(${res} STREQUAL "0")
28
			file(COPY  ${L}.lusi DESTINATION  ${LUSTRE_OUTPUT_DIR})
29
		else()
30
			message("${L}.lusi Error")
31
		endif()
32
	endif()
33
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_input_values)
34
		file(COPY  ${L}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
35
	elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}.lusi)
36
		message("generate input_values \n")
37
		execute_process(RESULT_VARIABLE res 
38
					COMMAND ${JAVA_RUNTIME} -cp ${CMAKE_BINARY_DIR}/modules/ Generate_inputs_lusi ${L} ${L}.lusi 
39
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
40
		if(${res} STREQUAL "0")
41
			file(COPY  ${L}_input_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
42
		else()
43
			message("${L}_input_values Error")
44
		endif()
45
	endif()
46
	if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_output_values)
47
		file(COPY  ${L}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
48
	elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${L}_input_values)
49
		message("generate output_values for reference \n")
50
		set(LUSTRE_NODE_OPT  "${L}")
51
		
52
		Lustre_Compile(LUS_FILE ${lfile}
53
						NODE ${LUSTRE_NODE_OPT}
54
						OPTS ""
55
						DIR ${CMAKE_CURRENT_SOURCE_DIR})
56
						
57
		set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
58
		
59
		execute_process(
60
					COMMAND ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
61
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})			
62
		execute_process(
63
					COMMAND  make -f ${L}.makefile
64
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})	
65
		execute_process(RESULT_VARIABLE res 
66
					COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ${L}_input_values > ${L}_output_values"
67
					WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})	
68
		file(REMOVE ${L}_${LUSTRE_NODE_OPT} io_frontend.o ${L}.c ${L}.h ${L}.lusic ${L}.makefile ${L}.o ${L}_alloc.h ${L}_main.c ${L}_main.o )
69
		if(${res} STREQUAL "0")
70
			file(COPY  ${L}_output_values DESTINATION  ${LUSTRE_OUTPUT_DIR})
71
		else()
72
			message("${L} output_values Error")
73
		endif()
74
	endif()
75
ENDFOREACH()
76

  
77
#first combination :no option
78
set(LUSTRE_OPTIONS_OPT "")
79
FOREACH(lus_file ${GLOBAL_LUSTRE_FILES})
80
	get_filename_component(L ${lus_file} NAME_WE)
81
	set(LUSTRE_NODE_OPT  "${L}")
82
	
83
	# First command generate C files from Lustre file
84
	Lustre_Compile(LUS_FILE ${lus_file}
85
					NODE ${LUSTRE_NODE_OPT}
86
					OPTS ${LUSTRE_OPTIONS_OPT})
87
					
88
	set(LUS_OPTS_CUT ${LUSTRE_OPTS_POSTFIX_${L}})
89
	add_test(NAME clocks_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
90
			COMMAND  ${LUSTRE_COMPILER} ${LUSTREC_ARGS_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}} 
91
	)
92

  
93
	 #********************* make -f ${L}.makefile ***************************
94
	 add_test(NAME clocks_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
95
			COMMAND  make -f ${L}.makefile
96
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
97
	)
98
	SET_TESTS_PROPERTIES ( clocks_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
99
	 PROPERTIES DEPENDS clocks_COMPIL_LUSTRE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
100
				REQUIRED_FILES ${L}.makefile
101
				)
102
	 
103
	 #************** execute C binary **********************************
104
	
105
	if (BASH)
106
		add_test(
107
			NAME clocks_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} 
108
			COMMAND ${BASH} -c "./${L}_${LUSTRE_NODE_OPT} < ../${L}_input_values > ${L}_${LUSTRE_NODE_OPT}_outputs"
109
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
110
		)
111
		SET_TESTS_PROPERTIES ( clocks_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
112
			PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}
113
				DEPENDS clocks_MAKE_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT})
114
	else()
115
		message(FATAL_ERROR "Unknown shell command ${BASH} -c for ${CMAKE_HOST_SYSTEM_NAME}")
116
	endif()
117

  
118
	 #************** execute C binary **********************************
119
	 add_test(NAME clocks_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
120
			COMMAND ${CMAKE_COMMAND} -E compare_files ${L}_${LUSTRE_NODE_OPT}_outputs ../${L}_output_values 
121
			WORKING_DIRECTORY ${LUSTRE_OUTPUT_DIR_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}}
122
	)
123
	SET_TESTS_PROPERTIES ( clocks_DIFF_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT}
124
	 PROPERTIES REQUIRED_FILES ${L}_${LUSTRE_NODE_OPT}_outputs
125
				DEPENDS clocks_BIN_${L}_${LUSTRE_NODE_OPT}_${LUS_OPTS_CUT} )
126
ENDFOREACH()
127

  
128
add_custom_target(clocks COMMAND ${CMAKE_CTEST_COMMAND} -R clocks)
129

  
regression_tests/lustre_files/success/clocks/clocks1.lus
1

  
2
node clocks1 (x:bool; d:bool clock) returns (a:int;b:int)
3
var e,f : bool;
4
let
5
  a = 1 when d;
6
  b = if x = d then 1 else 0;
7
  e = true fby e;
8
  f = if x then d else e;
9
tel
10

  
regression_tests/lustre_files/success/clocks/clocks1.lusi
1
(* Generated Lustre Interface file from clocks1.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:20 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
node clocks1 (x: bool; d: bool clock) returns (a: int when true(d); b: int);
6

  
regression_tests/lustre_files/success/clocks/clocks1_input_values
1
1
2
68.49860676020286
3
1
4
73.04316229042067
5
1
6
44.72517044832524
7
0
8
55.99224018747281
9
0
10
10.862326666566101
11
1
12
94.11640651570428
13
0
14
14.772246377047582
15
0
16
83.79479457320699
17
1
18
89.80874174775711
19
0
20
91.82672222627744
21
1
22
66.61107640795053
23
1
24
71.89490252962862
25
0
26
83.1924355526438
27
1
28
31.22882710404946
29
0
30
88.74226956934554
31
0
32
29.71902547798567
33
0
34
10.498912451224129
35
0
36
27.117855512530365
37
0
38
5.132076082668247
39
0
40
31.486702567270164
41
1
42
20.233995434106877
43
0
44
22.09783925385842
45
0
46
87.46704500726752
47
0
48
31.885348258301484
49
1
50
78.07448269275562
51
0
52
7.013128486437714
53
0
54
27.98883432360887
55
1
56
55.32481864959733
57
0
58
75.84597449188777
59
1
60
66.72970965746838
61
0
62
8.570562922517732
63
0
64
6.134255876678951
65
0
66
78.83684936067259
67
1
68
21.8286217685728
69
0
70
73.50131505504093
71
0
72
91.06887433144414
73
1
74
48.9772821631698
75
0
76
29.51839860213793
77
1
78
14.712173851856193
79
1
80
90.81189398187891
81
1
82
82.70034225493781
83
1
84
28.132568613356902
85
0
86
98.06597302982203
87
1
88
1.774725892271245
89
0
90
60.73777141346921
91
0
92
93.03352132750368
93
0
94
66.69102489194003
95
1
96
54.84290972453739
97
1
98
40.752000398662666
99
1
100
87.61503025741054
101
1
102
25.701946888947923
103
0
104
13.64917316280254
105
0
106
17.822606721440515
107
0
108
72.33965823185306
109
1
110
45.240775765500395
111
1
112
44.779295314223866
113
0
114
9.830937504845894
115
1
116
94.25839619187137
117
0
118
73.49915769185274
119
1
120
17.769392497637636
121
1
122
89.3499810685617
123
1
124
47.07047486488028
125
1
126
65.84501740696271
127
1
128
39.01068077627142
129
1
130
17.564194124779352
131
0
132
31.26068973467431
133
0
134
52.660060314132984
135
1
136
4.352874521100714
137
0
138
43.01976491692614
139
0
140
79.90701005525479
141
0
142
58.97030203350353
143
0
144
97.34098311933582
145
1
146
4.831124522556596
147
0
148
59.02702509433514
149
1
150
80.08074446359707
151
1
152
89.12075464667673
153
1
154
39.72331674153148
155
0
156
23.4101433201213
157
0
158
15.5549693999542
159
0
160
61.03093890994737
161
1
162
90.53851083108998
163
1
164
67.28277496258998
165
0
166
80.04594978934597
167
1
168
69.12938757708568
169
0
170
73.33238858952257
171
0
172
72.3331392178394
173
0
174
84.40849747018507
175
0
176
72.17553008464266
177
0
178
95.87378025246483
179
1
180
27.97533577022464
181
1
182
9.616512544976974
183
1
184
20.15206751023616
185
1
186
64.36766043527629
187
0
188
95.59087675292724
189
1
190
54.367398513224195
191
1
192
41.92983752753553
193
0
194
41.86381121062651
195
1
196
61.11964823510658
197
0
198
4.666610271222971
199
0
200
19.27487251122175
regression_tests/lustre_files/success/clocks/clocks1_output_values
1
'a': '1' 
2
'b': '1' 
3
'a': '1' 
4
'b': '1' 
5
'a': '1' 
6
'b': '1' 
7
'a': '1' 
8
'b': '0' 
9
'a': '1' 
10
'b': '0' 
11
'a': '1' 
12
'b': '1' 
13
'a': '1' 
14
'b': '0' 
15
'a': '1' 
16
'b': '0' 
17
'a': '1' 
18
'b': '1' 
19
'a': '1' 
20
'b': '0' 
21
'a': '1' 
22
'b': '1' 
23
'a': '1' 
24
'b': '1' 
25
'a': '1' 
26
'b': '0' 
27
'a': '1' 
28
'b': '1' 
29
'a': '1' 
30
'b': '0' 
31
'a': '1' 
32
'b': '0' 
33
'a': '1' 
34
'b': '0' 
35
'a': '1' 
36
'b': '0' 
37
'a': '1' 
38
'b': '0' 
39
'a': '1' 
40
'b': '0' 
41
'a': '1' 
42
'b': '1' 
43
'a': '1' 
44
'b': '0' 
45
'a': '1' 
46
'b': '0' 
47
'a': '1' 
48
'b': '0' 
49
'a': '1' 
50
'b': '1' 
51
'a': '1' 
52
'b': '0' 
53
'a': '1' 
54
'b': '0' 
55
'a': '1' 
56
'b': '1' 
57
'a': '1' 
58
'b': '0' 
59
'a': '1' 
60
'b': '1' 
61
'a': '1' 
62
'b': '0' 
63
'a': '1' 
64
'b': '0' 
65
'a': '1' 
66
'b': '0' 
67
'a': '1' 
68
'b': '1' 
69
'a': '1' 
70
'b': '0' 
71
'a': '1' 
72
'b': '0' 
73
'a': '1' 
74
'b': '1' 
75
'a': '1' 
76
'b': '0' 
77
'a': '1' 
78
'b': '1' 
79
'a': '1' 
80
'b': '1' 
81
'a': '1' 
82
'b': '1' 
83
'a': '1' 
84
'b': '1' 
85
'a': '1' 
86
'b': '0' 
87
'a': '1' 
88
'b': '1' 
89
'a': '1' 
90
'b': '0' 
91
'a': '1' 
92
'b': '0' 
93
'a': '1' 
94
'b': '0' 
95
'a': '1' 
96
'b': '1' 
97
'a': '1' 
98
'b': '1' 
99
'a': '1' 
100
'b': '1' 
101
'a': '1' 
102
'b': '1' 
103
'a': '1' 
104
'b': '0' 
105
'a': '1' 
106
'b': '0' 
107
'a': '1' 
108
'b': '0' 
109
'a': '1' 
110
'b': '1' 
111
'a': '1' 
112
'b': '1' 
113
'a': '1' 
114
'b': '0' 
115
'a': '1' 
116
'b': '1' 
117
'a': '1' 
118
'b': '0' 
119
'a': '1' 
120
'b': '1' 
121
'a': '1' 
122
'b': '1' 
123
'a': '1' 
124
'b': '1' 
125
'a': '1' 
126
'b': '1' 
127
'a': '1' 
128
'b': '1' 
129
'a': '1' 
130
'b': '1' 
131
'a': '1' 
132
'b': '0' 
133
'a': '1' 
134
'b': '0' 
135
'a': '1' 
136
'b': '1' 
137
'a': '1' 
138
'b': '0' 
139
'a': '1' 
140
'b': '0' 
141
'a': '1' 
142
'b': '0' 
143
'a': '1' 
144
'b': '0' 
145
'a': '1' 
146
'b': '1' 
147
'a': '1' 
148
'b': '0' 
149
'a': '1' 
150
'b': '1' 
151
'a': '1' 
152
'b': '1' 
153
'a': '1' 
154
'b': '1' 
155
'a': '1' 
156
'b': '0' 
157
'a': '1' 
158
'b': '0' 
159
'a': '1' 
160
'b': '0' 
161
'a': '1' 
162
'b': '1' 
163
'a': '1' 
164
'b': '1' 
165
'a': '1' 
166
'b': '0' 
167
'a': '1' 
168
'b': '1' 
169
'a': '1' 
170
'b': '0' 
171
'a': '1' 
172
'b': '0' 
173
'a': '1' 
174
'b': '0' 
175
'a': '1' 
176
'b': '0' 
177
'a': '1' 
178
'b': '0' 
179
'a': '1' 
180
'b': '1' 
181
'a': '1' 
182
'b': '1' 
183
'a': '1' 
184
'b': '1' 
185
'a': '1' 
186
'b': '1' 
187
'a': '1' 
188
'b': '0' 
189
'a': '1' 
190
'b': '1' 
191
'a': '1' 
192
'b': '1' 
193
'a': '1' 
194
'b': '0' 
195
'a': '1' 
196
'b': '1' 
197
'a': '1' 
198
'b': '0' 
199
'a': '1' 
200
'b': '0' 
regression_tests/lustre_files/success/clocks/clocks2.lus
1

  
2
type choice = enum { One, Two };
3
type entier = int;
4

  
5
const PI = 3;
6

  
7
const choix = One;
8

  
9
node toto (x:int) returns (a:int;y:int)
10
var c : choice clock;b1, b2:entier;
11
let
12
  a = PI fby (a+1);
13
  c = if a=x then One else Two ;
14
  b1 = 1 when One(c);
15
  b2 = 2 when Two(c);
16
  y = merge c (One -> b1) (Two -> b2);
17
tel
18

  
19
node clocks2 (x:bool) returns (y:int)
20
var a:int; b:int;
21
let
22
   (a,b) = toto(if x then 0 else 1);
23
   y = a ;
24
tel
25

  
regression_tests/lustre_files/success/clocks/clocks2.lusi
1
(* Generated Lustre Interface file from clocks2.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:20 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
type choice = enum {One, Two }; 
6

  
7
type entier = int; 
8

  
9
const PI = 3;
10

  
11
const choix = One;
12

  
13
node toto (x: int) returns (a: int; y: int);
14

  
15
node clocks2 (x: bool) returns (y: int);
16

  
regression_tests/lustre_files/success/clocks/clocks2_input_values
1
0
2
1
3
1
4
1
5
0
6
0
7
0
8
0
9
1
10
1
11
1
12
0
13
0
14
0
15
0
16
0
17
0
18
1
19
1
20
1
21
0
22
0
23
0
24
0
25
1
26
1
27
1
28
0
29
0
30
1
31
0
32
0
33
1
34
0
35
0
36
1
37
0
38
0
39
0
40
0
41
0
42
0
43
1
44
1
45
0
46
1
47
1
48
0
49
0
50
0
51
0
52
0
53
1
54
1
55
1
56
0
57
0
58
0
59
1
60
0
61
1
62
0
63
0
64
0
65
1
66
0
67
0
68
0
69
0
70
0
71
0
72
0
73
1
74
1
75
0
76
0
77
1
78
1
79
0
80
0
81
1
82
1
83
0
84
1
85
0
86
1
87
1
88
0
89
1
90
0
91
0
92
1
93
0
94
1
95
1
96
0
97
0
98
1
99
1
100
0
regression_tests/lustre_files/success/clocks/clocks2_output_values
1
'y': '3' 
2
'y': '4' 
3
'y': '5' 
4
'y': '6' 
5
'y': '7' 
6
'y': '8' 
7
'y': '9' 
8
'y': '10' 
9
'y': '11' 
10
'y': '12' 
11
'y': '13' 
12
'y': '14' 
13
'y': '15' 
14
'y': '16' 
15
'y': '17' 
16
'y': '18' 
17
'y': '19' 
18
'y': '20' 
19
'y': '21' 
20
'y': '22' 
21
'y': '23' 
22
'y': '24' 
23
'y': '25' 
24
'y': '26' 
25
'y': '27' 
26
'y': '28' 
27
'y': '29' 
28
'y': '30' 
29
'y': '31' 
30
'y': '32' 
31
'y': '33' 
32
'y': '34' 
33
'y': '35' 
34
'y': '36' 
35
'y': '37' 
36
'y': '38' 
37
'y': '39' 
38
'y': '40' 
39
'y': '41' 
40
'y': '42' 
41
'y': '43' 
42
'y': '44' 
43
'y': '45' 
44
'y': '46' 
45
'y': '47' 
46
'y': '48' 
47
'y': '49' 
48
'y': '50' 
49
'y': '51' 
50
'y': '52' 
51
'y': '53' 
52
'y': '54' 
53
'y': '55' 
54
'y': '56' 
55
'y': '57' 
56
'y': '58' 
57
'y': '59' 
58
'y': '60' 
59
'y': '61' 
60
'y': '62' 
61
'y': '63' 
62
'y': '64' 
63
'y': '65' 
64
'y': '66' 
65
'y': '67' 
66
'y': '68' 
67
'y': '69' 
68
'y': '70' 
69
'y': '71' 
70
'y': '72' 
71
'y': '73' 
72
'y': '74' 
73
'y': '75' 
74
'y': '76' 
75
'y': '77' 
76
'y': '78' 
77
'y': '79' 
78
'y': '80' 
79
'y': '81' 
80
'y': '82' 
81
'y': '83' 
82
'y': '84' 
83
'y': '85' 
84
'y': '86' 
85
'y': '87' 
86
'y': '88' 
87
'y': '89' 
88
'y': '90' 
89
'y': '91' 
90
'y': '92' 
91
'y': '93' 
92
'y': '94' 
93
'y': '95' 
94
'y': '96' 
95
'y': '97' 
96
'y': '98' 
97
'y': '99' 
98
'y': '100' 
99
'y': '101' 
100
'y': '102' 
regression_tests/lustre_files/success/clocks/clocks6.lus
1

  
2
type choice1 = enum { On, Off };
3
type choice2 = enum { Up, Down };
4

  
5
node clocks6 (x:int) returns (y:int)
6
var c:choice1 clock; d:choice2 clock; b1,b2,b3,z:int;
7
let
8
  c = if 0=x then Off else On;
9
  d = if x>0 then Up else Down;
10
  b1 = 1 when On(c);
11
  b2 = 2 when Off(c);
12
  b3 = 3 when Down(d);
13
  y = merge d (Up -> z when Up(d)) (Down -> b3);
14
  z = merge c (On -> b1) (Off -> b2);
15
tel
16

  
regression_tests/lustre_files/success/clocks/clocks6.lusi
1
(* Generated Lustre Interface file from clocks6.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:19 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
type choice1 = enum {On, Off }; 
6

  
7
type choice2 = enum {Up, Down }; 
8

  
9
function clocks6 (x: int) returns (y: int);
10

  
regression_tests/lustre_files/success/clocks/clocks7.lus
1

  
2
type choice1 = enum { On, Off };
3
type choice2 = enum { Up, Down };
4

  
5
node clocks7 (x:int) returns (y:int)
6
var c:choice1 clock; d:choice2 clock; b1,b2,b3,z:int;
7
let
8
  c = if 0=x when Up(d) then Off else On;
9
  d = if x>0 then Up else Down;
10
  b1 = 1 when On(c);
11
  b2 = 2 when Off(c);
12
  b3 = 3 when Down(d);
13
  y = merge d (Up -> z) (Down -> b3);
14
  z = merge c (On -> b1) (Off -> b2);
15
tel
16

  
regression_tests/lustre_files/success/clocks/clocks7.lusi
1
(* Generated Lustre Interface file from clocks7.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:19 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
type choice1 = enum {On, Off }; 
6

  
7
type choice2 = enum {Up, Down }; 
8

  
9
function clocks7 (x: int) returns (y: int);
10

  
regression_tests/lustre_files/success/clocks/clocks8.lus
1

  
2
type choice = enum { On, Off };
3

  
4
node clocks8 (x:int) returns (e:int)
5
var c:choice clock; a,b1,b2,d : int;
6
let
7
  a = 2*x;
8
  b1 = a + 1 when On(c);
9
  b2 = a - 1 when Off(c);
10
  c = if 0=x then Off else On;
11
  d = merge c (On -> b1) (Off -> b2);
12
  e = d/2;
13
tel
14

  
regression_tests/lustre_files/success/clocks/clocks8.lusi
1
(* Generated Lustre Interface file from clocks8.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:20 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
type choice = enum {On, Off }; 
6

  
7
function clocks8 (x: int) returns (e: int);
8

  
regression_tests/lustre_files/success/clocks/clocks9.lus
1

  
2
node toto (x:int; d:bool clock) returns (y:int)
3
let
4
  y = x when d;
5
tel
6

  
7
node clocks9(i:int) returns (o:int)
8
var c,d : bool clock;
9
 l : int;
10
let
11
  c = i=1 when d;
12
  d = i=0;
13
  l = toto(i,d) when c;
14
  o = 1;
15
tel
regression_tests/lustre_files/success/clocks/clocks9.lusi
1
(* Generated Lustre Interface file from clocks9.lus *)
2
(* by Lustre-C compiler version 1.3-458, 2016/10/21, 14:41:19 *)
3
(* Feel free to mask some of the definitions by removing them from this file. *)
4

  
5
function toto (x: int; d: bool clock) returns (y: int when true(d));
6

  
7
function clocks9 (i: int) returns (o: int);
8

  
regression_tests/lustre_files/success/clocks/oversampling0.lus
1

  
2
node f(x:int) returns (cpt, y:int )
3
let
4
  y = x + 1;
5
  cpt = (0 fby cpt) + 1;
6
tel
7

  
8
node g(c:bool clock; x:int) returns (out:int )
9
var t, cpt , y, last_y :int;
10
let
11
  (cpt , y) = f(t);
12
  t = merge c (true -> x) (false -> last_y when false(c));
13
  last_y = 0 fby y;
14
  out = y when false(c);
15
tel
16

  
17
node oversampling0 (x:int) returns (out:int; c:bool)
18
var toto:int;
19
let
20
  toto = 1 ;
21
  c = toto = 0 (*true fby false fby c*);
22
  out = g(x,toto=0);
23
tel
24

  

Also available in: Unified diff