Project

General

Profile

Revision db1c5c00

View differences:

src/machine_code.ml
430 430
let translate_eqs node args eqs =
431 431
  List.fold_right (fun eq args -> translate_eq node args eq) eqs args;;
432 432

  
433
let translate_decl nd =
433
let translate_decl nd sch =
434 434
  (*Log.report ~level:1 (fun fmt -> Printers.pp_node fmt nd);*)
435
  let nd, sch = Scheduling.schedule_node nd in
436 435
  let split_eqs = Splitting.tuple_split_eq_list nd.node_eqs in
437 436
  let eqs_rev, remainder = 
438 437
    List.fold_left 
......
488 487
    mannot = nd.node_annot;
489 488
  }
490 489

  
491

  
492
let translate_prog decls =
490
(** takes the global delcarations and the scheduling associated to each node *)
491
let translate_prog decls node_schs =
493 492
  let nodes = get_nodes decls in 
494
   (* What to do with Imported/Sensor/Actuators ? *)
495
   (*arrow_machine ::*)  List.map translate_decl nodes
493
  List.map 
494
    (fun node -> 
495
      let sch = List.assoc node.node_id node_schs in
496
      translate_decl node sch 
497
    ) nodes
496 498

  
497 499
let get_machine_opt name machines =  
498 500
  List.fold_left 
src/main_lustre_compiler.ml
261 261
      Access.check_prog normalized_prog;
262 262
    end;
263 263

  
264
  (* Computation of node equation scheduling. It also break dependency cycles. *)
265
  let cycle_free_prog, node_schs = Scheduling.schedule_prog normalized_prog in
266

  
264 267
  (* DFS with modular code generation *)
265 268
  report ~level:1 (fun fmt -> fprintf fmt ".. machines generation@,");
266
  let machine_code = Machine_code.translate_prog normalized_prog in
269
  let machine_code = Machine_code.translate_prog cycle_free_prog node_schs in
267 270
  report ~level:2 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@,"
268 271
    (Utils.fprintf_list ~sep:"@ " Machine_code.pp_machine)
269 272
    machine_code);
src/scheduling.ml
125 125
    pp_error Format.err_formatter v;
126 126
    raise exc
127 127

  
128
let schedule_prog prog =
129
  List.fold_right (
130
    fun top_decl (accu_prog, sch_map)  ->
131
      match top_decl.top_decl_desc with
132
	| Node nd -> 
133
	  let nd', sch = schedule_node nd in
134
	  {top_decl with top_decl_desc = Node nd'}::accu_prog, (nd.node_id, sch)::sch_map
135
	| _ -> top_decl::accu_prog, sch_map
136
    ) 
137
    prog
138
    ([],[])
139

  
128 140

  
129 141
(* Local Variables: *)
130 142
(* compile-command:"make -C .." *)

Also available in: Unified diff