diff --git a/src/socPredef2c.ml b/src/socPredef2c.ml index 244e2fc52d93d763dd8805c7b20d7946f8f5e416..53da07b826474a173cab08ecb3ef3fbcbee2b204 100644 --- a/src/socPredef2c.ml +++ b/src/socPredef2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 12/06/2014 (at 11:11) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/06/2014 (at 15:34) by Erwan Jahier> *) open Data open Soc @@ -81,13 +81,30 @@ let (lustre_array: Soc.key -> string) = (Printf.sprintf "%s.x%d" ctx (j+1))); done; !buff - - let (lustre_concat: Soc.key -> string) = - fun sk -> - let ctx = get_ctx_name sk in - assert false + fun (n,tl,si_opt) -> + let ctx = get_ctx_name (n,tl,si_opt) in + let t,s1,s2 = match tl with + | [Data.Array(t,s1); Data.Array(_,s2); _] -> t,s1,s2 + | _ -> assert false + in + let t1 = Printf.sprintf "%s.x" ctx + and t2 = Printf.sprintf "%s.y" ctx + and t12 = Printf.sprintf "%s.z" ctx in + (Printf.sprintf " memcpy(%s, %s, sizeof(%s));\n" t12 t1 t1)^ + (Printf.sprintf " memcpy(%s[%d], %s, sizeof(%s));\n" t12 s1 t2 t2) +(* Both seems to work *) +(* let buff = ref "" in *) +(* for j=0 to s1-1 do *) +(* buff := !buff^(Soc2cUtil.gen_assign t (Printf.sprintf "%s.z[%d]" ctx j) *) +(* (Printf.sprintf "%s.x[%d]" ctx j)); *) +(* done; *) +(* for j=s1 to s1+s2-1 do *) +(* buff := !buff^(Soc2cUtil.gen_assign t (Printf.sprintf "%s.z[%d]" ctx j) *) +(* (Printf.sprintf "%s.y[%d]" ctx (j-s1))); *) +(* done; *) +(* !buff *) let (lustre_slice: Soc.key -> string) = fun sk -> diff --git a/test/lus2lic.sum b/test/lus2lic.sum index c60d61f33c8aa8828af479308f2a0efab15d38d4..edede8dc66a55e63656f83c91326d2ecb5957119 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Thu Jun 12 11:12:29 2014 +Test Run By jahier on Fri Jun 13 14:46:06 2014 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -365,6 +365,9 @@ PASS: ./myec2c {-o /tmp/mm22.c /tmp/mm22.ec} PASS: ../utils/test_lus2lic_no_node should_work/mm22.lus PASS: ./lus2lic {-2c should_work/mm22.lus -n mm22} PASS: gcc mm22_mm22.c mm22_mm22_loop.c +PASS: ./lus2lic {-o /tmp/array_concat2.lic should_work/array_concat2.lus} +PASS: ./lus2lic {-ec -o /tmp/array_concat2.ec should_work/array_concat2.lus} +FAIL: Try ec2c on the result: ./myec2c {-o /tmp/array_concat2.c /tmp/array_concat2.ec} PASS: ./lus2lic {-o /tmp/is_stable.lic should_work/is_stable.lus} PASS: ./lus2lic {-ec -o /tmp/is_stable.ec should_work/is_stable.lus} PASS: ./myec2c {-o /tmp/is_stable.c /tmp/is_stable.ec} @@ -565,11 +568,10 @@ PASS: ./myec2c {-o /tmp/morel4.c /tmp/morel4.ec} PASS: ../utils/test_lus2lic_no_node should_work/morel4.lus PASS: ./lus2lic {-2c should_work/morel4.lus -n morel4} FAIL: Check that the generated C code compiles : gcc morel4_morel4.c morel4_morel4_loop.c -PASS: ./lus2lic {-o /tmp/trivial_array.lic should_work/trivial_array.lus} -PASS: ./lus2lic {-ec -o /tmp/trivial_array.ec should_work/trivial_array.lus} -PASS: ./myec2c {-o /tmp/trivial_array.c /tmp/trivial_array.ec} -PASS: ../utils/test_lus2lic_no_node should_work/trivial_array.lus -PASS: ./lus2lic {-2c should_work/trivial_array.lus -n trivial_array} +FAIL: without any option: ./lus2lic {-o /tmp/trivial_array.lic should_work/trivial_array.lus} +FAIL: Generate ec code : ./lus2lic {-ec -o /tmp/trivial_array.ec should_work/trivial_array.lus} +FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/trivial_array.lus +FAIL: Generate c code : ./lus2lic {-2c should_work/trivial_array.lus -n trivial_array} PASS: gcc trivial_array_trivial_array.c trivial_array_trivial_array_loop.c PASS: ./lus2lic {-o /tmp/param_node4.lic should_work/param_node4.lus} PASS: ./lus2lic {-ec -o /tmp/param_node4.ec should_work/param_node4.lus} @@ -973,6 +975,9 @@ PASS: ./myec2c {-o /tmp/mouse3.c /tmp/mouse3.ec} PASS: ../utils/test_lus2lic_no_node should_work/mouse3.lus PASS: ./lus2lic {-2c should_work/mouse3.lus -n mouse3} FAIL: Check that the generated C code compiles : gcc mouse3_mouse3.c mouse3_mouse3_loop.c +PASS: ./lus2lic {-o /tmp/array_concat.lic should_work/array_concat.lus} +PASS: ./lus2lic {-ec -o /tmp/array_concat.ec should_work/array_concat.lus} +FAIL: Try ec2c on the result: ./myec2c {-o /tmp/array_concat.c /tmp/array_concat.ec} PASS: ./lus2lic {-o /tmp/ex.lic should_work/ex.lus} PASS: ./lus2lic {-ec -o /tmp/ex.ec should_work/ex.lus} PASS: ./myec2c {-o /tmp/ex.c /tmp/ex.ec} @@ -1474,9 +1479,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === -# of expected passes 1172 -# of unexpected failures 232 +# of expected passes 1171 +# of unexpected failures 238 # of unexpected successes 21 # of expected failures 37 -testcase ./lus2lic.tests/non-reg.exp completed in 129 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 116 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds diff --git a/test/lus2lic.time b/test/lus2lic.time index b771258b27d419d55d4c949273a79842020ac0d2..45ce21b13d3ffe3ba4098094daa3f3b9e9594c43 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ -testcase ./lus2lic.tests/non-reg.exp completed in 129 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 116 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds diff --git a/test/should_work/array_concat.lus b/test/should_work/array_concat.lus new file mode 100644 index 0000000000000000000000000000000000000000..84fa41cabcbbf57970db8a63388535c643fc96aa --- /dev/null +++ b/test/should_work/array_concat.lus @@ -0,0 +1,5 @@ +node array_concat(x:bool) returns (y: bool^2); +let + y = [x]|[x]; +tel + diff --git a/test/should_work/array_concat2.lus b/test/should_work/array_concat2.lus new file mode 100644 index 0000000000000000000000000000000000000000..47578be0f8aee84c349dfe29a7a8822412ac0d92 --- /dev/null +++ b/test/should_work/array_concat2.lus @@ -0,0 +1,5 @@ +node array_concat2(x:bool^3) returns (y: bool^3^2); +let + y = [x]|[x]; +tel + diff --git a/test/should_work/trivial_array.lus b/test/should_work/trivial_array.lus index 63077dbdf5527325b3e657f08c26be0c871e1e51..fa47600c9ff58ea7b6b1c23b280843d52a97220a 100644 --- a/test/should_work/trivial_array.lus +++ b/test/should_work/trivial_array.lus @@ -1,5 +1,5 @@ -node trivial_array(x:bool) returns (y: bool^2); +node trivial_array(x:int^3) returns (y: int^3^4); let - y = [x,x]; + y = [x]|[x]|[x]|[x]; tel