From 0068920fdafa51d38fdbec10a8f0d3719b9c870f Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Tue, 7 May 2013 17:10:13 +0200 Subject: [PATCH] Fix the SOC generation of array slices. nb : #FAILS=135->131 --- src/lic2soc.ml | 45 ++++---- src/lv6MainArgs.ml | 5 +- src/socExec.ml | 49 ++++---- src/socExecEvalPredef.ml | 28 ++++- src/socPredef.ml | 125 +++++++++++---------- test/lus2lic.sum | 20 ++-- test/should_work/{car-V2.lus => carV2.lus} | 2 +- todo.org | 2 + 8 files changed, 157 insertions(+), 119 deletions(-) rename test/should_work/{car-V2.lus => carV2.lus} (97%) diff --git a/src/lic2soc.ml b/src/lic2soc.ml index 6b457773..c0f48d4a 100644 --- a/src/lic2soc.ml +++ b/src/lic2soc.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 26/04/2013 (at 14:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 07/05/2013 (at 17:08) by Erwan Jahier> *) open Lxm open Lic @@ -158,18 +158,15 @@ let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) = Some (List.flatten (List.map del_some var_values)) ) | Lic.ARRAY_SLICE si -> ( - (* XXX is it a good idea to explode slices? *) - let id = match val_exp_list with - | [{Lic.ve_core=Lic.CallByPosLic({it=Lic.VAR_REF id},[])}] -> id + (* XXX is it a good idea to explode slices? + let id, t, i = match val_exp_list with + | [{Lic.ve_core=Lic.CallByPosLic({it=Lic.VAR_REF id},[]); + Lic.ve_typ=[Array_type_eff(t,i)] + }] -> id, t, i | _ -> assert false in - let type_elt_ref,type_ref = - match type_ with - | [Lic.Array_type_eff(t,i)] -> - let t_soc = lic_to_data_type t in - t_soc, Data.Array(t_soc,i) - | _ -> assert false (* should not occur *) - in + let t_soc = lic_to_data_type t in + let type_elt_ref,type_ref = t_soc, Data.Array(t_soc,i) in let index_list = slice_info_to_index_list si in let exploded_array = (* val_exp is a var ident (t) of type array; we want to gen the list @@ -178,7 +175,9 @@ let rec get_leaf: (LicPrg.t -> Lic.val_exp -> Soc.var_expr list option) = (fun i -> Soc.Index(Soc.Const(id, type_ref), i, type_elt_ref)) index_list in - Some(exploded_array) +*) + None +(* Some(exploded_array) *) ) | Lic.PREDEF_CALL _ | Lic.CALL _ @@ -261,14 +260,15 @@ let soc_profile_of_node: Lic.node_exp -> Soc.var list * Soc.var list = let outputs = List.map lic_to_soc_var n.Lic.outlist_eff in inputs, outputs -let (make_soc_key_of_node_exp : Lic.node_key -> Data.t list -> Soc.key) = -fun nk vl -> - LicDump.string_of_node_key_rec false nk, vl, None +let (make_soc_key_of_node_exp : Lic.node_key -> Lic.slice_info option -> Data.t list -> Soc.key) = +fun nk si_opt vl -> + LicDump.string_of_node_key_rec false nk, vl, + (match si_opt with None -> None | Some si -> Some(si.Lic.se_first,si.Lic.se_last,si.Lic.se_step)) let (soc_key_of_node_exp : Lic.node_exp -> Soc.key) = fun n -> let svi,svo = soc_profile_of_node n in - let sk = make_soc_key_of_node_exp n.node_key_eff (List.map snd (svi@svo)) in + let sk = make_soc_key_of_node_exp n.node_key_eff None (List.map snd (svi@svo)) in sk (* XXX duplicated code with get_leaf *) @@ -425,6 +425,7 @@ let by_pos_op_to_soc_ident = function | CURRENT -> "Lustre::current" | CONCAT-> "Lustre::concat" | ARRAY -> "Lustre::array" + | ARRAY_SLICE _ -> "Lustre::array_slice" | HAT _ -> "Lustre::hat" | PREDEF_CALL n | CALL n -> LicDump.string_of_node_key_rec false n.it @@ -469,7 +470,7 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> ) | CallByPosLic (by_pos_op_flg, val_exp_list) -> ( match by_pos_op_flg.it with - | Lic.ARRAY_SLICE _ | Lic.VAR_REF _ | Lic.CONST_REF _ | Lic.CONST _ + | Lic.VAR_REF _ | Lic.CONST_REF _ | Lic.CONST _ | Lic.ARRAY_ACCES _ | Lic.STRUCT_ACCESS _ | Lic.TUPLE -> assert false (* should not occur: handled via get_leaf *) | Lic.WHEN ck -> ( @@ -490,6 +491,7 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> in ctx, actions_reclocked, outputs, mems, deps ) + | Lic.ARRAY_SLICE _ | CURRENT (* todo ? *) | CALL _ | PREDEF_CALL _ | HAT _ | ARRAY | PRE | ARROW | FBY | CONCAT -> ( @@ -502,7 +504,10 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> in let res_type = get_exp_type lpl in let full_profile = args_types @ res_type in - let sk = make_soc_key_of_node_exp (("",id),[]) full_profile in + let si_opt = match by_pos_op_flg.it with + Lic.ARRAY_SLICE si -> Some si | _ -> None + in + let sk = make_soc_key_of_node_exp (("",id),[]) si_opt full_profile in let fby_init_opt = let init = val_exp_to_filter ctx.prg (List.hd val_exp_list) in if by_pos_op_flg.it = Lic.FBY then Some init else None @@ -531,7 +536,7 @@ let rec (actions_of_expression_acc: Lxm.t -> Soc.tbl -> in let res_type = get_exp_type lpl in let full_profile = args_types @ res_type in - let sk = make_soc_key_of_node_exp (("Lustre","merge"),[]) full_profile in + let sk = make_soc_key_of_node_exp (("Lustre","merge"),[]) None full_profile in try Soc.SocMap.find sk soc_tbl with Not_found -> Verbose.exe ~flag:dbg (fun () -> @@ -720,7 +725,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = fun licprg node soc_tbl -> let io_list = node.Lic.inlist_eff @ node.Lic.outlist_eff in let io_type = List.map (fun vi -> lic_to_data_type vi.var_type_eff) io_list in - let soc_key = make_soc_key_of_node_exp node.Lic.node_key_eff io_type in + let soc_key = make_soc_key_of_node_exp node.Lic.node_key_eff None io_type in let lxm = node.Lic.lxm in let ctx = create_context licprg in let (soc_of_body: Lic.node_body -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) = diff --git a/src/lv6MainArgs.ml b/src/lv6MainArgs.ml index 51ed12cb..3580ca4d 100644 --- a/src/lv6MainArgs.ml +++ b/src/lv6MainArgs.ml @@ -55,7 +55,7 @@ let (global_opt:global_opt) = line_num = 1; line_start_pos = 0; current_file = ""; - expand_enums = AsEnum; + expand_enums = AsInt; } let (make_opt : unit -> t) = fun () -> @@ -174,8 +174,7 @@ let (mkopt : t -> string list -> ?hide:bool -> ?arg:string -> Arg.spec -> string (* utils *) let set_v4_options opt = global_opt.lv4 <- true; - if global_opt.expand_enums = AsEnum - then global_opt.expand_enums <- AsConst; (* only override the default *) + global_opt.expand_enums <- AsConst; (* only override the default *) opt.inline_iterator <- true; opt.expand_arrays <- true diff --git a/src/socExec.ml b/src/socExec.ml index bebe1453..73551053 100644 --- a/src/socExec.ml +++ b/src/socExec.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 26/04/2013 (at 15:41) by Erwan Jahier> *) +(* Time-stamp: <modified the 07/05/2013 (at 08:15) by Erwan Jahier> *) open Soc open Data @@ -68,23 +68,23 @@ let rec (soc_step : Soc.step_method -> Soc.tbl -> Soc.t -> SocExecValue.ctx let path_saved = ctx.cpath in let ctx = { ctx with cpath=inst_name::ctx.cpath } in let ctx = - if clk = B true then - let node_step = match node_soc.step with [step] -> step | _ -> assert false in - let ctx = { ctx with s = sadd ctx.s ("$first_step"::ctx.cpath) (B false) } in - let ctx = do_step inst_name node_step ctx soc_tbl node_soc vel_in vel_out in + if clk = B true then + let node_step = match node_soc.step with [step] -> step | _ -> assert false in + let ctx = { ctx with s = sadd ctx.s ("$first_step"::ctx.cpath) (B false) } in + let ctx = do_step inst_name node_step ctx soc_tbl node_soc vel_in vel_out in { ctx with cpath=path_saved } - else - let first_step = Var ("$first_step",Bool) in - let v = get_value ctx first_step in - if v <> U then + else + let first_step = Var ("$first_step",Bool) in + let v = get_value ctx first_step in + if v <> U then (* We are not on the first step of node_soc; hence we do nothing and the output will keep their previous value. *) { ctx with cpath=path_saved } - else - (* We are on the first step of node_soc; - - we assign the output var to the default values *) - let ctx = { ctx with cpath=path_saved } in - List.fold_left2 assign_expr ctx dft_cst vel_out + else + (* We are on the first step of node_soc; + - we assign the output var to the default values *) + let ctx = { ctx with cpath=path_saved } in + List.fold_left2 assign_expr ctx dft_cst vel_out in ctx ) @@ -126,11 +126,14 @@ and (do_gao : Lxm.t -> Soc.tbl -> SocExecValue.ctx -> gao -> SocExecValue.ctx) | Case(id, id_gao_l) -> ( try let id_val = get_enum id ctx in - let gaol = List.assoc id_val id_gao_l in + let gaol = List.assoc id_val id_gao_l in List.fold_left (do_gao lxm soc_tbl) ctx gaol with Not_found -> ctx ) - | Call(vel_out, Assign, vel_in) -> List.fold_left2 assign_expr ctx vel_in vel_out + | Call(vel_out, Assign, vel_in) -> ( + try List.fold_left2 assign_expr ctx vel_in vel_out + with _ -> assert false + ) | Call(vel_out, Procedure sk, vel_in) -> ( let (proc_name,_,_) = sk in let path_saved = ctx.cpath in @@ -168,13 +171,13 @@ and (do_step : Ident.t -> step_method -> SocExecValue.ctx -> Soc.tbl -> Soc.t -> and (filter_params : Soc.t -> Soc.var list -> int list -> Soc.var list) = fun soc el il -> let local_nth i l = - try List.nth l i - with _ -> - print_string ( - "\n*** Cannot get the " ^ (string_of_int (i+1)) ^ - "the element of a list of size " ^ (string_of_int (List.length l))^"\n"); - flush stdout; - assert false + try List.nth l i + with _ -> + print_string ( + "\n*** Cannot get the " ^ (string_of_int (i+1)) ^ + "the element of a list of size " ^ (string_of_int (List.length l))^"\n"); + flush stdout; + assert false in let res = List.map (fun i -> local_nth i el) il in res diff --git a/src/socExecEvalPredef.ml b/src/socExecEvalPredef.ml index 40c2d018..04af1004 100644 --- a/src/socExecEvalPredef.ml +++ b/src/socExecEvalPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 08/04/2013 (at 14:48) by Erwan Jahier> *) +(* Time-stamp: <modified the 07/05/2013 (at 15:45) by Erwan Jahier> *) open SocExecValue open Data @@ -230,6 +230,28 @@ let lustre_merge tl ctx = in { ctx with s = sadd ctx.s vn vv } +let lustre_slice tl si_opt ctx = + let _t,size = match List.hd (List.rev tl) with + | Data.Array(t,i) -> t,i + | _ -> assert false + in + let (vn,vv) = + match ([get_val "x" ctx], si_opt) with + | [A a],Some(b,e,step) -> + let a_res = Array.make size a.(0) in + let j=ref 0 in + for i = b to e do + if (i-b) mod step = 0 then ( + a_res.(!j) <- a.(i); + incr j + ); + done; + "z"::ctx.cpath, A (a_res) + | [U],_ -> "z"::ctx.cpath, U + | _ -> assert false + in + { ctx with s = sadd ctx.s vn vv } + let lustre_concat ctx = let (vn,vv) = match ([get_val "x" ctx; get_val "y" ctx]) with @@ -273,7 +295,7 @@ let lustre_hat tl ctx = (* exported *) let (get: Soc.key -> (ctx -> ctx)) = - fun (n,tl,_) -> + fun (n,tl,si_opt) -> match n with | "Lustre::plus" -> lustre_plus | "Lustre::times"-> lustre_times @@ -309,6 +331,8 @@ let (get: Soc.key -> (ctx -> ctx)) = | "Lustre::current" -> lustre_current | "Lustre::merge" -> lustre_merge tl + | "Lustre::array_slice" -> lustre_slice tl si_opt + | "Lustre::nor" -> assert false (* ougth to be translated into boolred *) | "Lustre::diese" -> assert false (* ditto *) | _ -> raise Not_found diff --git a/src/socPredef.ml b/src/socPredef.ml index 5e3f9d4d..9ed2d2f1 100644 --- a/src/socPredef.ml +++ b/src/socPredef.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 08/04/2013 (at 14:11) by Erwan Jahier> *) +(* Time-stamp: <modified the 07/05/2013 (at 15:20) by Erwan Jahier> *) (** Synchronous Object Code for Predefined operators. *) @@ -331,32 +331,33 @@ let instanciate_soc: Soc.t -> Data.t -> Soc.t = idem pour "x^n" (Hat_n). *) -let make_slice_soc: Lic.slice_info -> Data.t -> Soc.t = - fun si t -> - let (f,l,step) = (si.Lic.se_first, si.Lic.se_last,si.Lic.se_step) in - let sub_array_type = - match t with - | Data.Array(t_elt,size) -> - let slice_size = 1+abs( (l - f) / step) in - Data.Array(t_elt, slice_size) - | _ -> assert false - in - { - key = ("array_slice", [t], Some (f, l, step)); - profile = (["t", t], ["st", sub_array_type ]); - instances = []; - step = [ - { - name = "step"; - lxm = Lxm.dummy "predef soc"; - idx_ins = [0]; - idx_outs = [0]; - impl = Predef; - }; - ]; - precedences = []; - have_mem = None; - } +let make_array_slice_soc : Lic.slice_info -> int -> Data.t -> Soc.t = + fun si s t -> + let size = si.Lic.se_width in + let array_type_in = Array(t,s) in + let array_type_out = Array(t,size) in + let key_prof = [array_type_in; array_type_out] in + { + key = ("Lustre::array_slice", key_prof, Some(si.Lic.se_first,si.Lic.se_last,si.Lic.se_step)); + profile = (["x", array_type_in], ["z", array_type_out]); + instances = []; + step = [ + { + name = "step"; + lxm = Lxm.dummy "predef array slice soc"; + idx_ins = [0]; + idx_outs = [0]; + impl = Predef; + }; + ]; + precedences = []; + have_mem = None; + } + + + + + let (make_merge_soc: Soc.key -> Soc.t) = fun sk -> @@ -400,37 +401,38 @@ let make_array_soc: int -> Data.t -> Soc.t = instances = []; step = [ { - name = "step"; - lxm = Lxm.dummy "predef array soc"; + name = "step"; + lxm = Lxm.dummy "predef array soc"; idx_ins = SocUtils.gen_index_list i; idx_outs = [0]; - impl = Predef; + impl = Predef; }; ]; - precedences = []; + precedences = []; have_mem = None; } + let make_array_concat_soc: int -> int -> Data.t -> Soc.t = fun s1 s2 t -> let iprof = (["x", Array(t,s1); "y", Array(t,s2)], ["z", Array(t,s1+s2)])in let key_prof = [Array(t,s1); Array(t,s2); Array(t,s1+s2)] in - { - key = ("Lustre::concat", key_prof, None); - profile = iprof; - instances = []; - step = [ - { - name = "step"; - lxm = Lxm.dummy "predef array concat soc"; - idx_ins = [0;1]; - idx_outs = [0]; - impl = Predef; - }; - ]; - precedences = []; - have_mem = None; - } + { + key = ("Lustre::concat", key_prof, None); + profile = iprof; + instances = []; + step = [ + { + name = "step"; + lxm = Lxm.dummy "predef array concat soc"; + idx_ins = [0;1]; + idx_outs = [0]; + impl = Predef; + }; + ]; + precedences = []; + have_mem = None; + } let make_hat_soc: int -> Data.t -> Soc.t = fun i t -> @@ -476,43 +478,47 @@ let (soc_interface_of_pos_op: Lxm.t -> Lic.by_pos_op -> Data.t list -> Soc.var_expr option -> Soc.t) = fun lxm op types fby_init_opt -> match (op, types,fby_init_opt) with - | Lic.PREDEF_CALL ({Lxm.it=("Lustre","if"),[]}),_ ,_ -> - let concrete_type = List.nth types 1 in + | Lic.PREDEF_CALL ({Lxm.it=("Lustre","if"),[]}),_ ,_ -> + let concrete_type = List.nth types 1 in let soc = of_soc_key ("Lustre::if", types@[concrete_type], None) in instanciate_soc soc concrete_type - | Lic.PREDEF_CALL {Lxm.it=(op,sargs)}, _, _ -> + | Lic.PREDEF_CALL {Lxm.it=(op,sargs)}, _, _ -> assert (sargs=[]); let soc_name = Ident.string_of_long op in let out_type = output_type_of_op soc_name types in let soc = of_soc_key (soc_name, types@[out_type], None) in - soc - | Lic.FBY, _, Some init -> - let concrete_type = List.nth types 0 in + soc + | Lic.FBY, _, Some init -> + let concrete_type = List.nth types 0 in let soc = of_fby_soc_key init (("Lustre::fby"), types@[concrete_type], None) in instanciate_soc soc concrete_type | Lic.FBY, _, None -> assert false (* should ot occur *) | Lic.PRE, _, _ -> - let concrete_type = List.nth types 0 in + let concrete_type = List.nth types 0 in let soc = of_soc_key (("Lustre::pre"), types@[concrete_type], None) in instanciate_soc soc concrete_type | Lic.CURRENT, _, _ -> - let concrete_type = List.nth types 0 in + let concrete_type = List.nth types 0 in let soc = of_soc_key (("Lustre::current"), types@[concrete_type], None) in instanciate_soc soc concrete_type | Lic.ARROW, _, _ -> - let concrete_type = List.nth types 0 in + let concrete_type = List.nth types 0 in let soc = of_soc_key (("Lustre::arrow"), types@[concrete_type], None) in let soc = instanciate_soc soc concrete_type in soc - | Lic.HAT i,_, _ -> + | Lic.HAT i,_, _ -> let elt_type = List.nth types 0 in (make_hat_soc i elt_type) - | Lic.ARRAY, _, _ -> + | Lic.ARRAY, _, _ -> let elt_type = List.nth types 0 in - let i = (List.length types) in + let i = (List.length types) in (make_array_soc i elt_type) + | Lic.ARRAY_SLICE sinfo, [Array (t, s)], _ -> +(* assert false *) + (make_array_slice_soc sinfo s t) + | Lic.CONCAT, [Array (t1, s1); Array (t2, s2)], _-> assert (t1=t2); (make_array_concat_soc s1 s2 t1) @@ -522,7 +528,6 @@ let (soc_interface_of_pos_op: | Lic.CONST _ , _,_ -> assert false (* Those are not soc *) - | Lic.ARRAY_SLICE sinfo,_,_ -> assert false | Lic.VAR_REF _, _,_ -> assert false | Lic.CONST_REF _, _,_ -> assert false diff --git a/test/lus2lic.sum b/test/lus2lic.sum index ab02f1f6..e2952e09 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Mon May 6 11:18:55 2013 +Test Run By jahier on Tue May 7 17:03:33 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -68,7 +68,7 @@ PASS: ../utils/test_lus2lic_no_node should_work/redIf.lus PASS: ./lus2lic {-o /tmp/t0.lic should_work/t0.lus} PASS: ./lus2lic {-ec -o /tmp/t0.ec should_work/t0.lus} PASS: ./ec2c {-o /tmp/t0.c /tmp/t0.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/t0.lus +PASS: ../utils/test_lus2lic_no_node should_work/t0.lus PASS: ./lus2lic {-o /tmp/lucky.lic should_work/lucky.lus} PASS: ./lus2lic {-ec -o /tmp/lucky.ec should_work/lucky.lus} PASS: ./ec2c {-o /tmp/lucky.c /tmp/lucky.ec} @@ -92,7 +92,7 @@ PASS: ../utils/test_lus2lic_no_node should_work/rs.lus PASS: ./lus2lic {-o /tmp/access.lic should_work/access.lus} PASS: ./lus2lic {-ec -o /tmp/access.ec should_work/access.lus} PASS: ./ec2c {-o /tmp/access.c /tmp/access.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/access.lus +PASS: ../utils/test_lus2lic_no_node should_work/access.lus PASS: ./lus2lic {-o /tmp/aux.lic should_work/aux.lus} PASS: ./lus2lic {-ec -o /tmp/aux.ec should_work/aux.lus} PASS: ./ec2c {-o /tmp/aux.c /tmp/aux.ec} @@ -157,10 +157,6 @@ PASS: ./lus2lic {-o /tmp/packageTableau.lic should_work/packageTableau.lus} PASS: ./lus2lic {-ec -o /tmp/packageTableau.ec should_work/packageTableau.lus} PASS: ./ec2c {-o /tmp/packageTableau.c /tmp/packageTableau.ec} FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/packageTableau.lus -PASS: ./lus2lic {-o /tmp/car-V2.lic should_work/car-V2.lus} -PASS: ./lus2lic {-ec -o /tmp/car-V2.ec should_work/car-V2.lus} -PASS: ./ec2c {-o /tmp/car-V2.c /tmp/car-V2.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/car-V2.lus PASS: ./lus2lic {-o /tmp/nc8.lic should_work/nc8.lus} PASS: ./lus2lic {-ec -o /tmp/nc8.ec should_work/nc8.lus} PASS: ./ec2c {-o /tmp/nc8.c /tmp/nc8.ec} @@ -508,7 +504,7 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou PASS: ./lus2lic {-o /tmp/t2.lic should_work/t2.lus} PASS: ./lus2lic {-ec -o /tmp/t2.ec should_work/t2.lus} PASS: ./ec2c {-o /tmp/t2.c /tmp/t2.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/t2.lus +PASS: ../utils/test_lus2lic_no_node should_work/t2.lus PASS: ./lus2lic {-o /tmp/arbitre.lic should_work/arbitre.lus} PASS: ./lus2lic {-ec -o /tmp/arbitre.ec should_work/arbitre.lus} PASS: ./ec2c {-o /tmp/arbitre.c /tmp/arbitre.ec} @@ -519,6 +515,10 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou PASS: ./lus2lic {-o /tmp/when_tuple.lic should_work/when_tuple.lus} PASS: ./lus2lic {-ec -o /tmp/when_tuple.ec should_work/when_tuple.lus} PASS: ./ec2c {-o /tmp/when_tuple.c /tmp/when_tuple.ec} +PASS: ./lus2lic {-o /tmp/carV2.lic should_work/carV2.lus} +PASS: ./lus2lic {-ec -o /tmp/carV2.ec should_work/carV2.lus} +PASS: ./ec2c {-o /tmp/carV2.c /tmp/carV2.ec} +PASS: ../utils/test_lus2lic_no_node should_work/carV2.lus PASS: ./lus2lic {-o /tmp/FillFollowedByRed.lic should_work/FillFollowedByRed.lus} PASS: ./lus2lic {-ec -o /tmp/FillFollowedByRed.ec should_work/FillFollowedByRed.lus} PASS: ./ec2c {-o /tmp/FillFollowedByRed.c /tmp/FillFollowedByRed.ec} @@ -1045,8 +1045,8 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === -# of expected passes 828 -# of unexpected failures 135 +# of expected passes 832 +# of unexpected failures 131 # of unexpected successes 11 # of expected failures 37 # of unresolved testcases 22 diff --git a/test/should_work/car-V2.lus b/test/should_work/carV2.lus similarity index 97% rename from test/should_work/car-V2.lus rename to test/should_work/carV2.lus index ac2b3380..fcb00707 100644 --- a/test/should_work/car-V2.lus +++ b/test/should_work/carV2.lus @@ -99,7 +99,7 @@ tel type mode = enum { forward , waiting, buzzer_on, backing1, turn_right, backing2, buzzer_off }; - node CONTROLLER(RIGHT_WHITELINE_VALUE,MIDDLE_WHITELINE_VALUE,LEFT_WHITELINE_VALUE,FRONT_IR_VALUE,LEFT_IR_VALUE,SHAFT_COUNT_LEFT:int) +node carV2(RIGHT_WHITELINE_VALUE,MIDDLE_WHITELINE_VALUE,LEFT_WHITELINE_VALUE,FRONT_IR_VALUE,LEFT_IR_VALUE,SHAFT_COUNT_LEFT:int) returns(DIRECTION,VELOCITY:int; BUZZER:bool); var dir1,vel1,empty_start_pos,mode,start_back_pos,start_rightturn_pos:int; blocked,enough_gap,left_gap,enough_back1,turn_r_Complete :bool; diff --git a/todo.org b/todo.org index 2ad3afa5..0e7bff65 100644 --- a/todo.org +++ b/todo.org @@ -127,6 +127,8 @@ lus2ec voir. en fait, l'option --gen-auto-test traduit les types enums en entier ; du coup l'appel depuis l'oracle au noeud à tester est mal typé... +** TODO lus2lic -ee -exec devrait utiliser des enums (a la ecexe) + - State "TODO" from "" [2013-05-07 Tue 16:36] * Divers ** TODO lic2c : le jour ou on genere du code C, y'a peut-etre des trucs a recuperer -- GitLab