From 85d06d6d56afe87cdda4c759de334e6b3b00f547 Mon Sep 17 00:00:00 2001 From: Tom Barthe Date: Sun, 20 Dec 2020 18:25:24 +0100 Subject: [PATCH] Add Easync to MiniLustre --- compiler/main/hept2mls.ml | 1 + compiler/minils/minils.ml | 3 +++ compiler/minils/mls_printer.ml | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/compiler/main/hept2mls.ml b/compiler/main/hept2mls.ml index 7692881..49a029a 100644 --- a/compiler/main/hept2mls.ml +++ b/compiler/main/hept2mls.ml @@ -85,6 +85,7 @@ let translate_op = function | Heptagon.Eifthenelse -> Eifthenelse | Heptagon.Efun f -> Efun f | Heptagon.Enode f -> Enode f + | Heptagon.Easync (f, ack) -> Easync (f, ack) | Heptagon.Efield -> assert false | Heptagon.Efield_update -> Efield_update | Heptagon.Earray_fill -> Earray_fill diff --git a/compiler/minils/minils.ml b/compiler/minils/minils.ml index 2e34c73..502385f 100644 --- a/compiler/minils/minils.ml +++ b/compiler/minils/minils.ml @@ -108,6 +108,7 @@ and op = | Eequal (** [arg1 = arg2] *) | Efun of fun_name (** "Stateless" [longname <> (args) reset r] *) | Enode of fun_name (** "Stateful" [longname <> (args) reset r] *) + | Easync of fun_name * ack | Eifthenelse (** [if arg1 then arg2 else arg3] *) | Efield_update (** [{ arg1 with a_param1 = arg2 }] *) | Earray (** [[ args ]] *) @@ -119,6 +120,8 @@ and op = | Eupdate (** [[ arg1 with arg3..arg_n = arg2 ]] *) | Econcat (** [arg1\@\@arg2] *) +and ack = { ack_name : ack_name; ack_params : static_exp list } + type pat = | Etuplepat of pat list | Evarpat of var_ident diff --git a/compiler/minils/mls_printer.ml b/compiler/minils/mls_printer.ml index 1680eda..59d368f 100644 --- a/compiler/minils/mls_printer.ml +++ b/compiler/minils/mls_printer.ml @@ -163,6 +163,13 @@ and print_app ff (app, args) = | Efun f | Enode f -> fprintf ff "@[%a@,%a@,%a@]" print_qualname f print_params app.a_params print_w_tuple args + | Easync (f, ack) -> + fprintf ff "@[async@,%a@,%a@,%a@,on@,%s@,%a@]" + print_qualname f + print_params app.a_params + print_w_tuple args + ack.ack_name + print_static_exp_tuple ack.ack_params | Eifthenelse -> let e1, e2, e3 = assert_3 args in fprintf ff "@[if %a@ then %a@ else %a@]"