Revision 70e1006b src/machine_code.ml
src/machine_code.ml | ||
---|---|---|
165 | 165 |
let arrow_top_decl = |
166 | 166 |
{ |
167 | 167 |
top_decl_desc = Node arrow_desc; |
168 |
top_decl_owner = Version.prefix; |
|
169 |
top_decl_itf = false; |
|
168 | 170 |
top_decl_loc = Location.dummy_loc |
169 | 171 |
} |
170 | 172 |
|
... | ... | |
224 | 226 |
if ISet.exists (fun v -> v.var_id = id) m |
225 | 227 |
then StateVar var_id |
226 | 228 |
else LocalVar var_id |
227 |
with Not_found -> (* id is a constant *) |
|
228 |
LocalVar (Corelang.var_decl_of_const (Hashtbl.find Corelang.consts_table id)) |
|
229 |
with Not_found -> |
|
230 |
try (* id is a constant *) |
|
231 |
LocalVar (Corelang.var_decl_of_const (const_of_top (Hashtbl.find Corelang.consts_table id))) |
|
232 |
with Not_found -> |
|
233 |
(* id is a tag *) |
|
234 |
Cst (Const_tag id) |
|
229 | 235 |
|
230 | 236 |
let rec control_on_clock node ((m, si, j, d, s) as args) ck inst = |
231 | 237 |
match (Clocks.repr ck).cdesc with |
... | ... | |
446 | 452 |
let translate_decl nd sch = |
447 | 453 |
(*Log.report ~level:1 (fun fmt -> Printers.pp_node fmt nd);*) |
448 | 454 |
|
449 |
(* |
|
450 |
let eqs_rev, remainder = |
|
451 |
List.fold_left |
|
452 |
(fun (accu, node_eqs_remainder) v -> |
|
453 |
if List.exists (fun eq -> List.mem v eq.eq_lhs) accu |
|
454 |
then |
|
455 |
(accu, node_eqs_remainder) |
|
456 |
else |
|
457 |
(*if List.exists (fun vdecl -> vdecl.var_id = v) nd.node_locals |
|
458 |
|| List.exists (fun vdecl -> vdecl.var_id = v) nd.node_outputs |
|
459 |
then*) |
|
460 |
let eq_v, remainder = find_eq v node_eqs_remainder in |
|
461 |
eq_v::accu, remainder |
|
462 |
(* else it is a constant value, checked during typing phase |
|
463 |
else |
|
464 |
accu, node_eqs_remainder *) |
|
465 |
) |
|
466 |
([], split_eqs) |
|
467 |
sch |
|
468 |
in |
|
469 |
*) |
|
470 | 455 |
let sorted_eqs = sort_equations_from_schedule nd sch in |
471 | 456 |
|
472 | 457 |
let init_args = ISet.empty, [], Utils.IMap.empty, List.fold_right (fun l -> ISet.add l) nd.node_locals ISet.empty, [] in |
... | ... | |
506 | 491 |
let translate_prog decls node_schs = |
507 | 492 |
let nodes = get_nodes decls in |
508 | 493 |
List.map |
509 |
(fun node -> |
|
494 |
(fun decl -> |
|
495 |
let node = node_of_top decl in |
|
510 | 496 |
let sch = (Utils.IMap.find node.node_id node_schs).Scheduling.schedule in |
511 | 497 |
translate_decl node sch |
512 | 498 |
) nodes |
Also available in: Unified diff