From 1d7714f44c08925a79d81e98bc2d06603380987f Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Mon, 5 Dec 2011 13:59:11 +0100 Subject: [PATCH] =?UTF-8?q?le=20passage=20=C3=A0=20ocaml=204.00.0=20a=20mo?= =?UTF-8?q?difi=C3=A9=20les=20.ref=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +- release-lv6/Makefile | 1 + src/predef.ml | 4 +- src/test/test.res.exp | 6962 ++++++++++++++++++++--------------------- utils/lustre.el | 737 +++++ 5 files changed, 4217 insertions(+), 3492 deletions(-) create mode 100644 utils/lustre.el diff --git a/Makefile b/Makefile index e54e84c2..6f6b6f7f 100644 --- a/Makefile +++ b/Makefile @@ -44,4 +44,7 @@ ci:src/version.ml make test && git commit -F log && rm -f src/version.ml cia:src/version.ml - make test && git commit -a -F log && rm -f src/version.ml \ No newline at end of file + make test && git commit -a -F log && rm -f src/version.ml + +amend: + git commit -a -F log --amend && rm -f src/version.ml diff --git a/release-lv6/Makefile b/release-lv6/Makefile index 8e45edb7..6983878a 100644 --- a/release-lv6/Makefile +++ b/release-lv6/Makefile @@ -32,6 +32,7 @@ $(RELNAME): doc: cp $(LUS2LICDIR)/lv6-ref-man/lv6-ref-man.pdf $(RELNAME)/doc cp ~/slides/lv6/*.pdf $(RELNAME)/doc + cp $(LUS2LICDIR)/utils/lustre.el $(RELNAME)/utils lus2lic: cd $(LUS2LICDIR)/src ; make nc diff --git a/src/predef.ml b/src/predef.ml index 00086d0d..8c6719b6 100644 --- a/src/predef.ml +++ b/src/predef.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 25/02/2009 (at 16:38) by Erwan Jahier> *) +(** Time-stamp: <modified the 30/03/2012 (at 17:06) by Erwan Jahier> *) (* XXX shoud not type int, real, and bool be handled there ? *) @@ -65,7 +65,7 @@ let iterable_op = [ RUMINUS_n; RMINUS_n; RPLUS_n; RSLASH_n; RTIMES_n ; UMINUS_n; MINUS_n; PLUS_n; SLASH_n; TIMES_n ; EQ_n; NEQ_n; LT_n; LTE_n; GT_n; GTE_n ; - IF_n + IF_n; ] (* iterators? *) diff --git a/src/test/test.res.exp b/src/test/test.res.exp index abb250c8..ae961242 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -7,19 +7,14 @@ where [options] can be: --output-file <file> -o <file> Set the output file name. - --keep-nested-calls -knc Keep nested calls. By default, only one node per equation is generated. - --expand-iterators -ei Expand array iterators (i.e., generate iterator-free code). - --expand-enums -ee Translate enums into integers. - --expand-structs-and-arrays -esa Expand structures and arrays using as many variables as necessary (automatically impose '-ei'). - --expand-nodes -en Expand the main node (use the first node if no one is specified). --do-not-expand-node <node> @@ -28,36 +23,29 @@ where [options] can be: --lustre-v4 -lv4 Use Lustre V4 syntax (automatically impose '-ei -ee -esa'). - --expanded-code -ec Generate ec (actually just an alias for '-en -lv4 --no-prefix'). --no-prefix Do not prefix variable names by their module (beware: variable names may clash with this option). --test-lexer Internal option used to test the lexer - -tlex --verbose-level <int> -vl <int> Set the verbose level. - --verbose -v Set the verbose level to 1. - --version -version Display the current version of the tool. -unit Run some (internal) unit tests - --nonreg-test - -h - -help --help Display this message. -- ../lus2lic -vl 2 should_work/NONREG/ex.lus should_work/NONREG/ex.lus type _ex::t = A_A_A_int_1_2_3^4; type _ex::t1 = A_A_A_A_int_1_2_3_4^4; -type _ex::t2 = struct {a : int; b : A_A_bool_11_22}; type _ex::s1 = struct {x : int; y : A_A_A_A_int_1_2_3_4}; type _ex::s = struct {x : A_A_A_A_int_1_2_3_4; y : _ex::s1}; +type _ex::t2 = struct {a : int; b : A_A_bool_11_22}; node ex::ex(a:_ex::s) returns (b:int); var _v_1:A_A_A_A_int_1_2_3_4; @@ -87,12 +75,12 @@ let tel -- end of node ex::ex -- automatically defined aliases: -type A_A_bool_11_22 = A_bool_11^22; +type A_bool_11 = bool^11; type A_A_A_A_int_1_2_3_4 = A_A_A_int_1_2_3^4; type A_A_int_1_2 = A_int_1^2; -type A_A_A_int_1_2_3 = A_A_int_1_2^3; -type A_bool_11 = bool^11; type A_int_1 = int^1; +type A_A_bool_11_22 = A_bool_11^22; +type A_A_A_int_1_2_3 = A_A_int_1_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/COUNTER.lus @@ -909,37 +897,32 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/Watch.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/Watch.lus -type _Watch::STATUS_TYPE; -type _Watch::ALARM_TIME_TYPE; -type _Watch::WATCH_TIME_POSITION; -type _Watch::ALARM_TIME_POSITION; -type _Watch::DISPLAY_TYPE; -type _Watch::WATCH_TIME_TYPE; -type _Watch::STOPWATCH_TIME_TYPE; type _Watch::MAIN_DISPLAY_TYPE; -type _Watch::LABELS_TYPE; +type _Watch::DISPLAY_TYPE; +type _Watch::ALARM_TIME_POSITION; +type _Watch::ALARM_TIME_TYPE; type _Watch::DISPLAY_POSITION; -type _Watch::MINI_DISPLAY_TYPE; +type _Watch::WATCH_TIME_TYPE; type _Watch::string; +type _Watch::MINI_DISPLAY_TYPE; +type _Watch::WATCH_TIME_POSITION; +type _Watch::LABELS_TYPE; +type _Watch::STOPWATCH_TIME_TYPE; +type _Watch::STATUS_TYPE; const Watch::INITIAL_WATCH_POSITION:_Watch::WATCH_TIME_POSITION; const Watch::INITIAL_WATCH_TIME:_Watch::WATCH_TIME_TYPE; -const Watch::ALARM_DURATION:int; -const Watch::stringST:_Watch::string; const Watch::stringAL:_Watch::string; +const Watch::INITIAL_STOPWATCH_TIME:_Watch::STOPWATCH_TIME_TYPE; +const Watch::stringST:_Watch::string; +const Watch::NULL_POSITION:_Watch::DISPLAY_POSITION; +const Watch::ALARM_DURATION:int; const Watch::INITIAL_ALARM_TIME:_Watch::ALARM_TIME_TYPE; const Watch::INITIAL_ALARM_POSITION:_Watch::ALARM_TIME_POSITION; -const Watch::NULL_POSITION:_Watch::DISPLAY_POSITION; -const Watch::INITIAL_STOPWATCH_TIME:_Watch::STOPWATCH_TIME_TYPE; - -extern function Watch::ALARM_TO_DISPLAY_POS( - apos:_Watch::ALARM_TIME_POSITION) -returns ( - dpos:_Watch::DISPLAY_POSITION); -extern function Watch::INCREMENT_STOPWATCH_TIME( - time:_Watch::STOPWATCH_TIME_TYPE) +extern function Watch::INCREMENT_WATCH_TIME( + time:_Watch::WATCH_TIME_TYPE) returns ( - newtime:_Watch::STOPWATCH_TIME_TYPE); + newtime:_Watch::WATCH_TIME_TYPE); node Watch::TWO_STATES( init:bool; @@ -968,28 +951,6 @@ let _v_8 = if _v_3 then true else _v_7; tel -- end of node Watch::TWO_STATES -node Watch::DIVIDE(scale:int) returns (quotient:bool); -var - n:int; - _v_1:int; - _v_2:int; - _v_3:bool; - _v_4:int; - _v_5:int; - _v_6:int; - _v_7:bool; -let - n = 0 -> _v_6; - quotient = true -> _v_7; - _v_1 = pre (n); - _v_2 = _v_1 + 1; - _v_3 = _v_2 = scale; - _v_4 = pre (n); - _v_5 = _v_4 + 1; - _v_6 = if _v_3 then 0 else _v_5; - _v_7 = if _v_3 then true else false; -tel --- end of node Watch::DIVIDE extern function Watch::MAKE_DISPLAY( main:_Watch::MAIN_DISPLAY_TYPE; @@ -1001,82 +962,6 @@ extern function Watch::MAKE_DISPLAY( returns ( display:_Watch::DISPLAY_TYPE); -extern function Watch::WATCH_TIME_TO_MAIN_DISPLAY( - time:_Watch::WATCH_TIME_TYPE) -returns ( - display:_Watch::MAIN_DISPLAY_TYPE); - -extern function Watch::WATCH_DATE_TO_MINI_DISPLAY( - time:_Watch::WATCH_TIME_TYPE) -returns ( - display:_Watch::MINI_DISPLAY_TYPE); - -extern function Watch::WATCH_DAY_TO_ALPHA_DISPLAY( - time:_Watch::WATCH_TIME_TYPE) -returns ( - display:_Watch::string); - -extern function Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY( - time:_Watch::STOPWATCH_TIME_TYPE) -returns ( - display:_Watch::MAIN_DISPLAY_TYPE); - -extern function Watch::WATCH_TIME_TO_MINI_DISPLAY( - time:_Watch::WATCH_TIME_TYPE) -returns ( - display:_Watch::MINI_DISPLAY_TYPE); - -extern function Watch::ALARM_TIME_TO_MAIN_DISPLAY( - time:_Watch::ALARM_TIME_TYPE) -returns ( - display:_Watch::MAIN_DISPLAY_TYPE); - -node Watch::DISPLAY( - mode_is_watch:bool; - mode_is_stopwatch:bool; - mode_is_alarm:bool; - watch_time:_Watch::WATCH_TIME_TYPE; - stopwatch_time:_Watch::STOPWATCH_TIME_TYPE; - alarm_time:_Watch::ALARM_TIME_TYPE; - position_enhanced:_Watch::DISPLAY_POSITION; - status:_Watch::STATUS_TYPE; - labels:_Watch::LABELS_TYPE) -returns ( - display:_Watch::DISPLAY_TYPE); -var - main_display:_Watch::MAIN_DISPLAY_TYPE; - mini_display:_Watch::MINI_DISPLAY_TYPE; - alpha_display:_Watch::string; - _v_1:_Watch::MAIN_DISPLAY_TYPE; - _v_2:_Watch::MINI_DISPLAY_TYPE; - _v_3:_Watch::string; - _v_4:_Watch::MAIN_DISPLAY_TYPE; - _v_5:_Watch::MINI_DISPLAY_TYPE; - _v_6:_Watch::MAIN_DISPLAY_TYPE; - _v_7:_Watch::MINI_DISPLAY_TYPE; - _v_8:_Watch::MAIN_DISPLAY_TYPE; - _v_9:_Watch::MINI_DISPLAY_TYPE; - _v_10:_Watch::string; -let - display = Watch::MAKE_DISPLAY(main_display, mini_display, alpha_display, - status, position_enhanced, labels); - main_display = if mode_is_watch then _v_1 else _v_8; - mini_display = if mode_is_watch then _v_2 else _v_9; - alpha_display = if mode_is_watch then _v_3 else _v_10; - _v_1 = Watch::WATCH_TIME_TO_MAIN_DISPLAY(watch_time); - _v_2 = Watch::WATCH_DATE_TO_MINI_DISPLAY(watch_time); - _v_3 = Watch::WATCH_DAY_TO_ALPHA_DISPLAY(watch_time); - _v_4 = Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY(stopwatch_time); - _v_5 = Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time); - _v_6 = Watch::ALARM_TIME_TO_MAIN_DISPLAY(alarm_time); - _v_7 = Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time); - _v_8 = if mode_is_stopwatch then _v_4 else _v_6; - _v_9 = if mode_is_stopwatch then _v_5 else _v_7; - _v_10 = if mode_is_stopwatch then Watch::stringST else Watch::stringAL; -tel --- end of node Watch::DISPLAY -extern function Watch::SOMME(i1:int; i2:int; i3:int) returns (somme:int); - extern function Watch::COMPARE_WATCH_ALARM_TIME( watch_time:_Watch::WATCH_TIME_TYPE; alarm_time:_Watch::ALARM_TIME_TYPE) @@ -1226,109 +1111,221 @@ let tel -- end of node Watch::ALARM -extern function Watch::LABELS( - mode_is_watch:bool; - mode_is_stopwatch:bool; - mode_is_alarm:bool; - mode_is_set_watch:bool; - mode_is_set_alarm:bool) -returns ( - labels:_Watch::LABELS_TYPE); - -extern function Watch::WATCH_TO_DISPLAY_POS( - wpos:_Watch::WATCH_TIME_POSITION) -returns ( - dpos:_Watch::DISPLAY_POSITION); - -extern function Watch::STATUS( - alarm_is_set:bool; - chime_is_set:bool; - stopwatch_running:bool; - stopwatch_lapping:bool) -returns ( - status:_Watch::STATUS_TYPE); - -extern function Watch::IS_O_CLOCK( - time:_Watch::WATCH_TIME_TYPE) +extern function Watch::INCREMENT_STOPWATCH_TIME( + time:_Watch::STOPWATCH_TIME_TYPE) returns ( - is_o_clock:bool); + newtime:_Watch::STOPWATCH_TIME_TYPE); -extern function Watch::INCREMENT_WATCH_TIME( +extern function Watch::WATCH_TIME_TO_MAIN_DISPLAY( time:_Watch::WATCH_TIME_TYPE) returns ( - newtime:_Watch::WATCH_TIME_TYPE); + display:_Watch::MAIN_DISPLAY_TYPE); -extern function Watch::TOGGLE_24H_IN_WATCH_MODE( +extern function Watch::WATCH_DATE_TO_MINI_DISPLAY( time:_Watch::WATCH_TIME_TYPE) returns ( - newtime:_Watch::WATCH_TIME_TYPE); + display:_Watch::MINI_DISPLAY_TYPE); -extern function Watch::CONFIRM_TIME( +extern function Watch::WATCH_DAY_TO_ALPHA_DISPLAY( time:_Watch::WATCH_TIME_TYPE) returns ( - new_time:_Watch::WATCH_TIME_TYPE); + display:_Watch::string); -extern function Watch::INCREMENT_WATCH_TIME_IN_SET_MODE( - time:_Watch::WATCH_TIME_TYPE; - position:_Watch::WATCH_TIME_POSITION) +extern function Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY( + time:_Watch::STOPWATCH_TIME_TYPE) returns ( - new_time:_Watch::WATCH_TIME_TYPE); + display:_Watch::MAIN_DISPLAY_TYPE); -extern function Watch::SET_WATCH_TIME( - time:_Watch::WATCH_TIME_TYPE; - position:_Watch::WATCH_TIME_POSITION) +extern function Watch::WATCH_TIME_TO_MINI_DISPLAY( + time:_Watch::WATCH_TIME_TYPE) returns ( - new_time:_Watch::WATCH_TIME_TYPE); + display:_Watch::MINI_DISPLAY_TYPE); -extern function Watch::NEXT_WATCH_TIME_POSITION( - position:_Watch::WATCH_TIME_POSITION) +extern function Watch::ALARM_TIME_TO_MAIN_DISPLAY( + time:_Watch::ALARM_TIME_TYPE) returns ( - new_position:_Watch::WATCH_TIME_POSITION); + display:_Watch::MAIN_DISPLAY_TYPE); -node Watch::WATCH( - second:bool; - toggle_24h:bool; - toggle_chime:bool; - in_set:bool; - next_position:bool; - set:bool) +node Watch::DISPLAY( + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + watch_time:_Watch::WATCH_TIME_TYPE; + stopwatch_time:_Watch::STOPWATCH_TIME_TYPE; + alarm_time:_Watch::ALARM_TIME_TYPE; + position_enhanced:_Watch::DISPLAY_POSITION; + status:_Watch::STATUS_TYPE; + labels:_Watch::LABELS_TYPE) returns ( - time:_Watch::WATCH_TIME_TYPE; - enhance:_Watch::WATCH_TIME_POSITION; - chime_is_set:bool; - beep:int); + display:_Watch::DISPLAY_TYPE); var - position_set:_Watch::WATCH_TIME_POSITION; - internal_chime_is_set:int; - _v_1:int; - _v_2:bool; - _v_3:int; - _v_4:int; - _v_5:int; - _v_6:bool; - _v_7:bool; - _v_8:int; - _v_9:bool; - _v_10:_Watch::WATCH_TIME_TYPE; - _v_11:_Watch::WATCH_TIME_TYPE; - _v_12:_Watch::WATCH_TIME_TYPE; - _v_13:_Watch::WATCH_TIME_TYPE; - _v_14:bool; - _v_15:bool; - _v_16:_Watch::WATCH_TIME_TYPE; - _v_17:_Watch::WATCH_TIME_TYPE; - _v_18:_Watch::WATCH_TIME_TYPE; - _v_19:_Watch::WATCH_TIME_TYPE; - _v_20:_Watch::WATCH_TIME_TYPE; - _v_21:_Watch::WATCH_TIME_TYPE; - _v_22:_Watch::WATCH_TIME_TYPE; - _v_23:_Watch::WATCH_TIME_TYPE; - _v_24:_Watch::WATCH_TIME_TYPE; - _v_25:_Watch::WATCH_TIME_TYPE; - _v_26:_Watch::WATCH_TIME_TYPE; - _v_27:_Watch::WATCH_TIME_TYPE; - _v_28:_Watch::WATCH_TIME_TYPE; - _v_29:_Watch::WATCH_TIME_TYPE; + main_display:_Watch::MAIN_DISPLAY_TYPE; + mini_display:_Watch::MINI_DISPLAY_TYPE; + alpha_display:_Watch::string; + _v_1:_Watch::MAIN_DISPLAY_TYPE; + _v_2:_Watch::MINI_DISPLAY_TYPE; + _v_3:_Watch::string; + _v_4:_Watch::MAIN_DISPLAY_TYPE; + _v_5:_Watch::MINI_DISPLAY_TYPE; + _v_6:_Watch::MAIN_DISPLAY_TYPE; + _v_7:_Watch::MINI_DISPLAY_TYPE; + _v_8:_Watch::MAIN_DISPLAY_TYPE; + _v_9:_Watch::MINI_DISPLAY_TYPE; + _v_10:_Watch::string; +let + display = Watch::MAKE_DISPLAY(main_display, mini_display, alpha_display, + status, position_enhanced, labels); + main_display = if mode_is_watch then _v_1 else _v_8; + mini_display = if mode_is_watch then _v_2 else _v_9; + alpha_display = if mode_is_watch then _v_3 else _v_10; + _v_1 = Watch::WATCH_TIME_TO_MAIN_DISPLAY(watch_time); + _v_2 = Watch::WATCH_DATE_TO_MINI_DISPLAY(watch_time); + _v_3 = Watch::WATCH_DAY_TO_ALPHA_DISPLAY(watch_time); + _v_4 = Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY(stopwatch_time); + _v_5 = Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time); + _v_6 = Watch::ALARM_TIME_TO_MAIN_DISPLAY(alarm_time); + _v_7 = Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time); + _v_8 = if mode_is_stopwatch then _v_4 else _v_6; + _v_9 = if mode_is_stopwatch then _v_5 else _v_7; + _v_10 = if mode_is_stopwatch then Watch::stringST else Watch::stringAL; +tel +-- end of node Watch::DISPLAY +extern function Watch::TIME_SCALE(bidon:int) returns (scale:int); +node Watch::MORE_RECENT(evt:bool; delay:int) returns (more_recent:bool); +var + deadline:int; + _v_1:bool; + _v_2:bool; + _v_3:int; + _v_4:int; + _v_5:int; + _v_6:bool; + _v_7:int; + _v_8:bool; + _v_9:int; + _v_10:bool; + _v_11:int; +let + more_recent = if evt then true else _v_10; + deadline = if evt then 0 else _v_11; + _v_1 = pre (more_recent); + _v_2 = deadline < delay; + _v_3 = pre (deadline); + _v_4 = _v_3 + 1; + _v_5 = pre (deadline); + _v_6 = if _v_1 then _v_2 else false; + _v_7 = if _v_1 then _v_4 else _v_5; + _v_8 = if evt then true else _v_6; + _v_9 = if evt then 0 else _v_7; + _v_10 = false -> _v_8; + _v_11 = delay -> _v_9; +tel +-- end of node Watch::MORE_RECENT +extern function Watch::SOMME(i1:int; i2:int; i3:int) returns (somme:int); + +extern function Watch::LABELS( + mode_is_watch:bool; + mode_is_stopwatch:bool; + mode_is_alarm:bool; + mode_is_set_watch:bool; + mode_is_set_alarm:bool) +returns ( + labels:_Watch::LABELS_TYPE); + +extern function Watch::WATCH_TO_DISPLAY_POS( + wpos:_Watch::WATCH_TIME_POSITION) +returns ( + dpos:_Watch::DISPLAY_POSITION); + +extern function Watch::ALARM_TO_DISPLAY_POS( + apos:_Watch::ALARM_TIME_POSITION) +returns ( + dpos:_Watch::DISPLAY_POSITION); + +extern function Watch::STATUS( + alarm_is_set:bool; + chime_is_set:bool; + stopwatch_running:bool; + stopwatch_lapping:bool) +returns ( + status:_Watch::STATUS_TYPE); + +extern function Watch::IS_O_CLOCK( + time:_Watch::WATCH_TIME_TYPE) +returns ( + is_o_clock:bool); + +extern function Watch::TOGGLE_24H_IN_WATCH_MODE( + time:_Watch::WATCH_TIME_TYPE) +returns ( + newtime:_Watch::WATCH_TIME_TYPE); + +extern function Watch::CONFIRM_TIME( + time:_Watch::WATCH_TIME_TYPE) +returns ( + new_time:_Watch::WATCH_TIME_TYPE); + +extern function Watch::INCREMENT_WATCH_TIME_IN_SET_MODE( + time:_Watch::WATCH_TIME_TYPE; + position:_Watch::WATCH_TIME_POSITION) +returns ( + new_time:_Watch::WATCH_TIME_TYPE); + +extern function Watch::SET_WATCH_TIME( + time:_Watch::WATCH_TIME_TYPE; + position:_Watch::WATCH_TIME_POSITION) +returns ( + new_time:_Watch::WATCH_TIME_TYPE); + +extern function Watch::NEXT_WATCH_TIME_POSITION( + position:_Watch::WATCH_TIME_POSITION) +returns ( + new_position:_Watch::WATCH_TIME_POSITION); + +node Watch::WATCH( + second:bool; + toggle_24h:bool; + toggle_chime:bool; + in_set:bool; + next_position:bool; + set:bool) +returns ( + time:_Watch::WATCH_TIME_TYPE; + enhance:_Watch::WATCH_TIME_POSITION; + chime_is_set:bool; + beep:int); +var + position_set:_Watch::WATCH_TIME_POSITION; + internal_chime_is_set:int; + _v_1:int; + _v_2:bool; + _v_3:int; + _v_4:int; + _v_5:int; + _v_6:bool; + _v_7:bool; + _v_8:int; + _v_9:bool; + _v_10:_Watch::WATCH_TIME_TYPE; + _v_11:_Watch::WATCH_TIME_TYPE; + _v_12:_Watch::WATCH_TIME_TYPE; + _v_13:_Watch::WATCH_TIME_TYPE; + _v_14:bool; + _v_15:bool; + _v_16:_Watch::WATCH_TIME_TYPE; + _v_17:_Watch::WATCH_TIME_TYPE; + _v_18:_Watch::WATCH_TIME_TYPE; + _v_19:_Watch::WATCH_TIME_TYPE; + _v_20:_Watch::WATCH_TIME_TYPE; + _v_21:_Watch::WATCH_TIME_TYPE; + _v_22:_Watch::WATCH_TIME_TYPE; + _v_23:_Watch::WATCH_TIME_TYPE; + _v_24:_Watch::WATCH_TIME_TYPE; + _v_25:_Watch::WATCH_TIME_TYPE; + _v_26:_Watch::WATCH_TIME_TYPE; + _v_27:_Watch::WATCH_TIME_TYPE; + _v_28:_Watch::WATCH_TIME_TYPE; + _v_29:_Watch::WATCH_TIME_TYPE; _v_30:bool; _v_31:bool; _v_32:_Watch::WATCH_TIME_POSITION; @@ -1553,7 +1550,28 @@ let stop_alarm_beep = UR; tel -- end of node Watch::BUTTONS -extern function Watch::TIME_SCALE(bidon:int) returns (scale:int); +node Watch::DIVIDE(scale:int) returns (quotient:bool); +var + n:int; + _v_1:int; + _v_2:int; + _v_3:bool; + _v_4:int; + _v_5:int; + _v_6:int; + _v_7:bool; +let + n = 0 -> _v_6; + quotient = true -> _v_7; + _v_1 = pre (n); + _v_2 = _v_1 + 1; + _v_3 = _v_2 = scale; + _v_4 = pre (n); + _v_5 = _v_4 + 1; + _v_6 = if _v_3 then 0 else _v_5; + _v_7 = if _v_3 then true else false; +tel +-- end of node Watch::DIVIDE node Watch::Watch( UPLEFT:bool; @@ -1634,36 +1652,6 @@ let _v_7 = current (_v_6); tel -- end of node Watch::Watch -node Watch::MORE_RECENT(evt:bool; delay:int) returns (more_recent:bool); -var - deadline:int; - _v_1:bool; - _v_2:bool; - _v_3:int; - _v_4:int; - _v_5:int; - _v_6:bool; - _v_7:int; - _v_8:bool; - _v_9:int; - _v_10:bool; - _v_11:int; -let - more_recent = if evt then true else _v_10; - deadline = if evt then 0 else _v_11; - _v_1 = pre (more_recent); - _v_2 = deadline < delay; - _v_3 = pre (deadline); - _v_4 = _v_3 + 1; - _v_5 = pre (deadline); - _v_6 = if _v_1 then _v_2 else false; - _v_7 = if _v_1 then _v_4 else _v_5; - _v_8 = if evt then true else _v_6; - _v_9 = if evt then 0 else _v_7; - _v_10 = false -> _v_8; - _v_11 = delay -> _v_9; -tel --- end of node Watch::MORE_RECENT ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/X.lus @@ -1960,20 +1948,8 @@ tel -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/alarme.lus const alarme::delai_reprise = 4; -const alarme::delai_vigilence = 3; const alarme::delai_alarme = 6; -node alarme::edge(in:bool) returns (edge:bool); -var - _v_1:bool; - _v_2:bool; - _v_3:bool; -let - edge = false -> _v_3; - _v_1 = pre (in); - _v_2 = not _v_1; - _v_3 = in and _v_2; -tel --- end of node alarme::edge +const alarme::delai_vigilence = 3; node alarme::bascule( init:bool; @@ -2024,6 +2000,18 @@ let _v_5 = if init then val_init else _v_4; tel -- end of node alarme::decompte +node alarme::edge(in:bool) returns (edge:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; +let + edge = false -> _v_3; + _v_1 = pre (in); + _v_2 = not _v_1; + _v_3 = in and _v_2; +tel +-- end of node alarme::edge node alarme::alarme( MA:bool; @@ -2151,6 +2139,7 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/arbitre.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/arbitre.lus +extern node arbitre::xedge(x:bool) returns (y:bool); node arbitre::my_switch( set:bool; @@ -2179,7 +2168,6 @@ let _v_8 = if _v_3 then true else _v_7; tel -- end of node arbitre::my_switch -extern node arbitre::xedge(x:bool) returns (y:bool); node arbitre::process( request:bool; @@ -2430,6 +2418,7 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/call.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/call.lus +extern function call::p(a:int) returns (x:int; y:int); extern function call::f(a:int) returns (b:int); node call::n(a:int; b:bool) returns (x:int; y:int); var @@ -2440,7 +2429,6 @@ let _v_1 = call::f(a); tel -- end of node call::n -extern function call::p(a:int) returns (x:int; y:int); node call::call(a:int; b:bool) returns (x:int; y:int); var u:int; @@ -2752,9 +2740,9 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/cst.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/cst.lus -const cst::i:int; -const cst::j:int; const cst::k:int; +const cst::j:int; +const cst::i:int; node cst::cst(x:int) returns (y:int); var z:int; @@ -2778,8 +2766,8 @@ tel type _deconne::pendule; const deconne::G = 10.0; -const deconne::L = 2.0; const deconne::T = 0.1; +const deconne::L = 2.0; extern function deconne::make_pend( x0:real; @@ -3094,9 +3082,9 @@ tel type _ex::t = A_A_A_int_1_2_3^4; type _ex::t1 = A_A_A_A_int_1_2_3_4^4; -type _ex::t2 = struct {a : int; b : A_A_bool_11_22}; type _ex::s1 = struct {x : int; y : A_A_A_A_int_1_2_3_4}; type _ex::s = struct {x : A_A_A_A_int_1_2_3_4; y : _ex::s1}; +type _ex::t2 = struct {a : int; b : A_A_bool_11_22}; node ex::ex(a:_ex::s) returns (b:int); var _v_1:A_A_A_A_int_1_2_3_4; @@ -3126,12 +3114,12 @@ let tel -- end of node ex::ex -- automatically defined aliases: -type A_A_bool_11_22 = A_bool_11^22; +type A_bool_11 = bool^11; type A_A_A_A_int_1_2_3_4 = A_A_A_int_1_2_3^4; type A_A_int_1_2 = A_int_1^2; -type A_A_A_int_1_2_3 = A_A_int_1_2^3; -type A_bool_11 = bool^11; type A_int_1 = int^1; +type A_A_bool_11_22 = A_bool_11^22; +type A_A_A_int_1_2_3 = A_A_int_1_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/exclusion.lus @@ -3241,16 +3229,16 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/hanane.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/hanane.lus +type _hanane::t3; type _hanane::t1; const hanane::a = 4; type _hanane::string = int^4; type _hanane::string2d = A_int_4^4; type _hanane::structT = struct {x : int; y : real; z : A_A_A_int_4_4_4}; -type _hanane::t2; -type _hanane::t3; type _hanane::tabStruct = _hanane::structT^2; -const hanane::b = true; +type _hanane::t2; const hanane::c = 3.14; +const hanane::b = true; node hanane::hanane( a1:bool; @@ -3312,10 +3300,10 @@ let tel -- end of node hanane::hanane -- automatically defined aliases: -type A__hanane::structT_2 = _hanane::structT^2; type A_A_A_int_4_4_4 = A_A_int_4_4^4; -type A_A_int_4_4 = A_int_4^4; type A_int_4 = int^4; +type A__hanane::structT_2 = _hanane::structT^2; +type A_A_int_4_4 = A_int_4^4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/impl_priority.lus @@ -7836,13 +7824,13 @@ tel type _simple::S; type _simple::T = int; type _simple::H = struct {x : _simple::S; y : int}; -type _simple::U = struct {a : int; b : _simple::H}; -type _simple::V = _simple::U^4; const simple::size = 16; type _simple::W = int^18; -const simple::u = false; -const simple::pi = 3.1416; +type _simple::U = struct {a : int; b : _simple::H}; +type _simple::V = _simple::U^4; const simple::c = true; +const simple::pi = 3.1416; +const simple::u = false; node simple::simple(e:bool; a:_simple::U) returns (b:int); var x:int; @@ -7856,8 +7844,8 @@ let _v_2 = _v_1 = 0; tel -- end of node simple::simple -extern function simple::f1(x:int) returns (y:int); extern function simple::f2(u:int; v:int) returns (s:int; t:bool); +extern function simple::f1(x:int) returns (y:int); ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/sincos.lus @@ -8056,8 +8044,8 @@ tel type _test_const::t_binary = struct {valeur : bool; validite : bool}; type _test_const::t_PACQ_bin_inputs = struct {valeur : bool; validite : bool}; -const test_const::PAS_DE_COMMANDE_PACQbis = _test_const::t_binary{valeur = true; validite = false}; const test_const::toto = true; +const test_const::PAS_DE_COMMANDE_PACQbis = _test_const::t_binary{valeur = true; validite = false}; node test_const::TDF_sans_PACQ( dummy:bool) @@ -8203,9 +8191,9 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/type_decl.lus -- ../lus2lic -vl 2 --nonreg-test should_work/NONREG/type_decl.lus -type _type_decl::alias = int; type _type_decl::pair = struct {a : int; b : int}; type _type_decl::color = enum {type_decl::blue, type_decl::white, type_decl::black}; +type _type_decl::alias = int; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/NONREG/uu.lus @@ -8501,13 +8489,13 @@ tel -- end of node access::quick_access_int8 -- automatically defined aliases: type A_int_4 = int^4; -type A_int_8 = int^8; +type A_real_8 = real^8; type A_int_1 = int^1; type A_real_4 = real^4; -type A_real_8 = real^8; -type A_real_1 = real^1; -type A_int_2 = int^2; type A_real_2 = real^2; +type A_int_8 = int^8; +type A_int_2 = int^2; +type A_real_1 = real^1; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/consensus.lus @@ -8624,6 +8612,11 @@ let _v_4 = _v_1 and _v_3; tel -- end of node consensus_8 +node consensus::c8(T:A_bool_8) returns (a:bool); +let + a = consensus_8(T); +tel +-- end of node consensus::c8 node consensus_9(T:A_bool_9) returns (a:bool); var _v_1:bool; @@ -8657,22 +8650,17 @@ let a = consensus_10(T); tel -- end of node consensus::main2 -node consensus::c8(T:A_bool_8) returns (a:bool); -let - a = consensus_8(T); -tel --- end of node consensus::c8 -- automatically defined aliases: +type A_bool_5 = bool^5; +type A_bool_1 = bool^1; +type A_bool_10 = bool^10; type A_bool_7 = bool^7; -type A_bool_4 = bool^4; type A_bool_8 = bool^8; -type A_bool_1 = bool^1; -type A_bool_5 = bool^5; +type A_bool_4 = bool^4; type A_bool_9 = bool^9; -type A_bool_2 = bool^2; type A_bool_6 = bool^6; -type A_bool_10 = bool^10; type A_bool_3 = bool^3; +type A_bool_2 = bool^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/consensus2.lus @@ -8790,14 +8778,14 @@ let tel -- end of node consensus2::main -- automatically defined aliases: +type A_bool_5 = bool^5; +type A_bool_1 = bool^1; type A_bool_7 = bool^7; -type A_bool_4 = bool^4; type A_bool_8 = bool^8; -type A_bool_1 = bool^1; -type A_bool_5 = bool^5; -type A_bool_2 = bool^2; +type A_bool_4 = bool^4; type A_bool_6 = bool^6; type A_bool_3 = bool^3; +type A_bool_2 = bool^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/fby.lus @@ -8841,10 +8829,10 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/heater_control.lus -- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/heater_control.lus +const heater_control::DELTA = 0.5; +const heater_control::TMAX = 9.0; const heater_control::FAILURE = -999.0; const heater_control::TMIN = 6.0; -const heater_control::TMAX = 9.0; -const heater_control::DELTA = 0.5; node heater_control::not_a_sauna2( T:real; @@ -8865,72 +8853,14 @@ let _v_3 = _v_1 < _v_2; tel -- end of node heater_control::not_a_sauna2 -node heater_control::min2(one:real; two:real) returns (m:real); -var - _v_1:bool; -let - m = if _v_1 then one else two; - _v_1 = one < two; -tel --- end of node heater_control::min2 -node heater_control::max2(one:real; two:real) returns (m:real); -var - _v_1:bool; -let - m = if _v_1 then one else two; - _v_1 = one > two; -tel --- end of node heater_control::max2 -node heater_control::Median(a:real; b:real; c:real) returns (z:real); +node heater_control::Average(a:real; b:real) returns (z:real); var _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:real; let - z = _v_5 - _v_7; + z = _v_1 / 2.0; _v_1 = a + b; - _v_2 = _v_1 + c; - _v_3 = heater_control::min2(b, c); - _v_4 = heater_control::min2(a, _v_3); - _v_5 = _v_2 - _v_4; - _v_6 = heater_control::max2(b, c); - _v_7 = heater_control::max2(a, _v_6); -tel --- end of node heater_control::Median -node heater_control::abs(v:real) returns (a:real); -var - _v_1:bool; - _v_2:real; -let - a = if _v_1 then v else _v_2; - _v_1 = v >= 0.0; - _v_2 = -v; -tel --- end of node heater_control::abs - -node heater_control::noneoftree( - f1:bool; - f2:bool; - f3:bool) -returns ( - r:bool); -var - _v_1:bool; - _v_2:bool; - _v_3:bool; - _v_4:bool; -let - r = _v_3 and _v_4; - _v_1 = not f1; - _v_2 = not f2; - _v_3 = _v_1 and _v_2; - _v_4 = not f3; tel --- end of node heater_control::noneoftree +-- end of node heater_control::Average node heater_control::oneoftree( f1:bool; @@ -8983,14 +8913,72 @@ let _v_1 = f1 and f2; tel -- end of node heater_control::alloftree -node heater_control::Average(a:real; b:real) returns (z:real); +node heater_control::abs(v:real) returns (a:real); +var + _v_1:bool; + _v_2:real; +let + a = if _v_1 then v else _v_2; + _v_1 = v >= 0.0; + _v_2 = -v; +tel +-- end of node heater_control::abs + +node heater_control::noneoftree( + f1:bool; + f2:bool; + f3:bool) +returns ( + r:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; +let + r = _v_3 and _v_4; + _v_1 = not f1; + _v_2 = not f2; + _v_3 = _v_1 and _v_2; + _v_4 = not f3; +tel +-- end of node heater_control::noneoftree +node heater_control::min2(one:real; two:real) returns (m:real); +var + _v_1:bool; +let + m = if _v_1 then one else two; + _v_1 = one < two; +tel +-- end of node heater_control::min2 +node heater_control::max2(one:real; two:real) returns (m:real); +var + _v_1:bool; +let + m = if _v_1 then one else two; + _v_1 = one > two; +tel +-- end of node heater_control::max2 +node heater_control::Median(a:real; b:real; c:real) returns (z:real); var _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; + _v_7:real; let - z = _v_1 / 2.0; + z = _v_5 - _v_7; _v_1 = a + b; + _v_2 = _v_1 + c; + _v_3 = heater_control::min2(b, c); + _v_4 = heater_control::min2(a, _v_3); + _v_5 = _v_2 - _v_4; + _v_6 = heater_control::max2(b, c); + _v_7 = heater_control::max2(a, _v_6); tel --- end of node heater_control::Average +-- end of node heater_control::Median node heater_control::heater_control( T:real; @@ -9121,25 +9109,26 @@ let _v_1 = pre (fb); tel -- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; +type _pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); var - _v_1:bool; + _v_1:int; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pbool::fby1 -type _pint::t = int; -node pint::fby1(init:int; fb:int) returns (next:int); +-- end of node pint::fby1 +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); var - _v_1:int; + _v_1:bool; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pint::fby1 -type _inter::selType = struct {i : int; b : bool; r : real}; +-- end of node pbool::fby1 node inter::preced( in:_inter::selType) @@ -9173,81 +9162,119 @@ let (out, out2) = inter::preced(in); tel -- end of node mainPack::preced -const inter::n = -4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/onlyroll.lus -- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/onlyroll.lus -const onlyroll::NRminP = -5.1; -const onlyroll::NRminR = -25.3; -const onlyroll::NRmaxP = 5.1; -const onlyroll::DELTA_PITCH = 3.0; const onlyroll::NRmaxR = 25.3; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::HORmaxR = 285.0; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; -const onlyroll::DELTA_YAW = 2.73; -const onlyroll::NRminY = -5.0; -const onlyroll::HORminP = -57.0; +const onlyroll::NRmaxP = 5.1; const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; -const onlyroll::NRmaxY = 5.0; -const onlyroll::HORminR = -285.0; -const onlyroll::HORmaxP = 57.0; +const onlyroll::TIME_CROSS_ROLL = 3; +const onlyroll::TIME5 = 4; +const onlyroll::TIME_ROLL = 3; const onlyroll::CROSS_CH_TOL_PITCH = 10.1; -const onlyroll::HORmaxR = 285.0; -const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::DELTA_YAW = 2.73; const onlyroll::HORminY = -57.0; -const onlyroll::DELTA_ROLL = 14.9; -const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll::NRminP = -5.1; const onlyroll::OneSecond = 10; -const onlyroll::HORmaxY = 57.0; -const onlyroll::TIME_ROLL = 3; -const onlyroll::CROSS_CH_TOL_ROLL = 51.0; -const onlyroll::BID_LAST = 2.2; -const onlyroll::TIME5 = 4; const onlyroll::SAFE_COUNTER_TIME = 3; +const onlyroll::HORminP = -57.0; +const onlyroll::HORmaxY = 57.0; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll::BID_VAL = 3.3; -const onlyroll::CROSS_CH_TOL_YAW = 10.0; -const onlyroll::TIME_CROSS_ROLL = 3; - -node onlyroll::noneof( - f1:bool; - f2:bool; - f3:bool; - f4:bool) -returns ( - r:bool); +const onlyroll::NRminY = -5.0; +const onlyroll::BID_LAST = 2.2; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::NRminR = -25.3; +const onlyroll::HORminR = -285.0; +const onlyroll::NRmaxY = 5.0; +node onlyroll::abs(v:real) returns (a:real); var _v_1:bool; - _v_2:bool; + _v_2:real; +let + a = if _v_1 then v else _v_2; + _v_1 = v >= 0.0; + _v_2 = -v; +tel +-- end of node onlyroll::abs +node onlyroll::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; + _v_1:int; + _v_2:int; + _v_3:int; + _v_4:int; +let + cpt = _v_1 -> _v_4; + _v_1 = if val then 1 else 0; + _v_2 = pre (cpt); + _v_3 = _v_2 + 1; + _v_4 = if val then _v_3 else 0; + m = cpt >= n; +tel +-- end of node onlyroll::maintain + +node onlyroll::Monitor( + xa:real; + xb:real; + disc:bool) +returns ( + local_value:real; + inline_monitor_failed:bool); +var + _v_1:real; + _v_2:real; _v_3:bool; _v_4:bool; - _v_5:bool; - _v_6:bool; let - r = _v_5 and _v_6; - _v_1 = not f1; - _v_2 = not f2; - _v_3 = _v_1 and _v_2; - _v_4 = not f3; - _v_5 = _v_3 and _v_4; - _v_6 = not f4; + inline_monitor_failed = _v_4 or disc; + _v_1 = xa - xb; + _v_2 = onlyroll::abs(_v_1); + _v_3 = _v_2 > 14.9; + _v_4 = onlyroll::maintain(3, _v_3); + local_value = xa; tel --- end of node onlyroll::noneof +-- end of node onlyroll::Monitor +node onlyroll::InNominalRange(r:real) returns (i:bool); +var + _v_1:bool; + _v_2:bool; +let + i = _v_1 and _v_2; + _v_1 = r < 25.3; + _v_2 = r > -25.3; +tel +-- end of node onlyroll::InNominalRange -node onlyroll::oneoffour( - f1:bool; - f2:bool; - f3:bool; - f4:bool) +node onlyroll::values_nok( + pfother1:bool; + pfother2:bool; + pfother3:bool; + xi:real; + pxother1:real; + pxother2:real; + pxother3:real) returns ( r:bool); var - _v_1:bool; - _v_2:bool; - _v_3:bool; - _v_4:bool; - _v_5:bool; - _v_6:bool; + one:bool; + two:bool; + three:bool; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; _v_7:bool; _v_8:bool; _v_9:bool; @@ -9260,69 +9287,79 @@ var _v_16:bool; _v_17:bool; _v_18:bool; - _v_19:bool; - _v_20:bool; - _v_21:bool; - _v_22:bool; - _v_23:bool; - _v_24:bool; - _v_25:bool; - _v_26:bool; let - r = _v_20 or _v_26; - _v_1 = not f2; - _v_2 = f1 and _v_1; - _v_3 = not f3; - _v_4 = _v_2 and _v_3; - _v_5 = not f4; - _v_6 = _v_4 and _v_5; - _v_7 = not f1; - _v_8 = f2 and _v_7; - _v_9 = not f3; - _v_10 = _v_8 and _v_9; - _v_11 = not f4; - _v_12 = _v_10 and _v_11; - _v_13 = _v_6 or _v_12; - _v_14 = not f1; - _v_15 = f3 and _v_14; - _v_16 = not f2; - _v_17 = _v_15 and _v_16; - _v_18 = not f4; - _v_19 = _v_17 and _v_18; - _v_20 = _v_13 or _v_19; - _v_21 = not f1; - _v_22 = f4 and _v_21; - _v_23 = not f2; - _v_24 = _v_22 and _v_23; - _v_25 = not f3; - _v_26 = _v_24 and _v_25; + one = _v_2 > 51.0; + _v_1 = xi - pxother1; + _v_2 = onlyroll::abs(_v_1); + two = _v_4 > 51.0; + _v_3 = xi - pxother2; + _v_4 = onlyroll::abs(_v_3); + three = _v_6 > 51.0; + _v_5 = xi - pxother3; + _v_6 = onlyroll::abs(_v_5); + r = onlyroll::maintain(3, _v_18); + _v_7 = if pfother3 then false else three; + _v_8 = two and three; + _v_9 = if pfother3 then two else _v_8; + _v_10 = if pfother2 then _v_7 else _v_9; + _v_11 = one and three; + _v_12 = if pfother3 then one else _v_11; + _v_13 = one and two; + _v_14 = one and two; + _v_15 = _v_14 and three; + _v_16 = if pfother3 then _v_13 else _v_15; + _v_17 = if pfother2 then _v_12 else _v_16; + _v_18 = if pfother1 then _v_10 else _v_17; tel --- end of node onlyroll::oneoffour +-- end of node onlyroll::values_nok -node onlyroll::twooffour( - f1:bool; - f2:bool; - f3:bool; - f4:bool) +node onlyroll::FailDetect( + local_failure:bool; + xi:real; + ongroundreset:bool; + inairreset:bool; + choffi:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + a:bool) returns ( + failure:bool; + debug_cross_failure:bool; + debug_st:int; r:bool); var + cross_failure:bool; + ps:int; + state:int; + from1to2:bool; + from1to3:bool; + from2to3:bool; + from2to1:bool; + from3to1:bool; + NLfaults:bool; + will_latch:bool; + reset:bool; + foreign_failure:bool; _v_1:bool; _v_2:bool; _v_3:bool; _v_4:bool; - _v_5:bool; - _v_6:bool; - _v_7:bool; + _v_5:int; + _v_6:int; + _v_7:int; _v_8:bool; _v_9:bool; _v_10:bool; - _v_11:bool; - _v_12:bool; + _v_11:int; + _v_12:int; _v_13:bool; - _v_14:bool; - _v_15:bool; - _v_16:bool; + _v_14:int; + _v_15:int; + _v_16:int; _v_17:bool; _v_18:bool; _v_19:bool; @@ -9338,105 +9375,217 @@ var _v_29:bool; _v_30:bool; _v_31:bool; - _v_32:bool; + _v_32:int; _v_33:bool; _v_34:bool; _v_35:bool; _v_36:bool; - _v_37:bool; + _v_37:int; _v_38:bool; _v_39:bool; _v_40:bool; _v_41:bool; _v_42:bool; _v_43:bool; - _v_44:bool; - _v_45:bool; - _v_46:bool; - _v_47:bool; - _v_48:bool; - _v_49:bool; - _v_50:bool; - _v_51:bool; - _v_52:bool; - _v_53:bool; - _v_54:bool; - _v_55:bool; - _v_56:bool; - _v_57:bool; - _v_58:bool; - _v_59:bool; - _v_60:bool; - _v_61:bool; - _v_62:bool; let - r = _v_47 or _v_62; - _v_1 = not f3; - _v_2 = f2 and _v_1; - _v_3 = not f4; - _v_4 = _v_2 and _v_3; - _v_5 = not f2; - _v_6 = f3 and _v_5; - _v_7 = not f4; - _v_8 = _v_6 and _v_7; - _v_9 = _v_4 or _v_8; - _v_10 = not f2; - _v_11 = f4 and _v_10; - _v_12 = not f3; - _v_13 = _v_11 and _v_12; - _v_14 = _v_9 or _v_13; - _v_15 = f1 and _v_14; - _v_16 = not f3; - _v_17 = f1 and _v_16; - _v_18 = not f4; - _v_19 = _v_17 and _v_18; - _v_20 = not f1; - _v_21 = f3 and _v_20; - _v_22 = not f4; + debug_st = state; + ps = pre (state); + state = 1 -> _v_16; + _v_1 = ps = 1; + _v_2 = pre (reset); + _v_3 = pre (from1to2); + _v_4 = pre (from1to3); + _v_5 = if _v_4 then 3 else 1; + _v_6 = if _v_3 then 2 else _v_5; + _v_7 = if _v_2 then 1 else _v_6; + _v_8 = ps = 2; + _v_9 = pre (from2to1); + _v_10 = pre (from2to3); + _v_11 = if _v_10 then 3 else 2; + _v_12 = if _v_9 then 1 else _v_11; + _v_13 = pre (from3to1); + _v_14 = if _v_13 then 1 else 3; + _v_15 = if _v_8 then _v_12 else _v_14; + _v_16 = if _v_1 then _v_7 else _v_15; + failure = _v_19 or _v_21; + _v_17 = state = 2; + _v_18 = state = 3; + _v_19 = _v_17 or _v_18; + _v_20 = state = 1; + _v_21 = _v_20 and NLfaults; + reset = ongroundreset or _v_23; + _v_22 = not cross_failure; + _v_23 = inairreset and _v_22; + foreign_failure = _v_24 or pfother3; + _v_24 = pfother1 or pfother2; + NLfaults = choffi or local_failure; + from1to2 = will_latch and _v_26; + _v_25 = onlyroll::InNominalRange(xi); + _v_26 = not _v_25; + will_latch = cross_failure; + from1to3 = _v_27 and _v_28; + _v_27 = a and will_latch; + _v_28 = onlyroll::InNominalRange(xi); + from2to3 = a and _v_31; + _v_29 = pre (will_latch); + _v_30 = _v_29 and foreign_failure; + _v_31 = _v_30 or local_failure; + from3to1 = ongroundreset; + from2to1 = reset; + r = false -> _v_43; + _v_32 = pre (state); + _v_33 = _v_32 = 1; + _v_34 = _v_33 and cross_failure; + _v_35 = onlyroll::InNominalRange(xi); + _v_36 = _v_34 and _v_35; + _v_37 = pre (state); + _v_38 = _v_37 = 2; + _v_39 = pre (cross_failure); + _v_40 = _v_39 and foreign_failure; + _v_41 = _v_38 and _v_40; + _v_42 = _v_41 or local_failure; + _v_43 = _v_36 or _v_42; + cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, + pxother1, pxother2, pxother3); + debug_cross_failure = cross_failure; +tel +-- end of node onlyroll::FailDetect + +node onlyroll::Channel( + ongroundreset:bool; + inairreset:bool; + choffi:bool; + xai:real; + xbi:real; + disci:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + allowedi:bool) +returns ( + xi:real; + fi:bool; + aski:bool; + debug_localfailure:bool; + debug_cross_failure:bool; + debug_st:int); +var + local_failure:bool; +let + (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); + (fi, debug_cross_failure, debug_st, aski) = + onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, + pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); + debug_localfailure = local_failure; +tel +-- end of node onlyroll::Channel + +node onlyroll::Allocator( + r1:bool; + r2:bool; + r3:bool; + r4:bool; + reset:bool) +returns ( + a1:bool; + a2:bool; + a3:bool; + a4:bool); +var + nb_aut:int; + already:int; + _v_1:bool; + _v_2:int; + _v_3:bool; + _v_4:bool; + _v_5:bool; + _v_6:bool; + _v_7:bool; + _v_8:bool; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:bool; + _v_13:bool; + _v_14:bool; + _v_15:bool; + _v_16:bool; + _v_17:bool; + _v_18:bool; + _v_19:bool; + _v_20:bool; + _v_21:bool; + _v_22:bool; + _v_23:bool; + _v_24:bool; + _v_25:bool; + _v_26:bool; + _v_27:bool; + _v_28:bool; + _v_29:bool; + _v_30:bool; + _v_31:int; + _v_32:int; + _v_33:int; + _v_34:int; + _v_35:int; + _v_36:int; + _v_37:int; + _v_38:int; + _v_39:int; +let + already = if _v_1 then 0 else _v_2; + _v_1 = true -> reset; + _v_2 = pre (nb_aut); + a1 = r1 and _v_3; + _v_3 = already <= 1; + a2 = r2 and _v_9; + _v_4 = not r1; + _v_5 = already <= 1; + _v_6 = _v_4 and _v_5; + _v_7 = already = 0; + _v_8 = r1 and _v_7; + _v_9 = _v_6 or _v_8; + a3 = r3 and _v_18; + _v_10 = not r1; + _v_11 = not r2; + _v_12 = _v_10 and _v_11; + _v_13 = already <= 1; + _v_14 = _v_12 and _v_13; + _v_15 = #(r1, r2); + _v_16 = already = 0; + _v_17 = _v_15 and _v_16; + _v_18 = _v_14 or _v_17; + a4 = r4 and _v_29; + _v_19 = not r1; + _v_20 = not r2; + _v_21 = _v_19 and _v_20; + _v_22 = not r3; _v_23 = _v_21 and _v_22; - _v_24 = _v_19 or _v_23; - _v_25 = not f1; - _v_26 = f4 and _v_25; - _v_27 = not f3; + _v_24 = already <= 1; + _v_25 = _v_23 and _v_24; + _v_26 = #(r1, r2, r3); + _v_27 = already = 0; _v_28 = _v_26 and _v_27; - _v_29 = _v_24 or _v_28; - _v_30 = f2 and _v_29; - _v_31 = _v_15 or _v_30; - _v_32 = not f1; - _v_33 = f2 and _v_32; - _v_34 = not f4; - _v_35 = _v_33 and _v_34; - _v_36 = not f2; - _v_37 = f1 and _v_36; - _v_38 = not f4; - _v_39 = _v_37 and _v_38; - _v_40 = _v_35 or _v_39; - _v_41 = not f2; - _v_42 = f4 and _v_41; - _v_43 = not f1; - _v_44 = _v_42 and _v_43; - _v_45 = _v_40 or _v_44; - _v_46 = f3 and _v_45; - _v_47 = _v_31 or _v_46; - _v_48 = not f3; - _v_49 = f2 and _v_48; - _v_50 = not f1; - _v_51 = _v_49 and _v_50; - _v_52 = not f2; - _v_53 = f3 and _v_52; - _v_54 = not f1; - _v_55 = _v_53 and _v_54; - _v_56 = _v_51 or _v_55; - _v_57 = not f2; - _v_58 = f1 and _v_57; - _v_59 = not f3; - _v_60 = _v_58 and _v_59; - _v_61 = _v_56 or _v_60; - _v_62 = f4 and _v_61; + _v_29 = _v_25 or _v_28; + nb_aut = if _v_30 then 0 else _v_39; + _v_30 = true -> reset; + _v_31 = pre (nb_aut); + _v_32 = if a1 then 1 else 0; + _v_33 = _v_31 + _v_32; + _v_34 = if a2 then 1 else 0; + _v_35 = _v_33 + _v_34; + _v_36 = if a3 then 1 else 0; + _v_37 = _v_35 + _v_36; + _v_38 = if a4 then 1 else 0; + _v_39 = _v_37 + _v_38; tel --- end of node onlyroll::twooffour +-- end of node onlyroll::Allocator -node onlyroll::threeoffour( +node onlyroll::noneof( f1:bool; f2:bool; f3:bool; @@ -9448,22 +9597,249 @@ var _v_2:bool; _v_3:bool; _v_4:bool; + _v_5:bool; + _v_6:bool; let - r = onlyroll::oneoffour(_v_1, _v_2, _v_3, _v_4); + r = _v_5 and _v_6; _v_1 = not f1; _v_2 = not f2; - _v_3 = not f3; - _v_4 = not f4; -tel --- end of node onlyroll::threeoffour -node onlyroll::max2(one:real; two:real) returns (m:real); -var - _v_1:bool; -let - m = if _v_1 then one else two; - _v_1 = one > two; + _v_3 = _v_1 and _v_2; + _v_4 = not f3; + _v_5 = _v_3 and _v_4; + _v_6 = not f4; tel --- end of node onlyroll::max2 +-- end of node onlyroll::noneof + +node onlyroll::oneoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; + _v_5:bool; + _v_6:bool; + _v_7:bool; + _v_8:bool; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:bool; + _v_13:bool; + _v_14:bool; + _v_15:bool; + _v_16:bool; + _v_17:bool; + _v_18:bool; + _v_19:bool; + _v_20:bool; + _v_21:bool; + _v_22:bool; + _v_23:bool; + _v_24:bool; + _v_25:bool; + _v_26:bool; +let + r = _v_20 or _v_26; + _v_1 = not f2; + _v_2 = f1 and _v_1; + _v_3 = not f3; + _v_4 = _v_2 and _v_3; + _v_5 = not f4; + _v_6 = _v_4 and _v_5; + _v_7 = not f1; + _v_8 = f2 and _v_7; + _v_9 = not f3; + _v_10 = _v_8 and _v_9; + _v_11 = not f4; + _v_12 = _v_10 and _v_11; + _v_13 = _v_6 or _v_12; + _v_14 = not f1; + _v_15 = f3 and _v_14; + _v_16 = not f2; + _v_17 = _v_15 and _v_16; + _v_18 = not f4; + _v_19 = _v_17 and _v_18; + _v_20 = _v_13 or _v_19; + _v_21 = not f1; + _v_22 = f4 and _v_21; + _v_23 = not f2; + _v_24 = _v_22 and _v_23; + _v_25 = not f3; + _v_26 = _v_24 and _v_25; +tel +-- end of node onlyroll::oneoffour + +node onlyroll::twooffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; + _v_5:bool; + _v_6:bool; + _v_7:bool; + _v_8:bool; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:bool; + _v_13:bool; + _v_14:bool; + _v_15:bool; + _v_16:bool; + _v_17:bool; + _v_18:bool; + _v_19:bool; + _v_20:bool; + _v_21:bool; + _v_22:bool; + _v_23:bool; + _v_24:bool; + _v_25:bool; + _v_26:bool; + _v_27:bool; + _v_28:bool; + _v_29:bool; + _v_30:bool; + _v_31:bool; + _v_32:bool; + _v_33:bool; + _v_34:bool; + _v_35:bool; + _v_36:bool; + _v_37:bool; + _v_38:bool; + _v_39:bool; + _v_40:bool; + _v_41:bool; + _v_42:bool; + _v_43:bool; + _v_44:bool; + _v_45:bool; + _v_46:bool; + _v_47:bool; + _v_48:bool; + _v_49:bool; + _v_50:bool; + _v_51:bool; + _v_52:bool; + _v_53:bool; + _v_54:bool; + _v_55:bool; + _v_56:bool; + _v_57:bool; + _v_58:bool; + _v_59:bool; + _v_60:bool; + _v_61:bool; + _v_62:bool; +let + r = _v_47 or _v_62; + _v_1 = not f3; + _v_2 = f2 and _v_1; + _v_3 = not f4; + _v_4 = _v_2 and _v_3; + _v_5 = not f2; + _v_6 = f3 and _v_5; + _v_7 = not f4; + _v_8 = _v_6 and _v_7; + _v_9 = _v_4 or _v_8; + _v_10 = not f2; + _v_11 = f4 and _v_10; + _v_12 = not f3; + _v_13 = _v_11 and _v_12; + _v_14 = _v_9 or _v_13; + _v_15 = f1 and _v_14; + _v_16 = not f3; + _v_17 = f1 and _v_16; + _v_18 = not f4; + _v_19 = _v_17 and _v_18; + _v_20 = not f1; + _v_21 = f3 and _v_20; + _v_22 = not f4; + _v_23 = _v_21 and _v_22; + _v_24 = _v_19 or _v_23; + _v_25 = not f1; + _v_26 = f4 and _v_25; + _v_27 = not f3; + _v_28 = _v_26 and _v_27; + _v_29 = _v_24 or _v_28; + _v_30 = f2 and _v_29; + _v_31 = _v_15 or _v_30; + _v_32 = not f1; + _v_33 = f2 and _v_32; + _v_34 = not f4; + _v_35 = _v_33 and _v_34; + _v_36 = not f2; + _v_37 = f1 and _v_36; + _v_38 = not f4; + _v_39 = _v_37 and _v_38; + _v_40 = _v_35 or _v_39; + _v_41 = not f2; + _v_42 = f4 and _v_41; + _v_43 = not f1; + _v_44 = _v_42 and _v_43; + _v_45 = _v_40 or _v_44; + _v_46 = f3 and _v_45; + _v_47 = _v_31 or _v_46; + _v_48 = not f3; + _v_49 = f2 and _v_48; + _v_50 = not f1; + _v_51 = _v_49 and _v_50; + _v_52 = not f2; + _v_53 = f3 and _v_52; + _v_54 = not f1; + _v_55 = _v_53 and _v_54; + _v_56 = _v_51 or _v_55; + _v_57 = not f2; + _v_58 = f1 and _v_57; + _v_59 = not f3; + _v_60 = _v_58 and _v_59; + _v_61 = _v_56 or _v_60; + _v_62 = f4 and _v_61; +tel +-- end of node onlyroll::twooffour + +node onlyroll::threeoffour( + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; +let + r = onlyroll::oneoffour(_v_1, _v_2, _v_3, _v_4); + _v_1 = not f1; + _v_2 = not f2; + _v_3 = not f3; + _v_4 = not f4; +tel +-- end of node onlyroll::threeoffour +node onlyroll::max2(one:real; two:real) returns (m:real); +var + _v_1:bool; +let + m = if _v_1 then one else two; + _v_1 = one > two; +tel +-- end of node onlyroll::max2 node onlyroll::max4( one:real; @@ -9712,79 +10088,61 @@ let _v_17 = if _v_11 then _v_12 else _v_16; tel -- end of node onlyroll::Calculate -node onlyroll::abs(v:real) returns (a:real); -var - _v_1:bool; - _v_2:real; -let - a = if _v_1 then v else _v_2; - _v_1 = v >= 0.0; - _v_2 = -v; -tel --- end of node onlyroll::abs -node onlyroll::maintain(n:int; val:bool) returns (m:bool); -var - cpt:int; - _v_1:int; - _v_2:int; - _v_3:int; - _v_4:int; -let - cpt = _v_1 -> _v_4; - _v_1 = if val then 1 else 0; - _v_2 = pre (cpt); - _v_3 = _v_2 + 1; - _v_4 = if val then _v_3 else 0; - m = cpt >= n; -tel --- end of node onlyroll::maintain - -node onlyroll::Monitor( - xa:real; - xb:real; - disc:bool) -returns ( - local_value:real; - inline_monitor_failed:bool); -var - _v_1:real; - _v_2:real; - _v_3:bool; - _v_4:bool; -let - inline_monitor_failed = _v_4 or disc; - _v_1 = xa - xb; - _v_2 = onlyroll::abs(_v_1); - _v_3 = _v_2 > 14.9; - _v_4 = onlyroll::maintain(3, _v_3); - local_value = xa; -tel --- end of node onlyroll::Monitor -node onlyroll::InNominalRange(r:real) returns (i:bool); -var - _v_1:bool; - _v_2:bool; -let - i = _v_1 and _v_2; - _v_1 = r < 25.3; - _v_2 = r > -25.3; -tel --- end of node onlyroll::InNominalRange -node onlyroll::values_nok( - pfother1:bool; - pfother2:bool; - pfother3:bool; - xi:real; - pxother1:real; - pxother2:real; - pxother3:real) +node onlyroll::onlyroll( + xa1:real; + xb1:real; + xa2:real; + xb2:real; + xa3:real; + xb3:real; + xa4:real; + xb4:real; + ongroundreset:bool; + inairreset:bool; + disc1:bool; + disc2:bool; + disc3:bool; + disc4:bool; + choff1:bool; + choff2:bool; + choff3:bool; + choff4:bool) returns ( - r:bool); + x:real; + debug_localfailure1:bool; + debug_localfailure2:bool; + debug_localfailure3:bool; + debug_localfailure4:bool; + debug_cross_failure1:bool; + debug_cross_failure2:bool; + debug_cross_failure3:bool; + debug_cross_failure4:bool; + debug_ch_failed1:bool; + debug_ch_failed2:bool; + debug_ch_failed3:bool; + debug_ch_failed4:bool; + debug_st1:int; + debug_st2:int; + debug_st3:int; + debug_st4:int); var - one:bool; - two:bool; - three:bool; + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool; + ask1:bool; + ask2:bool; + ask3:bool; + ask4:bool; + allowed1:bool; + allowed2:bool; + allowed3:bool; + allowed4:bool; _v_1:real; _v_2:real; _v_3:real; @@ -9797,496 +10155,193 @@ var _v_10:bool; _v_11:bool; _v_12:bool; - _v_13:bool; - _v_14:bool; - _v_15:bool; - _v_16:bool; - _v_17:bool; - _v_18:bool; -let - one = _v_2 > 51.0; - _v_1 = xi - pxother1; - _v_2 = onlyroll::abs(_v_1); - two = _v_4 > 51.0; - _v_3 = xi - pxother2; - _v_4 = onlyroll::abs(_v_3); - three = _v_6 > 51.0; - _v_5 = xi - pxother3; - _v_6 = onlyroll::abs(_v_5); - r = onlyroll::maintain(3, _v_18); - _v_7 = if pfother3 then false else three; - _v_8 = two and three; - _v_9 = if pfother3 then two else _v_8; - _v_10 = if pfother2 then _v_7 else _v_9; - _v_11 = one and three; - _v_12 = if pfother3 then one else _v_11; - _v_13 = one and two; - _v_14 = one and two; - _v_15 = _v_14 and three; - _v_16 = if pfother3 then _v_13 else _v_15; - _v_17 = if pfother2 then _v_12 else _v_16; - _v_18 = if pfother1 then _v_10 else _v_17; -tel --- end of node onlyroll::values_nok - -node onlyroll::FailDetect( - local_failure:bool; - xi:real; - ongroundreset:bool; - inairreset:bool; - choffi:bool; - pxother1:real; - pxother2:real; - pxother3:real; - pfother1:bool; - pfother2:bool; - pfother3:bool; - a:bool) -returns ( - failure:bool; - debug_cross_failure:bool; - debug_st:int; - r:bool); -var - cross_failure:bool; - ps:int; - state:int; - from1to2:bool; - from1to3:bool; - from2to3:bool; - from2to1:bool; - from3to1:bool; - NLfaults:bool; - will_latch:bool; - reset:bool; - foreign_failure:bool; - _v_1:bool; - _v_2:bool; - _v_3:bool; - _v_4:bool; - _v_5:int; - _v_6:int; - _v_7:int; - _v_8:bool; - _v_9:bool; - _v_10:bool; - _v_11:int; - _v_12:int; - _v_13:bool; - _v_14:int; - _v_15:int; - _v_16:int; - _v_17:bool; - _v_18:bool; + _v_13:real; + _v_14:real; + _v_15:real; + _v_16:real; + _v_17:real; + _v_18:real; _v_19:bool; _v_20:bool; _v_21:bool; _v_22:bool; _v_23:bool; _v_24:bool; - _v_25:bool; - _v_26:bool; - _v_27:bool; - _v_28:bool; - _v_29:bool; - _v_30:bool; + _v_25:real; + _v_26:real; + _v_27:real; + _v_28:real; + _v_29:real; + _v_30:real; _v_31:bool; - _v_32:int; + _v_32:bool; _v_33:bool; _v_34:bool; _v_35:bool; _v_36:bool; - _v_37:int; - _v_38:bool; - _v_39:bool; - _v_40:bool; - _v_41:bool; - _v_42:bool; + _v_37:real; + _v_38:real; + _v_39:real; + _v_40:real; + _v_41:real; + _v_42:real; _v_43:bool; + _v_44:bool; + _v_45:bool; + _v_46:bool; + _v_47:bool; + _v_48:bool; let - debug_st = state; - ps = pre (state); - state = 1 -> _v_16; - _v_1 = ps = 1; - _v_2 = pre (reset); - _v_3 = pre (from1to2); - _v_4 = pre (from1to3); - _v_5 = if _v_4 then 3 else 1; - _v_6 = if _v_3 then 2 else _v_5; - _v_7 = if _v_2 then 1 else _v_6; - _v_8 = ps = 2; - _v_9 = pre (from2to1); - _v_10 = pre (from2to3); - _v_11 = if _v_10 then 3 else 2; - _v_12 = if _v_9 then 1 else _v_11; - _v_13 = pre (from3to1); - _v_14 = if _v_13 then 1 else 3; - _v_15 = if _v_8 then _v_12 else _v_14; - _v_16 = if _v_1 then _v_7 else _v_15; - failure = _v_19 or _v_21; - _v_17 = state = 2; - _v_18 = state = 3; - _v_19 = _v_17 or _v_18; - _v_20 = state = 1; - _v_21 = _v_20 and NLfaults; - reset = ongroundreset or _v_23; - _v_22 = not cross_failure; - _v_23 = inairreset and _v_22; - foreign_failure = _v_24 or pfother3; - _v_24 = pfother1 or pfother2; - NLfaults = choffi or local_failure; - from1to2 = will_latch and _v_26; - _v_25 = onlyroll::InNominalRange(xi); - _v_26 = not _v_25; - will_latch = cross_failure; - from1to3 = _v_27 and _v_28; - _v_27 = a and will_latch; - _v_28 = onlyroll::InNominalRange(xi); - from2to3 = a and _v_31; - _v_29 = pre (will_latch); - _v_30 = _v_29 and foreign_failure; - _v_31 = _v_30 or local_failure; - from3to1 = ongroundreset; - from2to1 = reset; - r = false -> _v_43; - _v_32 = pre (state); - _v_33 = _v_32 = 1; - _v_34 = _v_33 and cross_failure; - _v_35 = onlyroll::InNominalRange(xi); - _v_36 = _v_34 and _v_35; - _v_37 = pre (state); - _v_38 = _v_37 = 2; - _v_39 = pre (cross_failure); - _v_40 = _v_39 and foreign_failure; - _v_41 = _v_38 and _v_40; - _v_42 = _v_41 or local_failure; - _v_43 = _v_36 or _v_42; - cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, - pxother1, pxother2, pxother3); - debug_cross_failure = cross_failure; + debug_ch_failed1 = f1; + debug_ch_failed2 = f2; + debug_ch_failed3 = f3; + debug_ch_failed4 = f4; + (x1, f1, ask1, debug_localfailure1, debug_cross_failure1, debug_st1) = + onlyroll::Channel(ongroundreset, inairreset, choff1, xa1, xb1, disc1, _v_2, + _v_4, _v_6, _v_8, _v_10, _v_12, allowed1); + _v_1 = pre (x2); + _v_2 = 0.0 -> _v_1; + _v_3 = pre (x3); + _v_4 = 0.0 -> _v_3; + _v_5 = pre (x4); + _v_6 = 0.0 -> _v_5; + _v_7 = pre (f2); + _v_8 = false -> _v_7; + _v_9 = pre (f3); + _v_10 = false -> _v_9; + _v_11 = pre (f4); + _v_12 = false -> _v_11; + (x2, f2, ask2, debug_localfailure2, debug_cross_failure2, debug_st2) = + onlyroll::Channel(ongroundreset, inairreset, choff2, xa2, xb2, disc2, + _v_14, _v_16, _v_18, _v_20, _v_22, _v_24, allowed2); + _v_13 = pre (x1); + _v_14 = 0.0 -> _v_13; + _v_15 = pre (x3); + _v_16 = 0.0 -> _v_15; + _v_17 = pre (x4); + _v_18 = 0.0 -> _v_17; + _v_19 = pre (f1); + _v_20 = false -> _v_19; + _v_21 = pre (f3); + _v_22 = false -> _v_21; + _v_23 = pre (f4); + _v_24 = false -> _v_23; + (x3, f3, ask3, debug_localfailure3, debug_cross_failure3, debug_st3) = + onlyroll::Channel(ongroundreset, inairreset, choff3, xa3, xb3, disc3, + _v_26, _v_28, _v_30, _v_32, _v_34, _v_36, allowed3); + _v_25 = pre (x1); + _v_26 = 0.0 -> _v_25; + _v_27 = pre (x2); + _v_28 = 0.0 -> _v_27; + _v_29 = pre (x4); + _v_30 = 0.0 -> _v_29; + _v_31 = pre (f1); + _v_32 = false -> _v_31; + _v_33 = pre (f2); + _v_34 = false -> _v_33; + _v_35 = pre (f4); + _v_36 = false -> _v_35; + (x4, f4, ask4, debug_localfailure4, debug_cross_failure4, debug_st4) = + onlyroll::Channel(ongroundreset, inairreset, choff4, xa4, xb4, disc4, + _v_38, _v_40, _v_42, _v_44, _v_46, _v_48, allowed4); + _v_37 = pre (x1); + _v_38 = 0.0 -> _v_37; + _v_39 = pre (x2); + _v_40 = 0.0 -> _v_39; + _v_41 = pre (x3); + _v_42 = 0.0 -> _v_41; + _v_43 = pre (f1); + _v_44 = false -> _v_43; + _v_45 = pre (f2); + _v_46 = false -> _v_45; + _v_47 = pre (f3); + _v_48 = false -> _v_47; + (allowed1, allowed2, allowed3, allowed4) = onlyroll::Allocator(ask1, ask2, + ask3, ask4, ongroundreset); + x = onlyroll::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); tel --- end of node onlyroll::FailDetect +-- end of node onlyroll::onlyroll +node onlyroll::InHardoverRange(r:real) returns (i:bool); +var + _v_1:bool; + _v_2:bool; +let + i = _v_1 or _v_2; + _v_1 = r > 285.0; + _v_2 = r < -285.0; +tel +-- end of node onlyroll::InHardoverRange -node onlyroll::Channel( - ongroundreset:bool; - inairreset:bool; - choffi:bool; - xai:real; - xbi:real; - disci:bool; - pxother1:real; - pxother2:real; - pxother3:real; - pfother1:bool; - pfother2:bool; - pfother3:bool; - allowedi:bool) -returns ( - xi:real; - fi:bool; - aski:bool; - debug_localfailure:bool; - debug_cross_failure:bool; - debug_st:int); +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus +-- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus + +type _preal::t = real; +node preal::fby1(init:real; fb:real) returns (next:real); var - local_failure:bool; + _v_1:real; let - (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); - (fi, debug_cross_failure, debug_st, aski) = - onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, - pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); - debug_localfailure = local_failure; + next = init -> _v_1; + _v_1 = pre (fb); tel --- end of node onlyroll::Channel +-- end of node preal::fby1 +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; +type _pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); +var + _v_1:int; +let + next = init -> _v_1; + _v_1 = pre (fb); +tel +-- end of node pint::fby1 +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +var + _v_1:bool; +let + next = init -> _v_1; + _v_1 = pre (fb); +tel +-- end of node pbool::fby1 -node onlyroll::Allocator( - r1:bool; - r2:bool; - r3:bool; - r4:bool; - reset:bool) +node inter::preced( + in:_inter::selType) returns ( - a1:bool; - a2:bool; - a3:bool; - a4:bool); + out:_inter::selType; + out2:_inter::selType); var - nb_aut:int; - already:int; - _v_1:bool; + _v_1:int; _v_2:int; _v_3:bool; _v_4:bool; - _v_5:bool; - _v_6:bool; - _v_7:bool; - _v_8:bool; - _v_9:bool; - _v_10:bool; - _v_11:bool; - _v_12:bool; - _v_13:bool; - _v_14:bool; - _v_15:bool; - _v_16:bool; - _v_17:bool; - _v_18:bool; - _v_19:bool; - _v_20:bool; - _v_21:bool; - _v_22:bool; - _v_23:bool; - _v_24:bool; - _v_25:bool; - _v_26:bool; - _v_27:bool; - _v_28:bool; - _v_29:bool; - _v_30:bool; - _v_31:int; - _v_32:int; - _v_33:int; - _v_34:int; - _v_35:int; - _v_36:int; - _v_37:int; - _v_38:int; - _v_39:int; + _v_5:real; + _v_6:real; let - already = if _v_1 then 0 else _v_2; - _v_1 = true -> reset; - _v_2 = pre (nb_aut); - a1 = r1 and _v_3; - _v_3 = already <= 1; - a2 = r2 and _v_9; - _v_4 = not r1; - _v_5 = already <= 1; - _v_6 = _v_4 and _v_5; - _v_7 = already = 0; - _v_8 = r1 and _v_7; - _v_9 = _v_6 or _v_8; - a3 = r3 and _v_18; - _v_10 = not r1; - _v_11 = not r2; - _v_12 = _v_10 and _v_11; - _v_13 = already <= 1; - _v_14 = _v_12 and _v_13; - _v_15 = #(r1, r2); - _v_16 = already = 0; - _v_17 = _v_15 and _v_16; - _v_18 = _v_14 or _v_17; - a4 = r4 and _v_29; - _v_19 = not r1; - _v_20 = not r2; - _v_21 = _v_19 and _v_20; - _v_22 = not r3; - _v_23 = _v_21 and _v_22; - _v_24 = already <= 1; - _v_25 = _v_23 and _v_24; - _v_26 = #(r1, r2, r3); - _v_27 = already = 0; - _v_28 = _v_26 and _v_27; - _v_29 = _v_25 or _v_28; - nb_aut = if _v_30 then 0 else _v_39; - _v_30 = true -> reset; - _v_31 = pre (nb_aut); - _v_32 = if a1 then 1 else 0; - _v_33 = _v_31 + _v_32; - _v_34 = if a2 then 1 else 0; - _v_35 = _v_33 + _v_34; - _v_36 = if a3 then 1 else 0; - _v_37 = _v_35 + _v_36; - _v_38 = if a4 then 1 else 0; - _v_39 = _v_37 + _v_38; -tel --- end of node onlyroll::Allocator - -node onlyroll::onlyroll( - xa1:real; - xb1:real; - xa2:real; - xb2:real; - xa3:real; - xb3:real; - xa4:real; - xb4:real; - ongroundreset:bool; - inairreset:bool; - disc1:bool; - disc2:bool; - disc3:bool; - disc4:bool; - choff1:bool; - choff2:bool; - choff3:bool; - choff4:bool) -returns ( - x:real; - debug_localfailure1:bool; - debug_localfailure2:bool; - debug_localfailure3:bool; - debug_localfailure4:bool; - debug_cross_failure1:bool; - debug_cross_failure2:bool; - debug_cross_failure3:bool; - debug_cross_failure4:bool; - debug_ch_failed1:bool; - debug_ch_failed2:bool; - debug_ch_failed3:bool; - debug_ch_failed4:bool; - debug_st1:int; - debug_st2:int; - debug_st3:int; - debug_st4:int); -var - x1:real; - x2:real; - x3:real; - x4:real; - f1:bool; - f2:bool; - f3:bool; - f4:bool; - ask1:bool; - ask2:bool; - ask3:bool; - ask4:bool; - allowed1:bool; - allowed2:bool; - allowed3:bool; - allowed4:bool; - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:bool; - _v_8:bool; - _v_9:bool; - _v_10:bool; - _v_11:bool; - _v_12:bool; - _v_13:real; - _v_14:real; - _v_15:real; - _v_16:real; - _v_17:real; - _v_18:real; - _v_19:bool; - _v_20:bool; - _v_21:bool; - _v_22:bool; - _v_23:bool; - _v_24:bool; - _v_25:real; - _v_26:real; - _v_27:real; - _v_28:real; - _v_29:real; - _v_30:real; - _v_31:bool; - _v_32:bool; - _v_33:bool; - _v_34:bool; - _v_35:bool; - _v_36:bool; - _v_37:real; - _v_38:real; - _v_39:real; - _v_40:real; - _v_41:real; - _v_42:real; - _v_43:bool; - _v_44:bool; - _v_45:bool; - _v_46:bool; - _v_47:bool; - _v_48:bool; -let - debug_ch_failed1 = f1; - debug_ch_failed2 = f2; - debug_ch_failed3 = f3; - debug_ch_failed4 = f4; - (x1, f1, ask1, debug_localfailure1, debug_cross_failure1, debug_st1) = - onlyroll::Channel(ongroundreset, inairreset, choff1, xa1, xb1, disc1, _v_2, - _v_4, _v_6, _v_8, _v_10, _v_12, allowed1); - _v_1 = pre (x2); - _v_2 = 0.0 -> _v_1; - _v_3 = pre (x3); - _v_4 = 0.0 -> _v_3; - _v_5 = pre (x4); - _v_6 = 0.0 -> _v_5; - _v_7 = pre (f2); - _v_8 = false -> _v_7; - _v_9 = pre (f3); - _v_10 = false -> _v_9; - _v_11 = pre (f4); - _v_12 = false -> _v_11; - (x2, f2, ask2, debug_localfailure2, debug_cross_failure2, debug_st2) = - onlyroll::Channel(ongroundreset, inairreset, choff2, xa2, xb2, disc2, - _v_14, _v_16, _v_18, _v_20, _v_22, _v_24, allowed2); - _v_13 = pre (x1); - _v_14 = 0.0 -> _v_13; - _v_15 = pre (x3); - _v_16 = 0.0 -> _v_15; - _v_17 = pre (x4); - _v_18 = 0.0 -> _v_17; - _v_19 = pre (f1); - _v_20 = false -> _v_19; - _v_21 = pre (f3); - _v_22 = false -> _v_21; - _v_23 = pre (f4); - _v_24 = false -> _v_23; - (x3, f3, ask3, debug_localfailure3, debug_cross_failure3, debug_st3) = - onlyroll::Channel(ongroundreset, inairreset, choff3, xa3, xb3, disc3, - _v_26, _v_28, _v_30, _v_32, _v_34, _v_36, allowed3); - _v_25 = pre (x1); - _v_26 = 0.0 -> _v_25; - _v_27 = pre (x2); - _v_28 = 0.0 -> _v_27; - _v_29 = pre (x4); - _v_30 = 0.0 -> _v_29; - _v_31 = pre (f1); - _v_32 = false -> _v_31; - _v_33 = pre (f2); - _v_34 = false -> _v_33; - _v_35 = pre (f4); - _v_36 = false -> _v_35; - (x4, f4, ask4, debug_localfailure4, debug_cross_failure4, debug_st4) = - onlyroll::Channel(ongroundreset, inairreset, choff4, xa4, xb4, disc4, - _v_38, _v_40, _v_42, _v_44, _v_46, _v_48, allowed4); - _v_37 = pre (x1); - _v_38 = 0.0 -> _v_37; - _v_39 = pre (x2); - _v_40 = 0.0 -> _v_39; - _v_41 = pre (x3); - _v_42 = 0.0 -> _v_41; - _v_43 = pre (f1); - _v_44 = false -> _v_43; - _v_45 = pre (f2); - _v_46 = false -> _v_45; - _v_47 = pre (f3); - _v_48 = false -> _v_47; - (allowed1, allowed2, allowed3, allowed4) = onlyroll::Allocator(ask1, ask2, - ask3, ask4, ongroundreset); - x = onlyroll::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); + out2 = _inter::selType{i=0;b=true;r=0.0}; + out.i = pint::fby1(_v_1, _v_2); + _v_1 = out2.i; + _v_2 = in.i; + out.b = pbool::fby1(_v_3, _v_4); + _v_3 = out2.b; + _v_4 = in.b; + out.r = preal::fby1(_v_5, _v_6); + _v_5 = out2.r; + _v_6 = in.r; tel --- end of node onlyroll::onlyroll -node onlyroll::InHardoverRange(r:real) returns (i:bool); +-- end of node inter::preced +node mainPack::preced(in:_inter::selType) returns (out:_inter::selType); var - _v_1:bool; - _v_2:bool; + out2:_inter::selType; let - i = _v_1 or _v_2; - _v_1 = r > 285.0; - _v_2 = r < -285.0; + (out, out2) = inter::preced(in); tel --- end of node onlyroll::InHardoverRange +-- end of node mainPack::preced ---------------------------------------------------------------------- -====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus --- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/p.lus +====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus +-- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus type _preal::t = real; node preal::fby1(init:real; fb:real) returns (next:real); @@ -10297,25 +10352,27 @@ let _v_1 = pre (fb); tel -- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); +type _inter::toto = enum {inter::X, inter::Y}; +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; +type _pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); var - _v_1:bool; + _v_1:int; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pbool::fby1 -type _pint::t = int; -node pint::fby1(init:int; fb:int) returns (next:int); +-- end of node pint::fby1 +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); var - _v_1:int; + _v_1:bool; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pint::fby1 -type _inter::selType = struct {i : int; b : bool; r : real}; +-- end of node pbool::fby1 node inter::preced( in:_inter::selType) @@ -10342,6 +10399,10 @@ let _v_6 = in.r; tel -- end of node inter::preced +type _mainPack::couleurs = enum {mainPack::bleu, mainPack::rose, mainPack::jaune}; +const mainPack::N = 8; +type _mainPack::T = int^8; +const mainPack::X = 8; node mainPack::preced(in:_inter::selType) returns (out:_inter::selType); var out2:_inter::selType; @@ -10349,104 +10410,31 @@ let (out, out2) = inter::preced(in); tel -- end of node mainPack::preced -const inter::n = -4; ---------------------------------------------------------------------- -====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus --- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/packs.lus +====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/pfs.lus +*** Error in file "pfs.lus", line 43, col 22 to 22, token '[': +*** syntax error -type _preal::t = real; -node preal::fby1(init:real; fb:real) returns (next:real); + +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus +-- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus + +type _struct::complex = struct {re : real = 0.; im : real = 0.}; + +node struct::plus( + a:_struct::complex; + b:_struct::complex) +returns ( + c:_struct::complex); var + _v_4:real; + _v_5:real; + _v_6:real; _v_1:real; -let - next = init -> _v_1; - _v_1 = pre (fb); -tel --- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); -var - _v_1:bool; -let - next = init -> _v_1; - _v_1 = pre (fb); -tel --- end of node pbool::fby1 -type _pint::t = int; -node pint::fby1(init:int; fb:int) returns (next:int); -var - _v_1:int; -let - next = init -> _v_1; - _v_1 = pre (fb); -tel --- end of node pint::fby1 -const inter::n = -4; -const mainPack::N = 8; -type _mainPack::T = int^8; -type _mainPack::couleurs = enum {mainPack::bleu, mainPack::rose, mainPack::jaune}; -const mainPack::X = 8; -type _inter::selType = struct {i : int; b : bool; r : real}; - -node inter::preced( - in:_inter::selType) -returns ( - out:_inter::selType; - out2:_inter::selType); -var - _v_1:int; - _v_2:int; - _v_3:bool; - _v_4:bool; - _v_5:real; - _v_6:real; -let - out2 = _inter::selType{i=0;b=true;r=0.0}; - out.i = pint::fby1(_v_1, _v_2); - _v_1 = out2.i; - _v_2 = in.i; - out.b = pbool::fby1(_v_3, _v_4); - _v_3 = out2.b; - _v_4 = in.b; - out.r = preal::fby1(_v_5, _v_6); - _v_5 = out2.r; - _v_6 = in.r; -tel --- end of node inter::preced -node mainPack::preced(in:_inter::selType) returns (out:_inter::selType); -var - out2:_inter::selType; -let - (out, out2) = inter::preced(in); -tel --- end of node mainPack::preced -type _inter::toto = enum {inter::X, inter::Y}; - ----------------------------------------------------------------------- -====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/pfs.lus -*** Error in file "pfs.lus", line 43, col 22 to 22, token '[': -*** syntax error - - ----------------------------------------------------------------------- -====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus --- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/struct.lus - -type _struct::complex = struct {re : real = 0.; im : real = 0.}; - -node struct::plus( - a:_struct::complex; - b:_struct::complex) -returns ( - c:_struct::complex); -var - _v_4:real; - _v_5:real; - _v_6:real; - _v_1:real; - _v_2:real; - _v_3:real; + _v_2:real; + _v_3:real; let c = _struct::complex{re=_v_3;im=_v_6}; _v_4 = a.im; @@ -10496,14 +10484,6 @@ type A_int_2 = int^2; ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/t0.lus -- ../lus2lic -vl 2 --nonreg-test should_work/Pascal/t0.lus -node min_n_1(T:A_int_1) returns (mn:int); -var - _v_1:int; -let - mn = _v_1; - _v_1 = T[0]; -tel --- end of node min_n_1 node t0::min(x:int; y:int) returns (mn:int); var _v_1:bool; @@ -10512,6 +10492,14 @@ let _v_1 = x <= y; tel -- end of node t0::min +node min_n_1(T:A_int_1) returns (mn:int); +var + _v_1:int; +let + mn = _v_1; + _v_1 = T[0]; +tel +-- end of node min_n_1 node min_n_2(T:A_int_2) returns (mn:int); var _v_1:int; @@ -10566,10 +10554,10 @@ tel -- end of node t0::t0 extern function t0::max(x:int; y:int) returns (mx:int); -- automatically defined aliases: -type A_int_2 = int^2; -type A_int_3 = int^3; type A_int_4 = int^4; type A_int_1 = int^1; +type A_int_3 = int^3; +type A_int_2 = int^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/Pascal/t1.lus @@ -10631,9 +10619,9 @@ let tel -- end of node t1::consensus4 -- automatically defined aliases: -type A_bool_3 = bool^3; -type A_bool_4 = bool^4; type A_bool_1 = bool^1; +type A_bool_4 = bool^4; +type A_bool_3 = bool^3; type A_bool_2 = bool^2; ---------------------------------------------------------------------- @@ -10731,11 +10719,11 @@ let tel -- end of node t2::consensus_6_bis -- automatically defined aliases: +type A_bool_5 = bool^5; +type A_bool_1 = bool^1; +type A_bool_4 = bool^4; type A_bool_6 = bool^6; type A_bool_3 = bool^3; -type A_bool_4 = bool^4; -type A_bool_1 = bool^1; -type A_bool_5 = bool^5; type A_bool_2 = bool^2; ---------------------------------------------------------------------- @@ -10805,6 +10793,7 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/call/call03.lus -- ../lus2lic -vl 2 --nonreg-test should_work/call/call03.lus +extern function call03::momo(x:bool; y:bool) returns (z:bool); node call03::tutu(i1:A_bool_2; i2:A_bool_2) returns (o:A_bool_2); let o = Lustre::map<<Lustre::or, 2>>(i1, i2); @@ -10815,7 +10804,6 @@ let z = call03::tutu(x, y); tel -- end of node call03::call03 -extern function call03::momo(x:bool; y:bool) returns (z:bool); -- automatically defined aliases: type A_bool_2 = bool^2; @@ -10979,7 +10967,6 @@ tel -- ../lus2lic -vl 2 --nonreg-test should_work/clock/when_enum.lus type _when_enum::t = enum {when_enum::A, when_enum::B, when_enum::C}; -extern node when_enum::tutu(u:_when_enum::t) returns (x:bool); extern node when_enum::toto(u:bool; v:bool) returns (x:bool; y:bool); node when_enum::clock( @@ -11000,12 +10987,12 @@ let _v_2 = c when when_enum::A(a); tel -- end of node when_enum::clock +extern node when_enum::tutu(u:_when_enum::t) returns (x:bool); ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/clock/when_node.lus -- ../lus2lic -vl 2 --nonreg-test should_work/clock/when_node.lus -extern node when_node::tutu(u:bool) returns (x:bool); extern node when_node::toto(u:bool; v:bool) returns (x:bool; y:bool); node when_node::clock( @@ -11032,6 +11019,7 @@ let _v_6 = current (_v_4); tel -- end of node when_node::clock +extern node when_node::tutu(u:bool) returns (x:bool); ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/clock/when_not.lus @@ -11054,6 +11042,7 @@ returns ( ====> ../lus2lic -vl 2 --nonreg-test should_work/clock/when_tuple.lus -- ../lus2lic -vl 2 --nonreg-test should_work/clock/when_tuple.lus +extern node when_tuple::toto(u:bool; v:bool) returns (x:bool; y:bool); node when_tuple::titi( x:int; @@ -11068,7 +11057,6 @@ let c = x when clk; tel -- end of node when_tuple::titi -extern node when_tuple::toto(u:bool; v:bool) returns (x:bool; y:bool); node when_tuple::clock( a:bool; @@ -11093,19 +11081,19 @@ tel type _Gyroscope2::Valid_ChannelT = struct {local_failure : bool; local_value : real}; type _Gyroscope2::CFF_Eltstruct = struct {indx : int; indx_toChange : int; value : _Gyroscope2::Valid_ChannelT}; +type _Gyroscope2::CFF_struct = struct {indx : int; indx_toChange : int; tabToFill : A__Gyroscope2::Valid_ChannelT_3}; type _Gyroscope2::Faulty_ChannelT = struct {valuea : real; valueb : real}; type _Gyroscope2::Faulty_Array = A__Gyroscope2::Faulty_ChannelT_4^3; -type _Gyroscope2::CFF_struct = struct {indx : int; indx_toChange : int; tabToFill : A__Gyroscope2::Valid_ChannelT_3}; const Gyroscope2::DELTA_PITCH = 2.0; +const Gyroscope2::DELTA_TO_GOD_PITCH = 2.0; +const Gyroscope2::DELTA_TO_GOD_ROLL = 2.0; const Gyroscope2::DELTA_YAW = 2.0; -const Gyroscope2::DELTA_TO_GOD_YAW = 2.0; -const Gyroscope2::DELTA_ROLL = 2.0; -const Gyroscope2::CROSS_CHANNEL_TOLERANCE = 1.0; -const Gyroscope2::GOD_PITCH = 16.0; const Gyroscope2::GOD_ROLL = 15.0; const Gyroscope2::GOD_YAW = 14.0; -const Gyroscope2::DELTA_TO_GOD_ROLL = 2.0; -const Gyroscope2::DELTA_TO_GOD_PITCH = 2.0; +const Gyroscope2::GOD_PITCH = 16.0; +const Gyroscope2::DELTA_ROLL = 2.0; +const Gyroscope2::CROSS_CHANNEL_TOLERANCE = 1.0; +const Gyroscope2::DELTA_TO_GOD_YAW = 2.0; node Gyroscope2::abs(in:real) returns (out:real); var _v_1:bool; @@ -11117,237 +11105,92 @@ let tel -- end of node Gyroscope2::abs -node Gyroscope2::ValueIsSecureII( - accu_in:bool; - secure_value:real; - delta_to_god_value:real; - god_value:real) +node Gyroscope2::addOneChannelIter( + acc_in:_Gyroscope2::CFF_Eltstruct; + elt_in:_Gyroscope2::Valid_ChannelT) returns ( - is_valid:bool); + acc_out:_Gyroscope2::CFF_Eltstruct; + elt_out:_Gyroscope2::Valid_ChannelT); var - _v_1:real; - _v_2:real; - _v_3:bool; + _v_4:_Gyroscope2::Valid_ChannelT; + _v_3:int; + _v_1:int; + _v_2:int; + _v_5:int; + _v_6:int; + _v_7:bool; + _v_8:_Gyroscope2::Valid_ChannelT; let - is_valid = _v_3 and accu_in; - _v_1 = secure_value - god_value; - _v_2 = Gyroscope2::abs(_v_1); - _v_3 = _v_2 < 2.0; + acc_out = + _Gyroscope2::CFF_Eltstruct{indx=_v_2;indx_toChange=_v_3;value=_v_4}; + _v_4 = acc_in.value; + _v_3 = acc_in.indx_toChange; + _v_1 = acc_in.indx; + _v_2 = _v_1 + 1; + elt_out = if _v_7 then _v_8 else elt_in; + _v_5 = acc_in.indx; + _v_6 = acc_in.indx_toChange; + _v_7 = _v_5 = _v_6; + _v_8 = acc_in.value; tel --- end of node Gyroscope2::ValueIsSecureII +-- end of node Gyroscope2::addOneChannelIter -node Gyroscope2::countFalse( - accu_in:real; - elt_in:_Gyroscope2::Valid_ChannelT) +node Gyroscope2::addOneChannel( + indx_toChange:int; + channeltToAdd:_Gyroscope2::Valid_ChannelT; + tabToFill:A__Gyroscope2::Valid_ChannelT_3) returns ( - accu_out:real); + tabToFillAfter:A__Gyroscope2::Valid_ChannelT_3); var - _v_1:bool; - _v_2:real; + acc_out:_Gyroscope2::CFF_Eltstruct; + _v_1:_Gyroscope2::CFF_Eltstruct; let - accu_out = if _v_1 then accu_in else _v_2; - _v_1 = elt_in.local_failure; - _v_2 = accu_in + 1.0; + (acc_out, tabToFillAfter) = fillred<<Gyroscope2::addOneChannelIter, + 3>>(_v_1, tabToFill); + _v_1 = + _Gyroscope2::CFF_Eltstruct{indx=0;indx_toChange=indx_toChange;value=channeltToAdd}; tel --- end of node Gyroscope2::countFalse +-- end of node Gyroscope2::addOneChannel -node Gyroscope2::TooFar( - nbToFarIn:int; - channel:_Gyroscope2::Faulty_ChannelT; - god:real; - delta_to_god:real) +node Gyroscope2::CFC_iter( + structIn:_Gyroscope2::CFF_struct; + currentChannel:_Gyroscope2::Valid_ChannelT) returns ( - nbToFarOut:int); + structOut:_Gyroscope2::CFF_struct); var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:bool; + _v_4:int; _v_5:int; + _v_6:bool; + _v_7:A__Gyroscope2::Valid_ChannelT_3; + _v_8:int; + _v_9:A__Gyroscope2::Valid_ChannelT_3; + _v_10:A__Gyroscope2::Valid_ChannelT_3; + _v_11:A__Gyroscope2::Valid_ChannelT_3; + _v_3:int; + _v_1:int; + _v_2:int; let - nbToFarOut = if _v_4 then _v_5 else nbToFarIn; - _v_1 = channel.valuea; - _v_2 = _v_1 - god; - _v_3 = Gyroscope2::abs(_v_2); - _v_4 = _v_3 < delta_to_god; - _v_5 = nbToFarIn + 1; + structOut = + _Gyroscope2::CFF_struct{indx=_v_2;indx_toChange=_v_3;tabToFill=_v_11}; + _v_4 = structIn.indx_toChange; + _v_5 = structIn.indx; + _v_6 = _v_4 = _v_5; + _v_7 = structIn.tabToFill; + _v_8 = structIn.indx; + _v_9 = structIn.tabToFill; + _v_10 = Gyroscope2::addOneChannel(_v_8, currentChannel, _v_9); + _v_11 = if _v_6 then _v_7 else _v_10; + _v_3 = structIn.indx_toChange; + _v_1 = structIn.indx; + _v_2 = _v_1 + 1; tel --- end of node Gyroscope2::TooFar +-- end of node Gyroscope2::CFC_iter -node Gyroscope2::assumeEvaluateAxis( - channels:A__Gyroscope2::Faulty_ChannelT_4; - delta:real; - god:real; - delta_to_god:real) +node Gyroscope2::ComputeForeignChannels( + currentChannelIndx:int; + allChannels:A__Gyroscope2::Valid_ChannelT_4) returns ( - assumeOK:bool); -var - NbToFar:int; - _v_1:A_real_4; - _v_2:A_real_4; -let - NbToFar = red<<Gyroscope2::TooFar, 4>>(0, channels, _v_1, _v_2); - _v_1 = god^4; - _v_2 = delta_to_god^4; - assumeOK = NbToFar <= 1; -tel --- end of node Gyroscope2::assumeEvaluateAxis - -node Gyroscope2::assumeChannel( - previousOutChannel:A__Gyroscope2::Valid_ChannelT_4; - nbInChannel:int; - inChannel:_Gyroscope2::Faulty_ChannelT; - delta:real; - god:real; - delta_to_god:real) -returns ( - assumeOK:bool); -let - assumeOK = true; -tel --- end of node Gyroscope2::assumeChannel - -node Gyroscope2::countValidChannels( - channels:A__Gyroscope2::Valid_ChannelT_4) -returns ( - nb:real); -let - nb = red<<Gyroscope2::countFalse, 4>>(0.0, channels); -tel --- end of node Gyroscope2::countValidChannels -node Gyroscope2::sum(accu_in:real; elt_in:real) returns (accu_out:real); -let - accu_out = accu_in + elt_in; -tel --- end of node Gyroscope2::sum - -node Gyroscope2::masking( - channel:_Gyroscope2::Valid_ChannelT) -returns ( - out:real); -var - _v_1:bool; - _v_2:real; -let - out = if _v_1 then 0.0 else _v_2; - _v_1 = channel.local_failure; - _v_2 = channel.local_value; -tel --- end of node Gyroscope2::masking - -node Gyroscope2::Voter( - channels:A__Gyroscope2::Valid_ChannelT_4; - god:real; - delta_to_god:real) -returns ( - vote:real); -var - globalSum:real; - nbValid:real; - mask:A_real_4; -let - nbValid = Gyroscope2::countValidChannels(channels); - globalSum = red<<Gyroscope2::sum, 4>>(0.0, mask); - vote = globalSum / nbValid; - mask = map<<Gyroscope2::masking, 4>>(channels); -tel --- end of node Gyroscope2::Voter - -node Gyroscope2::selectFailure( - from:_Gyroscope2::Valid_ChannelT) -returns ( - failure:bool); -let - failure = from.local_failure; -tel --- end of node Gyroscope2::selectFailure - -node Gyroscope2::addOneChannelIter( - acc_in:_Gyroscope2::CFF_Eltstruct; - elt_in:_Gyroscope2::Valid_ChannelT) -returns ( - acc_out:_Gyroscope2::CFF_Eltstruct; - elt_out:_Gyroscope2::Valid_ChannelT); -var - _v_4:_Gyroscope2::Valid_ChannelT; - _v_3:int; - _v_1:int; - _v_2:int; - _v_5:int; - _v_6:int; - _v_7:bool; - _v_8:_Gyroscope2::Valid_ChannelT; -let - acc_out = - _Gyroscope2::CFF_Eltstruct{indx=_v_2;indx_toChange=_v_3;value=_v_4}; - _v_4 = acc_in.value; - _v_3 = acc_in.indx_toChange; - _v_1 = acc_in.indx; - _v_2 = _v_1 + 1; - elt_out = if _v_7 then _v_8 else elt_in; - _v_5 = acc_in.indx; - _v_6 = acc_in.indx_toChange; - _v_7 = _v_5 = _v_6; - _v_8 = acc_in.value; -tel --- end of node Gyroscope2::addOneChannelIter - -node Gyroscope2::addOneChannel( - indx_toChange:int; - channeltToAdd:_Gyroscope2::Valid_ChannelT; - tabToFill:A__Gyroscope2::Valid_ChannelT_3) -returns ( - tabToFillAfter:A__Gyroscope2::Valid_ChannelT_3); -var - acc_out:_Gyroscope2::CFF_Eltstruct; - _v_1:_Gyroscope2::CFF_Eltstruct; -let - (acc_out, tabToFillAfter) = fillred<<Gyroscope2::addOneChannelIter, - 3>>(_v_1, tabToFill); - _v_1 = - _Gyroscope2::CFF_Eltstruct{indx=0;indx_toChange=indx_toChange;value=channeltToAdd}; -tel --- end of node Gyroscope2::addOneChannel - -node Gyroscope2::CFC_iter( - structIn:_Gyroscope2::CFF_struct; - currentChannel:_Gyroscope2::Valid_ChannelT) -returns ( - structOut:_Gyroscope2::CFF_struct); -var - _v_4:int; - _v_5:int; - _v_6:bool; - _v_7:A__Gyroscope2::Valid_ChannelT_3; - _v_8:int; - _v_9:A__Gyroscope2::Valid_ChannelT_3; - _v_10:A__Gyroscope2::Valid_ChannelT_3; - _v_11:A__Gyroscope2::Valid_ChannelT_3; - _v_3:int; - _v_1:int; - _v_2:int; -let - structOut = - _Gyroscope2::CFF_struct{indx=_v_2;indx_toChange=_v_3;tabToFill=_v_11}; - _v_4 = structIn.indx_toChange; - _v_5 = structIn.indx; - _v_6 = _v_4 = _v_5; - _v_7 = structIn.tabToFill; - _v_8 = structIn.indx; - _v_9 = structIn.tabToFill; - _v_10 = Gyroscope2::addOneChannel(_v_8, currentChannel, _v_9); - _v_11 = if _v_6 then _v_7 else _v_10; - _v_3 = structIn.indx_toChange; - _v_1 = structIn.indx; - _v_2 = _v_1 + 1; -tel --- end of node Gyroscope2::CFC_iter - -node Gyroscope2::ComputeForeignChannels( - currentChannelIndx:int; - allChannels:A__Gyroscope2::Valid_ChannelT_4) -returns ( - foreignChannels:A__Gyroscope2::Valid_ChannelT_3); + foreignChannels:A__Gyroscope2::Valid_ChannelT_3); var acc_out:_Gyroscope2::CFF_struct; localtabToFill:_Gyroscope2::Valid_ChannelT; @@ -11385,6 +11228,15 @@ let tel -- end of node Gyroscope2::compare_rolls +node Gyroscope2::selectFailure( + from:_Gyroscope2::Valid_ChannelT) +returns ( + failure:bool); +let + failure = from.local_failure; +tel +-- end of node Gyroscope2::selectFailure + node Gyroscope2::values_nok( localChannel:_Gyroscope2::Valid_ChannelT; foreign_Channels:A__Gyroscope2::Valid_ChannelT_3) @@ -11549,117 +11401,66 @@ let tel -- end of node Gyroscope2::Channel -node Gyroscope2::guaranteeChannel( - previousOutChannel:A__Gyroscope2::Valid_ChannelT_4; - nbInChannel:int; - inChannel:_Gyroscope2::Faulty_ChannelT; - delta:real; - god:real; - delta_to_god:real; - nextOutChannel:A__Gyroscope2::Faulty_ChannelT_4; - outChannel:_Gyroscope2::Valid_ChannelT) +node Gyroscope2::countFalse( + accu_in:real; + elt_in:_Gyroscope2::Valid_ChannelT) returns ( - guaranteeOK:bool); + accu_out:real); var _v_1:bool; _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:bool; - _v_7:real; - _v_8:real; - _v_9:real; - _v_10:real; - _v_11:bool; - _v_12:bool; let - guaranteeOK = _v_1 or _v_12; - _v_1 = outChannel.local_failure; - _v_2 = inChannel.valuea; - _v_3 = outChannel.local_value; - _v_4 = _v_2 - _v_3; - _v_5 = Gyroscope2::abs(_v_4); - _v_6 = _v_5 < delta; - _v_7 = inChannel.valueb; - _v_8 = outChannel.local_value; - _v_9 = _v_7 - _v_8; - _v_10 = Gyroscope2::abs(_v_9); - _v_11 = _v_10 < delta; - _v_12 = _v_6 and _v_11; + accu_out = if _v_1 then accu_in else _v_2; + _v_1 = elt_in.local_failure; + _v_2 = accu_in + 1.0; tel --- end of node Gyroscope2::guaranteeChannel +-- end of node Gyroscope2::countFalse -node Gyroscope2::iteratedVoter( - acc_in:bool; - channel:_Gyroscope2::Valid_ChannelT; - god:real; - delta_to_god:real; - vote:real) +node Gyroscope2::countValidChannels( + channels:A__Gyroscope2::Valid_ChannelT_4) returns ( - acc_out:bool); + nb:real); +let + nb = red<<Gyroscope2::countFalse, 4>>(0.0, channels); +tel +-- end of node Gyroscope2::countValidChannels +node Gyroscope2::sum(accu_in:real; elt_in:real) returns (accu_out:real); +let + accu_out = accu_in + elt_in; +tel +-- end of node Gyroscope2::sum + +node Gyroscope2::masking( + channel:_Gyroscope2::Valid_ChannelT) +returns ( + out:real); var _v_1:bool; _v_2:real; - _v_3:real; - _v_4:real; - _v_5:bool; - _v_6:bool; let - acc_out = acc_in and _v_6; + out = if _v_1 then 0.0 else _v_2; _v_1 = channel.local_failure; _v_2 = channel.local_value; - _v_3 = vote - _v_2; - _v_4 = Gyroscope2::abs(_v_3); - _v_5 = _v_4 < delta_to_god; - _v_6 = _v_1 or _v_5; tel --- end of node Gyroscope2::iteratedVoter +-- end of node Gyroscope2::masking -node Gyroscope2::assumeVoter( +node Gyroscope2::Voter( channels:A__Gyroscope2::Valid_ChannelT_4; god:real; delta_to_god:real) returns ( - assumeOK:bool); + vote:real); +var + globalSum:real; + nbValid:real; + mask:A_real_4; let - assumeOK = true; -tel --- end of node Gyroscope2::assumeVoter - -node Gyroscope2::guaranteeEvaluateAxis( - channels:A__Gyroscope2::Faulty_ChannelT_4; - delta:real; - god:real; - delta_to_god:real; - AxisValue:real) -returns ( - guaranteeOK:bool); -var - _v_1:real; - _v_2:real; -let - guaranteeOK = _v_2 < delta_to_god; - _v_1 = AxisValue - god; - _v_2 = Gyroscope2::abs(_v_1); -tel --- end of node Gyroscope2::guaranteeEvaluateAxis - -node Gyroscope2::ValueIsSecure( - secure_value:real; - delta_to_god_value:real; - god_value:real) -returns ( - is_valid:bool); -var - _v_1:real; - _v_2:real; -let - is_valid = _v_2 < delta_to_god_value; - _v_1 = secure_value - god_value; - _v_2 = Gyroscope2::abs(_v_1); + nbValid = Gyroscope2::countValidChannels(channels); + globalSum = red<<Gyroscope2::sum, 4>>(0.0, mask); + vote = globalSum / nbValid; + mask = map<<Gyroscope2::masking, 4>>(channels); tel --- end of node Gyroscope2::ValueIsSecure +-- end of node Gyroscope2::Voter node Gyroscope2::EvaluateAxis( channels:A__Gyroscope2::Faulty_ChannelT_4; @@ -11694,6 +11495,25 @@ let tel -- end of node Gyroscope2::EvaluateAxis +node Gyroscope2::ValueIsSecureII( + accu_in:bool; + secure_value:real; + delta_to_god_value:real; + god_value:real) +returns ( + is_valid:bool); +var + _v_1:real; + _v_2:real; + _v_3:bool; +let + is_valid = _v_3 and accu_in; + _v_1 = secure_value - god_value; + _v_2 = Gyroscope2::abs(_v_1); + _v_3 = _v_2 < 2.0; +tel +-- end of node Gyroscope2::ValueIsSecureII + node Gyroscope2::Gyroscope2( axis:A_A__Gyroscope2::Faulty_ChannelT_4_3) returns ( @@ -11718,6 +11538,55 @@ let tel -- end of node Gyroscope2::Gyroscope2 +node Gyroscope2::iteratedVoter( + acc_in:bool; + channel:_Gyroscope2::Valid_ChannelT; + god:real; + delta_to_god:real; + vote:real) +returns ( + acc_out:bool); +var + _v_1:bool; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:bool; + _v_6:bool; +let + acc_out = acc_in and _v_6; + _v_1 = channel.local_failure; + _v_2 = channel.local_value; + _v_3 = vote - _v_2; + _v_4 = Gyroscope2::abs(_v_3); + _v_5 = _v_4 < delta_to_god; + _v_6 = _v_1 or _v_5; +tel +-- end of node Gyroscope2::iteratedVoter + +node Gyroscope2::TooFar( + nbToFarIn:int; + channel:_Gyroscope2::Faulty_ChannelT; + god:real; + delta_to_god:real) +returns ( + nbToFarOut:int); +var + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:bool; + _v_5:int; +let + nbToFarOut = if _v_4 then _v_5 else nbToFarIn; + _v_1 = channel.valuea; + _v_2 = _v_1 - god; + _v_3 = Gyroscope2::abs(_v_2); + _v_4 = _v_3 < delta_to_god; + _v_5 = nbToFarIn + 1; +tel +-- end of node Gyroscope2::TooFar + node Gyroscope2::guaranteeVoter( channels:A__Gyroscope2::Valid_ChannelT_4; god:real; @@ -11737,21 +11606,145 @@ let _v_3 = vote^4; tel -- end of node Gyroscope2::guaranteeVoter + +node Gyroscope2::guaranteeEvaluateAxis( + channels:A__Gyroscope2::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real; + AxisValue:real) +returns ( + guaranteeOK:bool); +var + _v_1:real; + _v_2:real; +let + guaranteeOK = _v_2 < delta_to_god; + _v_1 = AxisValue - god; + _v_2 = Gyroscope2::abs(_v_1); +tel +-- end of node Gyroscope2::guaranteeEvaluateAxis + +node Gyroscope2::ValueIsSecure( + secure_value:real; + delta_to_god_value:real; + god_value:real) +returns ( + is_valid:bool); +var + _v_1:real; + _v_2:real; +let + is_valid = _v_2 < delta_to_god_value; + _v_1 = secure_value - god_value; + _v_2 = Gyroscope2::abs(_v_1); +tel +-- end of node Gyroscope2::ValueIsSecure + +node Gyroscope2::assumeEvaluateAxis( + channels:A__Gyroscope2::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +var + NbToFar:int; + _v_1:A_real_4; + _v_2:A_real_4; +let + NbToFar = red<<Gyroscope2::TooFar, 4>>(0, channels, _v_1, _v_2); + _v_1 = god^4; + _v_2 = delta_to_god^4; + assumeOK = NbToFar <= 1; +tel +-- end of node Gyroscope2::assumeEvaluateAxis + +node Gyroscope2::assumeVoter( + channels:A__Gyroscope2::Valid_ChannelT_4; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope2::assumeVoter + +node Gyroscope2::assumeChannel( + previousOutChannel:A__Gyroscope2::Valid_ChannelT_4; + nbInChannel:int; + inChannel:_Gyroscope2::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real) +returns ( + assumeOK:bool); +let + assumeOK = true; +tel +-- end of node Gyroscope2::assumeChannel + +node Gyroscope2::guaranteeChannel( + previousOutChannel:A__Gyroscope2::Valid_ChannelT_4; + nbInChannel:int; + inChannel:_Gyroscope2::Faulty_ChannelT; + delta:real; + god:real; + delta_to_god:real; + nextOutChannel:A__Gyroscope2::Faulty_ChannelT_4; + outChannel:_Gyroscope2::Valid_ChannelT) +returns ( + guaranteeOK:bool); +var + _v_1:bool; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:bool; + _v_7:real; + _v_8:real; + _v_9:real; + _v_10:real; + _v_11:bool; + _v_12:bool; +let + guaranteeOK = _v_1 or _v_12; + _v_1 = outChannel.local_failure; + _v_2 = inChannel.valuea; + _v_3 = outChannel.local_value; + _v_4 = _v_2 - _v_3; + _v_5 = Gyroscope2::abs(_v_4); + _v_6 = _v_5 < delta; + _v_7 = inChannel.valueb; + _v_8 = outChannel.local_value; + _v_9 = _v_7 - _v_8; + _v_10 = Gyroscope2::abs(_v_9); + _v_11 = _v_10 < delta; + _v_12 = _v_6 and _v_11; +tel +-- end of node Gyroscope2::guaranteeChannel -- automatically defined aliases: -type A_real_3 = real^3; -type A__Gyroscope2::Valid_ChannelT_3 = _Gyroscope2::Valid_ChannelT^3; -type A_A__Gyroscope2::Faulty_ChannelT_4_3 = A__Gyroscope2::Faulty_ChannelT_4^3; type A_int_4 = int^4; +type A_A__Gyroscope2::Faulty_ChannelT_4_3 = A__Gyroscope2::Faulty_ChannelT_4^3; type A__Gyroscope2::Faulty_ChannelT_4 = _Gyroscope2::Faulty_ChannelT^4; +type A_real_3 = real^3; type A_real_4 = real^4; -type A__Gyroscope2::Valid_ChannelT_4 = _Gyroscope2::Valid_ChannelT^4; type A_bool_3 = bool^3; +type A__Gyroscope2::Valid_ChannelT_3 = _Gyroscope2::Valid_ChannelT^3; +type A__Gyroscope2::Valid_ChannelT_4 = _Gyroscope2::Valid_ChannelT^4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/alias.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/alias.lus const alias::SIZE = 3; +node alias::aliasPredefNot(i:bool) returns (o:bool); +let + o = Lustre::not(i); +tel +-- end of node alias::aliasPredefNot node alias::aliasIterOp(i1:int; i2:A_int_3) returns (o:int); let o = Lustre::red<<Lustre::iplus, 3>>(i1, i2); @@ -11777,11 +11770,6 @@ let c = alias::unNoeud(a, b); tel -- end of node alias::aliasGivenNode -node alias::aliasPredefNot(i:bool) returns (o:bool); -let - o = Lustre::not(i); -tel --- end of node alias::aliasPredefNot node alias::alias(a:bool) returns (b:bool; c:int); var _v_1:A_int_3; @@ -11796,8 +11784,8 @@ let tel -- end of node alias::alias -- automatically defined aliases: -type A_bool_2 = bool^2; type A_int_3 = int^3; +type A_bool_2 = bool^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/bred.lus @@ -11828,7 +11816,6 @@ type A_bool_2 = bool^2; ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/clock.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/clock.lus -extern node clock::clock2(u:bool; v:bool when u) returns (y:bool); extern node clock::clock3(u:bool) returns (x:bool; y:bool when x); extern node clock::clock4( @@ -11837,6 +11824,7 @@ extern node clock::clock4( returns ( x:bool; y:bool when x); +extern node clock::clock2(u:bool; v:bool when u) returns (y:bool); node clock::clock(a:bool; b:bool) returns (c:bool; d:bool when c); var z:bool; @@ -11900,36 +11888,21 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/decl.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/decl.lus +type _decl::couleur = enum {decl::bleu, decl::blanc, decl::rouge}; type _decl::t1; -type _decl::t2; -type _decl::t3; const decl::g = 4; type _decl::t4 = _decl::t1^8; +type _decl::t3; +type _decl::coord = struct {x : real; y : real}; +type _decl::coord_tab = _decl::coord^1; const decl::d = true; const decl::h = 2; type _decl::t5 = A__decl::t1_8^5; -type _decl::coord = struct {x : real; y : real}; -type _decl::coord_tab = _decl::coord^1; -type _decl::couleur = enum {decl::bleu, decl::blanc, decl::rouge}; -const decl::e = 8.5; +type _decl::t2; const decl::a:int; -const decl::b:int; +const decl::e = 8.5; const decl::c:int; - -extern node decl::decl( - a1:_decl::t1; - b1:_decl::t1; - c1:_decl::t1) -returns ( - d1:bool); - -extern function decl::f1( - a1:_decl::couleur; - b1:_decl::couleur; - c1:_decl::couleur) -returns ( - d1_0:bool; - d1_1:bool); +const decl::b:int; extern node decl::n2( a1_0:_decl::t1; @@ -11998,6 +11971,21 @@ returns ( e1_4_5:_decl::t1; e1_4_6:_decl::t1; e1_4_7:_decl::t1); + +extern node decl::decl( + a1:_decl::t1; + b1:_decl::t1; + c1:_decl::t1) +returns ( + d1:bool); + +extern function decl::f1( + a1:_decl::couleur; + b1:_decl::couleur; + c1:_decl::couleur) +returns ( + d1_0:bool; + d1_1:bool); -- automatically defined aliases: type A__decl::t1_8 = _decl::t1^8; @@ -12005,35 +11993,27 @@ type A__decl::t1_8 = _decl::t1^8; ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/declaration.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/declaration.lus +type _declaration::couleur = enum {declaration::bleu, declaration::blanc, declaration::rouge}; type _declaration::t1; -type _declaration::t2; -type _declaration::t3; const declaration::g = 4; type _declaration::t4 = _declaration::t1^8; +type _declaration::t3; +type _declaration::coord = struct {x : real; y : real}; +type _declaration::coord_tab = _declaration::coord^1; const declaration::d = true; const declaration::h = 2; type _declaration::t5 = A__declaration::t1_8^5; -type _declaration::coord = struct {x : real; y : real}; -type _declaration::coord_tab = _declaration::coord^1; -type _declaration::couleur = enum {declaration::bleu, declaration::blanc, declaration::rouge}; -const declaration::e = 8.5; +type _declaration::t2; const declaration::a:int; -const declaration::b:int; +const declaration::e = 8.5; const declaration::c:int; +const declaration::b:int; node declaration::declaration(a1:int) returns (b1:int); let b1 = a1; tel -- end of node declaration::declaration -extern function declaration::f1( - a1:_declaration::couleur; - b1:_declaration::couleur; - c1:_declaration::couleur) -returns ( - d1_0:bool; - d1_1:bool); - extern node declaration::n1( a1:_declaration::t1; b1:_declaration::t1; @@ -12108,6 +12088,22 @@ returns ( e1_4_5:_declaration::t1; e1_4_6:_declaration::t1; e1_4_7:_declaration::t1); +node declaration::n5(a1:real) returns (b1:real); +var + c1:real; +let + b1 = a1 / c1; + c1 = 1.0; +tel +-- end of node declaration::n5 + +extern function declaration::f1( + a1:_declaration::couleur; + b1:_declaration::couleur; + c1:_declaration::couleur) +returns ( + d1_0:bool; + d1_1:bool); node declaration::n4(a1:bool) returns (b1:bool); var c1:bool; @@ -12120,14 +12116,6 @@ let _v_2 = a1 and c1; tel -- end of node declaration::n4 -node declaration::n5(a1:real) returns (b1:real); -var - c1:real; -let - b1 = a1 / c1; - c1 = 1.0; -tel --- end of node declaration::n5 -- automatically defined aliases: type A__declaration::t1_8 = _declaration::t1^8; @@ -12135,17 +12123,17 @@ type A__declaration::t1_8 = _declaration::t1^8; ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/def.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/def.lus +type _def::t3; type _def::t1; const def::a = 4; type _def::string = int^4; type _def::string2d = A_int_4^4; type _def::structT = struct {x : int; y : real; z : A_A_A_int_4_4_4}; -type _def::t2; -type _def::t3; type _def::tabStruct = _def::structT^2; +type _def::t2; +const def::c = 3.14; const def::id_int = 5; const def::b = true; -const def::c = 3.14; node def::def( a1:bool; @@ -12333,11 +12321,11 @@ let tel -- end of node def::def -- automatically defined aliases: -type A_int_23 = int^23; -type A__def::structT_2 = _def::structT^2; type A_A_A_int_4_4_4 = A_A_int_4_4^4; -type A_A_int_4_4 = A_int_4^4; type A_int_4 = int^4; +type A_A_int_4_4 = A_int_4^4; +type A__def::structT_2 = _def::structT^2; +type A_int_23 = int^23; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/filliter.lus @@ -12376,8 +12364,8 @@ let tel -- end of node filliter::filliter -- automatically defined aliases: -type A_int_3 = int^3; type A_int_4 = int^4; +type A_int_3 = int^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/filter.lus @@ -12417,18 +12405,6 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/lustre_test1_ok.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/lustre_test1_ok.lus -node lustre_test1_ok::rising(in:bool) returns (out:bool); -var - _v_1:bool; - _v_2:bool; - _v_3:bool; -let - out = false -> _v_3; - _v_1 = pre (in); - _v_2 = not _v_1; - _v_3 = in and _v_2; -tel --- end of node lustre_test1_ok::rising node lustre_test1_ok::TransFnc_1(E:real) returns (S:real); var Sm_1:real; @@ -12443,6 +12419,18 @@ let _v_3 = pre (S); tel -- end of node lustre_test1_ok::TransFnc_1 +node lustre_test1_ok::rising(in:bool) returns (out:bool); +var + _v_1:bool; + _v_2:bool; + _v_3:bool; +let + out = false -> _v_3; + _v_1 = pre (in); + _v_2 = not _v_1; + _v_3 = in and _v_2; +tel +-- end of node lustre_test1_ok::rising node lustre_test1_ok::subsys1(s1:real) returns (s2:real); var Discrete_Filter:real; @@ -12541,15 +12529,15 @@ tel const map_red_iter::NBC = 20; type _map_red_iter::INTNBC = int^20; +type _map_red_iter::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; const map_red_iter::NBG = 4; type _map_red_iter::INTNBG = int^4; -type _map_red_iter::T_EntreeGlob = struct {chg2gen : A_int_20; mesure_chgs : A_int_20; mesure_gens : A_int_4}; -type _map_red_iter::T_ComChg = int; type _map_red_iter::T_InfoGenIndiv = struct {mesure_gen : int}; -type _map_red_iter::T_EtatCharge = int; +type _map_red_iter::T_EntreeGlob = struct {chg2gen : A_int_20; mesure_chgs : A_int_20; mesure_gens : A_int_4}; type _map_red_iter::T_InfoChgGlob = struct {chg2gen : A_int_20}; +type _map_red_iter::T_ComChg = int; type _map_red_iter::T_InfoChgIndiv = struct {mesure_chg : int}; -type _map_red_iter::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; +type _map_red_iter::T_EtatCharge = int; node map_red_iter::traite_genCore_itere( acc_in:int; @@ -12582,17 +12570,17 @@ let tel -- end of node map_red_iter::map_red_iter -- automatically defined aliases: +type A_int_4 = int^4; type A_int_20 = int^20; type A_bool_20 = bool^20; -type A_int_4 = int^4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/mapdeRed.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/mapdeRed.lus -const mapdeRed::m = 3; -const mapdeRed::n = 2; const mapdeRed::p = 5; +const mapdeRed::n = 2; +const mapdeRed::m = 3; node mapdeRed::incr(i:int) returns (accu:int; s:int); let accu = i + 1; @@ -12652,8 +12640,8 @@ type A_int_7 = int^7; -- ../lus2lic -vl 2 --nonreg-test should_work/demo/mappredef.lus const mappredef::N = 3; -type _mappredef::tab_int = int^3; type _mappredef::tab_bool = bool^3; +type _mappredef::tab_int = int^3; node mappredef::mappredef( x:A_bool_3; @@ -12761,13 +12749,18 @@ let tel -- end of node rediter::rediter -- automatically defined aliases: -type A_A_int_5_3 = A_int_5^3; type A_int_5 = int^5; +type A_A_int_5_3 = A_int_5^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/redoptest.lus -- ../lus2lic -vl 2 --nonreg-test should_work/demo/redoptest.lus +node redoptest::redoptest(a:A_A_int_5_3) returns (b:int); +let + b = red<<Lustre::red<<Lustre::plus, 5>>, 3>>(0, a); +tel +-- end of node redoptest::redoptest node redoptest::max(init:int; a:int) returns (b:int); var _v_1:bool; @@ -12776,14 +12769,9 @@ let _v_1 = init > a; tel -- end of node redoptest::max -node redoptest::redoptest(a:A_A_int_5_3) returns (b:int); -let - b = red<<Lustre::red<<Lustre::plus, 5>>, 3>>(0, a); -tel --- end of node redoptest::redoptest -- automatically defined aliases: -type A_A_int_5_3 = A_int_5^3; type A_int_5 = int^5; +type A_A_int_5_3 = A_int_5^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/demo/sample_time_change.lus @@ -13000,6 +12988,11 @@ tel -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/iter.lus const iter::n = 5; +node iter::plus(accu_in:int; elt_in:int) returns (accu_out:int); +let + accu_out = accu_in + elt_in; +tel +-- end of node iter::plus node iter::filled(accu_in:int) returns (accu_out:int; elt:int); let accu_out = accu_in + 1; @@ -13045,11 +13038,6 @@ let _v_2 = [0, 0, 0, 0, 0]; tel -- end of node iter::iter -node iter::plus(accu_in:int; elt_in:int) returns (accu_out:int); -let - accu_out = accu_in + elt_in; -tel --- end of node iter::plus -- automatically defined aliases: type A_int_5 = int^5; @@ -13084,19 +13072,6 @@ let tel -- end of node iterate::redduced -node iterate::filled( - accu_in:int) -returns ( - accu_out:int; - elt_out1:int; - elt_out2:int); -let - accu_out = accu_in + 1; - elt_out1 = accu_in; - elt_out2 = accu_in * 2; -tel --- end of node iterate::filled - node iterate::fill_redduced( accu_in:int; elt_in1:int; @@ -13114,6 +13089,19 @@ let tel -- end of node iterate::fill_redduced +node iterate::filled( + accu_in:int) +returns ( + accu_out:int; + elt_out1:int; + elt_out2:int); +let + accu_out = accu_in + 1; + elt_out1 = accu_in; + elt_out2 = accu_in * 2; +tel +-- end of node iterate::filled + node iterate::iterate( IN1:A_int_10; IN2:A_int_10) @@ -13144,48 +13132,6 @@ type A_int_10 = int^10; ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lecteur.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lecteur.lus -node lecteur::Propriete(vitesse:int) returns (ok:bool); -var - cpt:int; - acceptable:bool; - _v_1:bool; - _v_2:bool; - _v_3:int; - _v_4:int; - _v_5:int; - _v_6:int; - _v_7:bool; -let - acceptable = _v_1 and _v_2; - _v_1 = 8 <= vitesse; - _v_2 = vitesse <= 12; - cpt = 0 -> _v_5; - _v_3 = pre (cpt); - _v_4 = _v_3 + 1; - _v_5 = if acceptable then 0 else _v_4; - ok = true -> _v_7; - _v_6 = pre (cpt); - _v_7 = _v_6 < 15; -tel --- end of node lecteur::Propriete - -node lecteur::Controleur( - diff:int) -returns ( - vitesse:int; - Plus:bool; - Moins:bool); -var - _v_1:int; - _v_2:int; -let - vitesse = 0 -> _v_2; - _v_1 = pre (vitesse); - _v_2 = _v_1 + diff; - Plus = vitesse <= 9; - Moins = vitesse >= 11; -tel --- end of node lecteur::Controleur node lecteur::Environnement( diff:int; @@ -13226,32 +13172,66 @@ let _v_14 = if _v_11 then _v_13 else true; tel -- end of node lecteur::Environnement -node lecteur::lecteur(diff:int) returns (ok:bool); + +node lecteur::Controleur( + diff:int) +returns ( + vitesse:int; + Plus:bool; + Moins:bool); var - vitesse:int; - Plus:bool; - Moins:bool; - realiste:bool; + _v_1:int; + _v_2:int; let - assert(realiste); - (vitesse, Plus, Moins) = lecteur::Controleur(diff); - realiste = lecteur::Environnement(diff, Plus, Moins); - ok = lecteur::Propriete(vitesse); + vitesse = 0 -> _v_2; + _v_1 = pre (vitesse); + _v_2 = _v_1 + diff; + Plus = vitesse <= 9; + Moins = vitesse >= 11; tel --- end of node lecteur::lecteur - ----------------------------------------------------------------------- -====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus --- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus - -node lucky::implies(X:bool; Y:bool) returns (XimpliesY:bool); +-- end of node lecteur::Controleur +node lecteur::Propriete(vitesse:int) returns (ok:bool); var + cpt:int; + acceptable:bool; _v_1:bool; + _v_2:bool; + _v_3:int; + _v_4:int; + _v_5:int; + _v_6:int; + _v_7:bool; let - XimpliesY = _v_1 or Y; - _v_1 = not X; + acceptable = _v_1 and _v_2; + _v_1 = 8 <= vitesse; + _v_2 = vitesse <= 12; + cpt = 0 -> _v_5; + _v_3 = pre (cpt); + _v_4 = _v_3 + 1; + _v_5 = if acceptable then 0 else _v_4; + ok = true -> _v_7; + _v_6 = pre (cpt); + _v_7 = _v_6 < 15; tel --- end of node lucky::implies +-- end of node lecteur::Propriete +node lecteur::lecteur(diff:int) returns (ok:bool); +var + vitesse:int; + Plus:bool; + Moins:bool; + realiste:bool; +let + assert(realiste); + (vitesse, Plus, Moins) = lecteur::Controleur(diff); + realiste = lecteur::Environnement(diff, Plus, Moins); + ok = lecteur::Propriete(vitesse); +tel +-- end of node lecteur::lecteur + +---------------------------------------------------------------------- +====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus +-- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/lucky.lus + node lucky::after(X:bool) returns (afterX:bool); var _v_1:bool; @@ -13278,6 +13258,14 @@ let _v_5 = if _v_1 then _v_4 else false; tel -- end of node lucky::once_since +node lucky::implies(X:bool; Y:bool) returns (XimpliesY:bool); +var + _v_1:bool; +let + XimpliesY = _v_1 or Y; + _v_1 = not X; +tel +-- end of node lucky::implies node lucky::once_from_to(C:bool; A:bool; B:bool) returns (X:bool); var _v_1:bool; @@ -13355,8 +13343,8 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel.lus -type _morel::arrayb = bool^3; type _morel::arrayi = A_int_2^3; +type _morel::arrayb = bool^3; node morel::mcmorel(i:int) returns (t:A_int_2); var _v_1:A_int_2; @@ -13462,18 +13450,18 @@ let tel -- end of node morel::morel -- automatically defined aliases: +type A_A_int_2_3 = A_int_2^3; type A_bool_3 = bool^3; type A_int_2 = int^2; -type A_A_int_2_3 = A_int_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel2.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel2.lus +type _morel2::arrayi = A_int_2^3; type _morel2::a2 = int^2; type _morel2::a32 = A_int_2^3; type _morel2::arrayb = bool^3; -type _morel2::arrayi = A_int_2^3; node morel2::mcmorel(i:int) returns (t:A_int_2); var _v_1:A_int_2; @@ -13566,16 +13554,16 @@ let tel -- end of node morel2::morel2 -- automatically defined aliases: +type A_A_int_2_3 = A_int_2^3; type A_bool_3 = bool^3; type A_int_2 = int^2; -type A_A_int_2_3 = A_int_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel3.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel3.lus -type _morel3::arrayb = bool^3; type _morel3::arrayi = A_int_2^3; +type _morel3::arrayb = bool^3; node morel3::mcmorel(i:int) returns (t:A_int_2); var _v_1:A_int_2; @@ -13675,9 +13663,9 @@ let tel -- end of node morel3::morel3 -- automatically defined aliases: +type A_A_int_2_3 = A_int_2^3; type A_bool_3 = bool^3; type A_int_2 = int^2; -type A_A_int_2_3 = A_int_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel4.lus @@ -13685,8 +13673,8 @@ type A_A_int_2_3 = A_int_2^3; type _morel4::tube = struct {in : int; out : int}; type _morel4::toto = struct {titi : _morel4::tube; tutu : bool}; -type _morel4::arrayb = bool^3; type _morel4::arrayi = A_int_2^3; +type _morel4::arrayb = bool^3; node morel4::mcmorel(i:int) returns (t:A_int_2); var yo:_morel4::toto; @@ -13803,9 +13791,9 @@ let tel -- end of node morel4::morel4 -- automatically defined aliases: +type A_A_int_2_3 = A_int_2^3; type A_bool_3 = bool^3; type A_int_2 = int^2; -type A_A_int_2_3 = A_int_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/morel5.lus @@ -13813,8 +13801,8 @@ type A_A_int_2_3 = A_int_2^3; type _morel5::tube = struct {in : int; out : int}; type _morel5::toto = struct {titi : _morel5::tube; tutu : bool}; -type _morel5::arrayb = bool^3; type _morel5::arrayi = A_int_2^3; +type _morel5::arrayb = bool^3; node morel5::tab( yo:_morel5::toto; @@ -13889,22 +13877,6 @@ let _v_26 = _v_23 + _v_25; tel -- end of node morel5::tab - -node morel5::morel5( - t:_morel5::toto; - b:A_bool_3; - i:A_A_int_2_3) -returns ( - b1:bool; - b2:bool; - b3:bool; - i1:int; - i2:int; - i3:int); -let - (b1, b2, b3, i1, i2, i3) = morel5::tab(t, b, i); -tel --- end of node morel5::morel5 node morel5::mcmorel(i:int) returns (t:A_int_2; u:A_A_int_2_2); var yo:_morel5::toto; @@ -13943,11 +13915,27 @@ let _v_14 = [1000, 10000]; tel -- end of node morel5::mcmorel + +node morel5::morel5( + t:_morel5::toto; + b:A_bool_3; + i:A_A_int_2_3) +returns ( + b1:bool; + b2:bool; + b3:bool; + i1:int; + i2:int; + i3:int); +let + (b1, b2, b3, i1, i2, i3) = morel5::tab(t, b, i); +tel +-- end of node morel5::morel5 -- automatically defined aliases: +type A_A_int_2_3 = A_int_2^3; type A_bool_3 = bool^3; type A_int_2 = int^2; type A_A_int_2_2 = A_int_2^2; -type A_A_int_2_3 = A_int_2^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/noAlarm.lus @@ -13976,35 +13964,421 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll.lus -const onlyroll::NRminP = -5.1; -const onlyroll::NRminR = -25.3; -const onlyroll::NRmaxP = 5.1; -const onlyroll::DELTA_PITCH = 3.0; const onlyroll::NRmaxR = 25.3; +const onlyroll::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll::HORmaxP = 57.0; +const onlyroll::DELTA_PITCH = 3.0; +const onlyroll::HORmaxR = 285.0; +const onlyroll::CROSS_CH_TOL_YAW = 10.0; const onlyroll::FAIL_SAFE_PITCH_VALUE = 4.0; -const onlyroll::DELTA_YAW = 2.73; -const onlyroll::NRminY = -5.0; -const onlyroll::HORminP = -57.0; +const onlyroll::NRmaxP = 5.1; const onlyroll::XFAIL_SAFE_ROLL_VALUE = 1.1; -const onlyroll::NRmaxY = 5.0; -const onlyroll::HORminR = -285.0; -const onlyroll::HORmaxP = 57.0; +const onlyroll::TIME_CROSS_ROLL = 3; +const onlyroll::TIME5 = 4; +const onlyroll::TIME_ROLL = 3; const onlyroll::CROSS_CH_TOL_PITCH = 10.1; -const onlyroll::HORmaxR = 285.0; -const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::DELTA_YAW = 2.73; const onlyroll::HORminY = -57.0; -const onlyroll::DELTA_ROLL = 14.9; -const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll::NRminP = -5.1; const onlyroll::OneSecond = 10; -const onlyroll::HORmaxY = 57.0; -const onlyroll::TIME_ROLL = 3; -const onlyroll::CROSS_CH_TOL_ROLL = 51.0; -const onlyroll::BID_LAST = 2.2; -const onlyroll::TIME5 = 4; const onlyroll::SAFE_COUNTER_TIME = 3; +const onlyroll::HORminP = -57.0; +const onlyroll::HORmaxY = 57.0; +const onlyroll::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll::BID_VAL = 3.3; -const onlyroll::CROSS_CH_TOL_YAW = 10.0; -const onlyroll::TIME_CROSS_ROLL = 3; +const onlyroll::NRminY = -5.0; +const onlyroll::BID_LAST = 2.2; +const onlyroll::DELTA_ROLL = 14.9; +const onlyroll::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll::NRminR = -25.3; +const onlyroll::HORminR = -285.0; +const onlyroll::NRmaxY = 5.0; +node onlyroll::abs(v:real) returns (a:real); +var + _v_1:bool; + _v_2:real; +let + a = if _v_1 then v else _v_2; + _v_1 = v >= 0.0; + _v_2 = -v; +tel +-- end of node onlyroll::abs +node onlyroll::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; + _v_1:int; + _v_2:int; + _v_3:int; + _v_4:int; +let + cpt = _v_1 -> _v_4; + _v_1 = if val then 1 else 0; + _v_2 = pre (cpt); + _v_3 = _v_2 + 1; + _v_4 = if val then _v_3 else 0; + m = cpt >= n; +tel +-- end of node onlyroll::maintain + +node onlyroll::Monitor( + xa:real; + xb:real; + disc:bool) +returns ( + local_value:real; + inline_monitor_failed:bool); +var + _v_1:real; + _v_2:real; + _v_3:bool; + _v_4:bool; +let + inline_monitor_failed = _v_4 or disc; + _v_1 = xa - xb; + _v_2 = onlyroll::abs(_v_1); + _v_3 = _v_2 > 14.9; + _v_4 = onlyroll::maintain(3, _v_3); + local_value = xa; +tel +-- end of node onlyroll::Monitor +node onlyroll::InNominalRange(r:real) returns (i:bool); +var + _v_1:bool; + _v_2:bool; +let + i = _v_1 and _v_2; + _v_1 = r < 25.3; + _v_2 = r > -25.3; +tel +-- end of node onlyroll::InNominalRange + +node onlyroll::values_nok( + pfother1:bool; + pfother2:bool; + pfother3:bool; + xi:real; + pxother1:real; + pxother2:real; + pxother3:real) +returns ( + r:bool); +var + one:bool; + two:bool; + three:bool; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; + _v_7:bool; + _v_8:bool; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:bool; + _v_13:bool; + _v_14:bool; + _v_15:bool; + _v_16:bool; + _v_17:bool; + _v_18:bool; +let + one = _v_2 > 51.0; + _v_1 = xi - pxother1; + _v_2 = onlyroll::abs(_v_1); + two = _v_4 > 51.0; + _v_3 = xi - pxother2; + _v_4 = onlyroll::abs(_v_3); + three = _v_6 > 51.0; + _v_5 = xi - pxother3; + _v_6 = onlyroll::abs(_v_5); + r = onlyroll::maintain(3, _v_18); + _v_7 = if pfother3 then false else three; + _v_8 = two and three; + _v_9 = if pfother3 then two else _v_8; + _v_10 = if pfother2 then _v_7 else _v_9; + _v_11 = one and three; + _v_12 = if pfother3 then one else _v_11; + _v_13 = one and two; + _v_14 = one and two; + _v_15 = _v_14 and three; + _v_16 = if pfother3 then _v_13 else _v_15; + _v_17 = if pfother2 then _v_12 else _v_16; + _v_18 = if pfother1 then _v_10 else _v_17; +tel +-- end of node onlyroll::values_nok + +node onlyroll::FailDetect( + local_failure:bool; + xi:real; + ongroundreset:bool; + inairreset:bool; + choffi:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + a:bool) +returns ( + failure:bool; + debug_cross_failure:bool; + debug_st:int; + r:bool); +var + cross_failure:bool; + ps:int; + state:int; + from1to2:bool; + from1to3:bool; + from2to3:bool; + from2to1:bool; + from3to1:bool; + NLfaults:bool; + will_latch:bool; + reset:bool; + foreign_failure:bool; + _v_1:int; + _v_2:bool; + _v_3:bool; + _v_4:bool; + _v_5:bool; + _v_6:int; + _v_7:int; + _v_8:int; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:int; + _v_13:int; + _v_14:bool; + _v_15:int; + _v_16:int; + _v_17:int; + _v_18:bool; + _v_19:bool; + _v_20:bool; + _v_21:bool; + _v_22:bool; + _v_23:bool; + _v_24:bool; + _v_25:bool; + _v_26:bool; + _v_27:bool; + _v_28:bool; + _v_29:bool; + _v_30:bool; + _v_31:bool; + _v_32:bool; + _v_33:int; + _v_34:bool; + _v_35:bool; + _v_36:int; + _v_37:bool; + _v_38:bool; + _v_39:bool; + _v_40:bool; + _v_41:bool; + _v_42:bool; +let + debug_st = state; + ps = 1 -> _v_1; + _v_1 = pre (state); + state = 1 -> _v_17; + _v_2 = ps = 1; + _v_3 = pre (reset); + _v_4 = pre (from1to2); + _v_5 = pre (from1to3); + _v_6 = if _v_5 then 3 else 1; + _v_7 = if _v_4 then 2 else _v_6; + _v_8 = if _v_3 then 1 else _v_7; + _v_9 = ps = 2; + _v_10 = pre (from2to1); + _v_11 = pre (from2to3); + _v_12 = if _v_11 then 3 else 2; + _v_13 = if _v_10 then 1 else _v_12; + _v_14 = pre (from3to1); + _v_15 = if _v_14 then 1 else 3; + _v_16 = if _v_9 then _v_13 else _v_15; + _v_17 = if _v_2 then _v_8 else _v_16; + failure = _v_20 or _v_22; + _v_18 = state = 2; + _v_19 = state = 3; + _v_20 = _v_18 or _v_19; + _v_21 = state = 1; + _v_22 = _v_21 and NLfaults; + reset = ongroundreset or _v_24; + _v_23 = not cross_failure; + _v_24 = inairreset and _v_23; + foreign_failure = _v_25 or pfother3; + _v_25 = pfother1 or pfother2; + NLfaults = choffi or local_failure; + from1to2 = will_latch and _v_27; + _v_26 = onlyroll::InNominalRange(xi); + _v_27 = not _v_26; + will_latch = cross_failure; + from1to3 = _v_28 and _v_29; + _v_28 = a and will_latch; + _v_29 = onlyroll::InNominalRange(xi); + from2to3 = a and _v_32; + _v_30 = pre (will_latch); + _v_31 = _v_30 and foreign_failure; + _v_32 = _v_31 or local_failure; + from3to1 = ongroundreset; + from2to1 = reset; + r = false -> _v_42; + _v_33 = pre (state); + _v_34 = _v_33 = 1; + _v_35 = _v_34 and cross_failure; + _v_36 = pre (state); + _v_37 = _v_36 = 2; + _v_38 = pre (cross_failure); + _v_39 = _v_38 and foreign_failure; + _v_40 = _v_37 and _v_39; + _v_41 = _v_40 or local_failure; + _v_42 = _v_35 or _v_41; + cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, + pxother1, pxother2, pxother3); + debug_cross_failure = cross_failure; +tel +-- end of node onlyroll::FailDetect + +node onlyroll::Channel( + ongroundreset:bool; + inairreset:bool; + choffi:bool; + xai:real; + xbi:real; + disci:bool; + pxother1:real; + pxother2:real; + pxother3:real; + pfother1:bool; + pfother2:bool; + pfother3:bool; + allowedi:bool) +returns ( + xi:real; + fi:bool; + aski:bool; + debug_localfailure:bool; + debug_cross_failure:bool; + debug_st:int); +var + local_failure:bool; +let + (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); + (fi, debug_cross_failure, debug_st, aski) = + onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, + pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); + debug_localfailure = local_failure; +tel +-- end of node onlyroll::Channel + +node onlyroll::Allocator( + r1:bool; + r2:bool; + r3:bool; + r4:bool; + reset:bool) +returns ( + a1:bool; + a2:bool; + a3:bool; + a4:bool); +var + nb_aut:int; + already:int; + _v_1:bool; + _v_2:int; + _v_3:bool; + _v_4:bool; + _v_5:bool; + _v_6:bool; + _v_7:bool; + _v_8:bool; + _v_9:bool; + _v_10:bool; + _v_11:bool; + _v_12:bool; + _v_13:bool; + _v_14:bool; + _v_15:bool; + _v_16:bool; + _v_17:bool; + _v_18:bool; + _v_19:bool; + _v_20:bool; + _v_21:bool; + _v_22:bool; + _v_23:bool; + _v_24:bool; + _v_25:bool; + _v_26:bool; + _v_27:bool; + _v_28:bool; + _v_29:bool; + _v_30:bool; + _v_31:int; + _v_32:int; + _v_33:int; + _v_34:int; + _v_35:int; + _v_36:int; + _v_37:int; + _v_38:int; + _v_39:int; +let + already = if _v_1 then 0 else _v_2; + _v_1 = true -> reset; + _v_2 = pre (nb_aut); + a1 = r1 and _v_3; + _v_3 = already <= 1; + a2 = r2 and _v_9; + _v_4 = not r1; + _v_5 = already <= 1; + _v_6 = _v_4 and _v_5; + _v_7 = already = 0; + _v_8 = r1 and _v_7; + _v_9 = _v_6 or _v_8; + a3 = r3 and _v_18; + _v_10 = not r1; + _v_11 = not r2; + _v_12 = _v_10 and _v_11; + _v_13 = already <= 1; + _v_14 = _v_12 and _v_13; + _v_15 = #(r1, r2); + _v_16 = already = 0; + _v_17 = _v_15 and _v_16; + _v_18 = _v_14 or _v_17; + a4 = r4 and _v_29; + _v_19 = not r1; + _v_20 = not r2; + _v_21 = _v_19 and _v_20; + _v_22 = not r3; + _v_23 = _v_21 and _v_22; + _v_24 = already <= 1; + _v_25 = _v_23 and _v_24; + _v_26 = #(r1, r2, r3); + _v_27 = already = 0; + _v_28 = _v_26 and _v_27; + _v_29 = _v_25 or _v_28; + nb_aut = if _v_30 then 0 else _v_39; + _v_30 = true -> reset; + _v_31 = pre (nb_aut); + _v_32 = if a4 then 1 else 0; + _v_33 = 0 + _v_32; + _v_34 = if a3 then 1 else _v_33; + _v_35 = 0 + _v_34; + _v_36 = if a2 then 1 else _v_35; + _v_37 = 0 + _v_36; + _v_38 = if a1 then 1 else _v_37; + _v_39 = _v_31 + _v_38; +tel +-- end of node onlyroll::Allocator node onlyroll::noneof( f1:bool; @@ -14284,617 +14658,231 @@ var let m = if _v_1 then one else two; _v_1 = one < two; -tel --- end of node onlyroll::min2 - -node onlyroll::min4( - one:real; - two:real; - three:real; - four:real) -returns ( - m:real); -var - _v_1:real; - _v_2:real; -let - m = onlyroll::min2(_v_1, _v_2); - _v_1 = onlyroll::min2(one, two); - _v_2 = onlyroll::min2(three, four); -tel --- end of node onlyroll::min4 - -node onlyroll::OlympicAverage( - one:real; - two:real; - three:real; - four:real) -returns ( - m:real); -var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:real; -let - m = _v_7 / 2.0; - _v_1 = one + two; - _v_2 = _v_1 + three; - _v_3 = _v_2 + four; - _v_4 = onlyroll::max4(one, two, three, four); - _v_5 = _v_3 - _v_4; - _v_6 = onlyroll::min4(one, two, three, four); - _v_7 = _v_5 - _v_6; -tel --- end of node onlyroll::OlympicAverage -node onlyroll::MedianValue3(a:real; b:real; c:real) returns (z:real); -var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:real; -let - z = _v_5 - _v_7; - _v_1 = a + b; - _v_2 = _v_1 + c; - _v_3 = onlyroll::min2(b, c); - _v_4 = onlyroll::min2(a, _v_3); - _v_5 = _v_2 - _v_4; - _v_6 = onlyroll::max2(b, c); - _v_7 = onlyroll::max2(a, _v_6); -tel --- end of node onlyroll::MedianValue3 - -node onlyroll::Median( - x1:real; - x2:real; - x3:real; - x4:real; - f1:bool; - f2:bool; - f3:bool; - f4:bool) -returns ( - r:real); -var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; -let - r = if f1 then _v_1 else _v_6; - _v_1 = onlyroll::MedianValue3(x2, x3, x4); - _v_2 = onlyroll::MedianValue3(x1, x3, x4); - _v_3 = onlyroll::MedianValue3(x1, x2, x4); - _v_4 = onlyroll::MedianValue3(x1, x2, x3); - _v_5 = if f3 then _v_3 else _v_4; - _v_6 = if f2 then _v_2 else _v_5; -tel --- end of node onlyroll::Median -node onlyroll::Average2(a:real; b:real) returns (z:real); -var - _v_1:real; -let - z = _v_1 / 2.0; - _v_1 = a + b; -tel --- end of node onlyroll::Average2 - -node onlyroll::Average( - x1:real; - x2:real; - x3:real; - x4:real; - f1:bool; - f2:bool; - f3:bool; - f4:bool) -returns ( - r:real); -var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:real; - _v_8:real; - _v_9:real; - _v_10:real; - _v_11:real; - _v_12:real; - _v_13:real; - _v_14:real; - _v_15:real; - _v_16:real; - _v_17:real; - _v_18:real; - _v_19:real; - _v_20:real; - _v_21:real; - _v_22:real; -let - r = if f1 then _v_5 else _v_22; - _v_1 = onlyroll::Average2(x3, x4); - _v_2 = onlyroll::Average2(x2, x4); - _v_3 = onlyroll::Average2(x3, x2); - _v_4 = if f3 then _v_2 else _v_3; - _v_5 = if f2 then _v_1 else _v_4; - _v_6 = onlyroll::Average2(x3, x4); - _v_7 = onlyroll::Average2(x1, x4); - _v_8 = onlyroll::Average2(x3, x1); - _v_9 = if f3 then _v_7 else _v_8; - _v_10 = if f1 then _v_6 else _v_9; - _v_11 = onlyroll::Average2(x1, x4); - _v_12 = onlyroll::Average2(x2, x1); - _v_13 = onlyroll::Average2(x4, x2); - _v_14 = if f4 then _v_12 else _v_13; - _v_15 = if f2 then _v_11 else _v_14; - _v_16 = onlyroll::Average2(x3, x1); - _v_17 = onlyroll::Average2(x2, x1); - _v_18 = onlyroll::Average2(x3, x2); - _v_19 = if f3 then _v_17 else _v_18; - _v_20 = if f2 then _v_16 else _v_19; - _v_21 = if f3 then _v_15 else _v_20; - _v_22 = if f2 then _v_10 else _v_21; -tel --- end of node onlyroll::Average - -node onlyroll::Calculate( - x1:real; - x2:real; - x3:real; - x4:real; - f1:bool; - f2:bool; - f3:bool; - f4:bool) -returns ( - x:real); -var - zero_roll:bool; - one_roll:bool; - two_roll:bool; - three_roll:bool; - cpt_roll:int; - _v_1:int; - _v_2:bool; - _v_3:int; - _v_4:int; - _v_5:int; - _v_6:int; - _v_7:bool; - _v_8:bool; - _v_9:real; - _v_10:bool; - _v_11:bool; - _v_12:real; - _v_13:bool; - _v_14:bool; - _v_15:real; - _v_16:real; - _v_17:real; -let - cpt_roll = 0 -> _v_6; - _v_1 = pre (cpt_roll); - _v_2 = _v_1 > 0; - _v_3 = pre (cpt_roll); - _v_4 = _v_3 - 1; - _v_5 = if _v_2 then _v_4 else 0; - _v_6 = if three_roll then 3 else _v_5; - zero_roll = onlyroll::noneof(f1, f2, f3, f4); - one_roll = onlyroll::oneoffour(f1, f2, f3, f4); - two_roll = onlyroll::twooffour(f1, f2, f3, f4); - three_roll = onlyroll::threeoffour(f1, f2, f3, f4); - x = if _v_8 then _v_9 else _v_17; - _v_7 = cpt_roll = 0; - _v_8 = zero_roll and _v_7; - _v_9 = onlyroll::OlympicAverage(x1, x2, x3, x4); - _v_10 = cpt_roll = 0; - _v_11 = one_roll and _v_10; - _v_12 = onlyroll::Median(x1, x2, x3, x4, f1, f2, f3, f4); - _v_13 = cpt_roll = 0; - _v_14 = two_roll and _v_13; - _v_15 = onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4); - _v_16 = if _v_14 then _v_15 else 1.0; - _v_17 = if _v_11 then _v_12 else _v_16; -tel --- end of node onlyroll::Calculate -node onlyroll::abs(v:real) returns (a:real); -var - _v_1:bool; - _v_2:real; -let - a = if _v_1 then v else _v_2; - _v_1 = v >= 0.0; - _v_2 = -v; -tel --- end of node onlyroll::abs -node onlyroll::maintain(n:int; val:bool) returns (m:bool); -var - cpt:int; - _v_1:int; - _v_2:int; - _v_3:int; - _v_4:int; -let - cpt = _v_1 -> _v_4; - _v_1 = if val then 1 else 0; - _v_2 = pre (cpt); - _v_3 = _v_2 + 1; - _v_4 = if val then _v_3 else 0; - m = cpt >= n; -tel --- end of node onlyroll::maintain - -node onlyroll::Monitor( - xa:real; - xb:real; - disc:bool) +tel +-- end of node onlyroll::min2 + +node onlyroll::min4( + one:real; + two:real; + three:real; + four:real) returns ( - local_value:real; - inline_monitor_failed:bool); + m:real); var _v_1:real; _v_2:real; - _v_3:bool; - _v_4:bool; let - inline_monitor_failed = _v_4 or disc; - _v_1 = xa - xb; - _v_2 = onlyroll::abs(_v_1); - _v_3 = _v_2 > 14.9; - _v_4 = onlyroll::maintain(3, _v_3); - local_value = xa; + m = onlyroll::min2(_v_1, _v_2); + _v_1 = onlyroll::min2(one, two); + _v_2 = onlyroll::min2(three, four); tel --- end of node onlyroll::Monitor -node onlyroll::InNominalRange(r:real) returns (i:bool); +-- end of node onlyroll::min4 + +node onlyroll::OlympicAverage( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); var - _v_1:bool; - _v_2:bool; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; + _v_7:real; let - i = _v_1 and _v_2; - _v_1 = r < 25.3; - _v_2 = r > -25.3; + m = _v_7 / 2.0; + _v_1 = one + two; + _v_2 = _v_1 + three; + _v_3 = _v_2 + four; + _v_4 = onlyroll::max4(one, two, three, four); + _v_5 = _v_3 - _v_4; + _v_6 = onlyroll::min4(one, two, three, four); + _v_7 = _v_5 - _v_6; tel --- end of node onlyroll::InNominalRange - -node onlyroll::values_nok( - pfother1:bool; - pfother2:bool; - pfother3:bool; - xi:real; - pxother1:real; - pxother2:real; - pxother3:real) -returns ( - r:bool); +-- end of node onlyroll::OlympicAverage +node onlyroll::MedianValue3(a:real; b:real; c:real) returns (z:real); var - one:bool; - two:bool; - three:bool; _v_1:real; _v_2:real; _v_3:real; _v_4:real; _v_5:real; _v_6:real; - _v_7:bool; - _v_8:bool; - _v_9:bool; - _v_10:bool; - _v_11:bool; - _v_12:bool; - _v_13:bool; - _v_14:bool; - _v_15:bool; - _v_16:bool; - _v_17:bool; - _v_18:bool; + _v_7:real; let - one = _v_2 > 51.0; - _v_1 = xi - pxother1; - _v_2 = onlyroll::abs(_v_1); - two = _v_4 > 51.0; - _v_3 = xi - pxother2; - _v_4 = onlyroll::abs(_v_3); - three = _v_6 > 51.0; - _v_5 = xi - pxother3; - _v_6 = onlyroll::abs(_v_5); - r = onlyroll::maintain(3, _v_18); - _v_7 = if pfother3 then false else three; - _v_8 = two and three; - _v_9 = if pfother3 then two else _v_8; - _v_10 = if pfother2 then _v_7 else _v_9; - _v_11 = one and three; - _v_12 = if pfother3 then one else _v_11; - _v_13 = one and two; - _v_14 = one and two; - _v_15 = _v_14 and three; - _v_16 = if pfother3 then _v_13 else _v_15; - _v_17 = if pfother2 then _v_12 else _v_16; - _v_18 = if pfother1 then _v_10 else _v_17; + z = _v_5 - _v_7; + _v_1 = a + b; + _v_2 = _v_1 + c; + _v_3 = onlyroll::min2(b, c); + _v_4 = onlyroll::min2(a, _v_3); + _v_5 = _v_2 - _v_4; + _v_6 = onlyroll::max2(b, c); + _v_7 = onlyroll::max2(a, _v_6); tel --- end of node onlyroll::values_nok +-- end of node onlyroll::MedianValue3 -node onlyroll::FailDetect( - local_failure:bool; - xi:real; - ongroundreset:bool; - inairreset:bool; - choffi:bool; - pxother1:real; - pxother2:real; - pxother3:real; - pfother1:bool; - pfother2:bool; - pfother3:bool; - a:bool) +node onlyroll::Median( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) returns ( - failure:bool; - debug_cross_failure:bool; - debug_st:int; - r:bool); + r:real); var - cross_failure:bool; - ps:int; - state:int; - from1to2:bool; - from1to3:bool; - from2to3:bool; - from2to1:bool; - from3to1:bool; - NLfaults:bool; - will_latch:bool; - reset:bool; - foreign_failure:bool; - _v_1:int; - _v_2:bool; - _v_3:bool; - _v_4:bool; - _v_5:bool; - _v_6:int; - _v_7:int; - _v_8:int; - _v_9:bool; - _v_10:bool; - _v_11:bool; - _v_12:int; - _v_13:int; - _v_14:bool; - _v_15:int; - _v_16:int; - _v_17:int; - _v_18:bool; - _v_19:bool; - _v_20:bool; - _v_21:bool; - _v_22:bool; - _v_23:bool; - _v_24:bool; - _v_25:bool; - _v_26:bool; - _v_27:bool; - _v_28:bool; - _v_29:bool; - _v_30:bool; - _v_31:bool; - _v_32:bool; - _v_33:int; - _v_34:bool; - _v_35:bool; - _v_36:int; - _v_37:bool; - _v_38:bool; - _v_39:bool; - _v_40:bool; - _v_41:bool; - _v_42:bool; -let - debug_st = state; - ps = 1 -> _v_1; - _v_1 = pre (state); - state = 1 -> _v_17; - _v_2 = ps = 1; - _v_3 = pre (reset); - _v_4 = pre (from1to2); - _v_5 = pre (from1to3); - _v_6 = if _v_5 then 3 else 1; - _v_7 = if _v_4 then 2 else _v_6; - _v_8 = if _v_3 then 1 else _v_7; - _v_9 = ps = 2; - _v_10 = pre (from2to1); - _v_11 = pre (from2to3); - _v_12 = if _v_11 then 3 else 2; - _v_13 = if _v_10 then 1 else _v_12; - _v_14 = pre (from3to1); - _v_15 = if _v_14 then 1 else 3; - _v_16 = if _v_9 then _v_13 else _v_15; - _v_17 = if _v_2 then _v_8 else _v_16; - failure = _v_20 or _v_22; - _v_18 = state = 2; - _v_19 = state = 3; - _v_20 = _v_18 or _v_19; - _v_21 = state = 1; - _v_22 = _v_21 and NLfaults; - reset = ongroundreset or _v_24; - _v_23 = not cross_failure; - _v_24 = inairreset and _v_23; - foreign_failure = _v_25 or pfother3; - _v_25 = pfother1 or pfother2; - NLfaults = choffi or local_failure; - from1to2 = will_latch and _v_27; - _v_26 = onlyroll::InNominalRange(xi); - _v_27 = not _v_26; - will_latch = cross_failure; - from1to3 = _v_28 and _v_29; - _v_28 = a and will_latch; - _v_29 = onlyroll::InNominalRange(xi); - from2to3 = a and _v_32; - _v_30 = pre (will_latch); - _v_31 = _v_30 and foreign_failure; - _v_32 = _v_31 or local_failure; - from3to1 = ongroundreset; - from2to1 = reset; - r = false -> _v_42; - _v_33 = pre (state); - _v_34 = _v_33 = 1; - _v_35 = _v_34 and cross_failure; - _v_36 = pre (state); - _v_37 = _v_36 = 2; - _v_38 = pre (cross_failure); - _v_39 = _v_38 and foreign_failure; - _v_40 = _v_37 and _v_39; - _v_41 = _v_40 or local_failure; - _v_42 = _v_35 or _v_41; - cross_failure = onlyroll::values_nok(pfother1, pfother2, pfother3, xi, - pxother1, pxother2, pxother3); - debug_cross_failure = cross_failure; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; +let + r = if f1 then _v_1 else _v_6; + _v_1 = onlyroll::MedianValue3(x2, x3, x4); + _v_2 = onlyroll::MedianValue3(x1, x3, x4); + _v_3 = onlyroll::MedianValue3(x1, x2, x4); + _v_4 = onlyroll::MedianValue3(x1, x2, x3); + _v_5 = if f3 then _v_3 else _v_4; + _v_6 = if f2 then _v_2 else _v_5; tel --- end of node onlyroll::FailDetect +-- end of node onlyroll::Median +node onlyroll::Average2(a:real; b:real) returns (z:real); +var + _v_1:real; +let + z = _v_1 / 2.0; + _v_1 = a + b; +tel +-- end of node onlyroll::Average2 -node onlyroll::Channel( - ongroundreset:bool; - inairreset:bool; - choffi:bool; - xai:real; - xbi:real; - disci:bool; - pxother1:real; - pxother2:real; - pxother3:real; - pfother1:bool; - pfother2:bool; - pfother3:bool; - allowedi:bool) +node onlyroll::Average( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) returns ( - xi:real; - fi:bool; - aski:bool; - debug_localfailure:bool; - debug_cross_failure:bool; - debug_st:int); + r:real); var - local_failure:bool; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; + _v_7:real; + _v_8:real; + _v_9:real; + _v_10:real; + _v_11:real; + _v_12:real; + _v_13:real; + _v_14:real; + _v_15:real; + _v_16:real; + _v_17:real; + _v_18:real; + _v_19:real; + _v_20:real; + _v_21:real; + _v_22:real; let - (xi, local_failure) = onlyroll::Monitor(xai, xbi, disci); - (fi, debug_cross_failure, debug_st, aski) = - onlyroll::FailDetect(local_failure, xi, ongroundreset, inairreset, choffi, - pxother1, pxother2, pxother3, pfother1, pfother2, pfother3, allowedi); - debug_localfailure = local_failure; + r = if f1 then _v_5 else _v_22; + _v_1 = onlyroll::Average2(x3, x4); + _v_2 = onlyroll::Average2(x2, x4); + _v_3 = onlyroll::Average2(x3, x2); + _v_4 = if f3 then _v_2 else _v_3; + _v_5 = if f2 then _v_1 else _v_4; + _v_6 = onlyroll::Average2(x3, x4); + _v_7 = onlyroll::Average2(x1, x4); + _v_8 = onlyroll::Average2(x3, x1); + _v_9 = if f3 then _v_7 else _v_8; + _v_10 = if f1 then _v_6 else _v_9; + _v_11 = onlyroll::Average2(x1, x4); + _v_12 = onlyroll::Average2(x2, x1); + _v_13 = onlyroll::Average2(x4, x2); + _v_14 = if f4 then _v_12 else _v_13; + _v_15 = if f2 then _v_11 else _v_14; + _v_16 = onlyroll::Average2(x3, x1); + _v_17 = onlyroll::Average2(x2, x1); + _v_18 = onlyroll::Average2(x3, x2); + _v_19 = if f3 then _v_17 else _v_18; + _v_20 = if f2 then _v_16 else _v_19; + _v_21 = if f3 then _v_15 else _v_20; + _v_22 = if f2 then _v_10 else _v_21; tel --- end of node onlyroll::Channel +-- end of node onlyroll::Average -node onlyroll::Allocator( - r1:bool; - r2:bool; - r3:bool; - r4:bool; - reset:bool) +node onlyroll::Calculate( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) returns ( - a1:bool; - a2:bool; - a3:bool; - a4:bool); + x:real); var - nb_aut:int; - already:int; - _v_1:bool; - _v_2:int; - _v_3:bool; - _v_4:bool; - _v_5:bool; - _v_6:bool; + zero_roll:bool; + one_roll:bool; + two_roll:bool; + three_roll:bool; + cpt_roll:int; + _v_1:int; + _v_2:bool; + _v_3:int; + _v_4:int; + _v_5:int; + _v_6:int; _v_7:bool; _v_8:bool; - _v_9:bool; + _v_9:real; _v_10:bool; _v_11:bool; - _v_12:bool; + _v_12:real; _v_13:bool; _v_14:bool; - _v_15:bool; - _v_16:bool; - _v_17:bool; - _v_18:bool; - _v_19:bool; - _v_20:bool; - _v_21:bool; - _v_22:bool; - _v_23:bool; - _v_24:bool; - _v_25:bool; - _v_26:bool; - _v_27:bool; - _v_28:bool; - _v_29:bool; - _v_30:bool; - _v_31:int; - _v_32:int; - _v_33:int; - _v_34:int; - _v_35:int; - _v_36:int; - _v_37:int; - _v_38:int; - _v_39:int; + _v_15:real; + _v_16:real; + _v_17:real; let - already = if _v_1 then 0 else _v_2; - _v_1 = true -> reset; - _v_2 = pre (nb_aut); - a1 = r1 and _v_3; - _v_3 = already <= 1; - a2 = r2 and _v_9; - _v_4 = not r1; - _v_5 = already <= 1; - _v_6 = _v_4 and _v_5; - _v_7 = already = 0; - _v_8 = r1 and _v_7; - _v_9 = _v_6 or _v_8; - a3 = r3 and _v_18; - _v_10 = not r1; - _v_11 = not r2; - _v_12 = _v_10 and _v_11; - _v_13 = already <= 1; - _v_14 = _v_12 and _v_13; - _v_15 = #(r1, r2); - _v_16 = already = 0; - _v_17 = _v_15 and _v_16; - _v_18 = _v_14 or _v_17; - a4 = r4 and _v_29; - _v_19 = not r1; - _v_20 = not r2; - _v_21 = _v_19 and _v_20; - _v_22 = not r3; - _v_23 = _v_21 and _v_22; - _v_24 = already <= 1; - _v_25 = _v_23 and _v_24; - _v_26 = #(r1, r2, r3); - _v_27 = already = 0; - _v_28 = _v_26 and _v_27; - _v_29 = _v_25 or _v_28; - nb_aut = if _v_30 then 0 else _v_39; - _v_30 = true -> reset; - _v_31 = pre (nb_aut); - _v_32 = if a4 then 1 else 0; - _v_33 = 0 + _v_32; - _v_34 = if a3 then 1 else _v_33; - _v_35 = 0 + _v_34; - _v_36 = if a2 then 1 else _v_35; - _v_37 = 0 + _v_36; - _v_38 = if a1 then 1 else _v_37; - _v_39 = _v_31 + _v_38; + cpt_roll = 0 -> _v_6; + _v_1 = pre (cpt_roll); + _v_2 = _v_1 > 0; + _v_3 = pre (cpt_roll); + _v_4 = _v_3 - 1; + _v_5 = if _v_2 then _v_4 else 0; + _v_6 = if three_roll then 3 else _v_5; + zero_roll = onlyroll::noneof(f1, f2, f3, f4); + one_roll = onlyroll::oneoffour(f1, f2, f3, f4); + two_roll = onlyroll::twooffour(f1, f2, f3, f4); + three_roll = onlyroll::threeoffour(f1, f2, f3, f4); + x = if _v_8 then _v_9 else _v_17; + _v_7 = cpt_roll = 0; + _v_8 = zero_roll and _v_7; + _v_9 = onlyroll::OlympicAverage(x1, x2, x3, x4); + _v_10 = cpt_roll = 0; + _v_11 = one_roll and _v_10; + _v_12 = onlyroll::Median(x1, x2, x3, x4, f1, f2, f3, f4); + _v_13 = cpt_roll = 0; + _v_14 = two_roll and _v_13; + _v_15 = onlyroll::Average(x1, x2, x3, x4, f1, f2, f3, f4); + _v_16 = if _v_14 then _v_15 else 1.0; + _v_17 = if _v_11 then _v_12 else _v_16; tel --- end of node onlyroll::Allocator +-- end of node onlyroll::Calculate node onlyroll::onlyroll( xa1:real; @@ -15091,35 +15079,145 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll2.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/onlyroll2.lus -const onlyroll2::NRminP = -5.1; -const onlyroll2::NRminR = -25.3; -const onlyroll2::NRmaxP = 5.1; -const onlyroll2::DELTA_PITCH = 3.0; const onlyroll2::NRmaxR = 25.3; +const onlyroll2::CROSS_CH_TOL_ROLL = 51.0; +const onlyroll2::HORmaxP = 57.0; +const onlyroll2::DELTA_PITCH = 3.0; +const onlyroll2::HORmaxR = 285.0; +const onlyroll2::CROSS_CH_TOL_YAW = 10.0; const onlyroll2::FAIL_SAFE_PITCH_VALUE = 4.0; -const onlyroll2::DELTA_YAW = 2.73; -const onlyroll2::NRminY = -5.0; -const onlyroll2::HORminP = -57.0; +const onlyroll2::NRmaxP = 5.1; const onlyroll2::XFAIL_SAFE_ROLL_VALUE = 1.1; -const onlyroll2::NRmaxY = 5.0; -const onlyroll2::HORminR = -285.0; -const onlyroll2::HORmaxP = 57.0; +const onlyroll2::TIME_CROSS_ROLL = 3; +const onlyroll2::TIME5 = 4; +const onlyroll2::TIME_ROLL = 3; const onlyroll2::CROSS_CH_TOL_PITCH = 10.1; -const onlyroll2::HORmaxR = 285.0; -const onlyroll2::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll2::DELTA_YAW = 2.73; const onlyroll2::HORminY = -57.0; -const onlyroll2::DELTA_ROLL = 14.9; -const onlyroll2::FAIL_SAFE_ROLL_VALUE = 1.0; +const onlyroll2::NRminP = -5.1; const onlyroll2::OneSecond = 10; -const onlyroll2::HORmaxY = 57.0; -const onlyroll2::TIME_ROLL = 3; -const onlyroll2::CROSS_CH_TOL_ROLL = 51.0; -const onlyroll2::BID_LAST = 2.2; -const onlyroll2::TIME5 = 4; const onlyroll2::SAFE_COUNTER_TIME = 3; +const onlyroll2::HORminP = -57.0; +const onlyroll2::HORmaxY = 57.0; +const onlyroll2::FAIL_SAFE_ROLL_VALUE = 1.0; const onlyroll2::BID_VAL = 3.3; -const onlyroll2::CROSS_CH_TOL_YAW = 10.0; -const onlyroll2::TIME_CROSS_ROLL = 3; +const onlyroll2::NRminY = -5.0; +const onlyroll2::BID_LAST = 2.2; +const onlyroll2::DELTA_ROLL = 14.9; +const onlyroll2::FAIL_SAFE_YAW_VALUE = 4.0; +const onlyroll2::NRminR = -25.3; +const onlyroll2::HORminR = -285.0; +const onlyroll2::NRmaxY = 5.0; +node onlyroll2::min2(one:real; two:real) returns (m:real); +var + _v_1:bool; +let + m = if _v_1 then one else two; + _v_1 = one < two; +tel +-- end of node onlyroll2::min2 + +node onlyroll2::min4( + one:real; + two:real; + three:real; + four:real) +returns ( + m:real); +var + _v_1:real; + _v_2:real; +let + m = onlyroll2::min2(_v_1, _v_2); + _v_1 = onlyroll2::min2(one, two); + _v_2 = onlyroll2::min2(three, four); +tel +-- end of node onlyroll2::min4 +node onlyroll2::maintain(n:int; val:bool) returns (m:bool); +var + cpt:int; + _v_1:int; + _v_2:int; + _v_3:int; + _v_4:int; +let + cpt = _v_1 -> _v_4; + _v_1 = if val then 1 else 0; + _v_2 = pre (cpt); + _v_3 = _v_2 + 1; + _v_4 = if val then _v_3 else 0; + m = cpt >= n; +tel +-- end of node onlyroll2::maintain +node onlyroll2::Average2(a:real; b:real) returns (z:real); +var + _v_1:real; +let + z = _v_1 / 2.0; + _v_1 = a + b; +tel +-- end of node onlyroll2::Average2 + +node onlyroll2::Average( + x1:real; + x2:real; + x3:real; + x4:real; + f1:bool; + f2:bool; + f3:bool; + f4:bool) +returns ( + r:real); +var + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; + _v_7:real; + _v_8:real; + _v_9:real; + _v_10:real; + _v_11:real; + _v_12:real; + _v_13:real; + _v_14:real; + _v_15:real; + _v_16:real; + _v_17:real; + _v_18:real; + _v_19:real; + _v_20:real; + _v_21:real; + _v_22:real; +let + r = if f1 then _v_5 else _v_22; + _v_1 = onlyroll2::Average2(x3, x4); + _v_2 = onlyroll2::Average2(x2, x4); + _v_3 = onlyroll2::Average2(x3, x2); + _v_4 = if f3 then _v_2 else _v_3; + _v_5 = if f2 then _v_1 else _v_4; + _v_6 = onlyroll2::Average2(x3, x4); + _v_7 = onlyroll2::Average2(x1, x4); + _v_8 = onlyroll2::Average2(x3, x1); + _v_9 = if f3 then _v_7 else _v_8; + _v_10 = if f1 then _v_6 else _v_9; + _v_11 = onlyroll2::Average2(x1, x4); + _v_12 = onlyroll2::Average2(x2, x1); + _v_13 = onlyroll2::Average2(x4, x2); + _v_14 = if f4 then _v_12 else _v_13; + _v_15 = if f2 then _v_11 else _v_14; + _v_16 = onlyroll2::Average2(x3, x1); + _v_17 = onlyroll2::Average2(x2, x1); + _v_18 = onlyroll2::Average2(x3, x2); + _v_19 = if f3 then _v_17 else _v_18; + _v_20 = if f2 then _v_16 else _v_19; + _v_21 = if f3 then _v_15 else _v_20; + _v_22 = if f2 then _v_10 else _v_21; +tel +-- end of node onlyroll2::Average node onlyroll2::noneof( f1:bool; @@ -15393,31 +15491,6 @@ let _v_2 = onlyroll2::max2(three, four); tel -- end of node onlyroll2::max4 -node onlyroll2::min2(one:real; two:real) returns (m:real); -var - _v_1:bool; -let - m = if _v_1 then one else two; - _v_1 = one < two; -tel --- end of node onlyroll2::min2 - -node onlyroll2::min4( - one:real; - two:real; - three:real; - four:real) -returns ( - m:real); -var - _v_1:real; - _v_2:real; -let - m = onlyroll2::min2(_v_1, _v_2); - _v_1 = onlyroll2::min2(one, two); - _v_2 = onlyroll2::min2(three, four); -tel --- end of node onlyroll2::min4 node onlyroll2::OlympicAverage( one:real; @@ -15494,75 +15567,6 @@ let _v_6 = if f2 then _v_2 else _v_5; tel -- end of node onlyroll2::Median -node onlyroll2::Average2(a:real; b:real) returns (z:real); -var - _v_1:real; -let - z = _v_1 / 2.0; - _v_1 = a + b; -tel --- end of node onlyroll2::Average2 - -node onlyroll2::Average( - x1:real; - x2:real; - x3:real; - x4:real; - f1:bool; - f2:bool; - f3:bool; - f4:bool) -returns ( - r:real); -var - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; - _v_7:real; - _v_8:real; - _v_9:real; - _v_10:real; - _v_11:real; - _v_12:real; - _v_13:real; - _v_14:real; - _v_15:real; - _v_16:real; - _v_17:real; - _v_18:real; - _v_19:real; - _v_20:real; - _v_21:real; - _v_22:real; -let - r = if f1 then _v_5 else _v_22; - _v_1 = onlyroll2::Average2(x3, x4); - _v_2 = onlyroll2::Average2(x2, x4); - _v_3 = onlyroll2::Average2(x3, x2); - _v_4 = if f3 then _v_2 else _v_3; - _v_5 = if f2 then _v_1 else _v_4; - _v_6 = onlyroll2::Average2(x3, x4); - _v_7 = onlyroll2::Average2(x1, x4); - _v_8 = onlyroll2::Average2(x3, x1); - _v_9 = if f3 then _v_7 else _v_8; - _v_10 = if f1 then _v_6 else _v_9; - _v_11 = onlyroll2::Average2(x1, x4); - _v_12 = onlyroll2::Average2(x2, x1); - _v_13 = onlyroll2::Average2(x4, x2); - _v_14 = if f4 then _v_12 else _v_13; - _v_15 = if f2 then _v_11 else _v_14; - _v_16 = onlyroll2::Average2(x3, x1); - _v_17 = onlyroll2::Average2(x2, x1); - _v_18 = onlyroll2::Average2(x3, x2); - _v_19 = if f3 then _v_17 else _v_18; - _v_20 = if f2 then _v_16 else _v_19; - _v_21 = if f3 then _v_15 else _v_20; - _v_22 = if f2 then _v_10 else _v_21; -tel --- end of node onlyroll2::Average node onlyroll2::Calculate( x1:real; @@ -15630,26 +15634,10 @@ var _v_2:real; let a = if _v_1 then v else _v_2; - _v_1 = v >= 0.0; - _v_2 = -v; -tel --- end of node onlyroll2::abs -node onlyroll2::maintain(n:int; val:bool) returns (m:bool); -var - cpt:int; - _v_1:int; - _v_2:int; - _v_3:int; - _v_4:int; -let - cpt = _v_1 -> _v_4; - _v_1 = if val then 1 else 0; - _v_2 = pre (cpt); - _v_3 = _v_2 + 1; - _v_4 = if val then _v_3 else 0; - m = cpt >= n; + _v_1 = v >= 0.0; + _v_2 = -v; tel --- end of node onlyroll2::maintain +-- end of node onlyroll2::abs node onlyroll2::Monitor( xa:real; @@ -16010,6 +15998,16 @@ let _v_39 = _v_31 + _v_38; tel -- end of node onlyroll2::Allocator +node onlyroll2::InHardoverRange(r:real) returns (i:bool); +var + _v_1:bool; + _v_2:bool; +let + i = _v_1 or _v_2; + _v_1 = r > 285.0; + _v_2 = r < -285.0; +tel +-- end of node onlyroll2::InHardoverRange node onlyroll2::onlyroll2( xa1:real; @@ -16191,21 +16189,22 @@ let x = onlyroll2::Calculate(x1, x2, x3, x4, f1, f2, f3, f4); tel -- end of node onlyroll2::onlyroll2 -node onlyroll2::InHardoverRange(r:real) returns (i:bool); -var - _v_1:bool; - _v_2:bool; -let - i = _v_1 or _v_2; - _v_1 = r > 285.0; - _v_2 = r < -285.0; -tel --- end of node onlyroll2::InHardoverRange ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/test.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/test.lus +node test::two_outputs(c1:bool; c2:bool) returns (c4:bool; c5:bool); +var + _v_1:bool; + _v_2:bool; +let + c4 = false -> _v_1; + _v_1 = pre (c1); + c5 = true -> _v_2; + _v_2 = pre (c2); +tel +-- end of node test::two_outputs node test::three_outputs( c1:bool; @@ -16228,17 +16227,6 @@ let _v_3 = if c1 then c3 else c3; tel -- end of node test::three_outputs -node test::two_outputs(c1:bool; c2:bool) returns (c4:bool; c5:bool); -var - _v_1:bool; - _v_2:bool; -let - c4 = false -> _v_1; - _v_1 = pre (c1); - c5 = true -> _v_2; - _v_2 = pre (c2); -tel --- end of node test::two_outputs node test::test( b1:bool; @@ -16281,11 +16269,11 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/toolate.lus -- ../lus2lic -vl 2 --nonreg-test should_work/fab_test/toolate.lus -type _toolate::tab1 = int^2; -type _toolate::tab2 = A_int_3^4; -type _toolate::tab3 = A_A_int_5_6^7; const toolate::ze_const_int = 5; type _toolate::bool4 = bool^5; +type _toolate::tab3 = A_A_int_5_6^7; +type _toolate::tab2 = A_int_3^4; +type _toolate::tab1 = int^2; type _toolate::really = real; node toolate::bidon(in:bool) returns (out1:bool; out2:bool); var @@ -16303,33 +16291,6 @@ let out2 = false and in; tel -- end of node toolate::bidon -node toolate::edge_detect(in:bool) returns (edge:bool); -var - bidon1:bool; - bidon2:bool; - _v_1:bool; - _v_2:bool; - _v_3:bool; - _v_4:bool; - _v_5:bool; -let - edge = false -> _v_5; - _v_1 = pre (in); - _v_2 = not _v_1; - _v_3 = in and _v_2; - _v_4 = bidon2 and bidon1; - _v_5 = _v_3 or _v_4; - (bidon1, bidon2) = toolate::bidon(in); -tel --- end of node toolate::edge_detect -node toolate::implies(X:bool; Y:bool) returns (XimpliesY:bool); -var - _v_1:bool; -let - XimpliesY = _v_1 or Y; - _v_1 = not X; -tel --- end of node toolate::implies node toolate::after(X:bool) returns (afterX:bool); var bidon1:bool; @@ -16363,6 +16324,14 @@ let _v_5 = if _v_1 then _v_4 else false; tel -- end of node toolate::once_since +node toolate::implies(X:bool; Y:bool) returns (XimpliesY:bool); +var + _v_1:bool; +let + XimpliesY = _v_1 or Y; + _v_1 = not X; +tel +-- end of node toolate::implies node toolate::once_from_to(C:bool; A:bool; B:bool) returns (X:bool); var _v_1:bool; @@ -16399,11 +16368,30 @@ let _v_7 = toolate::once_from_to(action, begin, en); tel -- end of node toolate::toolate +node toolate::edge_detect(in:bool) returns (edge:bool); +var + bidon1:bool; + bidon2:bool; + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; + _v_5:bool; +let + edge = false -> _v_5; + _v_1 = pre (in); + _v_2 = not _v_1; + _v_3 = in and _v_2; + _v_4 = bidon2 and bidon1; + _v_5 = _v_3 or _v_4; + (bidon1, bidon2) = toolate::bidon(in); +tel +-- end of node toolate::edge_detect -- automatically defined aliases: -type A_int_2 = int^2; -type A_A_int_5_6 = A_int_5^6; type A_int_5 = int^5; +type A_A_int_5_6 = A_int_5^6; type A_int_3 = int^3; +type A_int_2 = int^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/fab_test/toto.lus @@ -16473,138 +16461,79 @@ type A_real_10 = real^10; ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/Gyroscope.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/Gyroscope.lus +type _Gyroscope::Valid_ChannelT = struct {local_failure : bool; local_value : real}; type _Gyroscope::Faulty_ChannelT = struct {valuea : real; valueb : real}; type _Gyroscope::Faulty_Array = A__Gyroscope::Faulty_ChannelT_4^3; -type _Gyroscope::Valid_ChannelT = struct {local_failure : bool; local_value : real}; const Gyroscope::DELTA_PITCH = 2.0; +const Gyroscope::TIME = 3; +const Gyroscope::DELTA_TO_GOD_PITCH = 2.0; +const Gyroscope::DELTA_TO_GOD_ROLL = 2.0; const Gyroscope::DELTA_YAW = 2.0; -const Gyroscope::DELTA_TO_GOD_YAW = 2.0; -const Gyroscope::DELTA_ROLL = 2.0; -const Gyroscope::GOD_PITCH = 16.0; const Gyroscope::GOD_ROLL = 15.0; const Gyroscope::GOD_YAW = 14.0; -const Gyroscope::DELTA_TO_GOD_ROLL = 2.0; -const Gyroscope::TIME = 3; -const Gyroscope::DELTA_TO_GOD_PITCH = 2.0; -node Gyroscope::abs(in:real) returns (out:real); +const Gyroscope::GOD_PITCH = 16.0; +const Gyroscope::DELTA_ROLL = 2.0; +const Gyroscope::DELTA_TO_GOD_YAW = 2.0; +node Gyroscope::min_int(n1:int; n2:int) returns (n:int); var _v_1:bool; - _v_2:real; let - out = if _v_1 then _v_2 else in; - _v_1 = in < 0.0; - _v_2 = -in; + n = if _v_1 then n2 else n1; + _v_1 = n1 > n2; tel --- end of node Gyroscope::abs +-- end of node Gyroscope::min_int -node Gyroscope::ValueIsSecureII( - accu_in:bool; - secure_value:real; - delta_to_god:real; - god_value:real) +node Gyroscope::guaranteeSum( + accu_in:real; + elt_in:real; + accu_out:real) returns ( - is_valid:bool); + guaranteeOK:bool); var + otherVarBidon:real; _v_1:real; - _v_2:real; - _v_3:bool; let - is_valid = _v_3 and accu_in; - _v_1 = secure_value - god_value; - _v_2 = Gyroscope::abs(_v_1); - _v_3 = _v_2 < 2.0; + otherVarBidon = 1.0; + guaranteeOK = _v_1 < accu_out; + _v_1 = elt_in + otherVarBidon; tel --- end of node Gyroscope::ValueIsSecureII - -node Gyroscope::countFalse( - accu_in:real; - elt_in:_Gyroscope::Valid_ChannelT) -returns ( - accu_out:real); +-- end of node Gyroscope::guaranteeSum +node Gyroscope::abs(in:real) returns (out:real); var _v_1:bool; _v_2:real; let - accu_out = if _v_1 then accu_in else _v_2; - _v_1 = elt_in.local_failure; - _v_2 = accu_in + 1.0; + out = if _v_1 then _v_2 else in; + _v_1 = in < 0.0; + _v_2 = -in; tel --- end of node Gyroscope::countFalse +-- end of node Gyroscope::abs -node Gyroscope::TooFar( - nbToFarIn:int; - channel:_Gyroscope::Faulty_ChannelT; +node Gyroscope::iteratedVoter( + acc_in:bool; + channel:_Gyroscope::Valid_ChannelT; god:real; - delta_to_god:real) + delta_to_god:real; + vote:real) returns ( - nbToFarOut:int); + acc_out:bool); var - _v_1:real; + _v_1:bool; _v_2:real; _v_3:real; - _v_4:bool; - _v_5:int; -let - nbToFarOut = if _v_4 then _v_5 else nbToFarIn; - _v_1 = channel.valuea; - _v_2 = _v_1 - god; - _v_3 = Gyroscope::abs(_v_2); - _v_4 = _v_3 < delta_to_god; - _v_5 = nbToFarIn + 1; -tel --- end of node Gyroscope::TooFar - -node Gyroscope::assumeEvaluateAxis( - channels:A__Gyroscope::Faulty_ChannelT_4; - delta:real; - god:real; - delta_to_god:real) -returns ( - assumeOK:bool); -var - NbToFar:int; - _v_1:A_real_4; - _v_2:A_real_4; -let - NbToFar = red<<Gyroscope::TooFar, 4>>(0, channels, _v_1, _v_2); - _v_1 = god^4; - _v_2 = delta_to_god^4; - assumeOK = NbToFar <= 1; -tel --- end of node Gyroscope::assumeEvaluateAxis - -node Gyroscope::assumeSum( - accu_in:real; - elt_in:real) -returns ( - assumeOK:bool); -var - varBidon:real; -let - varBidon = 1.0; - assumeOK = varBidon < elt_in; -tel --- end of node Gyroscope::assumeSum - -node Gyroscope::assumeChannel( - inChannel:_Gyroscope::Faulty_ChannelT; - delta:real; - god:real; - delta_to_god:real) -returns ( - assumeOK:bool); -let - assumeOK = true; -tel --- end of node Gyroscope::assumeChannel -node Gyroscope::min_int(n1:int; n2:int) returns (n:int); -var - _v_1:bool; + _v_4:real; + _v_5:bool; + _v_6:bool; let - n = if _v_1 then n2 else n1; - _v_1 = n1 > n2; + acc_out = acc_in and _v_6; + _v_1 = channel.local_failure; + _v_2 = channel.local_value; + _v_3 = vote - _v_2; + _v_4 = Gyroscope::abs(_v_3); + _v_5 = _v_4 < delta_to_god; + _v_6 = _v_1 or _v_5; tel --- end of node Gyroscope::min_int +-- end of node Gyroscope::iteratedVoter node Gyroscope::Maintain(n:int; val:bool) returns (m:bool); var cpt:int; @@ -16660,6 +16589,21 @@ let tel -- end of node Gyroscope::Channel +node Gyroscope::countFalse( + accu_in:real; + elt_in:_Gyroscope::Valid_ChannelT) +returns ( + accu_out:real); +var + _v_1:bool; + _v_2:real; +let + accu_out = if _v_1 then accu_in else _v_2; + _v_1 = elt_in.local_failure; + _v_2 = accu_in + 1.0; +tel +-- end of node Gyroscope::countFalse + node Gyroscope::countValidChannels( channels:A__Gyroscope::Valid_ChannelT_4) returns ( @@ -16668,6 +16612,49 @@ let nb = red<<Gyroscope::countFalse, 4>>(0.0, channels); tel -- end of node Gyroscope::countValidChannels + +node Gyroscope::TooFar( + nbToFarIn:int; + channel:_Gyroscope::Faulty_ChannelT; + god:real; + delta_to_god:real) +returns ( + nbToFarOut:int); +var + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:bool; + _v_5:int; +let + nbToFarOut = if _v_4 then _v_5 else nbToFarIn; + _v_1 = channel.valuea; + _v_2 = _v_1 - god; + _v_3 = Gyroscope::abs(_v_2); + _v_4 = _v_3 < delta_to_god; + _v_5 = nbToFarIn + 1; +tel +-- end of node Gyroscope::TooFar + +node Gyroscope::guaranteeVoter( + channels:A__Gyroscope::Valid_ChannelT_4; + god:real; + delta_to_god:real; + vote:real) +returns ( + guaranteeOK:bool); +var + _v_1:A_real_4; + _v_2:A_real_4; + _v_3:A_real_4; +let + guaranteeOK = red<<Gyroscope::iteratedVoter, 4>>(true, channels, _v_1, + _v_2, _v_3); + _v_1 = god^4; + _v_2 = delta_to_god^4; + _v_3 = vote^4; +tel +-- end of node Gyroscope::guaranteeVoter node Gyroscope::sum(accu_in:real; elt_in:real) returns (accu_out:real); let accu_out = accu_in + elt_in; @@ -16747,6 +16734,56 @@ let tel -- end of node Gyroscope::EvaluateAxis +node Gyroscope::guaranteeEvaluateAxis( + channels:A__Gyroscope::Faulty_ChannelT_4; + delta:real; + god:real; + delta_to_god:real; + AxisValue:real) +returns ( + guaranteeOK:bool); +var + _v_1:real; + _v_2:real; +let + guaranteeOK = _v_2 < delta_to_god; + _v_1 = AxisValue - god; + _v_2 = Gyroscope::abs(_v_1); +tel +-- end of node Gyroscope::guaranteeEvaluateAxis + +node Gyroscope::assumeSum( + accu_in:real; + elt_in:real) +returns ( + assumeOK:bool); +var + varBidon:real; +let + varBidon = 1.0; + assumeOK = varBidon < elt_in; +tel +-- end of node Gyroscope::assumeSum + +node Gyroscope::ValueIsSecureII( + accu_in:bool; + secure_value:real; + delta_to_god:real; + god_value:real) +returns ( + is_valid:bool); +var + _v_1:real; + _v_2:real; + _v_3:bool; +let + is_valid = _v_3 and accu_in; + _v_1 = secure_value - god_value; + _v_2 = Gyroscope::abs(_v_1); + _v_3 = _v_2 < 2.0; +tel +-- end of node Gyroscope::ValueIsSecureII + node Gyroscope::Gyroscope( axis:A_A__Gyroscope::Faulty_ChannelT_4_3) returns ( @@ -16770,69 +16807,40 @@ let tel -- end of node Gyroscope::Gyroscope -node Gyroscope::guaranteeChannel( - inChannel:_Gyroscope::Faulty_ChannelT; - delta:real; - god:real; - delta_to_god:real; - outChannel:_Gyroscope::Valid_ChannelT) +node Gyroscope::ValueIsSecure( + secure_value:real; + delta_to_god_value:real; + god_value:real) returns ( - guaranteeOK:bool); + is_valid:bool); var - _v_1:bool; + _v_1:real; _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:bool; - _v_7:real; - _v_8:real; - _v_9:real; - _v_10:real; - _v_11:bool; - _v_12:bool; let - guaranteeOK = _v_1 or _v_12; - _v_1 = outChannel.local_failure; - _v_2 = inChannel.valuea; - _v_3 = outChannel.local_value; - _v_4 = _v_2 - _v_3; - _v_5 = Gyroscope::abs(_v_4); - _v_6 = _v_5 < delta; - _v_7 = inChannel.valueb; - _v_8 = outChannel.local_value; - _v_9 = _v_7 - _v_8; - _v_10 = Gyroscope::abs(_v_9); - _v_11 = _v_10 < delta; - _v_12 = _v_6 and _v_11; + is_valid = _v_2 < delta_to_god_value; + _v_1 = secure_value - god_value; + _v_2 = Gyroscope::abs(_v_1); tel --- end of node Gyroscope::guaranteeChannel +-- end of node Gyroscope::ValueIsSecure -node Gyroscope::iteratedVoter( - acc_in:bool; - channel:_Gyroscope::Valid_ChannelT; +node Gyroscope::assumeEvaluateAxis( + channels:A__Gyroscope::Faulty_ChannelT_4; + delta:real; god:real; - delta_to_god:real; - vote:real) + delta_to_god:real) returns ( - acc_out:bool); + assumeOK:bool); var - _v_1:bool; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:bool; - _v_6:bool; + NbToFar:int; + _v_1:A_real_4; + _v_2:A_real_4; let - acc_out = acc_in and _v_6; - _v_1 = channel.local_failure; - _v_2 = channel.local_value; - _v_3 = vote - _v_2; - _v_4 = Gyroscope::abs(_v_3); - _v_5 = _v_4 < delta_to_god; - _v_6 = _v_1 or _v_5; + NbToFar = red<<Gyroscope::TooFar, 4>>(0, channels, _v_1, _v_2); + _v_1 = god^4; + _v_2 = delta_to_god^4; + assumeOK = NbToFar <= 1; tel --- end of node Gyroscope::iteratedVoter +-- end of node Gyroscope::assumeEvaluateAxis node Gyroscope::assumeVoter( channels:A__Gyroscope::Valid_ChannelT_4; @@ -16845,81 +16853,61 @@ let tel -- end of node Gyroscope::assumeVoter -node Gyroscope::guaranteeEvaluateAxis( - channels:A__Gyroscope::Faulty_ChannelT_4; +node Gyroscope::assumeChannel( + inChannel:_Gyroscope::Faulty_ChannelT; delta:real; god:real; - delta_to_god:real; - AxisValue:real) -returns ( - guaranteeOK:bool); -var - _v_1:real; - _v_2:real; -let - guaranteeOK = _v_2 < delta_to_god; - _v_1 = AxisValue - god; - _v_2 = Gyroscope::abs(_v_1); -tel --- end of node Gyroscope::guaranteeEvaluateAxis - -node Gyroscope::ValueIsSecure( - secure_value:real; - delta_to_god_value:real; - god_value:real) -returns ( - is_valid:bool); -var - _v_1:real; - _v_2:real; -let - is_valid = _v_2 < delta_to_god_value; - _v_1 = secure_value - god_value; - _v_2 = Gyroscope::abs(_v_1); -tel --- end of node Gyroscope::ValueIsSecure - -node Gyroscope::guaranteeSum( - accu_in:real; - elt_in:real; - accu_out:real) + delta_to_god:real) returns ( - guaranteeOK:bool); -var - otherVarBidon:real; - _v_1:real; + assumeOK:bool); let - otherVarBidon = 1.0; - guaranteeOK = _v_1 < accu_out; - _v_1 = elt_in + otherVarBidon; + assumeOK = true; tel --- end of node Gyroscope::guaranteeSum +-- end of node Gyroscope::assumeChannel -node Gyroscope::guaranteeVoter( - channels:A__Gyroscope::Valid_ChannelT_4; +node Gyroscope::guaranteeChannel( + inChannel:_Gyroscope::Faulty_ChannelT; + delta:real; god:real; delta_to_god:real; - vote:real) + outChannel:_Gyroscope::Valid_ChannelT) returns ( guaranteeOK:bool); var - _v_1:A_real_4; - _v_2:A_real_4; - _v_3:A_real_4; + _v_1:bool; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:bool; + _v_7:real; + _v_8:real; + _v_9:real; + _v_10:real; + _v_11:bool; + _v_12:bool; let - guaranteeOK = red<<Gyroscope::iteratedVoter, 4>>(true, channels, _v_1, - _v_2, _v_3); - _v_1 = god^4; - _v_2 = delta_to_god^4; - _v_3 = vote^4; + guaranteeOK = _v_1 or _v_12; + _v_1 = outChannel.local_failure; + _v_2 = inChannel.valuea; + _v_3 = outChannel.local_value; + _v_4 = _v_2 - _v_3; + _v_5 = Gyroscope::abs(_v_4); + _v_6 = _v_5 < delta; + _v_7 = inChannel.valueb; + _v_8 = outChannel.local_value; + _v_9 = _v_7 - _v_8; + _v_10 = Gyroscope::abs(_v_9); + _v_11 = _v_10 < delta; + _v_12 = _v_6 and _v_11; tel --- end of node Gyroscope::guaranteeVoter +-- end of node Gyroscope::guaranteeChannel -- automatically defined aliases: +type A__Gyroscope::Faulty_ChannelT_4 = _Gyroscope::Faulty_ChannelT^4; +type A_real_3 = real^3; type A_real_4 = real^4; -type A_A__Gyroscope::Faulty_ChannelT_4_3 = A__Gyroscope::Faulty_ChannelT_4^3; type A__Gyroscope::Valid_ChannelT_4 = _Gyroscope::Valid_ChannelT^4; -type A_real_3 = real^3; -type A__Gyroscope::Faulty_ChannelT_4 = _Gyroscope::Faulty_ChannelT^4; +type A_A__Gyroscope::Faulty_ChannelT_4_3 = A__Gyroscope::Faulty_ChannelT_4^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/ProduitBool/produitBool.lus @@ -16929,9 +16917,9 @@ type A__Gyroscope::Faulty_ChannelT_4 = _Gyroscope::Faulty_ChannelT^4; const produitBool::size = 10; type _produitBool::Tacc_in = struct {multiplieur : A_bool_10; rank : int}; type _produitBool::T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; -type _produitBool::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; type _produitBool::Tacc_inShift2 = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; type _produitBool::Tacc_inShift = struct {acc_in_PLC : _produitBool::Tacc_in; actual_rank : int}; +type _produitBool::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; node produitBool::iterated_isElementOf_( acc_in:_produitBool::T_isElementOf_; @@ -16969,6 +16957,19 @@ let tel -- end of node produitBool::_isElementOf_ +node produitBool::produitBool( + multiplicande:A_bool_10; + multiplieur:A_bool_10) +returns ( + matrice:A_A_bool_20_10); +var + _v_1:A_bool_20; +let + matrice = _v_1^10; + _v_1 = true^20; +tel +-- end of node produitBool::produitBool + node produitBool::selectOneStage( acc_in:_produitBool::iteratedStruct; currentElt:bool) @@ -17080,19 +17081,6 @@ let tel -- end of node produitBool::shift -node produitBool::produitBool( - multiplicande:A_bool_10; - multiplieur:A_bool_10) -returns ( - matrice:A_A_bool_20_10); -var - _v_1:A_bool_20; -let - matrice = _v_1^10; - _v_1 = true^20; -tel --- end of node produitBool::produitBool - node produitBool::PLC( acc_in:_produitBool::Tacc_in; multiplicande:bool) @@ -17113,8 +17101,8 @@ tel -- end of node produitBool::PLC -- automatically defined aliases: type A_bool_10 = bool^10; -type A_A_bool_20_10 = A_bool_20^10; type A_bool_20 = bool^20; +type A_A_bool_20_10 = A_bool_20^10; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/ProduitBool/shiftFill_ludic.lus @@ -17122,14 +17110,14 @@ type A_bool_20 = bool^20; -- should_work/lionel/ProduitBool/shiftFill_ludic.lus type _shiftFill_ludic::T1_ARRAY = bool^10; -type _shiftFill_ludic::T4_STRUCT = struct {multiplieur : A_bool_10; rank : int}; +type _shiftFill_ludic::T2_STRUCT = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shiftFill_ludic::t_Tacc_inShift2 = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; type _shiftFill_ludic::T6_STRUCT = struct {eltToSearch : bool; iselementof : bool}; -type _shiftFill_ludic::T5_STRUCT = struct {acc_in_PLC : _shiftFill_ludic::T4_STRUCT; actual_rank : int}; -type _shiftFill_ludic::t_Tacc_inShift = struct {acc_in_PLC : _shiftFill_ludic::T4_STRUCT; actual_rank : int}; type _shiftFill_ludic::t_T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; -type _shiftFill_ludic::T2_STRUCT = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shiftFill_ludic::T4_STRUCT = struct {multiplieur : A_bool_10; rank : int}; type _shiftFill_ludic::t_Tacc_in = struct {multiplieur : A_bool_10; rank : int}; -type _shiftFill_ludic::t_Tacc_inShift2 = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shiftFill_ludic::T5_STRUCT = struct {acc_in_PLC : _shiftFill_ludic::T4_STRUCT; actual_rank : int}; +type _shiftFill_ludic::t_Tacc_inShift = struct {acc_in_PLC : _shiftFill_ludic::T4_STRUCT; actual_rank : int}; type _shiftFill_ludic::T3_STRUCT = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; type _shiftFill_ludic::t_iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; const shiftFill_ludic::c_size = 10; @@ -17232,17 +17220,17 @@ type A_bool_10 = bool^10; -- should_work/lionel/ProduitBool/shift_ludic.lus type _shift_ludic::T1_ARRAY = bool^10; -type _shift_ludic::T4_STRUCT = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; -type _shift_ludic::T5_STRUCT = struct {multiplieur : A_bool_10; rank : int}; -type _shift_ludic::T6_STRUCT = struct {acc_in_PLC : _shift_ludic::T5_STRUCT; actual_rank : int}; -type _shift_ludic::T3_ARRAY = bool^20; -type _shift_ludic::t_Tacc_inShift = struct {acc_in_PLC : _shift_ludic::T5_STRUCT; actual_rank : int}; +type _shift_ludic::T2_STRUCT = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shift_ludic::t_Tacc_inShift2 = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; type _shift_ludic::T7_STRUCT = struct {eltToSearch : bool; iselementof : bool}; type _shift_ludic::t_T_isElementOf_ = struct {eltToSearch : bool; iselementof : bool}; -type _shift_ludic::T2_STRUCT = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shift_ludic::T5_STRUCT = struct {multiplieur : A_bool_10; rank : int}; type _shift_ludic::t_Tacc_in = struct {multiplieur : A_bool_10; rank : int}; -type _shift_ludic::t_Tacc_inShift2 = struct {multiplieur : A_bool_10; rank : int; actual_rank : int}; +type _shift_ludic::T6_STRUCT = struct {acc_in_PLC : _shift_ludic::T5_STRUCT; actual_rank : int}; +type _shift_ludic::t_Tacc_inShift = struct {acc_in_PLC : _shift_ludic::T5_STRUCT; actual_rank : int}; +type _shift_ludic::T4_STRUCT = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; type _shift_ludic::t_iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : bool}; +type _shift_ludic::T3_ARRAY = bool^20; const shift_ludic::c_size = 10; node shift_ludic::n_selectOneStage( @@ -17352,19 +17340,19 @@ let tel -- end of node shift_ludic::n_shift -- automatically defined aliases: -type A_bool_20 = bool^20; type A_bool_10 = bool^10; +type A_bool_20 = bool^20; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/arrays.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/arrays.lus const arrays::n = 4; +type _arrays::byte = bool^4; const arrays::m = 3; +type _arrays::word = A_bool_4^3; const arrays::p = 2; type _arrays::tab3d = A_A_int_4_3^2; -type _arrays::byte = bool^4; -type _arrays::word = A_bool_4^3; type _arrays::long = A_A_bool_4_3^2; node arrays::incr(accin:int) returns (accout:int; val:int); let @@ -17372,24 +17360,6 @@ let val = accin; tel -- end of node arrays::incr -node arrays::big_sum(x:A_A_A_int_4_3_2) returns (s:int); -let - s = red<<Lustre::red<<Lustre::red<<Lustre::plus, 4>>, 3>>, 2>>(0, x); -tel --- end of node arrays::big_sum -node arrays::big_or(x:A_A_A_bool_4_3_2) returns (s:bool); -let - s = red<<Lustre::red<<Lustre::red<<Lustre::or, 4>>, 3>>, 2>>(false, x); -tel --- end of node arrays::big_or -node arrays::big_incr(init:int) returns (x:A_A_A_int_4_3_2); -var - accout:int; -let - (accout, x) = fill<<Lustre::fill<<Lustre::fill<<arrays::incr, 4>>, 3>>, - 2>>(init); -tel --- end of node arrays::big_incr node arrays::full_adder( ci:bool; @@ -17410,6 +17380,18 @@ let _v_3 = x and y; tel -- end of node arrays::full_adder +node arrays::add_byte(x:A_bool_4; y:A_bool_4) returns (s:A_bool_4); +var + co:bool; +let + (co, s) = fillred<<arrays::full_adder, 4>>(false, x, y); +tel +-- end of node arrays::add_byte +node arrays::big_or(x:A_A_A_bool_4_3_2) returns (s:bool); +let + s = red<<Lustre::red<<Lustre::red<<Lustre::or, 4>>, 3>>, 2>>(false, x); +tel +-- end of node arrays::big_or node arrays::add_long( x:A_A_A_bool_4_3_2; @@ -17423,6 +17405,19 @@ let 4>>, 3>>, 2>>(false, x, y); tel -- end of node arrays::add_long +node arrays::big_sum(x:A_A_A_int_4_3_2) returns (s:int); +let + s = red<<Lustre::red<<Lustre::red<<Lustre::plus, 4>>, 3>>, 2>>(0, x); +tel +-- end of node arrays::big_sum +node arrays::big_incr(init:int) returns (x:A_A_A_int_4_3_2); +var + accout:int; +let + (accout, x) = fill<<Lustre::fill<<Lustre::fill<<arrays::incr, 4>>, 3>>, + 2>>(init); +tel +-- end of node arrays::big_incr node arrays::big_xor(x:A_A_A_bool_4_3_2) returns (s:bool); let s = red<<Lustre::red<<Lustre::red<<Lustre::xor, 4>>, 3>>, 2>>(false, x); @@ -17451,20 +17446,13 @@ let _v_3 = arrays::big_xor(fillred_res); tel -- end of node arrays::arrays -node arrays::add_byte(x:A_bool_4; y:A_bool_4) returns (s:A_bool_4); -var - co:bool; -let - (co, s) = fillred<<arrays::full_adder, 4>>(false, x, y); -tel --- end of node arrays::add_byte -- automatically defined aliases: -type A_A_int_4_3 = A_int_4^3; -type A_A_A_bool_4_3_2 = A_A_bool_4_3^2; -type A_bool_4 = bool^4; type A_A_A_int_4_3_2 = A_A_int_4_3^2; +type A_A_A_bool_4_3_2 = A_A_bool_4_3^2; type A_A_bool_4_3 = A_bool_4^3; type A_int_4 = int^4; +type A_bool_4 = bool^4; +type A_A_int_4_3 = A_int_4^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/bug.lus @@ -17479,10 +17467,10 @@ type A_int_4 = int^4; -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/calculs_max.lus const calculs_max::taille = 10; -type _calculs_max::bool_arrays = bool^10; type _calculs_max::int_arrays = int^10; type _calculs_max::struct_fill_bool = struct {imax1 : int; imax2 : int; icourant : int}; type _calculs_max::struct_max = struct {max1 : int; max2 : int; imax1 : int; imax2 : int; icourant : int}; +type _calculs_max::bool_arrays = bool^10; node calculs_max::max( strin:_calculs_max::struct_max; @@ -17646,9 +17634,9 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/deSimone.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/deSimone.lus +type _deSimone::cell_accu = struct {token : bool; grant : bool}; const deSimone::size = 10; type _deSimone::tabType = bool^10; -type _deSimone::cell_accu = struct {token : bool; grant : bool}; node deSimone::oneCell( accu_in:_deSimone::cell_accu; @@ -17685,19 +17673,6 @@ let tel -- end of node deSimone::oneCell -node deSimone::prop1_iter( - accu_in:int; - elt_in:bool) -returns ( - accu_out:int); -var - _v_1:int; -let - accu_out = accu_in + _v_1; - _v_1 = if elt_in then 1 else 0; -tel --- end of node deSimone::prop1_iter - node deSimone::deSimone( new_token:bool; request:A_bool_10) @@ -17711,6 +17686,19 @@ let _v_1 = _deSimone::cell_accu{token=new_token;grant=true}; tel -- end of node deSimone::deSimone + +node deSimone::prop1_iter( + accu_in:int; + elt_in:bool) +returns ( + accu_out:int); +var + _v_1:int; +let + accu_out = accu_in + _v_1; + _v_1 = if elt_in then 1 else 0; +tel +-- end of node deSimone::prop1_iter node deSimone::prop1(request:A_bool_10) returns (ok:bool); var acknowledge:A_bool_10; @@ -17769,16 +17757,6 @@ const mapiter::L = 2; type _mapiter::Reg_L = bool^2; const mapiter::H = 3; type _mapiter::T_Reg_H = A_bool_2^3; -node mapiter::incr(init:int; b:bool) returns (res:int); -var - _v_1:bool; - _v_2:int; -let - res = if _v_1 then _v_2 else init; - _v_1 = b = true; - _v_2 = init + 1; -tel --- end of node mapiter::incr node mapiter::bitalt(in:bool) returns (sacc:bool; out:bool); let sacc = not in; @@ -17795,21 +17773,6 @@ let (sacc, R) = fill<<mapiter::fill_bitalt, 3>>(iacc); tel -- end of node mapiter::initmat -node mapiter::red_incr(init:int; b:A_bool_2) returns (res:int); -let - res = Lustre::red<<mapiter::incr, 2>>(init, b); -tel --- end of node mapiter::red_incr -node mapiter::reducemat(iacc:int; I:A_A_bool_2_3) returns (res:int); -let - res = red<<mapiter::red_incr, 3>>(iacc, I); -tel --- end of node mapiter::reducemat -node mapiter::map_egal(i1:A_bool_2; i2:A_bool_2) returns (o:A_bool_2); -let - o = Lustre::map<<Lustre::eq, 2>>(i1, i2); -tel --- end of node mapiter::map_egal node mapiter::composemat( i1:A_A_bool_2_3; @@ -17820,6 +17783,26 @@ let s1 = map<<Lustre::map<<Lustre::eq, 2>>, 3>>(i1, i2); tel -- end of node mapiter::composemat +node mapiter::incr(init:int; b:bool) returns (res:int); +var + _v_1:bool; + _v_2:int; +let + res = if _v_1 then _v_2 else init; + _v_1 = b = true; + _v_2 = init + 1; +tel +-- end of node mapiter::incr +node mapiter::red_incr(init:int; b:A_bool_2) returns (res:int); +let + res = Lustre::red<<mapiter::incr, 2>>(init, b); +tel +-- end of node mapiter::red_incr +node mapiter::reducemat(iacc:int; I:A_A_bool_2_3) returns (res:int); +let + res = red<<mapiter::red_incr, 3>>(iacc, I); +tel +-- end of node mapiter::reducemat node mapiter::mapiter(a:bool) returns (nbTrue:int); var bid1:bool; @@ -17839,15 +17822,14 @@ tel -- automatically defined aliases: type A_A_bool_2_3 = A_bool_2^3; type A_bool_2 = bool^2; -type A_bool_2 = bool^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/matrice.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/matrice.lus type _matrice::T_fibo = int^2; -const matrice::m = 3; const matrice::n = 2; +const matrice::m = 3; node matrice::fibo(accu_in:A_int_2) returns (accu_out:A_int_2; elt:int); var _v_1:int; @@ -17883,16 +17865,16 @@ let tel -- end of node matrice::matrice -- automatically defined aliases: -type A_int_2 = int^2; -type A_int_3 = int^3; type A_A_int_3_2 = A_int_3^2; +type A_int_3 = int^3; +type A_int_2 = int^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/matrice2.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/matrice2.lus -const matrice2::m = 2; const matrice2::n = 2; +const matrice2::m = 2; node matrice2::matrice2(a:int) returns (res:int); var _v_1:A_int_2; @@ -17904,15 +17886,15 @@ let tel -- end of node matrice2::matrice2 -- automatically defined aliases: -type A_A_int_2_2 = A_int_2^2; type A_int_2 = int^2; +type A_A_int_2_2 = A_int_2^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/minus.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/minus.lus -const minus::m = 2; const minus::n = 3; +const minus::m = 2; node minus::bitalt(a:bool) returns (out:bool; b:bool); let b = a; @@ -18002,92 +17984,76 @@ type A_real_10 = real^10; const normal::NBC = 20; type _normal::INTNBC = int^20; +type _normal::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; const normal::NBG = 4; type _normal::INTNBG = int^4; -type _normal::T_EntreeGlob = struct {chg2gen : A_int_20; mesure_chgs : A_int_20; mesure_gens : A_int_4}; -type _normal::T_ComChg = int; type _normal::T_InfoGenIndiv = struct {mesure_gen : int}; -type _normal::T_EtatCharge = int; +type _normal::T_EntreeGlob = struct {chg2gen : A_int_20; mesure_chgs : A_int_20; mesure_gens : A_int_4}; type _normal::T_InfoChgGlob = struct {chg2gen : A_int_20}; +type _normal::T_ComChg = int; type _normal::T_InfoChgIndiv = struct {mesure_chg : int}; -type _normal::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; +type _normal::T_EtatCharge = int; +const normal::EC_NON_CTRL = 2; const normal::EC_LESTAGE = 3; -const normal::COM_ON = 1; const normal::EC_OFF = 1; -const normal::COM_OFF = 2; -const normal::EC_NON_CTRL = 2; -const normal::EC_DELESTAGE = 4; -const normal::EC_ON = 0; const normal::COM_ERR = 0; - -node normal::int2InfoChgIndiv( - m:int) -returns ( - InfoChgIndiv:_normal::T_InfoChgIndiv); -let - InfoChgIndiv = _normal::T_InfoChgIndiv{mesure_chg=m}; -tel --- end of node normal::int2InfoChgIndiv - -node normal::extract_tab_info_chg_indiv( - EntreeGlob:_normal::T_EntreeGlob) -returns ( - TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20); +const normal::COM_ON = 1; +const normal::COM_OFF = 2; +const normal::EC_ON = 0; +const normal::EC_DELESTAGE = 4; +node normal::trChItere(acc_in:int; elt:int) returns (acc_out:int); var - _v_1:A_int_20; + _v_1:bool; let - TabInfoChgIndiv = map<<normal::int2InfoChgIndiv, 20>>(_v_1); - _v_1 = EntreeGlob.mesure_chgs; + acc_out = if _v_1 then acc_in else elt; + _v_1 = acc_in > elt; tel --- end of node normal::extract_tab_info_chg_indiv +-- end of node normal::trChItere -node normal::int2InfoGenIndiv( - m:int) +node normal::traite_charge( + InfoChgIndiv:_normal::T_InfoChgIndiv; + InfoChgGlob:_normal::T_InfoChgGlob) returns ( - InfoGenIndiv:_normal::T_InfoGenIndiv); + EtatCharge:int); +var + _v_1:int; + _v_2:A_int_20; let - InfoGenIndiv = _normal::T_InfoGenIndiv{mesure_gen=m}; + EtatCharge = red<<normal::trChItere, 20>>(_v_1, _v_2); + _v_1 = InfoChgIndiv.mesure_chg; + _v_2 = InfoChgGlob.chg2gen; tel --- end of node normal::int2InfoGenIndiv +-- end of node normal::traite_charge -node normal::extract_tab_info_gen_indiv( - EntreeGlob:_normal::T_EntreeGlob) +node normal::traiteChg( + TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20; + TabInfoChgGlob:A__normal::T_InfoChgGlob_20) returns ( - TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4); -var - _v_1:A_int_4; -let - TabInfoGenIndiv = map<<normal::int2InfoGenIndiv, 4>>(_v_1); - _v_1 = EntreeGlob.mesure_gens; -tel --- end of node normal::extract_tab_info_gen_indiv -node normal::egal_indice(indice:int; val:int) returns (r:bool); + TabEtatCharge:A_int_20); let - r = val = indice; + TabEtatCharge = map<<normal::traite_charge, 20>>(TabInfoChgIndiv, + TabInfoChgGlob); tel --- end of node normal::egal_indice -node normal::copie(acc_in:int) returns (acc_out:int; elt:int); +-- end of node normal::traiteChg +node normal::id(elt_in:int) returns (elt_out:int); let - acc_out = acc_in; - elt = acc_in; + elt_out = elt_in; tel --- end of node normal::copie +-- end of node normal::id -node normal::essai_traite_gen( - indice_gen:int; - infoGenGlob:_normal::T_InfoGenGlob) +node normal::extract_info_gen_glob( + EntreeGlob:_normal::T_EntreeGlob) returns ( - TabComVal:A_bool_20); + InfoGenGlob:_normal::T_InfoGenGlob); var - Tab_indiceGen:A_int_20; - bid:int; _v_1:A_int_20; + _v_2:A_int_20; let - (bid, Tab_indiceGen) = fill<<normal::copie, 20>>(indice_gen); - TabComVal = map<<normal::egal_indice, 20>>(Tab_indiceGen, _v_1); - _v_1 = infoGenGlob.chg2gen; + InfoGenGlob = _normal::T_InfoGenGlob{elt_bidon=0;chg2gen=_v_2}; + _v_1 = EntreeGlob.chg2gen; + _v_2 = map<<normal::id, 20>>(_v_1); tel --- end of node normal::essai_traite_gen +-- end of node normal::extract_info_gen_glob node normal::fusion_une_com( in_com:int; @@ -18124,6 +18090,17 @@ let AllTabComVal); tel -- end of node normal::fusion_com +node normal::egal_indice(indice:int; val:int) returns (r:bool); +let + r = val = indice; +tel +-- end of node normal::egal_indice +node normal::copie(acc_in:int) returns (acc_out:int; elt:int); +let + acc_out = acc_in; + elt = acc_in; +tel +-- end of node normal::copie node normal::traite_genCore_itere( acc_in:int; @@ -18138,73 +18115,6 @@ let tel -- end of node normal::traite_genCore_itere -node normal::essai2( - a:A_int_20; - d:_normal::T_InfoGenGlob) -returns ( - c:A_bool_20); -var - _v_1:A_int_20; -let - c = map<<normal::egal_indice, 20>>(a, _v_1); - _v_1 = d.chg2gen; -tel --- end of node normal::essai2 -node normal::id(elt_in:int) returns (elt_out:int); -let - elt_out = elt_in; -tel --- end of node normal::id - -node normal::extract_info_chg_glob( - EntreeGlob:_normal::T_EntreeGlob) -returns ( - InfoChgGlob:_normal::T_InfoChgGlob); -var - _v_1:A_int_20; - _v_2:A_int_20; -let - InfoChgGlob = _normal::T_InfoChgGlob{chg2gen=_v_2}; - _v_1 = EntreeGlob.chg2gen; - _v_2 = map<<normal::id, 20>>(_v_1); -tel --- end of node normal::extract_info_chg_glob - -node normal::extrCharge( - EntreeGlob:_normal::T_EntreeGlob) -returns ( - TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20; - TabInfoChgGlob:A__normal::T_InfoChgGlob_20); -var - _v_1:_normal::T_InfoChgGlob; -let - TabInfoChgIndiv = normal::extract_tab_info_chg_indiv(EntreeGlob); - TabInfoChgGlob = _v_1^20; - _v_1 = normal::extract_info_chg_glob(EntreeGlob); -tel --- end of node normal::extrCharge -node normal::trChItere(acc_in:int; elt:int) returns (acc_out:int); -var - _v_1:bool; -let - acc_out = if _v_1 then acc_in else elt; - _v_1 = acc_in > elt; -tel --- end of node normal::trChItere - -node normal::essai3( - indice:A_int_20; - info:_normal::T_InfoGenGlob) -returns ( - Connerie:A_bool_20); -var - _v_1:A_int_20; -let - Connerie = map<<normal::egal_indice, 20>>(indice, _v_1); - _v_1 = info.chg2gen; -tel --- end of node normal::essai3 - node normal::traite_gen_core( indice_gen:int; InfoGenIndiv:_normal::T_InfoGenIndiv; @@ -18248,85 +18158,160 @@ let tel -- end of node normal::traite_gen -node normal::extract_info_gen_glob( +node normal::traiteGen( + TabIndiceGen:A_int_4; + TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4; + TabInfoGenGlob:A__normal::T_InfoGenGlob_4; + TabEtatCharge:A_int_20) +returns ( + AllTabComChg:A_A_int_20_4; + AllTabComVal:A_A_bool_20_4); +var + _v_1:A_A_int_20_4; +let + (AllTabComChg, AllTabComVal) = map<<normal::traite_gen, 4>>(TabIndiceGen, + TabInfoGenIndiv, TabInfoGenGlob, _v_1); + _v_1 = TabEtatCharge^4; +tel +-- end of node normal::traiteGen + +node normal::int2InfoChgIndiv( + m:int) +returns ( + InfoChgIndiv:_normal::T_InfoChgIndiv); +let + InfoChgIndiv = _normal::T_InfoChgIndiv{mesure_chg=m}; +tel +-- end of node normal::int2InfoChgIndiv + +node normal::int2InfoGenIndiv( + m:int) +returns ( + InfoGenIndiv:_normal::T_InfoGenIndiv); +let + InfoGenIndiv = _normal::T_InfoGenIndiv{mesure_gen=m}; +tel +-- end of node normal::int2InfoGenIndiv + +node normal::extract_tab_info_gen_indiv( EntreeGlob:_normal::T_EntreeGlob) returns ( - InfoGenGlob:_normal::T_InfoGenGlob); + TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4); +var + _v_1:A_int_4; +let + TabInfoGenIndiv = map<<normal::int2InfoGenIndiv, 4>>(_v_1); + _v_1 = EntreeGlob.mesure_gens; +tel +-- end of node normal::extract_tab_info_gen_indiv +node normal::incr_acc(acc_in:int) returns (acc_out:int; res:int); +let + res = acc_in; + acc_out = res + 1; +tel +-- end of node normal::incr_acc + +node normal::extrGen( + EntreeGlob:_normal::T_EntreeGlob) +returns ( + TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4; + TabInfoGenGlob:A__normal::T_InfoGenGlob_4; + TabIndiceGen:A_int_4); +var + bid:int; + _v_1:_normal::T_InfoGenGlob; +let + TabInfoGenIndiv = normal::extract_tab_info_gen_indiv(EntreeGlob); + TabInfoGenGlob = _v_1^4; + _v_1 = normal::extract_info_gen_glob(EntreeGlob); + (bid, TabIndiceGen) = fill<<normal::incr_acc, 4>>(0); +tel +-- end of node normal::extrGen + +node normal::essai3( + indice:A_int_20; + info:_normal::T_InfoGenGlob) +returns ( + Connerie:A_bool_20); var _v_1:A_int_20; - _v_2:A_int_20; let - InfoGenGlob = _normal::T_InfoGenGlob{elt_bidon=0;chg2gen=_v_2}; - _v_1 = EntreeGlob.chg2gen; - _v_2 = map<<normal::id, 20>>(_v_1); + Connerie = map<<normal::egal_indice, 20>>(indice, _v_1); + _v_1 = info.chg2gen; tel --- end of node normal::extract_info_gen_glob +-- end of node normal::essai3 -node normal::traite_charge( - InfoChgIndiv:_normal::T_InfoChgIndiv; - InfoChgGlob:_normal::T_InfoChgGlob) +node normal::essai_traite_gen( + indice_gen:int; + infoGenGlob:_normal::T_InfoGenGlob) returns ( - EtatCharge:int); + TabComVal:A_bool_20); +var + Tab_indiceGen:A_int_20; + bid:int; + _v_1:A_int_20; +let + (bid, Tab_indiceGen) = fill<<normal::copie, 20>>(indice_gen); + TabComVal = map<<normal::egal_indice, 20>>(Tab_indiceGen, _v_1); + _v_1 = infoGenGlob.chg2gen; +tel +-- end of node normal::essai_traite_gen + +node normal::extract_info_chg_glob( + EntreeGlob:_normal::T_EntreeGlob) +returns ( + InfoChgGlob:_normal::T_InfoChgGlob); var - _v_1:int; + _v_1:A_int_20; _v_2:A_int_20; let - EtatCharge = red<<normal::trChItere, 20>>(_v_1, _v_2); - _v_1 = InfoChgIndiv.mesure_chg; - _v_2 = InfoChgGlob.chg2gen; -tel --- end of node normal::traite_charge -node normal::incr_acc(acc_in:int) returns (acc_out:int; res:int); -let - res = acc_in; - acc_out = res + 1; + InfoChgGlob = _normal::T_InfoChgGlob{chg2gen=_v_2}; + _v_1 = EntreeGlob.chg2gen; + _v_2 = map<<normal::id, 20>>(_v_1); tel --- end of node normal::incr_acc +-- end of node normal::extract_info_chg_glob -node normal::extrGen( +node normal::extract_tab_info_chg_indiv( EntreeGlob:_normal::T_EntreeGlob) returns ( - TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4; - TabInfoGenGlob:A__normal::T_InfoGenGlob_4; - TabIndiceGen:A_int_4); + TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20); var - bid:int; - _v_1:_normal::T_InfoGenGlob; + _v_1:A_int_20; let - TabInfoGenIndiv = normal::extract_tab_info_gen_indiv(EntreeGlob); - TabInfoGenGlob = _v_1^4; - _v_1 = normal::extract_info_gen_glob(EntreeGlob); - (bid, TabIndiceGen) = fill<<normal::incr_acc, 4>>(0); + TabInfoChgIndiv = map<<normal::int2InfoChgIndiv, 20>>(_v_1); + _v_1 = EntreeGlob.mesure_chgs; tel --- end of node normal::extrGen +-- end of node normal::extract_tab_info_chg_indiv -node normal::traiteGen( - TabIndiceGen:A_int_4; - TabInfoGenIndiv:A__normal::T_InfoGenIndiv_4; - TabInfoGenGlob:A__normal::T_InfoGenGlob_4; - TabEtatCharge:A_int_20) +node normal::extrCharge( + EntreeGlob:_normal::T_EntreeGlob) returns ( - AllTabComChg:A_A_int_20_4; - AllTabComVal:A_A_bool_20_4); + TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20; + TabInfoChgGlob:A__normal::T_InfoChgGlob_20); var - _v_1:A_A_int_20_4; + _v_1:_normal::T_InfoChgGlob; let - (AllTabComChg, AllTabComVal) = map<<normal::traite_gen, 4>>(TabIndiceGen, - TabInfoGenIndiv, TabInfoGenGlob, _v_1); - _v_1 = TabEtatCharge^4; + TabInfoChgIndiv = normal::extract_tab_info_chg_indiv(EntreeGlob); + TabInfoChgGlob = _v_1^20; + _v_1 = normal::extract_info_chg_glob(EntreeGlob); tel --- end of node normal::traiteGen +-- end of node normal::extrCharge -node normal::traiteChg( - TabInfoChgIndiv:A__normal::T_InfoChgIndiv_20; - TabInfoChgGlob:A__normal::T_InfoChgGlob_20) +node normal::traite_gen_bis( + a:int; + c:_normal::T_InfoGenGlob) returns ( - TabEtatCharge:A_int_20); + e:A_bool_20); +var + loc_a:A_int_20; + bid:int; + _v_1:A_int_20; let - TabEtatCharge = map<<normal::traite_charge, 20>>(TabInfoChgIndiv, - TabInfoChgGlob); + (bid, loc_a) = fill<<normal::copie, 20>>(a); + e = map<<normal::egal_indice, 20>>(loc_a, _v_1); + _v_1 = c.chg2gen; tel --- end of node normal::traiteChg +-- end of node normal::traite_gen_bis node normal::normal( EntreeGlob:_normal::T_EntreeGlob) @@ -18352,31 +18337,28 @@ let tel -- end of node normal::normal -node normal::traite_gen_bis( - a:int; - c:_normal::T_InfoGenGlob) +node normal::essai2( + a:A_int_20; + d:_normal::T_InfoGenGlob) returns ( - e:A_bool_20); + c:A_bool_20); var - loc_a:A_int_20; - bid:int; _v_1:A_int_20; let - (bid, loc_a) = fill<<normal::copie, 20>>(a); - e = map<<normal::egal_indice, 20>>(loc_a, _v_1); - _v_1 = c.chg2gen; + c = map<<normal::egal_indice, 20>>(a, _v_1); + _v_1 = d.chg2gen; tel --- end of node normal::traite_gen_bis +-- end of node normal::essai2 -- automatically defined aliases: type A_int_4 = int^4; -type A__normal::T_InfoGenGlob_4 = _normal::T_InfoGenGlob^4; +type A_int_20 = int^20; +type A__normal::T_InfoChgGlob_20 = _normal::T_InfoChgGlob^20; type A__normal::T_InfoChgIndiv_20 = _normal::T_InfoChgIndiv^20; -type A_A_bool_20_4 = A_bool_20^4; -type A_bool_20 = bool^20; type A__normal::T_InfoGenIndiv_4 = _normal::T_InfoGenIndiv^4; -type A__normal::T_InfoChgGlob_20 = _normal::T_InfoChgGlob^20; +type A_bool_20 = bool^20; +type A_A_bool_20_4 = A_bool_20^4; +type A__normal::T_InfoGenGlob_4 = _normal::T_InfoGenGlob^4; type A_A_int_20_4 = A_int_20^4; -type A_int_20 = int^20; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/pack1.lus @@ -19308,10 +19290,10 @@ let tel -- end of node pilote::system -- automatically defined aliases: -type A_int_8 = int^8; +type A_int_10 = int^10; type A_bool_10 = bool^10; type A_bool_8 = bool^8; -type A_int_10 = int^10; +type A_int_8 = int^8; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/pipeline.lus @@ -19354,10 +19336,10 @@ type A_bool_10 = bool^10; -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/predefOp.lus const predefOp::L = 2; +type _predefOp::Tab_L = int^2; type _predefOp::Reg_L = bool^2; const predefOp::H = 3; type _predefOp::T_Reg_H = A_bool_2^3; -type _predefOp::Tab_L = int^2; type _predefOp::T_Tab_H = A_int_2^3; node predefOp::incr(init:int; b:bool) returns (res:int); var @@ -19369,6 +19351,60 @@ let _v_2 = init + 1; tel -- end of node predefOp::incr +node predefOp::incremental(iacc:int) returns (oacc:int; res:int); +let + res = iacc; + oacc = res + 1; +tel +-- end of node predefOp::incremental +node predefOp::initmatint(iacc:int) returns (sacc:int; R:A_A_int_2_3); +let + (sacc, R) = fill<<Lustre::fill<<predefOp::incremental, 2>>, 3>>(iacc); +tel +-- end of node predefOp::initmatint + +node predefOp::composematint( + i1:A_A_int_2_3; + i2:A_A_int_2_3) +returns ( + s1:A_A_int_2_3; + s2:A_A_bool_2_3); +let + s1 = map<<Lustre::map<<Lustre::div, 2>>, 3>>(i1, i2); + s2 = map<<Lustre::map<<Lustre::gte, 2>>, 3>>(i1, i2); +tel +-- end of node predefOp::composematint +node predefOp::reducematint(iacc:int; I:A_A_int_2_3) returns (res:int); +let + res = red<<Lustre::red<<Lustre::plus, 2>>, 3>>(iacc, I); +tel +-- end of node predefOp::reducematint + +node predefOp::predefOp( + a:int) +returns ( + res:int; + init1:A_A_int_2_3; + init2:A_A_int_2_3; + matres1:A_A_int_2_3; + matres2:A_A_bool_2_3); +var + bid1:int; + bid2:int; + _v_1:int; +let + (bid1, init1) = predefOp::initmatint(a); + (bid2, init2) = predefOp::initmatint(_v_1); + _v_1 = a * a; + (matres1, matres2) = predefOp::composematint(init1, init2); + res = predefOp::reducematint(0, matres1); +tel +-- end of node predefOp::predefOp +node predefOp::reducematbool(iacc:int; I:A_A_bool_2_3) returns (res:int); +let + res = red<<Lustre::red<<predefOp::incr, 2>>, 3>>(iacc, I); +tel +-- end of node predefOp::reducematbool node predefOp::bitalt(iacc:bool) returns (oacc:bool; res:bool); let res = iacc; @@ -19395,11 +19431,6 @@ let s1 = map<<Lustre::map<<Lustre::impl, 2>>, 3>>(i1, i2); tel -- end of node predefOp::composematbool -node predefOp::reducematbool(iacc:int; I:A_A_bool_2_3) returns (res:int); -let - res = red<<Lustre::red<<predefOp::incr, 2>>, 3>>(iacc, I); -tel --- end of node predefOp::reducematbool node predefOp::predefOp2( a:bool) @@ -19420,60 +19451,11 @@ let nbTrue = predefOp::reducematbool(0, XORMAT); tel -- end of node predefOp::predefOp2 - -node predefOp::composematint( - i1:A_A_int_2_3; - i2:A_A_int_2_3) -returns ( - s1:A_A_int_2_3; - s2:A_A_bool_2_3); -let - s1 = map<<Lustre::map<<Lustre::div, 2>>, 3>>(i1, i2); - s2 = map<<Lustre::map<<Lustre::gte, 2>>, 3>>(i1, i2); -tel --- end of node predefOp::composematint -node predefOp::incremental(iacc:int) returns (oacc:int; res:int); -let - res = iacc; - oacc = res + 1; -tel --- end of node predefOp::incremental -node predefOp::reducematint(iacc:int; I:A_A_int_2_3) returns (res:int); -let - res = red<<Lustre::red<<Lustre::plus, 2>>, 3>>(iacc, I); -tel --- end of node predefOp::reducematint -node predefOp::initmatint(iacc:int) returns (sacc:int; R:A_A_int_2_3); -let - (sacc, R) = fill<<Lustre::fill<<predefOp::incremental, 2>>, 3>>(iacc); -tel --- end of node predefOp::initmatint - -node predefOp::predefOp( - a:int) -returns ( - res:int; - init1:A_A_int_2_3; - init2:A_A_int_2_3; - matres1:A_A_int_2_3; - matres2:A_A_bool_2_3); -var - bid1:int; - bid2:int; - _v_1:int; -let - (bid1, init1) = predefOp::initmatint(a); - (bid2, init2) = predefOp::initmatint(_v_1); - _v_1 = a * a; - (matres1, matres2) = predefOp::composematint(init1, init2); - res = predefOp::reducematint(0, matres1); -tel --- end of node predefOp::predefOp -- automatically defined aliases: type A_A_bool_2_3 = A_bool_2^3; -type A_int_2 = int^2; type A_A_int_2_3 = A_int_2^3; type A_bool_2 = bool^2; +type A_int_2 = int^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/redIf.lus @@ -19865,16 +19847,16 @@ let tel -- end of node util::observer -- automatically defined aliases: -type A_int_8 = int^8; -type A_bool_8 = bool^8; type A_int_10 = int^10; +type A_bool_8 = bool^8; +type A_int_8 = int^8; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/simpleRed.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/simpleRed.lus -const simpleRed::m = 3; const simpleRed::n = 2; +const simpleRed::m = 3; node simpleRed::simpleRed(a:int) returns (res:int); var _v_1:A_int_3; @@ -19892,78 +19874,78 @@ type A_int_3 = int^3; const testSilus::NBC = 20; type _testSilus::INTNBC = int^20; +type _testSilus::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; const testSilus::NBG = 4; type _testSilus::INTNBG = int^4; +type _testSilus::T_InfoGenIndiv = struct {mesure_gen : int}; type _testSilus::T_EntreeGlob = struct {chg2gen : A_int_20; mesure_chgs : A_int_20; mesure_gens : A_int_4}; +type _testSilus::T_InfoChgGlob = struct {chg2gen : A_int_20}; type _testSilus::T_ComChg = int; -type _testSilus::T_InfoGenIndiv = struct {mesure_gen : int}; type _testSilus::BOOLNBC = bool^20; -type _testSilus::T_EtatCharge = int; -type _testSilus::T_InfoChgGlob = struct {chg2gen : A_int_20}; type _testSilus::T_InfoChgIndiv = struct {mesure_chg : int}; +type _testSilus::T_EtatCharge = int; type _testSilus::T_ComChgNBC = int^20; -type _testSilus::T_InfoGenGlob = struct {elt_bidon : int; chg2gen : A_int_20}; +const testSilus::EC_NON_CTRL = 2; const testSilus::EC_LESTAGE = 3; -const testSilus::COM_ON = 1; const testSilus::EC_OFF = 1; +const testSilus::COM_ERR = 0; +const testSilus::COM_ON = 1; const testSilus::COM_OFF = 2; -const testSilus::EC_NON_CTRL = 2; -const testSilus::EC_DELESTAGE = 4; const testSilus::EC_ON = 0; -const testSilus::COM_ERR = 0; - -node testSilus::int2InfoChgIndiv( - m:int) -returns ( - InfoChgIndiv:_testSilus::T_InfoChgIndiv); +const testSilus::EC_DELESTAGE = 4; +node testSilus::trChItere(acc_in:int; elt:int) returns (acc_out:int); +var + _v_1:bool; let - InfoChgIndiv = _testSilus::T_InfoChgIndiv{mesure_chg=m}; + acc_out = if _v_1 then acc_in else elt; + _v_1 = acc_in > elt; tel --- end of node testSilus::int2InfoChgIndiv +-- end of node testSilus::trChItere -node testSilus::extract_tab_info_chg_indiv( - EntreeGlob:_testSilus::T_EntreeGlob) +node testSilus::traite_charge( + InfoChgIndiv:_testSilus::T_InfoChgIndiv; + InfoChgGlob:_testSilus::T_InfoChgGlob) returns ( - TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20); + EtatCharge:int); var - _v_1:A_int_20; + _v_1:int; + _v_2:A_int_20; let - TabInfoChgIndiv = map<<testSilus::int2InfoChgIndiv, 20>>(_v_1); - _v_1 = EntreeGlob.mesure_chgs; + EtatCharge = red<<testSilus::trChItere, 20>>(_v_1, _v_2); + _v_1 = InfoChgIndiv.mesure_chg; + _v_2 = InfoChgGlob.chg2gen; tel --- end of node testSilus::extract_tab_info_chg_indiv +-- end of node testSilus::traite_charge -node testSilus::int2InfoGenIndiv( - m:int) +node testSilus::traiteChg( + TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20; + TabInfoChgGlob:A__testSilus::T_InfoChgGlob_20) returns ( - InfoGenIndiv:_testSilus::T_InfoGenIndiv); + TabEtatCharge:A_int_20); let - InfoGenIndiv = _testSilus::T_InfoGenIndiv{mesure_gen=m}; + TabEtatCharge = map<<testSilus::traite_charge, 20>>(TabInfoChgIndiv, + TabInfoChgGlob); tel --- end of node testSilus::int2InfoGenIndiv +-- end of node testSilus::traiteChg +node testSilus::id(elt_in:int) returns (elt_out:int); +let + elt_out = elt_in; +tel +-- end of node testSilus::id -node testSilus::extract_tab_info_gen_indiv( +node testSilus::extract_info_gen_glob( EntreeGlob:_testSilus::T_EntreeGlob) returns ( - TabInfoGenIndiv:A__testSilus::T_InfoGenIndiv_4); + InfoGenGlob:_testSilus::T_InfoGenGlob); var - _v_1:A_int_4; -let - TabInfoGenIndiv = map<<testSilus::int2InfoGenIndiv, 4>>(_v_1); - _v_1 = EntreeGlob.mesure_gens; -tel --- end of node testSilus::extract_tab_info_gen_indiv -node testSilus::egal_indice(indice:int; val:int) returns (r:bool); -let - r = val = indice; -tel --- end of node testSilus::egal_indice -node testSilus::copie(acc_in:int) returns (acc_out:int; elt:int); + _v_1:A_int_20; + _v_2:A_int_20; let - acc_out = acc_in; - elt = acc_in; + InfoGenGlob = _testSilus::T_InfoGenGlob{elt_bidon=0;chg2gen=_v_2}; + _v_1 = EntreeGlob.chg2gen; + _v_2 = map<<testSilus::id, 20>>(_v_1); tel --- end of node testSilus::copie +-- end of node testSilus::extract_info_gen_glob node testSilus::fusion_une_com( in_com:int; @@ -20013,47 +19995,6 @@ let acc_out = acc_in; tel -- end of node testSilus::traite_genCore_itere -node testSilus::id(elt_in:int) returns (elt_out:int); -let - elt_out = elt_in; -tel --- end of node testSilus::id - -node testSilus::extract_info_chg_glob( - EntreeGlob:_testSilus::T_EntreeGlob) -returns ( - InfoChgGlob:_testSilus::T_InfoChgGlob); -var - _v_1:A_int_20; - _v_2:A_int_20; -let - InfoChgGlob = _testSilus::T_InfoChgGlob{chg2gen=_v_2}; - _v_1 = EntreeGlob.chg2gen; - _v_2 = map<<testSilus::id, 20>>(_v_1); -tel --- end of node testSilus::extract_info_chg_glob - -node testSilus::extrCharge( - EntreeGlob:_testSilus::T_EntreeGlob) -returns ( - TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20; - TabInfoChgGlob:A__testSilus::T_InfoChgGlob_20); -var - _v_1:_testSilus::T_InfoChgGlob; -let - TabInfoChgIndiv = testSilus::extract_tab_info_chg_indiv(EntreeGlob); - TabInfoChgGlob = _v_1^20; - _v_1 = testSilus::extract_info_chg_glob(EntreeGlob); -tel --- end of node testSilus::extrCharge -node testSilus::trChItere(acc_in:int; elt:int) returns (acc_out:int); -var - _v_1:bool; -let - acc_out = if _v_1 then acc_in else elt; - _v_1 = acc_in > elt; -tel --- end of node testSilus::trChItere node testSilus::traite_gen_core( indice_gen:int; @@ -20072,6 +20013,17 @@ let _v_1 = InfoGenGlob.chg2gen; tel -- end of node testSilus::traite_gen_core +node testSilus::egal_indice(indice:int; val:int) returns (r:bool); +let + r = val = indice; +tel +-- end of node testSilus::egal_indice +node testSilus::copie(acc_in:int) returns (acc_out:int; elt:int); +let + acc_out = acc_in; + elt = acc_in; +tel +-- end of node testSilus::copie node testSilus::traite_gen( indice_gen:int; @@ -20094,45 +20046,52 @@ let tel -- end of node testSilus::traite_gen -node testSilus::extract_info_gen_glob( - EntreeGlob:_testSilus::T_EntreeGlob) +node testSilus::traiteGen( + TabIndiceGen:A_int_4; + TabInfoGenIndiv:A__testSilus::T_InfoGenIndiv_4; + TabInfoGenGlob:A__testSilus::T_InfoGenGlob_4; + TabEtatCharge:A_int_20) returns ( - InfoGenGlob:_testSilus::T_InfoGenGlob); + AllTabComChg:A_A_int_20_4; + AllTabComVal:A_A_bool_20_4); var - _v_1:A_int_20; - _v_2:A_int_20; + _v_1:A_A_int_20_4; let - InfoGenGlob = _testSilus::T_InfoGenGlob{elt_bidon=0;chg2gen=_v_2}; - _v_1 = EntreeGlob.chg2gen; - _v_2 = map<<testSilus::id, 20>>(_v_1); + (AllTabComChg, AllTabComVal) = map<<testSilus::traite_gen, + 4>>(TabIndiceGen, TabInfoGenIndiv, TabInfoGenGlob, _v_1); + _v_1 = TabEtatCharge^4; tel --- end of node testSilus::extract_info_gen_glob +-- end of node testSilus::traiteGen -node testSilus::traite_charge( - InfoChgIndiv:_testSilus::T_InfoChgIndiv; - InfoChgGlob:_testSilus::T_InfoChgGlob) +node testSilus::int2InfoChgIndiv( + m:int) returns ( - EtatCharge:int); -var - _v_1:int; - _v_2:A_int_20; + InfoChgIndiv:_testSilus::T_InfoChgIndiv); let - EtatCharge = red<<testSilus::trChItere, 20>>(_v_1, _v_2); - _v_1 = InfoChgIndiv.mesure_chg; - _v_2 = InfoChgGlob.chg2gen; + InfoChgIndiv = _testSilus::T_InfoChgIndiv{mesure_chg=m}; tel --- end of node testSilus::traite_charge +-- end of node testSilus::int2InfoChgIndiv -node testSilus::traiteChg( - TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20; - TabInfoChgGlob:A__testSilus::T_InfoChgGlob_20) +node testSilus::int2InfoGenIndiv( + m:int) returns ( - TabEtatCharge:A_int_20); + InfoGenIndiv:_testSilus::T_InfoGenIndiv); let - TabEtatCharge = map<<testSilus::traite_charge, 20>>(TabInfoChgIndiv, - TabInfoChgGlob); + InfoGenIndiv = _testSilus::T_InfoGenIndiv{mesure_gen=m}; tel --- end of node testSilus::traiteChg +-- end of node testSilus::int2InfoGenIndiv + +node testSilus::extract_tab_info_gen_indiv( + EntreeGlob:_testSilus::T_EntreeGlob) +returns ( + TabInfoGenIndiv:A__testSilus::T_InfoGenIndiv_4); +var + _v_1:A_int_4; +let + TabInfoGenIndiv = map<<testSilus::int2InfoGenIndiv, 4>>(_v_1); + _v_1 = EntreeGlob.mesure_gens; +tel +-- end of node testSilus::extract_tab_info_gen_indiv node testSilus::incr_acc(acc_in:int) returns (acc_out:int; res:int); let res = acc_in; @@ -20157,22 +20116,45 @@ let tel -- end of node testSilus::extrGen -node testSilus::traiteGen( - TabIndiceGen:A_int_4; - TabInfoGenIndiv:A__testSilus::T_InfoGenIndiv_4; - TabInfoGenGlob:A__testSilus::T_InfoGenGlob_4; - TabEtatCharge:A_int_20) +node testSilus::extract_info_chg_glob( + EntreeGlob:_testSilus::T_EntreeGlob) returns ( - AllTabComChg:A_A_int_20_4; - AllTabComVal:A_A_bool_20_4); + InfoChgGlob:_testSilus::T_InfoChgGlob); var - _v_1:A_A_int_20_4; + _v_1:A_int_20; + _v_2:A_int_20; let - (AllTabComChg, AllTabComVal) = map<<testSilus::traite_gen, - 4>>(TabIndiceGen, TabInfoGenIndiv, TabInfoGenGlob, _v_1); - _v_1 = TabEtatCharge^4; + InfoChgGlob = _testSilus::T_InfoChgGlob{chg2gen=_v_2}; + _v_1 = EntreeGlob.chg2gen; + _v_2 = map<<testSilus::id, 20>>(_v_1); tel --- end of node testSilus::traiteGen +-- end of node testSilus::extract_info_chg_glob + +node testSilus::extract_tab_info_chg_indiv( + EntreeGlob:_testSilus::T_EntreeGlob) +returns ( + TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20); +var + _v_1:A_int_20; +let + TabInfoChgIndiv = map<<testSilus::int2InfoChgIndiv, 20>>(_v_1); + _v_1 = EntreeGlob.mesure_chgs; +tel +-- end of node testSilus::extract_tab_info_chg_indiv + +node testSilus::extrCharge( + EntreeGlob:_testSilus::T_EntreeGlob) +returns ( + TabInfoChgIndiv:A__testSilus::T_InfoChgIndiv_20; + TabInfoChgGlob:A__testSilus::T_InfoChgGlob_20); +var + _v_1:_testSilus::T_InfoChgGlob; +let + TabInfoChgIndiv = testSilus::extract_tab_info_chg_indiv(EntreeGlob); + TabInfoChgGlob = _v_1^20; + _v_1 = testSilus::extract_info_chg_glob(EntreeGlob); +tel +-- end of node testSilus::extrCharge node testSilus::testSilus( EntreeGlob:_testSilus::T_EntreeGlob) @@ -20198,25 +20180,25 @@ let tel -- end of node testSilus::testSilus -- automatically defined aliases: +type A__testSilus::T_InfoChgGlob_20 = _testSilus::T_InfoChgGlob^20; type A_int_4 = int^4; -type A__testSilus::T_InfoGenGlob_4 = _testSilus::T_InfoGenGlob^4; +type A_int_20 = int^20; type A__testSilus::T_InfoChgIndiv_20 = _testSilus::T_InfoChgIndiv^20; -type A_A_bool_20_4 = A_bool_20^4; type A_bool_20 = bool^20; -type A__testSilus::T_InfoGenIndiv_4 = _testSilus::T_InfoGenIndiv^4; -type A__testSilus::T_InfoChgGlob_20 = _testSilus::T_InfoChgGlob^20; +type A__testSilus::T_InfoGenGlob_4 = _testSilus::T_InfoGenGlob^4; +type A_A_bool_20_4 = A_bool_20^4; type A_A_int_20_4 = A_int_20^4; -type A_int_20 = int^20; +type A__testSilus::T_InfoGenIndiv_4 = _testSilus::T_InfoGenIndiv^4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/lionel/triSel.lus -- ../lus2lic -vl 2 --nonreg-test should_work/lionel/triSel.lus +type _triSel::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; const triSel::size = 50; type _triSel::tabSize = int^50; type _triSel::Sort_accu = struct {CurrentRank : int; Tab : A_int_50}; type _triSel::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; -type _triSel::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; type _triSel::sorted_iter_accu = struct {prev_elt : int; prop_is_tt : bool}; type _triSel::Exchange_accu = struct {MinVal : int; MinRank : int; RankFrom : int; CurrentVal : int; Rank : int}; @@ -20580,22 +20562,74 @@ I use _0 as prefix for fresh var names. type _intArray::elementType = int; const intArray::size = 10; type _intArray::arrayType = int^10; +type _intArray::currentRank_withMemorizedRank = struct {currentRank : int; rankOfMemorizedVal : int; memorizedVal : int}; node util::igt(i:int; j:int) returns (res:bool); let res = i > j; tel --- end of node util::igt -node intArray::_isGreaterThan_(i:int; j:int) returns (res:bool); +-- end of node util::igt +node intArray::_isGreaterThan_(i:int; j:int) returns (res:bool); +let + res = util::igt(i, j); +tel +-- end of node intArray::_isGreaterThan_ + +node intArray::selectMaxRank( + acc_in:_intArray::currentRank_withMemorizedRank; + e1:int) +returns ( + acc_out:_intArray::currentRank_withMemorizedRank); +var + _0v_8:int; + _0v_9:bool; + _0v_10:int; + _0v_11:int; + _0v_3:int; + _0v_4:bool; + _0v_5:int; + _0v_6:int; + _0v_7:int; + _0v_1:int; + _0v_2:int; +let + acc_out = + _intArray::currentRank_withMemorizedRank{currentRank=_0v_2;rankOfMemorizedVal=_0v_7;memorizedVal=_0v_11}; + _0v_8 = acc_in.memorizedVal; + _0v_9 = intArray::_isGreaterThan_(e1, _0v_8); + _0v_10 = acc_in.memorizedVal; + _0v_11 = if _0v_9 then e1 else _0v_10; + _0v_3 = acc_in.memorizedVal; + _0v_4 = intArray::_isGreaterThan_(e1, _0v_3); + _0v_5 = acc_in.currentRank; + _0v_6 = acc_in.rankOfMemorizedVal; + _0v_7 = if _0v_4 then _0v_5 else _0v_6; + _0v_1 = acc_in.currentRank; + _0v_2 = _0v_1 + 1; +tel +-- end of node intArray::selectMaxRank + +node intArray::getRank_ofMaximumIn_( + array:A_int_10) +returns ( + rankOfMaximumElement:int); +var + local:_intArray::currentRank_withMemorizedRank; + _0v_1:int; + _0v_2:_intArray::currentRank_withMemorizedRank; let - res = util::igt(i, j); + local = red<<intArray::selectMaxRank, 10>>(_0v_2, array); + _0v_1 = array[0]; + _0v_2 = + _intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=_0v_1}; + rankOfMaximumElement = local.rankOfMemorizedVal; tel --- end of node intArray::_isGreaterThan_ +-- end of node intArray::getRank_ofMaximumIn_ +type _intArray::T_isElementOf_ = struct {eltToSearch : int; iselementof : bool}; node intArray::_isEqualTo_(i1:int; i2:int) returns (o:bool); let o = Lustre::eq(i1, i2); tel -- end of node intArray::_isEqualTo_ -type _intArray::T_isElementOf_ = struct {eltToSearch : int; iselementof : bool}; node intArray::iterated_isElementOf_( acc_in:_intArray::T_isElementOf_; @@ -20680,6 +20714,91 @@ let array_isLoselySorted = result.sortedUpToHere; tel -- end of node intArray::_isLoselySorted +node intArray::selectMax(e1:int; e2:int) returns (e:int); +var + _0v_1:bool; +let + e = if _0v_1 then e1 else e2; + _0v_1 = intArray::_isGreaterThan_(e1, e2); +tel +-- end of node intArray::selectMax + +node intArray::getMaximumIn_( + array:A_int_10) +returns ( + maximumElement:int); +var + _0v_1:int; +let + maximumElement = red<<intArray::selectMax, 10>>(_0v_1, array); + _0v_1 = array[0]; +tel +-- end of node intArray::getMaximumIn_ +node intArray::selectMin(e1:int; e2:int) returns (e:int); +var + _0v_1:bool; +let + e = if _0v_1 then e2 else e1; + _0v_1 = intArray::_isGreaterThan_(e1, e2); +tel +-- end of node intArray::selectMin + +node intArray::getMinimumIn_( + array:A_int_10) +returns ( + minimumElement:int); +var + maximum:int; +let + maximum = intArray::getMaximumIn_(array); + minimumElement = red<<intArray::selectMin, 10>>(maximum, array); +tel +-- end of node intArray::getMinimumIn_ + +node intArray::selectMinRank( + acc_in:_intArray::currentRank_withMemorizedRank; + elt:int) +returns ( + acc_out:_intArray::currentRank_withMemorizedRank); +var + _0v_8:int; + _0v_3:int; + _0v_4:bool; + _0v_5:int; + _0v_6:int; + _0v_7:int; + _0v_1:int; + _0v_2:int; +let + acc_out = + _intArray::currentRank_withMemorizedRank{currentRank=_0v_2;rankOfMemorizedVal=_0v_7;memorizedVal=_0v_8}; + _0v_8 = acc_in.memorizedVal; + _0v_3 = acc_in.memorizedVal; + _0v_4 = intArray::_isEqualTo_(_0v_3, elt); + _0v_5 = acc_in.currentRank; + _0v_6 = acc_in.rankOfMemorizedVal; + _0v_7 = if _0v_4 then _0v_5 else _0v_6; + _0v_1 = acc_in.currentRank; + _0v_2 = _0v_1 + 1; +tel +-- end of node intArray::selectMinRank + +node intArray::getRank_ofMinimumIn_( + array:A_int_10) +returns ( + rankOfMinimumElement:int); +var + minElement:int; + _0v_1:_intArray::currentRank_withMemorizedRank; + _0v_2:_intArray::currentRank_withMemorizedRank; +let + minElement = intArray::getMinimumIn_(array); + rankOfMinimumElement = _0v_2.rankOfMemorizedVal; + _0v_1 = + _intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=minElement}; + _0v_2 = red<<intArray::selectMinRank, 10>>(_0v_1, array); +tel +-- end of node intArray::getRank_ofMinimumIn_ type _intArray::Sort_accu = struct {CurrentRank : int; Tab : A_int_10}; type _intArray::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; type _intArray::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; @@ -20881,26 +21000,6 @@ let arraySorted = UnarySort_accu_out.Tab; tel -- end of node intArray::sort_ -node intArray::selectMax(e1:int; e2:int) returns (e:int); -var - _0v_1:bool; -let - e = if _0v_1 then e1 else e2; - _0v_1 = intArray::_isGreaterThan_(e1, e2); -tel --- end of node intArray::selectMax - -node intArray::getMaximumIn_( - array:A_int_10) -returns ( - maximumElement:int); -var - _0v_1:int; -let - maximumElement = red<<intArray::selectMax, 10>>(_0v_1, array); - _0v_1 = array[0]; -tel --- end of node intArray::getMaximumIn_ type _intArray::iteratedStruct = struct {currentRank : int; rankToSelect : int; elementSelected : int}; node intArray::selectOneStage( @@ -20935,136 +21034,19 @@ node intArray::selectElementOfRank_inArray_( rankToSelect:int; array:A_int_10) returns ( - elementSelected:int); -var - iterationResult:_intArray::iteratedStruct; - _0v_1:int; - _0v_2:_intArray::iteratedStruct; -let - iterationResult = red<<intArray::selectOneStage, 10>>(_0v_2, array); - _0v_1 = array[0]; - _0v_2 = - _intArray::iteratedStruct{currentRank=0;rankToSelect=rankToSelect;elementSelected=_0v_1}; - elementSelected = iterationResult.elementSelected; -tel --- end of node intArray::selectElementOfRank_inArray_ -node intArray::selectMin(e1:int; e2:int) returns (e:int); -var - _0v_1:bool; -let - e = if _0v_1 then e2 else e1; - _0v_1 = intArray::_isGreaterThan_(e1, e2); -tel --- end of node intArray::selectMin - -node intArray::getMinimumIn_( - array:A_int_10) -returns ( - minimumElement:int); -var - maximum:int; -let - maximum = intArray::getMaximumIn_(array); - minimumElement = red<<intArray::selectMin, 10>>(maximum, array); -tel --- end of node intArray::getMinimumIn_ -type _intArray::currentRank_withMemorizedRank = struct {currentRank : int; rankOfMemorizedVal : int; memorizedVal : int}; - -node intArray::selectMaxRank( - acc_in:_intArray::currentRank_withMemorizedRank; - e1:int) -returns ( - acc_out:_intArray::currentRank_withMemorizedRank); -var - _0v_8:int; - _0v_9:bool; - _0v_10:int; - _0v_11:int; - _0v_3:int; - _0v_4:bool; - _0v_5:int; - _0v_6:int; - _0v_7:int; - _0v_1:int; - _0v_2:int; -let - acc_out = - _intArray::currentRank_withMemorizedRank{currentRank=_0v_2;rankOfMemorizedVal=_0v_7;memorizedVal=_0v_11}; - _0v_8 = acc_in.memorizedVal; - _0v_9 = intArray::_isGreaterThan_(e1, _0v_8); - _0v_10 = acc_in.memorizedVal; - _0v_11 = if _0v_9 then e1 else _0v_10; - _0v_3 = acc_in.memorizedVal; - _0v_4 = intArray::_isGreaterThan_(e1, _0v_3); - _0v_5 = acc_in.currentRank; - _0v_6 = acc_in.rankOfMemorizedVal; - _0v_7 = if _0v_4 then _0v_5 else _0v_6; - _0v_1 = acc_in.currentRank; - _0v_2 = _0v_1 + 1; -tel --- end of node intArray::selectMaxRank - -node intArray::getRank_ofMaximumIn_( - array:A_int_10) -returns ( - rankOfMaximumElement:int); -var - local:_intArray::currentRank_withMemorizedRank; - _0v_1:int; - _0v_2:_intArray::currentRank_withMemorizedRank; -let - local = red<<intArray::selectMaxRank, 10>>(_0v_2, array); - _0v_1 = array[0]; - _0v_2 = - _intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=_0v_1}; - rankOfMaximumElement = local.rankOfMemorizedVal; -tel --- end of node intArray::getRank_ofMaximumIn_ - -node intArray::selectMinRank( - acc_in:_intArray::currentRank_withMemorizedRank; - elt:int) -returns ( - acc_out:_intArray::currentRank_withMemorizedRank); -var - _0v_8:int; - _0v_3:int; - _0v_4:bool; - _0v_5:int; - _0v_6:int; - _0v_7:int; - _0v_1:int; - _0v_2:int; -let - acc_out = - _intArray::currentRank_withMemorizedRank{currentRank=_0v_2;rankOfMemorizedVal=_0v_7;memorizedVal=_0v_8}; - _0v_8 = acc_in.memorizedVal; - _0v_3 = acc_in.memorizedVal; - _0v_4 = intArray::_isEqualTo_(_0v_3, elt); - _0v_5 = acc_in.currentRank; - _0v_6 = acc_in.rankOfMemorizedVal; - _0v_7 = if _0v_4 then _0v_5 else _0v_6; - _0v_1 = acc_in.currentRank; - _0v_2 = _0v_1 + 1; -tel --- end of node intArray::selectMinRank - -node intArray::getRank_ofMinimumIn_( - array:A_int_10) -returns ( - rankOfMinimumElement:int); + elementSelected:int); var - minElement:int; - _0v_1:_intArray::currentRank_withMemorizedRank; - _0v_2:_intArray::currentRank_withMemorizedRank; + iterationResult:_intArray::iteratedStruct; + _0v_1:int; + _0v_2:_intArray::iteratedStruct; let - minElement = intArray::getMinimumIn_(array); - rankOfMinimumElement = _0v_2.rankOfMemorizedVal; - _0v_1 = - _intArray::currentRank_withMemorizedRank{currentRank=0;rankOfMemorizedVal=0;memorizedVal=minElement}; - _0v_2 = red<<intArray::selectMinRank, 10>>(_0v_1, array); + iterationResult = red<<intArray::selectOneStage, 10>>(_0v_2, array); + _0v_1 = array[0]; + _0v_2 = + _intArray::iteratedStruct{currentRank=0;rankToSelect=rankToSelect;elementSelected=_0v_1}; + elementSelected = iterationResult.elementSelected; tel --- end of node intArray::getRank_ofMinimumIn_ +-- end of node intArray::selectElementOfRank_inArray_ node main::main( a:A_int_10) @@ -21114,11 +21096,11 @@ Error. No package has been provided -- ../lus2lic -vl 2 --nonreg-test -- should_work/packEnvTest/contractForElementSelectionInArray/tri.lus +type _tri::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; const tri::size = 10; type _tri::INTSIZE = int^10; type _tri::Sort_accu = struct {CurrentRank : int; Tab : A_int_10}; type _tri::Select_accu = struct {RankToFind : int; CurrentRank : int; Val : int}; -type _tri::MinFR_accu = struct {MinVal : int; MinRank : int; RankFrom : int; Rank : int}; type _tri::sorted_iter_accu = struct {prev_elt : int; prop_is_tt : bool}; type _tri::Exchange_accu = struct {MinVal : int; MinRank : int; RankFrom : int; CurrentVal : int; Rank : int}; @@ -21396,6 +21378,15 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_work/packEnvTest/modelInst.lus -- ../lus2lic -vl 2 --nonreg-test should_work/packEnvTest/modelInst.lus +type _Pbool::t = bool; +node Pbool::n(init:bool; in:bool) returns (ok:bool); +var + _v_1:bool; +let + ok = init -> _v_1; + _v_1 = pre (in); +tel +-- end of node Pbool::n type _Pint::t = int; node Pint::n(init:int; in:int) returns (ok:int); var @@ -21405,6 +21396,7 @@ let _v_1 = pre (in); tel -- end of node Pint::n +const main::pi = 3.14159; type _Preal::t = real; node Preal::n(init:real; in:real) returns (ok:real); var @@ -21414,16 +21406,6 @@ let _v_1 = pre (in); tel -- end of node Preal::n -type _Pbool::t = bool; -node Pbool::n(init:bool; in:bool) returns (ok:bool); -var - _v_1:bool; -let - ok = init -> _v_1; - _v_1 = pre (in); -tel --- end of node Pbool::n -const main::pi = 3.14159; node main::main( i:int; @@ -21461,25 +21443,26 @@ let _v_1 = pre (fb); tel -- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; +type _pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); var - _v_1:bool; + _v_1:int; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pbool::fby1 -type _pint::t = int; -node pint::fby1(init:int; fb:int) returns (next:int); +-- end of node pint::fby1 +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); var - _v_1:int; + _v_1:bool; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pint::fby1 -type _inter::selType = struct {i : int; b : bool; r : real}; +-- end of node pbool::fby1 node inter::preced( in:_inter::selType) @@ -21513,7 +21496,6 @@ let (out, out2) = inter::preced(in); tel -- end of node mainPack::preced -const inter::n = -4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/packEnvTest/packages2.lus @@ -21528,15 +21510,13 @@ let _v_1 = pre (fb); tel -- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); -var - _v_1:bool; +node main::foo(in:int) returns (out:int); let - next = init -> _v_1; - _v_1 = pre (fb); + out = in; tel --- end of node pbool::fby1 +-- end of node main::foo +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; type _pint::t = int; node pint::fby1(init:int; fb:int) returns (next:int); var @@ -21546,8 +21526,15 @@ let _v_1 = pre (fb); tel -- end of node pint::fby1 -type _inter::selType = struct {i : int; b : bool; r : real}; -const inter::n = -4; +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); +var + _v_1:bool; +let + next = init -> _v_1; + _v_1 = pre (fb); +tel +-- end of node pbool::fby1 node inter::preced( in:_inter::selType) @@ -21574,11 +21561,6 @@ let _v_6 = in.r; tel -- end of node inter::preced -node main::foo(in:int) returns (out:int); -let - out = in; -tel --- end of node main::foo ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_work/packEnvTest/polymorphic_pack.lus @@ -21606,8 +21588,11 @@ type A_int_3 = int^3; type _asservi::pendule; const asservi::G = 10.0; -const asservi::L = 2.0; const asservi::T = 0.1; +const asservi::L = 2.0; +extern function asservi::sin(x:real) returns (y:real); +extern function asservi::cos(x:real) returns (y:real); +extern function asservi::sqrt(x:real) returns (y:real); node asservi::D(x:real) returns (d:real); var _v_1:real; @@ -21620,8 +21605,6 @@ let _v_3 = _v_2 / 0.1; tel -- end of node asservi::D -extern function asservi::sin(x:real) returns (y:real); -extern function asservi::cos(x:real) returns (y:real); node asservi::I(dx:real) returns (x:real); var _v_1:real; @@ -21676,35 +21659,6 @@ extern function asservi::make_pend( y:real) returns ( p:_asservi::pendule); -node asservi::jeu(x0:real; y0:real) returns (p:_asservi::pendule); -var - d2x0:real; - d2y0:real; - teta:real; - x:real; - y:real; - _v_1:real; - _v_2:real; - _v_3:real; - _v_4:real; - _v_5:real; - _v_6:real; -let - d2x0 = asservi::D(_v_1); - _v_1 = asservi::D(x0); - d2y0 = asservi::D(_v_2); - _v_2 = asservi::D(y0); - teta = asservi::PEND(d2x0, d2y0); - x = x0 + _v_4; - _v_3 = asservi::sin(teta); - _v_4 = 2.0 * _v_3; - y = y0 + _v_6; - _v_5 = asservi::cos(teta); - _v_6 = 2.0 * _v_5; - p = asservi::make_pend(x0, y0, x, y); -tel --- end of node asservi::jeu -extern function asservi::sqrt(x:real) returns (y:real); node asservi::asservi(delta:real) returns (p:_asservi::pendule); var d2x0:real; @@ -21763,6 +21717,34 @@ let p = asservi::make_pend(x0, y0, x, y); tel -- end of node asservi::asservi +node asservi::jeu(x0:real; y0:real) returns (p:_asservi::pendule); +var + d2x0:real; + d2y0:real; + teta:real; + x:real; + y:real; + _v_1:real; + _v_2:real; + _v_3:real; + _v_4:real; + _v_5:real; + _v_6:real; +let + d2x0 = asservi::D(_v_1); + _v_1 = asservi::D(x0); + d2y0 = asservi::D(_v_2); + _v_2 = asservi::D(y0); + teta = asservi::PEND(d2x0, d2y0); + x = x0 + _v_4; + _v_3 = asservi::sin(teta); + _v_4 = 2.0 * _v_3; + y = y0 + _v_6; + _v_5 = asservi::cos(teta); + _v_6 = 2.0 * _v_5; + p = asservi::make_pend(x0, y0, x, y); +tel +-- end of node asservi::jeu Those tests are supposed to generate errors ---------------------------------------------------------------------- @@ -21788,7 +21770,6 @@ Those tests are supposed to generate errors ====> ../lus2lic -vl 2 --nonreg-test should_fail/clock/clock.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/clock/clock.lus -extern node clock::clock2(u:bool; v:bool when u) returns (y:bool); extern node clock::clock3(u:bool) returns (x:bool; y:bool when x); extern node clock::clock4( @@ -21797,6 +21778,7 @@ extern node clock::clock4( returns ( x:bool; y:bool when x); +extern node clock::clock2(u:bool; v:bool when u) returns (y:bool); *** Error in file "clock.lus", line 23, col 12 to 17, token 'clock4': *** *** clock error: The two following clocks are not unifiable: @@ -21824,8 +21806,8 @@ returns ( -- ../lus2lic -vl 2 --nonreg-test should_fail/clock/when_enum.lus type _when_enum::t = enum {when_enum::A, when_enum::B, when_enum::C}; -extern node when_enum::tutu(u:_when_enum::t) returns (x:bool); extern node when_enum::toto(u:bool; v:bool) returns (x:bool; y:bool); +extern node when_enum::tutu(u:_when_enum::t) returns (x:bool); *** Error in file "when_enum.lus", line 10, col 12 to 15, token 'toto': *** *** clock error: The two following clocks are not unifiable: @@ -21836,22 +21818,22 @@ extern node when_enum::toto(u:bool; v:bool) returns (x:bool; y:bool); ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/activation1.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/activation1.lus -node activation1::up(in:int) returns (out:int); +node activation1::down(in:int) returns (out:int); var _v_1:int; let - out = _v_1 + 1; + out = _v_1 - 1; _v_1 = pre (in); tel --- end of node activation1::up -node activation1::down(in:int) returns (out:int); +-- end of node activation1::down +node activation1::up(in:int) returns (out:int); var _v_1:int; let - out = _v_1 - 1; + out = _v_1 + 1; _v_1 = pre (in); tel --- end of node activation1::down +-- end of node activation1::up node activation1::activation1(evt:bool; reset:bool) returns (scie:int); var go_up:bool; @@ -21940,20 +21922,20 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/bad_call01.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/bad_call01.lus -*** Error in file "bad_call01.lus", line 2, col 13 to 16, token 'titi': -*** Recursion loop detected in node bad_call01::titi - node ref in file "bad_call01.lus", line 2, col 13 to 16, token 'titi' +*** Error in file "bad_call01.lus", line 3, col 13 to 16, token 'toto': +*** Recursion loop detected in node bad_call01::toto + node ref in file "bad_call01.lus", line 3, col 13 to 16, token 'toto' ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/bug.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/bug.lus -type _bug::tab1 = int^2; -type _bug::tab2 = A_int_3^4; -type _bug::tab3 = A_A_int_5_6^7; const bug::ze_const_int = 5; type _bug::bool4 = bool^5; +type _bug::tab3 = A_A_int_5_6^7; +type _bug::tab2 = A_int_3^4; +type _bug::tab1 = int^2; type _bug::really = real; node bug::bidon(in:bool) returns (out1:bool; out2:bool); var @@ -21971,6 +21953,23 @@ let out2 = false and in; tel -- end of node bug::bidon +node bug::after(X:bool) returns (afterX:bool); +var + bidon1:bool; + bidon2:bool; + _v_1:bool; + _v_2:bool; + _v_3:bool; + _v_4:bool; +let + afterX = false -> _v_4; + _v_1 = X or afterX; + _v_2 = pre (_v_1); + _v_3 = bidon2 and bidon1; + _v_4 = _v_2 or _v_3; + (bidon1, bidon2) = bug::bidon(X); +tel +-- end of node bug::after node bug::edge_detect(in:bool) returns (edge:bool); var bidon1:bool; @@ -21990,23 +21989,6 @@ let (bidon1, bidon2) = bug::bidon(in); tel -- end of node bug::edge_detect -node bug::after(X:bool) returns (afterX:bool); -var - bidon1:bool; - bidon2:bool; - _v_1:bool; - _v_2:bool; - _v_3:bool; - _v_4:bool; -let - afterX = false -> _v_4; - _v_1 = X or afterX; - _v_2 = pre (_v_1); - _v_3 = bidon2 and bidon1; - _v_4 = _v_2 or _v_3; - (bidon1, bidon2) = bug::bidon(X); -tel --- end of node bug::after node bug::once_since(C:bool; A:bool) returns (X:bool); var _v_1:bool; @@ -22099,10 +22081,10 @@ let tel -- end of node bug::bug -- automatically defined aliases: -type A_int_2 = int^2; -type A_A_int_5_6 = A_int_5^6; type A_int_5 = int^5; +type A_A_int_5_6 = A_int_5^6; type A_int_3 = int^3; +type A_int_2 = int^2; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/const.lus @@ -22209,15 +22191,6 @@ type A_int_4 = int^4; ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/piege.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/piege.lus -node piege::aux2(in1:bool; in2:bool) returns (out1:bool; out2:bool); -var - _v_1:bool; -let - out1 = true -> _v_1; - _v_1 = pre (in1); - out2 = in2; -tel --- end of node piege::aux2 node piege::aux1(in1:bool; in2:bool) returns (out:bool); var _v_1:bool; @@ -22228,6 +22201,15 @@ let _v_2 = true -> _v_1; tel -- end of node piege::aux1 +node piege::aux2(in1:bool; in2:bool) returns (out1:bool; out2:bool); +var + _v_1:bool; +let + out1 = true -> _v_1; + _v_1 = pre (in1); + out2 = in2; +tel +-- end of node piege::aux2 node piege::piege(in:bool) returns (out:bool); var _v_1:bool; @@ -22244,25 +22226,26 @@ tel ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/tranche.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/tranche.lus -type _tranche::t2 = A_A_A_bool_7_8_9^10; type _tranche::t = A_bool_3^4; +type _tranche::t2 = A_A_A_bool_7_8_9^10; *** Error in file "tranche.lus", line 7, col 6 to 6, token 'n': *** *** can't eval constant: *** cannot access this extern constant value +const tranche::s:A_A_A_A_bool_7_8_9_10; const tranche::n:A_A_bool_3_4; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_fail/semantics/x.lus -- ../lus2lic -vl 2 --nonreg-test should_fail/semantics/x.lus -*** Error in file "x.lus", line 4, col 7 to 7, token 'm': +*** Error in file "x.lus", line 8, col 7 to 7, token 't': *** Recursion loop detected: -*** const ref in file "x.lus", line 4, col 11 to 11, token 'x' - > const ref in file "x.lus", line 6, col 11 to 11, token 't' - > const ref in file "x.lus", line 8, col 11 to 11, token 'n' +*** const ref in file "x.lus", line 8, col 11 to 11, token 'n' > const ref in file "x.lus", line 2, col 11 to 11, token 'm' + > const ref in file "x.lus", line 4, col 11 to 11, token 'x' + > const ref in file "x.lus", line 6, col 11 to 11, token 't' ---------------------------------------------------------------------- @@ -22307,8 +22290,8 @@ let tel -- end of node bad_call03::bad_call03 -- automatically defined aliases: -type A_int_3 = int^3; type A_real_3 = real^3; +type A_int_3 = int^3; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 --nonreg-test should_fail/type/const2.lus @@ -22351,25 +22334,26 @@ let _v_1 = pre (fb); tel -- end of node preal::fby1 -type _pbool::t = bool; -node pbool::fby1(init:bool; fb:bool) returns (next:bool); +type _inter::selType = struct {i : int; b : bool; r : real}; +const inter::n = -4; +type _pint::t = int; +node pint::fby1(init:int; fb:int) returns (next:int); var - _v_1:bool; + _v_1:int; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pbool::fby1 -type _pint::t = int; -node pint::fby1(init:int; fb:int) returns (next:int); +-- end of node pint::fby1 +type _pbool::t = bool; +node pbool::fby1(init:bool; fb:bool) returns (next:bool); var - _v_1:int; + _v_1:bool; let next = init -> _v_1; _v_1 = pre (fb); tel --- end of node pint::fby1 -type _inter::selType = struct {i : int; b : bool; r : real}; +-- end of node pbool::fby1 node inter::preced( in:_inter::selType) diff --git a/utils/lustre.el b/utils/lustre.el new file mode 100644 index 00000000..5fcc2012 --- /dev/null +++ b/utils/lustre.el @@ -0,0 +1,737 @@ +;;; lustre.el - Major mode for editing lustre source in Emacs +;; +;; Copyright (C) 2001 Olivier Chevallier +;; 2010 Nicolas Berthier +;; +;; Author: Chevallier Olivier <p6mip467 at infop6.jussieu.fr> +;; Created: 30 / 05 / 2001 +;; +;; Additional author & modifications: +;; +;; o Nicolas Berthier <nicolas.berthier at imag.fr> (June 30, 2011): +;; - Corrected a bug in font-lock descriptor (keywords in commentaries). +;; +;; o Nicolas Berthier (March 26, 2010): +;; - Added lustre group for customize. +;; - Hacked compilation command generation. +;; - Stripped some electric keys. +;; - Updated to use syntax tables. +;; - Improved font-lock descriptor. +;; +;; This file is not part of GNU Emacs +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +;; +;;; INSTALL : +;; +;; Put these lines at the end of your .emacs : +;; +;; (setq auto-mode-alist (cons '("\\.lus$" . lustre-mode) auto-mode-alist)) +;; (autoload 'lustre-mode "lustre" "Edition de code lustre" t) +;; +;; Set the load-path variable : +;; +;; (setq load-path +;; (append load-path +;; '("/home/dir_where_you_put_lustre.el"))) +;; +;; Byte-compile lustre.el to speed-up +;; the loading of a lustre source file : +;; +;; M-x byte-compile-file -> lustre.el +;; +;;; USAGE : +;; +;; \C-c\C-c -> send a node to the lustre compiler. +;; To close the compilation window : +;; \C-x 0 while in compilation buffer +;; or \C-x 1 while in source buffer +;; +;; TAB -> indent current line. + +;;; code : + +(require 'font-lock) +(require 'cl) + +; version of lustre-mode +(defconst lustre-mode-version "1.3") + +;;; Customisable values : + +;; NB: `lustre' customization group. +(defgroup lustre nil + "Group of customizable values for Lustre major mode." + :prefix "lustre-") + +(defcustom lustre-ask-node-mode nil + "*Way to choose the node to compile: + - t : prompt the user for the name of the node. + - nil : compile current node without asking." + :type '(boolean) + :group 'lustre) + +(defcustom lustre-compiler-name "luciole -comp" + "*Name of the lustre compiler to call." + :type '(string) + :group 'lustre) + +(defcustom lustre-comment-ind-level 2 + "*How many spaces to indent a comment." + :type '(integer) + :group 'lustre) + +;;; Hooks + +(defvar lustre-mode-hook nil + "functions called when entering Lustre Mode.") + +;;; Key-map for Lustre-mode + +(defvar lustre-mode-map nil + "Keymap for lustre major mode.") +(unless lustre-mode-map + (setq lustre-mode-map (make-sparse-keymap)) + ;; NB: strip those annoying electric keys. + ;; (define-key lustre-mode-map "," 'electric-lustre-special-char) + ;; (define-key lustre-mode-map ":" 'electric-lustre-special-char) + (define-key lustre-mode-map "\C-c\C-c" 'lustre-compil) + (define-key lustre-mode-map "\r" 'electric-lustre-end-of-line) + ;; (define-key lustre-mode-map "\t" 'electric-lustre-tab) + ) + +;;; Compilation ------------------------------------------------- + +(defun lustre-compil () + "Saves the file and calls the lustre compiler. Prompt for saving if +`compilation-ask-about-save' is non nil" + (interactive) + (if (buffer-modified-p) + (if (or (not compilation-ask-about-save) + (y-or-n-p "Save file? ")) + (save-buffer))) + (let ((fichier (buffer-file-name)) + (node nil)) + (if lustre-ask-node-mode + (setq node (lustre-ask-node-name)) + (setq node (lustre-get-current-node))) + (if (and (not lustre-ask-node-mode) (eq node "")) + (message "no node to compile.") + ;; NB: split command now, and add options at the end... + (let* ((str (split-string (eval 'lustre-compiler-name))) + (cmd (car str)) + (opts (cadr str))) + (progn + ;; TODO: use `compile-command' instead, since I hate this window + ;; spliting behavior... + (delete-other-windows) + (split-window-vertically) + (get-buffer-create "*compil-lustre*") + (select-window (next-window)) + (switch-to-buffer "*compil-lustre*") + (apply 'start-process "lustre-compilation" "*compil-lustre*" + (list cmd fichier node opts)) + (end-of-buffer) + (select-window (next-window))))))) + +(defun lustre-get-current-node () + "Returns the current node. + Search backward for keyword 'node' and returns the following node. + Nil means not in a node." + (interactive) + (save-excursion + (let ((res "")) + (end-of-line) + (if (re-search-backward "^\\<node\\>" 1 t) + (progn + (forward-char 4) + (skip-chars-forward " \t\n") + (while (not (looking-at "\\((\\| \\|$\\)")) + (setq res (concat res (char-to-string (char-after (point))))) + (forward-char 1)))) + res))) + +(defun lustre-ask-node-name () + "Ask for the node to compile." + (interactive) + (read-from-minibuffer "node to compile :")) + +;; ----------------------------------------------------------------------------- + +;; {{{ Syntax table + +(defvar lustre-mode-syntax-table (make-syntax-table) + "Syntax table used in the Lustre mode.") + + ; `_' is also in words. +(modify-syntax-entry ?\_ "w" lustre-mode-syntax-table) + + ; comment line finisher: +(modify-syntax-entry ?\n ">" lustre-mode-syntax-table) + + ; comment start if double, + ; punct. otherwise. +(modify-syntax-entry ?\- ". 12" lustre-mode-syntax-table) + +;; multiline comments (is this the right syntax?): + ; beg of multiline comment starter +(modify-syntax-entry ?\( "()1b" lustre-mode-syntax-table) + ; beg of multiline comment finisher +(modify-syntax-entry ?\) ")(4b" lustre-mode-syntax-table) + ; end & beg of multiline comment starter + ; & finisher. +(modify-syntax-entry ?\* ". 23b" lustre-mode-syntax-table) + +;; }}} + +;; ----------------------------------------------------------------------------- + +;; {{{ Font lock + +;; NB: Note `labels' is a common-lisp feature. +(defconst lustre-font-lock-keywords + ;; note that we specify optional multi-line font lock here... + (let ((sep "[\t\n ]*") + (id "\\<\\(\\w*\\)\\>") + (ids "\\(\\w\\|[,\t\n ]\\)*") + (var font-lock-variable-name-face) + (fun font-lock-function-name-face) + (cte font-lock-constant-face) + (cmt font-lock-comment-face) + (typ font-lock-type-face) + (kw font-lock-keyword-face)) + (labels ((id-before (suf) (concat id sep suf)) + (id-after (pref) (concat pref sep id)) + (id-in-btw (pref suf) (concat pref sep (id-before suf))) + (ids-before (suf) (concat ids sep suf)) + (ids-after (pref) (concat pref sep ids)) + (ids-in-btw (pref suf) (concat pref sep (ids-before suf)))) + `( + ; identifiers + (,(ids-in-btw "\\([(;^]\\|\\<var\\|const\\>\\)" ":") . ,var) + ;; NB: needed in some cases, such as long lists of formal arguments...: + (,(ids-before ":") . ,var) + + (,(concat "[:;,/().]\\|" ; keywords (override since we + ; match commas and other keywords + ; in lists of identifiers) + (regexp-opt '("/" "*" "#" "=" "+" "-" "*" "<" ">")) "\\|" + (regexp-opt '("node" "const" "function" "include" "let" + "returns" "tel" "type" "var" "if" "with" + "then" "else" "and" "or" "xor" "assert" + "pre" "not" "when" + "current") 'words)) 0 ,kw t) + + ;; NB: we need to do this 'cause keywords may be highlighted in comments + ;; otherwise (in some circumstances). + ;; + ;; XXX: I have no clue for multi-line comments yet... (except maybe a + ;; call to some function). + ("--.*$" 0 ,cmt t) + + ; type names + (,(id-after (regexp-opt '("type"))) 1 ,typ) + (,(id-after ":") 1 ,typ) + + ; call + (,(id-after (regexp-opt '("node" "function") 'words)) 1 ,fun) + (,(id-before "(") 1 ,fun) + + ; constants + (,(regexp-opt '("true" "false") 'words) . ,cte) + ("\\<[0-9]*\\>" . ,cte)))) + + "Regular expressions used by Font-lock mode.") + +(defun lustre-font-lock-mode () + "Initialisation of font-lock for Lustre mode." + (setq font-lock-multiline 'undecided + font-lock-defaults '(lustre-font-lock-keywords)) + (font-lock-mode 1)) + +(add-hook 'lustre-mode-hook 'lustre-font-lock-mode) + +;; }}} + +;;; indentation code ---------------------------------------------- + + +(defun lustre-indent-decl () + "Returns the indentation of a declaration line. " + (interactive) + (let ((result 2)) + (save-excursion + (if (re-search-backward "^\\<\\(const\\|tel\\|type\\|var\\)\\>" 0 t) + (cond + ((looking-at "^\\<tel\\>") (setq result 2)) + ((looking-at "^\\<\\(const\\|type\\|var\\)\\>[ \t]*$") + (setq result 2)) + ((looking-at + "^\\<const\\>[ \t]*.+") (setq result 6)) + ((looking-at "^\\<type\\>[ \t]*.+") (setq result 5)) + ((looking-at "^\\<var\\>[ \t]*.+") (setq result 4))))) + result)) + + +(defun electric-lustre-special-char () + "Insert a space after ',' or ':' ." + (interactive) + (insert last-command-char) + (insert " ")) + +(defun electric-lustre-end-of-line () + "Insert a newline." + (interactive) + (newline)) + +(defun electric-lustre-tab () + "Indent current line ." + (interactive) + (let ((mark (make-marker))) + (set-marker mark (point)) + (beginning-of-line) + (lustre-indent (lustre-compute-indent)) + (goto-char (marker-position mark)) + (set-marker mark nil) + ) + (if (looking-at "^") + (skip-chars-forward " \t"))) + + +(defun lustre-get-beginning-of-line (&optional arg) + "Returns position of the first non-space char of the current line, + or line (arg - 1) if optional argument is given." + (interactive) + (save-excursion + (beginning-of-line arg) + (let ((deb (point))) + (skip-chars-forward " \t") + (let ((fin (point))) + (- fin deb))))) + +(defun lustre-get-point-of-line () + "Returns position of the first char of the current line." + (interactive) + (save-excursion + (beginning-of-line) + (point))) + +(defun lustre-skip-comments () + "set point before the commentary of the current line (if any)." + (interactive) + (beginning-of-line) + (while (not (or (looking-at "$") + (looking-at "--"))) + (forward-char 1))) + +(defun lustre-line-is-comment (&optional arg) + "non-nil means line is only a commentary." + (interactive) + (save-excursion + (beginning-of-line arg) + (skip-chars-forward " \t") + (looking-at "--"))) + +(defun lustre-line-is-decl () + "non-nil means current line is a declaration. " + (interactive) + (save-excursion + (let ((res nil) + (continue t)) + (while continue + (if (= (point) 1) + (setq continue nil)) + (re-search-backward + "\\<\\(const\\|let\\|node\\|var\\|type\\|function\\)\\>" 1 t) + (if (not (lustre-line-is-comment)) + (setq continue nil))) + (if (looking-at "\\<\\(const\\|type\\|var\\)\\>") + (setq res t)) + (if (looking-at "\\<\\(let\\|node\\|function\\)\\>") + (setq res nil)) + res))) + + +(defun lustre-in-comment () + "non-nil means point is inside a comment." + (interactive) + (save-excursion + (re-search-backward "--" (lustre-get-point-of-line) t))) + +(defun lustre-skip-commentary-lines () + "set point to the beginnig of the first non-commemtary line before + the current line." + (interactive) + (forward-line -1) + (while (and (lustre-line-is-comment) (> (point) 1)) + (forward-line -1))) + +(defun lustre-indent (niveau) + "Indents current line ." + (interactive "p") + (beginning-of-line) + (delete-char (lustre-get-beginning-of-line)) + (let ((ind niveau)) + (while (> ind 0) + (insert " ") + (setq ind (- ind 1))))) + + +(defun lustre-find-noindent-reg () + "non-nil means current line begins with: + const, function, include, let, var, tel, node, returns, type." + (interactive) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (and + (looking-at + +"\\<\\(const\\|function\\|include\\|let\\|node\\|returns\\|tel\\|type\\|var\\)\\>") + (not (lustre-in-comment))))) + + +(defun lustre-find-unmatching-parent () + "Looks for an unmatched parenthese, and returns its position. + (or nil if there isn't any). " + (interactive) + (let ((continue t) + (result nil) + (beg nil) + (count-parent 0)) + (save-excursion + (beginning-of-line) + (if (= (point) 1) + (setq continue nil)) + (while continue + (forward-line -1) + (setq beg (point)) + (end-of-line) + (while (and (not (looking-at "^")) continue) + (if (and (looking-at ")") (not (lustre-in-comment))) + (setq count-parent (- count-parent 1)) + (if (and (looking-at "(") (not (lustre-in-comment))) + (progn + (setq count-parent (+ count-parent 1)) + (if (= count-parent 1) + (progn + (setq result (- (point) beg)) + (setq continue nil)))))) + (forward-char -1)) + (skip-chars-forward " \t") + (if (and (looking-at "\\<const\\|var\\|type\\|node\\|function\\>") + (not (lustre-in-comment))) + (setq continue nil)) + (beginning-of-line) + (if (= (point) 1) + (setq continue nil)))) + result)) + + +(defun lustre-indent-normal () + "non-nil means indent normally." + (interactive) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (looking-at "[]a-zA-Z0-9^[()]+"))) + +(defun lustre-empty-line () + "non-nil means line is empty." + (interactive) + (save-excursion + (skip-chars-forward " \t") + (looking-at "$"))) + + + +(defun lustre-compute-indent () + "Returns indentation of current line." + (interactive) + (cond + ; if line is comment + ((lustre-line-is-comment) lustre-comment-ind-level) + ; if line begins with node,include... + ((lustre-find-noindent-reg) 0) + ; if line begins with 'then' or 'else' + ((lustre-find-then-else-beg) (lustre-indent-then-else-beg)) + ; if previous line ends with 'then' or 'else' + ((lustre-find-then-else-end) (+ (lustre-indent-then-else-end) 2)) + ; looks for an unmatched parenthese + ((lustre-find-unmatching-parent) (+ (lustre-find-unmatching-parent) 1)) + ; if line is a declaration + ((lustre-line-is-decl) (lustre-indent-decl)) + ; if previous line ends with '->' + ((lustre-find-arrow) (lustre-indent-arrow-equal-bool)) + ; if previous line ends with '=' + ((lustre-find-equal-end) (lustre-indent-arrow-equal-bool)) + ; if previous line ends with a boolean operator + ((lustre-find-bool-expr-end) (lustre-indent-arrow-equal-bool)) + ; if line is a 'normal line' + ((lustre-indent-normal) 2) + ; line is empty + ((lustre-empty-line) 2) + ; else ... + (t 0))) + + +(defun lustre-find-arrow () + "non-nil means previous line ends with '->' ." + (interactive) + (save-excursion + (lustre-skip-commentary-lines) + (lustre-skip-comments) + (skip-chars-backward " \t") + (forward-char -2) + (and (looking-at "->") (not (lustre-in-comment))))) + + +(defun lustre-indent-arrow-equal-bool () + "Find the level of indentation when previous line ends with '->', +'=' + or a boolean (or, xor, and)." + (interactive) + (save-excursion + (lustre-skip-commentary-lines) + (+ (lustre-get-beginning-of-line) 2))) + + +(defun lustre-find-bool-expr-end () + "non-nil means last line ends with 'and', 'xor' or 'or'." + (interactive) + (let ((result nil)) + (save-excursion + (lustre-skip-commentary-lines) + (lustre-skip-comments) + (skip-chars-backward " \t") + (forward-char -2) + (setq result (and (looking-at "\\<or\\>") + (not (lustre-in-comment)))) + (forward-char -1) + (or (and (looking-at "\\<\\(and\\|not\\|xor\\)\\>") + (not (lustre-in-comment))) + + result)))) + + +(defun lustre-find-then-else-beg () + "non-nil means current line begins with 'then' or 'else' ." + (interactive) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (and (looking-at "\\<\\(else\\|then\\)\\>") + (not (lustre-in-comment))))) + + +(defun lustre-find-then-else-end () + "non-nil means last line ends with 'then' or 'else'." + (interactive) + (save-excursion + (lustre-skip-commentary-lines) + (lustre-skip-comments) + (skip-chars-backward " \t") + (forward-char -4) + (and (looking-at "\\<\\(else\\|then\\)\\>") + (not (lustre-in-comment))))) + + + +(defun lustre-find-equal-end () + "non-nil means last line ends with '=' ." + (interactive) + (save-excursion + (lustre-skip-commentary-lines) + (lustre-skip-comments) + (skip-chars-backward " \t") + (forward-char -1) + (and (looking-at "=") + (not (lustre-in-comment))))) + + + +(defun lustre-indent-then-else-beg () + "Returns the level of indentation of a line beginning with + 'then' or 'else'." + (interactive) + (let ((beg nil) + (result nil) + (count-expr 0) + (continue t)) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (if (and (looking-at "\\<then\\>") (not (lustre-in-comment))) + (while continue + (lustre-skip-commentary-lines) + (setq beg (point)) + (lustre-skip-comments) + (skip-chars-forward " \t") + (if (and (looking-at "\\<node\\|function\\>") + (not (lustre-in-comment))) + (setq continue nil)) + (end-of-line) + (while (and (not (looking-at "^")) continue) + (if (and (looking-at "\\<then\\>") + (not (lustre-in-comment))) + (setq count-expr (- count-expr 1)) + (if (and (looking-at "\\<\\(if\\|with\\)\\>") + (not (lustre-in-comment))) + (progn + (setq count-expr (+ count-expr 1)) + (if (and (= count-expr 1) continue) + (progn + (setq continue nil) + (setq result (- (point) beg))))))) + (forward-char -1))) + (if (looking-at "\\<else\\>") + (while continue + (lustre-skip-commentary-lines) + (setq beg (point)) + (lustre-skip-comments) + (skip-chars-forward " \t") + (if (and (looking-at "\\<node\\|function\\>") + (not (lustre-in-comment))) + (setq continue nil)) + (end-of-line) + (while (and (not (looking-at "^")) continue) + (if (and (looking-at "\\<else\\>") + (not (lustre-in-comment))) + (setq count-expr (- count-expr 1)) + (if (and (looking-at "\\<\\(if\\|with\\)\\>") + (not (lustre-in-comment))) + (progn + (setq count-expr (+ count-expr 1)) + (if (and (= count-expr 1) continue) + (progn + (setq continue nil) + (setq result (- (point) beg))))))) + (forward-char -1)))))) + result)) + + +(defun lustre-indent-then-else-end () + "Returns the level of indentation of a line ending with 'then' or +'else'." + (interactive) + (let ((beg nil) + (result nil) + (count-expr 1) + (continue t)) + (save-excursion + (lustre-skip-commentary-lines) + (lustre-skip-comments) + (skip-chars-backward " \t") + (forward-char -4) + (if (and (looking-at "\\<then\\>") (not (lustre-in-comment))) + (progn + (forward-line 1) + (while continue + (forward-line -1) + (setq beg (point)) + (skip-chars-forward " \t") + (if (and (looking-at "\\<node\\|function\\>") + (not (lustre-in-comment))) + (setq continue nil)) + (end-of-line) + (while (and (not (looking-at "^")) continue) + (if (and (looking-at "\\<then\\>") + (not (lustre-in-comment))) + (setq count-expr (- count-expr 1)) + (if (and (looking-at "\\<\\(if\\|with\\)\\>") + (not (lustre-in-comment))) + (progn + (setq count-expr (+ count-expr 1)) + (if (and (= count-expr 1) continue) + (progn + (setq continue nil) + (setq result (- (point) beg))))))) + (forward-char -1)))) + (if (and (looking-at "\\<else\\>") (not (lustre-in-comment))) + (progn + (forward-line 1) + (while continue + (forward-line -1) + (setq beg (point)) + (skip-chars-forward " \t") + (if (and (looking-at "\\<node\\|function\\>") + (not (lustre-in-comment))) + (setq continue nil)) + (end-of-line) + (while (and (not (looking-at "^")) continue) + (if (and (looking-at "\\<else\\>") + (not (lustre-in-comment))) + (setq count-expr (- count-expr 1)) + (if (and (looking-at "\\<\\(if\\|with\\)\\>") + (not (lustre-in-comment))) + (progn + (setq count-expr (+ count-expr 1)) + (if (and (= count-expr 1) continue) + (progn + (setq continue nil) + (setq result (- (point) beg))))))) + (forward-char -1))))))) + result)) + +;; ----------------------------------------------------------------------------- + +;;; Major-mode + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.lus$" . lustre-mode)) + +;;;###autoload +(defun lustre-mode () + "Major mode for editing Lustre files. + + Special Commands : + C-c C-c : send a node to the lustre compiler + TAB : indent current line + + Customisable variables : + + - lustre-comment-ind-level: + How many spaces to indent a comment. (default: 2) + + - lustre-compiler-name: + Name of the lustre compiler to call, and additional options. + (default: 'luciole') + + - lustre-ask-node-mode: + Way to choose the node to compile: + * t : prompt the user for the name of the node. + * nil : compile current node without asking. (default) + + + Send bugs report to p6mip467 at infop6.jussieu.fr" + + (interactive) + (kill-all-local-variables) + (setq major-mode 'lustre-mode + mode-name "Lustre") + (use-local-map lustre-mode-map) + + (set (make-local-variable 'indent-line-function) 'electric-lustre-tab) + (set (make-local-variable 'comment-start) "-- ") + (set (make-local-variable 'comment-end) "") + + (set-syntax-table lustre-mode-syntax-table) + (run-hooks 'lustre-mode-hook)) + +(provide 'lustre) + +;; ----------------------------------------------------------------------------- + +;;; lustre.el ends here... -- GitLab