Skip to content
Snippets Groups Projects
Commit ede35c39 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Soc2c : handle array concat expressions.

parent 052f7713
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 12/06/2014 (at 11:11) by Erwan Jahier> *)
(* Time-stamp: <modified the 13/06/2014 (at 15:04) 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[%s], %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 ->
......
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
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
node array_concat(x:bool) returns (y: bool^2);
let
y = [x]|[x];
tel
node array_concat2(x:bool^3) returns (y: bool^3^2);
let
y = [x]|[x];
tel
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment