From d290481fb8ea2dc3d37b419356b09392eae1433a Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Wed, 8 Apr 2015 15:10:53 +0200 Subject: [PATCH] --2c-inline-loop, -2cil: a new option that inline iterator loops. Actually, that was the default behavior. Now the default behavior is to generate loops for iterators. nb : with -2ch, loops are still always inlined --- lv6-ref-man/lv6-ref-man.tex | 45 ++++++++----- src/lic2soc.ml | 4 +- src/lv6MainArgs.ml | 11 +++- src/lv6MainArgs.mli | 1 + src/soc2c.ml | 7 +- src/socPredef2cStack.ml | 108 ++++++++++++++++++++++++------- test/lus2lic.sum | 26 ++++---- test/lus2lic.time | 16 ++--- test/should_work/TIME_STABLE.lus | 7 +- test/should_work/alias.lus | 12 ++-- test/should_work/matrice.lus | 4 +- test/should_work/matrice2.lus | 2 +- test/should_work/moyenne.lus | 4 +- test/should_work/redIf.lus | 4 +- test/should_work/rediter.lus | 4 +- test/should_work/xx.lus | 2 +- 16 files changed, 173 insertions(+), 84 deletions(-) diff --git a/lv6-ref-man/lv6-ref-man.tex b/lv6-ref-man/lv6-ref-man.tex index 8b9f7327..8ed68a5d 100644 --- a/lv6-ref-man/lv6-ref-man.tex +++ b/lv6-ref-man/lv6-ref-man.tex @@ -520,6 +520,7 @@ true whenever a second elapses. Of course, we can write a new program which freezes the counter whenever the ``\prog{second}'' is not there: +\label{clock-intro} \begin{example}[The TIME\_STABLE1 node] \input{TIME_STABLE1.lus} \end{example} @@ -628,7 +629,24 @@ that}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Lexical aspects} -\todo + + +\begin{itemize} +\item +One-line comments start with \key{--} and stop at the the end of the +line. +\item +Multi-line comments start with \key{(*} and end at the next following +\key{*)}. Multi-line comments cannot be nested. +\item +\bnfrightident{Ident} stands for identifier, following the C standard +(\bnftoken{[\_a-zA-Z][\_a-zA-Z0-9]*}), +\item +\bnfrightident{Floating} and \bnfrightident{Integer} stands for decimal floating point and integer +notations, following C standard, +\end{itemize} + + \sxDef{Ident} \sxDef{string} @@ -976,9 +994,7 @@ sense that they are operating pointwise on streams. \section{Combinational operators} -An operator is a predefined Lustre node. Most of them are infix. - -\xxx say which one +An operator is a predefined Lustre node. %\xxx parler du package Lustre @@ -1043,10 +1059,12 @@ defines X as the stream (0,1,2,3, ...) It also provides a notion of clock, with a sampling operator (\prog{when}) and a dual projection operator \prog{current}. -\begin{example}[] -\todo + +\begin{example}[An example illustrating the use of clocks (cf Section \ref{clock-intro})] +\input{TIME_STABLE.lus} \end{example} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Abstract types} @@ -1055,13 +1073,11 @@ of {\em abstract types} (also called {\em imported types}). An imported type is defined as a simple name. Abstract constants and function manipulating such types can be declared. The way those external items are effectively launched from a Lustre program depends -on the back-ends of the compiler (see the Lustre V6 Code Generator -Manual). +on the back-ends of the compiler. -cf sec 2.2 man-ref.v5 (p17) \begin{example}[] -\todo +\input{complex.lus} \end{example} @@ -1633,14 +1649,13 @@ and model instances. \\ % like in Lustre-V4 . } -XXX -nb: a basic Lustre program is not a valid Lustre V6 program according -to those syntax rules. However, basic lustre programs are still accepted -by the lustre V6 compiler, which consider that a program without package -annotations : +Basic lustre programs are still accepted by the lustre V6 compiler, +which consider implicitely that a program without package annotations +: \begin{itemize} \item uses no other package \item provides all the package parameters it defines +\item is part of a package that is made of the file name \end{itemize} diff --git a/src/lic2soc.ml b/src/lic2soc.ml index 6f96930e..82bf69ae 100644 --- a/src/lic2soc.ml +++ b/src/lic2soc.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 26/02/2015 (at 11:21) by Erwan Jahier> *) +(** Time-stamp: <modified the 08/04/2015 (at 14:36) by Erwan Jahier> *) (* XXX ce module est mal écrit. A reprendre. (R1) *) @@ -855,7 +855,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = | _ -> assert false (* hmm. Iterating on a pre will not work. XXX fixme ! *) in let rec make_n_instance ctx acc n = - if n=0 then ctx,acc else + if n=0 then ctx, List.rev acc else match make_instance lxm Lic.BaseLic ctx nsoc with | ctx,Some inst -> make_n_instance ctx (inst::acc) (n-1) | ctx,None -> ctx,[] diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml index ee3e49e5..6bc83d20 100644 --- a/src/lv6MainArgs.ml +++ b/src/lv6MainArgs.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 30/03/2015 (at 10:21) by Erwan Jahier> *) +(* Time-stamp: <modified the 07/04/2015 (at 16:07) by Erwan Jahier> *) (* Le manager d'argument adapté de celui de lutin, plus joli N.B. solution un peu batarde : les options sont stockées, comme avant, dans Global, @@ -59,6 +59,7 @@ type global_opt = { mutable line_num : int; mutable line_start_pos : int; mutable soc2c_no_switch : bool; + mutable soc2c_inline_loops : bool; mutable io_transmit_mode : io_transmit_mode; mutable schedul_mode : schedul_mode; } @@ -75,6 +76,7 @@ let (global_opt:global_opt) = current_file = ""; expand_enums = AsInt; soc2c_no_switch = false; + soc2c_inline_loops = false; io_transmit_mode = Stack; schedul_mode = Simple; } @@ -324,6 +326,11 @@ let mkoptab (opt:t) : unit = ( (Arg.Unit (fun () -> global_opt.no_prefix <- true)) ["Do not prefix variable names by their module (beware: variable names may clash with this option)."] ; + mkopt opt + ["--2c-inline-loop";"-2cil"] + (Arg.Unit (fun i -> global_opt.soc2c_inline_loops <- true; opt.gen_c <- true)) + ["inline loops (that comes from array iterators)."] + ; mkopt opt ["-version"; "--version"] @@ -413,7 +420,7 @@ let mkoptab (opt:t) : unit = ( ; mkopt opt ~hide:true - ["--2c-no-switch"] + ["--2c-no-switch"; "-2cns"] (Arg.Unit (fun () -> global_opt.soc2c_no_switch <-true)) ["Use if-then-else instead of switches when generating C codes"] ; diff --git a/src/lv6MainArgs.mli b/src/lv6MainArgs.mli index 84d74fd2..2c0f4027 100644 --- a/src/lv6MainArgs.mli +++ b/src/lv6MainArgs.mli @@ -60,6 +60,7 @@ type global_opt = { mutable line_num : int; mutable line_start_pos : int; mutable soc2c_no_switch : bool; + mutable soc2c_inline_loops : bool; mutable io_transmit_mode : io_transmit_mode; mutable schedul_mode : schedul_mode; } diff --git a/src/soc2c.ml b/src/soc2c.ml index 50bdfb23..56eda63c 100644 --- a/src/soc2c.ml +++ b/src/soc2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 26/03/2015 (at 17:55) by Erwan Jahier> *) +(* Time-stamp: <modified the 02/04/2015 (at 10:46) by Erwan Jahier> *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) @@ -724,8 +724,9 @@ typedef float _float; in let main_step = (string_of_soc_key msoc)^"_step" in let gcc = if args.Lv6MainArgs.gen_wcet then - (gcc ^ " > owcet.out; owcet.arm "^execfile^ " --add-prop otawa::ilp::OUTPUT_PATH="^ - main_step^".0.lp "^main_step^" 2>&1 | grep WCET") + (gcc ^ " > owcet.out; owcet.arm "^execfile^ + (* " --add-prop otawa::ilp::OUTPUT_PATH="^main_step^".0.lp "^ *) + main_step^" 2>&1 | grep WCET") else gcc in if args.Lv6MainArgs.launch_cc then ( diff --git a/src/socPredef2cStack.ml b/src/socPredef2cStack.ml index f24ca1c1..26ecb24e 100644 --- a/src/socPredef2cStack.ml +++ b/src/socPredef2cStack.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 26/02/2015 (at 09:52) by Erwan Jahier> *) +(* Time-stamp: <modified the 08/04/2015 (at 14:39) by Erwan Jahier> *) open Data open Soc @@ -216,7 +216,6 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = ) | _ -> let inst_names = List.map fst soc.instances in - let inst_names = List.rev inst_names in let step_args = List.map (fun sn -> ("&ctx->"^(id2s sn))) inst_names in let ctx = List.map (fun sn -> ("ctx->"^(id2s sn))) inst_names in let (array_index : int -> var -> Soc.var_expr) = @@ -225,7 +224,7 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = | Data.Array(vt,_) -> vt | _ -> assert false in - Index(Var (Printf.sprintf "%s" vn, Data.Array(vt,i)),i,vt_elt) + Index(Var (vn, Data.Array(vt,i)),i,vt_elt) (* Var(Printf.sprintf "%s[%d]" vn i,vt) *) in Array.of_list step_args, @@ -258,34 +257,95 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = buff := !buff^(Printf.sprintf " %s;\n" (Soc2cUtil.data_type_to_c telt a_in_bis)); ); - for i=0 to n-1 do - let vel_in, vel_out = - match iterator with - | "map" -> + (match Lv6MainArgs.global_opt.Lv6MainArgs.soc2c_inline_loops, iterator with + | true, "map" -> ( + for i=0 to n-1 do + let vel_in, vel_out = (List.map (array_index i) iter_inputs, List.map (array_index i) iter_outputs) - | "fold" | "red" | "fill" | "fillred" -> + in + buff := !buff^( + Soc2cStack.gen_step_call + soc it_soc vel_out vel_in ctx.(i) node_step step_args.(i)); + done + ) + | false, "map" -> ( + let vel_in, vel_out = + (* xxx <ugly>... Soc.var_expr cannot hold index variable + and I don't want to rewrite (nor duplicate) + gen_step_call for now. Hence this ugly 666 turn-around *) + (List.map (array_index (-666)) iter_inputs, + List.map (array_index (-666)) iter_outputs) + in + let for_loop = Printf.sprintf "for (_i=0 ; _i<%i ; _i+=1) {" n in + let body = Soc2cStack.gen_step_call + soc it_soc vel_out vel_in ctx.(0) node_step step_args.(0); + in + let body = Str.global_replace (Str.regexp "\[-666\]") "[_i]" body in (* </ugly> *) + let str = Printf.sprintf " int _i;\n %s\n %s }" for_loop body in + buff := !buff ^ str + ) + | true, ("fold" | "red" | "fill" | "fillred") -> ( + let a_out = + let o,t = List.hd iter_outputs in + if Soc2cStack.is_soc_output (Var(o,t)) soc && not_an_array t + then "*"^o else o + in + for i=0 to n-1 do + let vel_in, vel_out = let a_in_v, a_in_bis_v = if i mod 2 = 0 then a_in_v, a_in_bis_v else a_in_bis_v, a_in_v in a_in_v ::(List.map (array_index i) (List.tl iter_inputs)), a_in_bis_v::(List.map (array_index i) (List.tl iter_outputs)) - | _ -> assert false (* should not occur *) - in - buff := !buff^( - Soc2cStack.gen_step_call - soc it_soc vel_out vel_in ctx.(i) node_step step_args.(i)); - done; - if iterator <> "map" then ( - let a_out = - let o,t = List.hd iter_outputs in - if Soc2cStack.is_soc_output (Var(o,t)) soc && not_an_array t - then "*"^o else o - in - if n mod 2 = 0 then - buff := !buff^(Soc2cStack.gen_assign telt a_out a_in) (* a_out=a_n *) - else - buff := !buff^(Soc2cStack.gen_assign telt a_out a_in_bis) + in + buff := !buff^( + Soc2cStack.gen_step_call + soc it_soc vel_out vel_in ctx.(i) node_step step_args.(i)) ; + done; + if n mod 2 = 0 then + buff := !buff^(Soc2cStack.gen_assign telt a_out a_in) (* a_out=a_n *) + else + buff := !buff^(Soc2cStack.gen_assign telt a_out a_in_bis) + ) + | false, ("fold" | "red" | "fill" | "fillred") -> ( + let a_out = + let o,t = List.hd iter_outputs in + if Soc2cStack.is_soc_output (Var(o,t)) soc && not_an_array t + then "*"^o else o + in + let for_loop = Printf.sprintf "for (_i=0 ; _i<%i ; _i+=2){" (n-1) in + let vel_in, vel_out = + a_in_v ::(List.map (array_index (-666)) (List.tl iter_inputs)), + a_in_bis_v::(List.map (array_index (-666)) (List.tl iter_outputs)) + in + let vel_in2, vel_out2 = + List.hd vel_out ::( List.tl vel_in), + List.hd vel_in ::( List.tl vel_out) + in + let step_arg = if step_args.(0) = "" then "" else step_args.(0)^"+_i" in + let step_arg2 = if step_args.(0) = "" then "" else step_args.(0)^"+_i+1" in + let body = Soc2cStack.gen_step_call + soc it_soc vel_out vel_in ctx.(0) node_step step_arg; + in + let body2 = Soc2cStack.gen_step_call + soc it_soc vel_out2 vel_in2 ctx.(0) node_step step_arg2; + in + let call1 = Str.global_replace (Str.regexp "\[-666\]") "[_i]" body in + let call2 = Str.global_replace (Str.regexp "\[-666\]") "[_i+1]" body2 in (* </ugly> *) + let call3 = if (n mod 2 = 1) then + Str.global_replace (Str.regexp "\[-666\]") ("["^string_of_int (n-1)^"]") body + else "" + in + let str = Printf.sprintf + " int _i;\n %s\n %s %s }\n%s " for_loop call1 call2 call3 + in + buff := !buff ^ str; + if n mod 2 = 0 then + buff := !buff^(Soc2cStack.gen_assign telt a_out a_in) (* a_out=a_n *) + else + buff := !buff^(Soc2cStack.gen_assign telt a_out a_in_bis) + ) ); !buff diff --git a/test/lus2lic.sum b/test/lus2lic.sum index ad2b8104..2592573a 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,5 +1,5 @@ ==> lus2lic0.sum <== -Test Run By jahier on Fri Mar 27 10:03:13 +Test Run By jahier on Wed Apr 8 14:47:31 Native configuration is x86_64-unknown-linux-gnu === lus2lic0 tests === @@ -63,7 +63,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus ==> lus2lic1.sum <== -Test Run By jahier on Fri Mar 27 10:03:19 +Test Run By jahier on Wed Apr 8 14:47:37 Native configuration is x86_64-unknown-linux-gnu === lus2lic1 tests === @@ -397,7 +397,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} ==> lus2lic2.sum <== -Test Run By jahier on Fri Mar 27 10:03:58 +Test Run By jahier on Wed Apr 8 14:48:19 Native configuration is x86_64-unknown-linux-gnu === lus2lic2 tests === @@ -727,7 +727,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} ==> lus2lic3.sum <== -Test Run By jahier on Fri Mar 27 10:05:03 +Test Run By jahier on Wed Apr 8 14:49:27 Native configuration is x86_64-unknown-linux-gnu === lus2lic3 tests === @@ -1230,7 +1230,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ==> lus2lic4.sum <== -Test Run By jahier on Fri Mar 27 10:05:48 +Test Run By jahier on Wed Apr 8 14:50:05 Native configuration is x86_64-unknown-linux-gnu === lus2lic4 tests === @@ -1727,13 +1727,13 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} =============================== # Total number of failures: 14 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 5 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 39 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 65 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 44 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 79 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 41 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 68 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 72 seconds * Ref time: -0.04user 0.02system 3:54.30elapsed 0%CPU (0avgtext+0avgdata 5136maxresident)k -160inputs+0outputs (0major+5542minor)pagefaults 0swaps +0.04user 0.01system 3:46.25elapsed 0%CPU (0avgtext+0avgdata 5156maxresident)k +160inputs+0outputs (0major+5535minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.01system 1:38.23elapsed 0%CPU (0avgtext+0avgdata 5144maxresident)k -160inputs+0outputs (0major+5550minor)pagefaults 0swaps +0.04user 0.02system 1:27.44elapsed 0%CPU (0avgtext+0avgdata 5188maxresident)k +160inputs+0outputs (0major+5527minor)pagefaults 0swaps diff --git a/test/lus2lic.time b/test/lus2lic.time index cd3b9d9b..8eef8b8d 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,11 +1,11 @@ lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 5 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 39 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 65 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 44 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 79 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 41 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 68 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 72 seconds * Ref time: -0.04user 0.02system 3:54.30elapsed 0%CPU (0avgtext+0avgdata 5136maxresident)k -160inputs+0outputs (0major+5542minor)pagefaults 0swaps +0.04user 0.01system 3:46.25elapsed 0%CPU (0avgtext+0avgdata 5156maxresident)k +160inputs+0outputs (0major+5535minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.01system 1:38.23elapsed 0%CPU (0avgtext+0avgdata 5144maxresident)k -160inputs+0outputs (0major+5550minor)pagefaults 0swaps +0.04user 0.02system 1:27.44elapsed 0%CPU (0avgtext+0avgdata 5188maxresident)k +160inputs+0outputs (0major+5527minor)pagefaults 0swaps diff --git a/test/should_work/TIME_STABLE.lus b/test/should_work/TIME_STABLE.lus index 86512231..a5b881a3 100644 --- a/test/should_work/TIME_STABLE.lus +++ b/test/should_work/TIME_STABLE.lus @@ -4,4 +4,9 @@ let level = current(STABLE((set,delay) when ck)); ck = true -> set or second; tel -node STABLE (set: bool; delay: int) returns (level: bool);var count: int; let level = (count > 0); count = if set then delay else if false -> pre(level) then pre(count)-1 else 0;tel -- del \ No newline at end of file +node STABLE (set: bool; delay: int) returns (level: bool); +var count: int; +let + level = (count > 0); + count = if set then delay else if false -> pre(level) then pre(count)-1 else 0; +tel \ No newline at end of file diff --git a/test/should_work/alias.lus b/test/should_work/alias.lus index 8c7101b7..93eb204c 100644 --- a/test/should_work/alias.lus +++ b/test/should_work/alias.lus @@ -16,7 +16,7 @@ const SIZE = 3; --================================================ -- Le noeud principal --================================================ -node alias (a:bool) returns (b:bool; c:int); +function alias (a:bool) returns (b:bool; c:int); let b = aliasPredefNot(a); c = aliasGivenNode(0, map<<Lustre::iplus; SIZE>>(0^SIZE, SIZE^SIZE)); @@ -25,7 +25,7 @@ tel --================================================ -- Un noeud --================================================ -node unNoeud(a: int; b: int ^ SIZE ) returns (c: int); +function unNoeud(a: int; b: int ^ SIZE ) returns (c: int); var x : bool; let c = aliasIterOp(a, b); @@ -36,15 +36,15 @@ tel -- DEFINITIONS DES ALIAS --================================================ -- alias vers un operateur predefini -node aliasPredefNot = Lustre::not; +function aliasPredefNot = Lustre::not; -- alias vers un noeud défini -node aliasGivenNode = unNoeud; +function aliasGivenNode = unNoeud; -- alias d´un iterateur -node aliasIterOp = red<<Lustre::iplus; SIZE>>; +function aliasIterOp = red<<Lustre::iplus; SIZE>>; -- alias de l´iterateur booleen. -node aliasBoolRed = boolred<<0, SIZE-2, SIZE-1>>; +function aliasBoolRed = boolred<<0, SIZE-2, SIZE-1>>; diff --git a/test/should_work/matrice.lus b/test/should_work/matrice.lus index 5f077c5a..307f4c31 100644 --- a/test/should_work/matrice.lus +++ b/test/should_work/matrice.lus @@ -3,13 +3,13 @@ const m = 3 ; type T_fibo = int^2; -node fibo(accu_in : T_fibo) returns (accu_out : T_fibo; elt : int); +function fibo(accu_in : T_fibo) returns (accu_out : T_fibo; elt : int); let accu_out = [accu_in[0]+accu_in[1], accu_in[0]]; elt = accu_in[0]+accu_in[1]; tel -node matrice ( a : int ) returns ( sum: int; bid: T_fibo; T: int^m^n); +function matrice ( a : int ) returns ( sum: int; bid: T_fibo; T: int^m^n); let bid, T = fill << fill << fibo ; m >> ; n >> ([a, a]); sum = red << red <<node Lustre::plus ; m >> ; n >> (0, T); diff --git a/test/should_work/matrice2.lus b/test/should_work/matrice2.lus index 0a39772e..8bccca4e 100644 --- a/test/should_work/matrice2.lus +++ b/test/should_work/matrice2.lus @@ -1,7 +1,7 @@ const n = 2 ; const m = 2 ; -node matrice2 ( a : int ) returns ( res : int ); +function matrice2 ( a : int ) returns ( res : int ); let res = red << red << +, m >>, n >> (0, 1^m^n ); tel diff --git a/test/should_work/moyenne.lus b/test/should_work/moyenne.lus index 4a73558e..b5a44096 100644 --- a/test/should_work/moyenne.lus +++ b/test/should_work/moyenne.lus @@ -12,7 +12,7 @@ type moyenne_accu = struct {sum : real; moyenne : real; rank : real}; -node moyenne_step(accu_in : moyenne_accu; elt_in : real) returns (accu_out : moyenne_accu); +function moyenne_step(accu_in : moyenne_accu; elt_in : real) returns (accu_out : moyenne_accu); let accu_out = moyenne_accu { sum = accu_in.sum + elt_in; @@ -26,7 +26,7 @@ tel -node moyenne(Tab : real^size) +function moyenne(Tab : real^size) returns (moy : real); var accu_out : moyenne_accu; let diff --git a/test/should_work/redIf.lus b/test/should_work/redIf.lus index 1e48528e..9e67af66 100644 --- a/test/should_work/redIf.lus +++ b/test/should_work/redIf.lus @@ -1,11 +1,11 @@ -node redIf(a : bool; b, c : bool^3) returns (r : bool); +function redIf(a : bool; b, c : bool^3) returns (r : bool); let -- r = red<<if, 3>>(a,b,c); r = red<<monIf, 3>>(a,b,c); tel -node monIf(a,b,c : bool) returns (r : bool); +function monIf(a,b,c : bool) returns (r : bool); let r = if(a) then b else c; tel diff --git a/test/should_work/rediter.lus b/test/should_work/rediter.lus index 83487a62..0858f6e0 100644 --- a/test/should_work/rediter.lus +++ b/test/should_work/rediter.lus @@ -1,9 +1,9 @@ -node max(init: int; a: int) returns (b: int); +function max(init: int; a: int) returns (b: int); let b = if(init>a) then init else a; tel -node rediter(a: int^5^3) returns (b: int); +function rediter(a: int^5^3) returns (b: int); let b = red<<red<<max; 5>>; 3>>(0, a); tel diff --git a/test/should_work/xx.lus b/test/should_work/xx.lus index 1ea553df..1f8dedc4 100644 --- a/test/should_work/xx.lus +++ b/test/should_work/xx.lus @@ -1,4 +1,4 @@ -node xx(i1:int; i2:A_int_2) returns (o:int); +function xx(i1:int; i2:A_int_2) returns (o:int); let o = Lustre::red<<Lustre::plus, 2>>(i1, i2); tel -- GitLab