From c6a04f5d8ca6d86fc3289bae2d1af4d39604c1ff Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 8 Oct 2024 22:55:28 -0700 Subject: [PATCH] Update LF and known good --- lingua-franca | 2 +- .../C/src/ActionIsPresentReset.html | 358 ++++ test/known-good/C/src/LastTimeDefer.html | 68 +- test/known-good/C/src/LastTimeDrop.html | 68 +- test/known-good/C/src/LastTimeReplace.html | 68 +- test/known-good/C/src/Mutable.html | 899 +++++++++ test/known-good/C/src/TriggerIssue.html | 495 +++++ test/known-good/C/src/TriggerIssue2.html | 730 ++++++++ .../C/src/concurrent/ScheduleAt.html | 13 +- .../concurrent/{ => failing}/Watchdog.html | 0 .../{ => failing}/WatchdogAction.html | 0 .../{ => failing}/WatchdogMultiple.html | 0 .../{ => failing}/WatchdogMutex.html | 0 .../WatchdogRestartTerminated.html | 0 .../C/src/enclave/EnclaveRequestStop.html | 2 +- test/known-good/C/src/federated/Dataflow.html | 1007 +++++++++++ .../C/src/federated/DecentralizedLagging.html | 1065 +++++++++++ .../federated/DecentralizedMicrosteps.html | 1062 +++++++++++ ...ntralizedP2PUnbalancedTimeoutPhysical.html | 28 +- .../C/src/federated/DecentralizedTimeout.html | 414 +++++ .../modal_models/BanksCount3ModesComplex.html | 6 +- .../modal_models/ModalNestedReactions.html | 8 +- .../BankMultiportIsPresentSetup.html | 1227 +++++++++++++ .../BankOfActionsIsPresentSetup.html | 493 +++++ test/known-good/C/src/token/MutableToken.html | 1605 +++++++++++++++++ .../library-test/src/lib/Import.html | 144 ++ .../Python/src/LingoFederatedImport.html | 244 +++ .../Python/src/federated/BankIndexFed.html | 290 +++ .../src/federated/BankIndexOverride.html | 136 ++ .../Python/src/federated/Dataflow.html | 76 +- .../FederatedTestImportPackages.html | 244 +++ .../src/lingo_imports/TestImportPackages.html | 240 +++ .../modal_models/BanksCount3ModesComplex.html | 6 +- .../modal_models/ModalNestedReactions.html | 8 +- 34 files changed, 10715 insertions(+), 291 deletions(-) create mode 100644 test/known-good/C/src/ActionIsPresentReset.html create mode 100644 test/known-good/C/src/Mutable.html create mode 100644 test/known-good/C/src/TriggerIssue.html create mode 100644 test/known-good/C/src/TriggerIssue2.html rename test/known-good/C/src/concurrent/{ => failing}/Watchdog.html (100%) rename test/known-good/C/src/concurrent/{ => failing}/WatchdogAction.html (100%) rename test/known-good/C/src/concurrent/{ => failing}/WatchdogMultiple.html (100%) rename test/known-good/C/src/concurrent/{ => failing}/WatchdogMutex.html (100%) rename test/known-good/C/src/concurrent/{ => failing}/WatchdogRestartTerminated.html (100%) create mode 100644 test/known-good/C/src/federated/Dataflow.html create mode 100644 test/known-good/C/src/federated/DecentralizedLagging.html create mode 100644 test/known-good/C/src/federated/DecentralizedMicrosteps.html create mode 100644 test/known-good/C/src/federated/DecentralizedTimeout.html create mode 100644 test/known-good/C/src/multiport/BankMultiportIsPresentSetup.html create mode 100644 test/known-good/C/src/multiport/BankOfActionsIsPresentSetup.html create mode 100644 test/known-good/C/src/token/MutableToken.html create mode 100644 test/known-good/Python/build/lfc_include/library-test/src/lib/Import.html create mode 100644 test/known-good/Python/src/LingoFederatedImport.html create mode 100644 test/known-good/Python/src/federated/BankIndexFed.html create mode 100644 test/known-good/Python/src/federated/BankIndexOverride.html create mode 100644 test/known-good/Python/src/lingo_imports/FederatedTestImportPackages.html create mode 100644 test/known-good/Python/src/lingo_imports/TestImportPackages.html diff --git a/lingua-franca b/lingua-franca index 9f6f363f6..dd53b50ae 160000 --- a/lingua-franca +++ b/lingua-franca @@ -1 +1 @@ -Subproject commit 9f6f363f65969f4b4b08bdb07e33e98fb8afd9b7 +Subproject commit dd53b50ae51b9789af7321a4ae04cbd3a234ad8d diff --git a/test/known-good/C/src/ActionIsPresentReset.html b/test/known-good/C/src/ActionIsPresentReset.html new file mode 100644 index 000000000..c1a72e793 --- /dev/null +++ b/test/known-good/C/src/ActionIsPresentReset.html @@ -0,0 +1,358 @@ + +target + + + + + +C + + + { + + + + timeout + + +: + + +7 + + + + + +msecs + + +, + + + + fast + + +: + + +true + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +logical + + + + + +action + + + + + +a + + + + + + +logical + + + + + +action + + + + + +b + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + a { + + += + + + + lf_schedule(a, MSEC( + + +1 + + +)); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +a, b) + + +-> + + + a, b { + + += + + + + if (a + + +-> + + +is_present) { + + + + printf( + + +" + + +A + + +" + + +); + + + + lf_schedule(b, MSEC( + + +2 + + +)); + + + + } + + + + if (b + + +-> + + +is_present) { + + + + printf( + + +" + + +B + + +" + + +); + + + + lf_schedule(a, MSEC( + + +1 + + +)); + + + + } + + + + + + + + lf_print( + + +" + + + at %d msecs with triggers (%d,%d) + + +" + + +, lf_time_logical_elapsed() + + +/ + + + MSEC( + + +1 + + +), a + + +-> + + +is_present, b + + +-> + + +is_present); + + + + + + + + if (a + + +-> + + +is_present && b + + +-> + + +is_present) { + + + + lf_print_error_and_exit( + + +" + + +Both triggers should not be present + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/LastTimeDefer.html b/test/known-good/C/src/LastTimeDefer.html index 44c964d2e..59a8bd538 100644 --- a/test/known-good/C/src/LastTimeDefer.html +++ b/test/known-good/C/src/LastTimeDefer.html @@ -214,73 +214,7 @@ = - - - -0 - - - - - - - - - - -reaction - - -( - - -startup - - -) { - - -= - - - - - - -// Unfortunately, a time state variable cannot be initialized with NEVER. - - - - - - -// So we do that here. - - - - self - - --> - - -last - - -= - - - NEVER; - - - - - - -= - - -} + never diff --git a/test/known-good/C/src/LastTimeDrop.html b/test/known-good/C/src/LastTimeDrop.html index 59c2a304f..58bb1358b 100644 --- a/test/known-good/C/src/LastTimeDrop.html +++ b/test/known-good/C/src/LastTimeDrop.html @@ -186,73 +186,7 @@ = - - - -0 - - - - - - - - - - -reaction - - -( - - -startup - - -) { - - -= - - - - - - -// Unfortunately, a time state variable cannot be initialized with NEVER. - - - - - - -// So we do that here. - - - - self - - --> - - -last - - -= - - - NEVER; - - - - - - -= - - -} + never diff --git a/test/known-good/C/src/LastTimeReplace.html b/test/known-good/C/src/LastTimeReplace.html index e32db065c..60a955866 100644 --- a/test/known-good/C/src/LastTimeReplace.html +++ b/test/known-good/C/src/LastTimeReplace.html @@ -186,73 +186,7 @@ = - - - -0 - - - - - - - - - - -reaction - - -( - - -startup - - -) { - - -= - - - - - - -// Unfortunately, a time state variable cannot be initialized with NEVER. - - - - - - -// So we do that here. - - - - self - - --> - - -last - - -= - - - NEVER; - - - - - - -= - - -} + never diff --git a/test/known-good/C/src/Mutable.html b/test/known-good/C/src/Mutable.html new file mode 100644 index 000000000..faedf53cf --- /dev/null +++ b/test/known-good/C/src/Mutable.html @@ -0,0 +1,899 @@ + +target + + + + + +C + + + + + + + +reactor + + + + + +S + + +(width: + + +int + + + + + += + + + + + +4 + + +) { + + + + + + +output + + +[ + + +width + + +] + + +out + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out { + + += + + + + for(int i + + += + + + + + +0 + + +; i < self + + +-> + + +width; i + + ++ + + ++ + + +) { + + + + lf_set(out[i], + + +0 + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +R + + +(width: + + +int + + + + + += + + + + + +4 + + +) { + + + + + + +mutable + + + + + +input + + +[width] in: + + + + + +int + + + + + + +output + + +[ + + +width + + +] + + +out + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +in) + + +-> + + + out { + + += + + + + for(int i + + += + + + + + +0 + + +; i < self + + +-> + + +width; i + + ++ + + ++ + + +) { + + + + in[i] + + +-> + + +value + + += + + + (i + + ++ + + + + + +1 + + +) + + +* + + + + + +2 + + +; + + + + lf_set(out[i], in[i] + + +-> + + +value); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +s + + + + + += + + + + + +new + + + + + +S + + +(width + + += + + +2 + + +) + + + + + + +r + + + + + += + + + + + +new + + + + + +R + + +(width + + += + + +2 + + +) + + + + + + +s + + +. + + +out + + + + + +-> + + + + + +r + + +. + + +in + + + + + + + + + + +reaction + + +( + + +r + + +. + + +out + + +) { + + += + + + + lf_print( + + +" + + +Received from R %d, %d + + +" + + +, + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value, + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value); + + + + if ( + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value ! + + += + + + + + +2 + + + || + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value ! + + += + + + + + +4 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Expected 2 and 4. + + +" + + +); + + + + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +s + + +. + + +out + + +) { + + += + + + + lf_print( + + +" + + +Received from S %d, %d + + +" + + +, + + +s + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value, + + +s + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value); + + + + if ( + + +s + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value ! + + += + + + + + +0 + + + || + + +s + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value ! + + += + + + + + +0 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Expected zeros. + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/TriggerIssue.html b/test/known-good/C/src/TriggerIssue.html new file mode 100644 index 000000000..25939db09 --- /dev/null +++ b/test/known-good/C/src/TriggerIssue.html @@ -0,0 +1,495 @@ + +/** + + + Testing that unconnected port does not block triggering. + + +*/ + + + +target + + + + + +C + + + { + + + + logging + + +: + + +debug + + + +} + + + + + + + +reactor + + + + + +Source + + + { + + + + + + +output + + + + + +x + + +: + + + + + +bool + + + + + + +output + + + + + +y + + +: + + + + + +bool + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + x, y { + + += + + + + lf_print( + + +" + + +S + + +" + + +); + + + + lf_set(y, + + +true + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +Destination + + + { + + + + + + +input + + + + + +y + + +: + + + + + +bool + + + + + + + + + + +state + + + + + +gotY + + +: + + + + + +bool + + + + + += + + + + + +false + + + + + + + + + + +reaction + + +( + + +y) { + + += + + + + lf_print( + + +" + + +Y + + +" + + +); + + + + self + + +-> + + +gotY + + += + + + + + +true + + +; + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (!self + + +-> + + +gotY) { + + + + lf_print_error_and_exit( + + +" + + +No reaction to Y! + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +ui + + + + + += + + + + + +new + + + + + +Source + + +() + + + + + + +dlc + + + + + += + + + + + +new + + + + + +Destination + + +() + + + + + + + + + + +ui + + +. + + +y + + + + + +-> + + + + + +dlc + + +. + + +y + + + +} + + + + + + diff --git a/test/known-good/C/src/TriggerIssue2.html b/test/known-good/C/src/TriggerIssue2.html new file mode 100644 index 000000000..c6ec09bc4 --- /dev/null +++ b/test/known-good/C/src/TriggerIssue2.html @@ -0,0 +1,730 @@ + +/** + + + Test that untriggered reactions are not triggered. + + +*/ + + + +target + + + + + +C + + + + + + + +reactor + + + + + +OnlySuccess + + + { + + + + + + +input + + + + + +start + + +: + + + + + +bool + + + + + + +output + + + + + +success + + +: + + + + + +bool + + + + + + +output + + + + + +failure + + +: + + + + + +bool + + + + + + + + + + +reaction + + +( + + +start) + + +-> + + + success, failure { + + += + + + + lf_print( + + +" + + +Create Success + + +" + + +); + + + + lf_set(success, + + +true + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +ForwardFailure + + + { + + + + + + +input + + + + + +in + + +: + + + + + +bool + + + + + + +output + + + + + +out + + +: + + + + + +bool + + + + + + + + + + +reaction + + +( + + +in) + + +-> + + + out { + + += + + + + lf_print( + + +" + + +Forward Failure + + +" + + +); + + + + lf_set(out, + + +true + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +Sequence + + + { + + + + + + +input + + + + + +start + + +: + + + + + +bool + + + + + + +output + + + + + +success + + +: + + + + + +bool + + + + + + +output + + + + + +failure + + +: + + + + + +bool + + + + + + +s + + + + + += + + + + + +new + + + + + +OnlySuccess + + +() + + + + + + +f + + + + + += + + + + + +new + + + + + +ForwardFailure + + +() + + + + start + + +-> + + + + + +s + + +. + + +start + + + + + + +s + + +. + + +success + + + + + +-> + + + success + + + + + + +s + + +. + + +failure + + + + + +-> + + + + + +f + + +. + + +in + + + + + + +f + + +. + + +out + + + + + +-> + + + failure + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +s + + + + + += + + + + + +new + + + + + +Sequence + + +() + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + + + +s + + +. + + +start + + + { + + += + + + + lf_print( + + +" + + +Start + + +" + + +); + + + + lf_set( + + +s + + +. + + +start + + +, + + +true + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +s + + +. + + +failure + + +) { + + += + + + + lf_print_error_and_exit( + + +" + + +Failure + + +" + + +); + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/C/src/concurrent/ScheduleAt.html b/test/known-good/C/src/concurrent/ScheduleAt.html index 57dbf106e..6afc93336 100644 --- a/test/known-good/C/src/concurrent/ScheduleAt.html +++ b/test/known-good/C/src/concurrent/ScheduleAt.html @@ -1080,16 +1080,7 @@ - if (elapsed_time - - -= - - -= - - - self + if (self -> @@ -1098,7 +1089,7 @@ action -_hit_list_times[self->action_hit_list_index] && +_hit_list_index < 9 && elapsed_time == self->action_hit_list_times[self->action_hit_list_index] && diff --git a/test/known-good/C/src/concurrent/Watchdog.html b/test/known-good/C/src/concurrent/failing/Watchdog.html similarity index 100% rename from test/known-good/C/src/concurrent/Watchdog.html rename to test/known-good/C/src/concurrent/failing/Watchdog.html diff --git a/test/known-good/C/src/concurrent/WatchdogAction.html b/test/known-good/C/src/concurrent/failing/WatchdogAction.html similarity index 100% rename from test/known-good/C/src/concurrent/WatchdogAction.html rename to test/known-good/C/src/concurrent/failing/WatchdogAction.html diff --git a/test/known-good/C/src/concurrent/WatchdogMultiple.html b/test/known-good/C/src/concurrent/failing/WatchdogMultiple.html similarity index 100% rename from test/known-good/C/src/concurrent/WatchdogMultiple.html rename to test/known-good/C/src/concurrent/failing/WatchdogMultiple.html diff --git a/test/known-good/C/src/concurrent/WatchdogMutex.html b/test/known-good/C/src/concurrent/failing/WatchdogMutex.html similarity index 100% rename from test/known-good/C/src/concurrent/WatchdogMutex.html rename to test/known-good/C/src/concurrent/failing/WatchdogMutex.html diff --git a/test/known-good/C/src/concurrent/WatchdogRestartTerminated.html b/test/known-good/C/src/concurrent/failing/WatchdogRestartTerminated.html similarity index 100% rename from test/known-good/C/src/concurrent/WatchdogRestartTerminated.html rename to test/known-good/C/src/concurrent/failing/WatchdogRestartTerminated.html diff --git a/test/known-good/C/src/enclave/EnclaveRequestStop.html b/test/known-good/C/src/enclave/EnclaveRequestStop.html index b86290bf8..fda6a56c6 100644 --- a/test/known-good/C/src/enclave/EnclaveRequestStop.html +++ b/test/known-good/C/src/enclave/EnclaveRequestStop.html @@ -28,7 +28,7 @@ : -1 +10 diff --git a/test/known-good/C/src/federated/Dataflow.html b/test/known-good/C/src/federated/Dataflow.html new file mode 100644 index 000000000..7c117f5ba --- /dev/null +++ b/test/known-good/C/src/federated/Dataflow.html @@ -0,0 +1,1007 @@ + +target + + + + + +C + + + { + + + + coordination + + +: + + +decentralized + + + + + +// logging: debug + + + +} + + + + + + + +reactor + + + + + +Client + + +(STP_offset: + + +time + + + + + += + + + + + +1 + + + + + +day + + +) { + + + + + + +input + + + + + +server_message + + +: + + + + + +int + + + + + + +output + + + + + +client_message + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +startup + + +) { + + += + + + + lf_print( + + +" + + +Client Startup! + + +" + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +server_message) + + +-> + + + client_message { + + += + + + + int val + + += + + + server_message + + +-> + + +value + + ++ + + + + + +1 + + +; + + + + lf_sleep(MSEC( + + +100 + + +)); + + + + lf_print( + + +" + + +client: %d + + +" + + +, val); + + + + if (val + + += + + += + + + + + +9 + + +) { + + + + lf_print( + + +" + + +client requesting stop + + +" + + +); + + + + lf_request_stop(); + + + + } + + + + lf_set(client_message, val); + + + + + + += + + +} + + +STP + + +( + + +0 + + +) { + + += + + + + + + +// Zero STAA because STA is large and gets added. + + + + lf_print_error_and_exit( + + +" + + +Client STP Violated! + + +" + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +Server + + +(STP_offset: + + +time + + + + + += + + + + + +1 + + + + + +day + + +) { + + + + + + +output + + + + + +server_message + + +: + + + + + +int + + + + + + +input + + + + + +client_message1 + + +: + + + + + +int + + + + + + +input + + + + + +client_message2 + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + server_message { + + += + + + + lf_print( + + +" + + +Server Startup! + + +" + + +); + + + + lf_set(server_message, + + +0 + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +client_message1, client_message2) + + +-> + + + server_message { + + += + + + + int val + + += + + + client_message1 + + +-> + + +value; + + + + if (val < client_message2 + + +-> + + +value) val + + += + + + client_message2 + + +-> + + +value; + + + + lf_sleep(MSEC( + + +100 + + +)); + + + + val + + ++ + + += + + + + + +1 + + +; + + + + lf_print( + + +" + + +server: %d + + +" + + +, val); + + + + if (val + + += + + += + + + + + +8 + + +) { + + + + lf_print( + + +" + + +server requesting stop + + +" + + +); + + + + lf_set(server_message, val); + + + + lf_request_stop(); + + + + } + + + + lf_set(server_message, val); + + + + + + += + + +} + + +STP + + +( + + +0 + + +) { + + += + + + + + + +// Zero STAA because STA is large and gets added. + + + + lf_print_error_and_exit( + + +" + + +Server STP Violated! + + +" + + +); + + + + + + += + + +} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +client1 + + + + + += + + + + + +new + + + + + +Client + + +() + + + + + + +client2 + + + + + += + + + + + +new + + + + + +Client + + +() + + + + + + +server + + + + + += + + + + + +new + + + + + +Server + + +() + + + + + + +server + + +. + + +server_message + + + + + +-> + + + + + +client1 + + +. + + +server_message + + + + + + +client1 + + +. + + +client_message + + + + + +-> + + + + + +server + + +. + + +client_message1 + + + + + +after + + + + + +0 + + + + + + +server + + +. + + +server_message + + + + + +-> + + + + + +client2 + + +. + + +server_message + + + + + + +client2 + + +. + + +client_message + + + + + +-> + + + + + +server + + +. + + +client_message2 + + + + + +after + + + + + +0 + + + +} + + + + + + diff --git a/test/known-good/C/src/federated/DecentralizedLagging.html b/test/known-good/C/src/federated/DecentralizedLagging.html new file mode 100644 index 000000000..9a5918b38 --- /dev/null +++ b/test/known-good/C/src/federated/DecentralizedLagging.html @@ -0,0 +1,1065 @@ + +/** + + + + * @brief A federated system with a decentralized coordinator that has large STA and STAA offsets. + + + + * + + + + * This test verifies that a large STA and STAA offset can be used when the data flow is predictable + + + + * even if the the program is lagging behind physical time. + + + + * + + + + * @author Edward A. Lee + + + + + + +*/ + + + +target + + + + + +C + + + { + + + + coordination + + +: + + +decentralized + + +, + + + + timeout + + +: + + +40 + + + ns + + + +} + + + + + + + +// Pi needs an STP_offset because its event queue is usually empty and otherwise it will advance to the stop time. + + + +reactor + + + + + +Pi + + +(STP_offset: + + +time + + + + + += + + + + + +1 + + + + + +day + + +) { + + + + + + +input + + + + + +trigger + + +: + + + + + +bool + + + + + + +output + + + + + +out + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +trigger) + + +-> + + + out { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print( + + +" + + +***** at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + lf_set(out, + + +42 + + +); + + + + + + += + + +} + + +STP + + +( + + +30 + + + s) { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print_error_and_exit( + + +" + + +STP violation at Pi at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + + + += + + +} + + + +} + + + + + + + +// Gather doesn't need an STP_offset because its event queue is never empty. + + + +reactor + + + + + +Gather + + + { + + + + + + +input + + +[4] in: + + + + + +int + + + + + + +output + + + + + +next + + +: + + + + + +bool + + + + + + +logical + + + + + +action + + + + + +a + + +( + + +10 + + + ns) + + + + + + +state + + + + + +count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + + + + + +reaction + + +( + + +startup + + +, a) + + +-> + + + next { + + += + + + + lf_set(next, + + +true + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in) + + +-> + + + a { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + for (int i + + += + + + + + +0 + + +; i < + + +4 + + +; i + + ++ + + ++ + + +) { + + + + if (!in[i] + + +-> + + +is_present) { + + + + lf_print_error_and_exit( + + +" + + +Missing input %d in Gather at tag + + +" + + + PRINTF_TAG, + + + + i, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + } + + + + } + + + + lf_print( + + +" + + +%d: at tag + + +" + + + PRINTF_TAG, self + + +-> + + +count, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + self + + +-> + + +count + + ++ + + ++ + + +; + + + + lf_schedule(a, + + +0 + + +); + + + + + + += + + +} + + +STP + + +( + + +1 + + + + + +day + + +) { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print_error_and_exit( + + +" + + +STP violation at Gather at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (self + + +-> + + +count < + + +5 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Gather received only %d inputs. Expected 5. + + +" + + +, self + + +-> + + +count); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +pi + + + + + += + + + + + +new + + +[ + + +4 + + +] Pi() + + + + + + +g + + + + + += + + + + + +new + + + + + +Gather + + +() + + + + + + +pi + + +. + + +out + + + + + +-> + + + + + +g + + +. + + +in + + + + ( + + +g + + +. + + +next + + +) + + ++ + + + + + +-> + + + + + +pi + + +. + + +trigger + + + +} + + + + + + diff --git a/test/known-good/C/src/federated/DecentralizedMicrosteps.html b/test/known-good/C/src/federated/DecentralizedMicrosteps.html new file mode 100644 index 000000000..49aa7fcb5 --- /dev/null +++ b/test/known-good/C/src/federated/DecentralizedMicrosteps.html @@ -0,0 +1,1062 @@ + +/** + + + + * @brief A federated system with a decentralized coordinator that has large STA and STAA offsets. + + + + * + + + + * This test verifies that a large STA and STAA offset can be used when the data flow is predictable + + + + * even if the the program is lagging behind physical time. This version uses microsteps and never + + + + * advances past the start time. It also uses lf_request_stop() to stop the execution. + + + + * + + + + * @author Edward A. Lee + + + + + + +*/ + + + +target + + + + + +C + + + { + + + + coordination + + +: + + +decentralized + + + +} + + + + + + + +// Pi needs an STP_offset because it's event queue is usually empty and otherwise it will advance to the stop time. + + + +reactor + + + + + +Pi + + +(STP_offset: + + +time + + + + + += + + + + + +30 + + + s) { + + + + + + +input + + + + + +trigger + + +: + + + + + +bool + + + + + + +output + + + + + +out + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +trigger) + + +-> + + + out { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print( + + +" + + +***** at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + lf_set(out, + + +42 + + +); + + + + + + += + + +} + + +STP + + +( + + +30 + + + s) { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print_error_and_exit( + + +" + + +STP violation at Pi at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + + + += + + +} + + + +} + + + + + + + +// Gather doesn't need an STP_offset because its event queue is never empty. + + + +reactor + + + + + +Gather + + + { + + + + + + +input + + +[4] in: + + + + + +int + + + + + + +output + + + + + +next + + +: + + + + + +bool + + + + + + +logical + + + + + +action + + + + + +a + + + + + + +state + + + + + +count + + +: + + + + + +int + + + + + += + + + + + +0 + + + + + + + + + + +reaction + + +( + + +startup + + +, a) + + +-> + + + next { + + += + + + + lf_set(next, + + +true + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in) + + +-> + + + a { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + for (int i + + += + + + + + +0 + + +; i < + + +4 + + +; i + + ++ + + ++ + + +) { + + + + if (!in[i] + + +-> + + +is_present) { + + + + lf_print_error_and_exit( + + +" + + +Missing input %d in Gather at tag + + +" + + + PRINTF_TAG, + + + + i, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + } + + + + } + + + + lf_print( + + +" + + +%d: at tag + + +" + + + PRINTF_TAG, self + + +-> + + +count, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + self + + +-> + + +count + + ++ + + ++ + + +; + + + + if (self + + +-> + + +count > + + += + + + + + +4 + + +) { + + + + lf_request_stop(); + + + + } + + + + lf_schedule(a, + + +0 + + +); + + + + + + += + + +} + + +STP + + +( + + +30 + + + s) { + + += + + + + tag_t now + + += + + + lf_tag(); + + + + lf_print_error_and_exit( + + +" + + +STP violation at Gather at tag + + +" + + + PRINTF_TAG, + + +now + + +. + + +time + + + + + +- + + + lf_time_start(), + + +now + + +. + + +microstep + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +shutdown + + +) { + + += + + + + if (self + + +-> + + +count < + + +5 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Gather received only %d inputs. Expected at least 5. + + +" + + +, self + + +-> + + +count); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +pi + + + + + += + + + + + +new + + +[ + + +4 + + +] Pi() + + + + + + +g + + + + + += + + + + + +new + + + + + +Gather + + +() + + + + + + +pi + + +. + + +out + + + + + +-> + + + + + +g + + +. + + +in + + + + ( + + +g + + +. + + +next + + +) + + ++ + + + + + +-> + + + + + +pi + + +. + + +trigger + + + +} + + + + + + diff --git a/test/known-good/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.html b/test/known-good/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.html index 0d5872992..0f1539172 100644 --- a/test/known-good/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.html +++ b/test/known-good/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.html @@ -333,6 +333,14 @@ + +// This needs an STA offset because otherwise it may advance to the stop time while the + + + +// physical connection is in the process of assigning a timestamp. + + reactor @@ -343,7 +351,25 @@ Destination - { +(STA: + + +time + + + + + += + + + + + +1 + + + ms) { diff --git a/test/known-good/C/src/federated/DecentralizedTimeout.html b/test/known-good/C/src/federated/DecentralizedTimeout.html new file mode 100644 index 000000000..36ccd9ebf --- /dev/null +++ b/test/known-good/C/src/federated/DecentralizedTimeout.html @@ -0,0 +1,414 @@ + +/** + + + + * This test checks that a timeout time without any events does not cause a federate to hang. + + + + * Success is simply exiting. + + + + + + +*/ + + + +target + + + + + +C + + + { + + + + coordination + + +: + + +decentralized + + +, + + + + timeout + + +: + + +7 + + + ms + + + +} + + + + + + + +import + + + + + +Count + + + + + +from + + + + + +" + + +../lib/Count.lf + + +" + + + + + + + +reactor + + + + + +PrintLag + + +(STA: + + +time + + + + + += + + + + + +100 + + + + + +weeks + + +) { + + + + + + +input + + + + + +in + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +in) { + + += + + + + interval_t lag + + += + + + lf_time_physical() + + +- + + + lf_time_logical(); + + + + lf_print( + + +" + + +**** Reaction to network input %d lag is + + +" + + + PRINTF_TIME + + +" + + +us at logical time + + +" + + + PRINTF_TIME + + +" + + +us, microstep %d. + + +" + + +, + + + + in + + +-> + + +value, lag + + +/ + + +1000 + + +, lf_time_logical_elapsed() + + +/ + + +1000 + + +, lf_tag() + + +. + + +microstep); + + + + + + += + + +} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +c + + + + + += + + + + + +new + + + + + +Count + + +(offset + + += + + +0 + + +, period + + += + + + + + +3 + + + ms) + + + + + + +p + + + + + += + + + + + +new + + + + + +PrintLag + + +() + + + + + + +c + + +. + + +out + + + + + +-> + + + + + +p + + +. + + +in + + + +} + + + + + + diff --git a/test/known-good/C/src/modal_models/BanksCount3ModesComplex.html b/test/known-good/C/src/modal_models/BanksCount3ModesComplex.html index 16c85449f..bb7fcae3d 100644 --- a/test/known-good/C/src/modal_models/BanksCount3ModesComplex.html +++ b/test/known-good/C/src/modal_models/BanksCount3ModesComplex.html @@ -253,7 +253,7 @@ ] -never +neverp : @@ -788,7 +788,7 @@ -> - never + neverp @@ -3634,7 +3634,7 @@ . -never +neverp diff --git a/test/known-good/C/src/modal_models/ModalNestedReactions.html b/test/known-good/C/src/modal_models/ModalNestedReactions.html index b5d5475b6..f830119fe 100644 --- a/test/known-good/C/src/modal_models/ModalNestedReactions.html +++ b/test/known-good/C/src/modal_models/ModalNestedReactions.html @@ -151,7 +151,7 @@ -never +neverp : @@ -408,14 +408,14 @@ -> - never { + neverp { = - lf_set(never, + lf_set(neverp, true @@ -1027,7 +1027,7 @@ . -never +neverp ) { diff --git a/test/known-good/C/src/multiport/BankMultiportIsPresentSetup.html b/test/known-good/C/src/multiport/BankMultiportIsPresentSetup.html new file mode 100644 index 000000000..93ce2169d --- /dev/null +++ b/test/known-good/C/src/multiport/BankMultiportIsPresentSetup.html @@ -0,0 +1,1227 @@ + +// Smoke test for checking that the `is_present_fields` is setup correctly + + + +// for a complicated hierarchy of banks with multiports and actions. + + + +target + + + + + +C + + + + + + + +reactor + + + + + +R1 + + + { + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + + + + +output + + +[ + + +2 + + +] + + +out + + +: + + + + + +int + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out { + + += + + + + lf_set(out[ + + +0 + + +], + + +42 + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out { + + += + + + + lf_set(out[ + + +1 + + +], + + +43 + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +R4 + + + { + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + + + + +input + + +[3] in: + + + + + +int + + + + + + +input + + +[3] in2: + + + + + +int + + + + + + +input + + +[2] in3: + + + + + +int + + + + + + + + + + +reaction + + +( + + +in) { + + += + + + + lf_print( + + +" + + +in = [%d, %d, %d] + + +" + + +, in[ + + +0 + + +] + + +-> + + +value, in[ + + +1 + + +] + + +-> + + +value, in[ + + +2 + + +] + + +-> + + +value); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in2) { + + += + + + + lf_print( + + +" + + +in2 = [%d, %d, %d] + + +" + + +, in2[ + + +0 + + +] + + +-> + + +value, in2[ + + +1 + + +] + + +-> + + +value, in2[ + + +2 + + +] + + +-> + + +value); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +in3) { + + += + + + + lf_print( + + +" + + +in3 = [%d, %d] + + +" + + +, in3[ + + +0 + + +] + + +-> + + +value, in3[ + + +1 + + +] + + +-> + + +value); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +R2 + + + { + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + + + + +r1 + + + + + += + + + + + +new + + +[ + + +3 + + +] R1() + + + + + + +r4 + + + + + += + + + + + +new + + +[ + + +2 + + +] R4() + + + + + + +r1 + + +. + + +out + + + + + +-> + + + + + +r4 + + +. + + +in + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + + + +r4 + + +. + + +in2 + + +, + + +r4 + + +. + + +in3 + + + { + + += + + + + lf_set(r4[ + + +0 + + +] + + +. + + +in2[ + + +0 + + +], + + +44 + + +); + + + + lf_set(r4[ + + +1 + + +] + + +. + + +in2[ + + +0 + + +], + + +45 + + +); + + + + lf_set(r4[ + + +0 + + +] + + +. + + +in2[ + + +1 + + +], + + +46 + + +); + + + + lf_set(r4[ + + +1 + + +] + + +. + + +in2[ + + +1 + + +], + + +47 + + +); + + + + lf_set(r4[ + + +0 + + +] + + +. + + +in2[ + + +2 + + +], + + +48 + + +); + + + + lf_set(r4[ + + +1 + + +] + + +. + + +in2[ + + +2 + + +], + + +49 + + +); + + + + + + + + lf_set(r4[ + + +0 + + +] + + +. + + +in3[ + + +0 + + +], + + +50 + + +); + + + + lf_set(r4[ + + +1 + + +] + + +. + + +in3[ + + +0 + + +], + + +51 + + +); + + + + lf_set(r4[ + + +0 + + +] + + +. + + +in3[ + + +1 + + +], + + +52 + + +); + + + + lf_set(r4[ + + +1 + + +] + + +. + + +in3[ + + +1 + + +], + + +53 + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +R3 + + + { + + + + + + +r2 + + + + + += + + + + + +new + + +[ + + +4 + + +] R2() + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +r + + + + + += + + + + + +new + + +[ + + +2 + + +] R3() + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + +} + + + + + + diff --git a/test/known-good/C/src/multiport/BankOfActionsIsPresentSetup.html b/test/known-good/C/src/multiport/BankOfActionsIsPresentSetup.html new file mode 100644 index 000000000..32e2e4f37 --- /dev/null +++ b/test/known-good/C/src/multiport/BankOfActionsIsPresentSetup.html @@ -0,0 +1,493 @@ + +// Smoke test for checking that the `is_present_fields` is setup correctly + + + +// for a complicated hierarchy of nested banks with actions. + + + +target + + + + + +C + + + + + + + +reactor + + + + + +R1 + + + { + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + a1, a2 { + + += + + + + lf_schedule(a1, MSEC( + + +10 + + +)); + + + + lf_schedule(a2, MSEC( + + +10 + + +)); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +a1) { + + += + + + + lf_print( + + +" + + +a1 + + +" + + +); + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +a2) { + + += + + + + lf_print( + + +" + + +a2 + + +" + + +); + + + + + + += + + +} + + + +} + + + + + + + +reactor + + + + + +R2 + + + { + + + + + + +r1 + + + + + += + + + + + +new + + +[ + + +3 + + +] R1() + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + +} + + + + + + + +reactor + + + + + +R3 + + + { + + + + + + +r2 + + + + + += + + + + + +new + + +[ + + +4 + + +] R2() + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +r + + + + + += + + + + + +new + + +[ + + +2 + + +] R3() + + + + + + +logical + + + + + +action + + + + + +a1 + + + + + + +logical + + + + + +action + + + + + +a2 + + + +} + + + + + + diff --git a/test/known-good/C/src/token/MutableToken.html b/test/known-good/C/src/token/MutableToken.html new file mode 100644 index 000000000..38094c743 --- /dev/null +++ b/test/known-good/C/src/token/MutableToken.html @@ -0,0 +1,1605 @@ + +target + + + + + +C + + + { + + + + timeout + + +: + + +0 + + + s, + + + + files + + +: [ + + +" + + +include/array.h + + +" + + +] + + + +} + + + + + + + +import + + + + + +TokenSource + + + + + +from + + + + + +" + + +lib/Token.lf + + +" + + + + + + + +preamble + + + { + + += + + + + + + +#include "array.h" + + + += + + +} + + + + + + + +reactor + + + + + +R + + +(width: + + +int + + + + + += + + + + + +4 + + +) { + + + + + + +mutable + + + + + +input + + +[width] in: + + + + + +int_array_t + + +* + + + + + + +output + + +[ + + +width + + +] + + +out + + +: + + + + + +int_array_t + + +* + + + + + + + + + + +reaction + + +( + + +in) + + +-> + + + out { + + += + + + + for(int i + + += + + + + + +0 + + +; i < self + + +-> + + +width; i + + ++ + + ++ + + +) { + + + + for (int j + + += + + + + + +0 + + +; j < in[i] + + +-> + + +value + + +-> + + +length; j + + ++ + + ++ + + +) { + + + + in[i] + + +-> + + +value + + +-> + + +data[j] + + += + + + in[i] + + +-> + + +value + + +-> + + +data[j] + + +* + + + + + +2 + + +; + + + + } + + + + lf_set_token(out[i], in[i] + + +-> + + +token); + + + + } + + + + + + += + + +} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +s + + + + + += + + + + + +new + + +[ + + +2 + + +] TokenSource() + + + + + + +r + + + + + += + + + + + +new + + + + + +R + + +(width + + += + + +2 + + +) + + + + + + +s + + +. + + +out + + + + + +-> + + + + + +r + + +. + + +in + + + + + + + + + + +reaction + + +( + + +r + + +. + + +out + + +) { + + += + + + + lf_print( + + +" + + +Received from R [%d, %d, %d], [%d, %d, %d] + + +" + + +, + + + + + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +0 + + +], + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +1 + + +], + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +2 + + +], + + + + + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +0 + + +], + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +1 + + +], + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +2 + + +]); + + + + if ( + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +0 + + +] ! + + += + + + + + +0 + + + || + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +1 + + +] ! + + += + + + + + +2 + + + || + + +r + + +. + + +out + + +[ + + +0 + + +] + + +-> + + +value + + +-> + + +data[ + + +2 + + +] ! + + += + + + + + +4 + + + + || + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +0 + + +] ! + + += + + + + + +0 + + + || + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +1 + + +] ! + + += + + + + + +2 + + + || + + +r + + +. + + +out + + +[ + + +1 + + +] + + +-> + + +value + + +-> + + +data[ + + +2 + + +] ! + + += + + + + + +4 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Expected [0, 2, 4]. + + +" + + +); + + + + } + + + + + + += + + +} + + + + + + + + + + +reaction + + +( + + +s + + +. + + +out + + +) { + + += + + + + lf_print( + + +" + + +Received from S [%d, %d, %d], [%d, %d, %d] + + +" + + +, + + + + s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +0 + + +], s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +1 + + +], s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +2 + + +], + + + + s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +0 + + +], s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +1 + + +], s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +2 + + +]); + + + + if (s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +0 + + +] ! + + += + + + + + +0 + + + || s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +1 + + +] ! + + += + + + + + +1 + + + || s[ + + +0 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +2 + + +] ! + + += + + + + + +2 + + + + || s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +0 + + +] ! + + += + + + + + +0 + + + || s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +1 + + +] ! + + += + + + + + +1 + + + || s[ + + +1 + + +] + + +. + + +out + + +-> + + +value + + +-> + + +data[ + + +2 + + +] ! + + += + + + + + +2 + + +) { + + + + lf_print_error_and_exit( + + +" + + +Expected [0, 2, 4]. + + +" + + +); + + + + } + + + + + + += + + +} + + + +} + + + + + + diff --git a/test/known-good/Python/build/lfc_include/library-test/src/lib/Import.html b/test/known-good/Python/build/lfc_include/library-test/src/lib/Import.html new file mode 100644 index 000000000..6cc63af02 --- /dev/null +++ b/test/known-good/Python/build/lfc_include/library-test/src/lib/Import.html @@ -0,0 +1,144 @@ + +target + + + + + +Python + + + + + + + +reactor + + + + + +Count + + +(offset + + += + + +0 + + +, period + + += + + + + + +1 + + + + + +sec + + +) { + + + + + + +state + + + + + +count + + + + + += + + + + + +1 + + + + + + +output + + + + + +out + + + + + + +timer + + + t(offset, period) + + + + + + + + + + +reaction + + +(t) + + +-> + + + out + + +{= + + + + out.set(self.count) + + + + self.count += 1 + + + + + + +=} + + + +} + + diff --git a/test/known-good/Python/src/LingoFederatedImport.html b/test/known-good/Python/src/LingoFederatedImport.html new file mode 100644 index 000000000..a9bb96e2b --- /dev/null +++ b/test/known-good/Python/src/LingoFederatedImport.html @@ -0,0 +1,244 @@ + +# Test the new import statement for Lingo downloaded packages with the import path enclosed in angle brackets + + + +# Version 1: The LF file is located in "src". + + + +target + + + + + +Python + + + { + + + + timeout + + +: + + +2 + + + + + +sec + + + +} + + + + + + + +import + + + + + +Count + + + + + +from + + + < + + +library-test/Import.lf + + +> + + + + + + + +reactor + + + + + +Actuator + + + { + + + + + + +input + + + + + +results + + + + + + + + + + +reaction + + +(results) + + +{= + + + + print(f"Count: {results.value}") + + + + + + +=} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +count + + + + + += + + + + + +new + + + + + +Count + + +() + + + + + + +act + + + + + += + + + + + +new + + + + + +Actuator + + +() + + + + + + +count + + +. + + +out + + + + + +-> + + + + + +act + + +. + + +results + + + +} + + + + + + diff --git a/test/known-good/Python/src/federated/BankIndexFed.html b/test/known-good/Python/src/federated/BankIndexFed.html new file mode 100644 index 000000000..22b83869f --- /dev/null +++ b/test/known-good/Python/src/federated/BankIndexFed.html @@ -0,0 +1,290 @@ + +target + + + + + +Python + + + + + + + +reactor + + + + + +FirstReactor + + +(bank_index + + += + + +0 + + +) { + + + + + + +output + + + + + +out + + + + + + + + + + +reaction + + +( + + +startup + + +) + + +-> + + + out + + +{= + + + + print("bank_index: {:d}".format(self.bank_index)) + + + + out.set(self.bank_index) + + + + + + +=} + + + +} + + + + + + + +reactor + + + + + +SecondReactor + + + { + + + + + + +input + + +[ + + +4 + + +] inp + + + + + + + + + + +reaction + + +(inp) + + +{= + + + + for i, port in enumerate(inp): + + + + assert port.is_present + + + + print("in[{:d}]: {:d}".format(i, port.value)) + + + + assert port.value == i + + + + request_stop() + + + + + + +=} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +a + + + + + += + + + + + +new + + +[ + + +4 + + +] FirstReactor() + + + + + + +b + + + + + += + + + + + +new + + + + + +SecondReactor + + +() + + + + + + +a + + +. + + +out + + + + + +-> + + + + + +b + + +. + + +inp + + + +} + + + + + + diff --git a/test/known-good/Python/src/federated/BankIndexOverride.html b/test/known-good/Python/src/federated/BankIndexOverride.html new file mode 100644 index 000000000..47b64746c --- /dev/null +++ b/test/known-good/Python/src/federated/BankIndexOverride.html @@ -0,0 +1,136 @@ + +target + + + + + +Python + + + + + + + +reactor + + + + + +SingleReactor + + +(bank_index + + += + + +0 + + +) { + + + + + + +reaction + + +( + + +startup + + +) + + +{= + + + + print("bank_index: {:d}".format(self.bank_index)) + + + + assert(self.bank_index == 2) + + + + + + +=} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +a + + + + + += + + + + + +new + + + + + +SingleReactor + + +(bank_index + + += + + +2 + + +) + + + +} + + + + + + diff --git a/test/known-good/Python/src/federated/Dataflow.html b/test/known-good/Python/src/federated/Dataflow.html index 9a49c8a37..8d8be9997 100644 --- a/test/known-good/Python/src/federated/Dataflow.html +++ b/test/known-good/Python/src/federated/Dataflow.html @@ -73,25 +73,13 @@ Client -(STP_offset +(STA = - - - -{= - - - FOREVER - - -=} - - -) { +forever) { @@ -206,11 +194,11 @@ - if val<49: + # Need to unconditionally produce output or downstream could lock up waiting for it. - client_message.set(val) + client_message.set(val) @@ -226,20 +214,14 @@ STP -( - - -10 - - - s) +(forever) {= - print("Client STP Violated!") + print("Client STAA Violated!") @@ -271,25 +253,13 @@ Server -(STP_offset +(STA = - - - -{= - - - FOREVER - - -=} - - -) { +forever) { @@ -431,11 +401,11 @@ - if val<48: + # Need to unconditionally produce output or downstream could lock up waiting for it. - server_message.set(val) + server_message.set(val) @@ -451,20 +421,14 @@ STP -( - - -10 - - - s) +(forever) {= - print("Server STP Violated!") + print("Server STAA Violated!") @@ -496,25 +460,13 @@ reactor -(STP_offset +(STA = - - - -{= - - - FOREVER - - -=} - - -) { +forever) { diff --git a/test/known-good/Python/src/lingo_imports/FederatedTestImportPackages.html b/test/known-good/Python/src/lingo_imports/FederatedTestImportPackages.html new file mode 100644 index 000000000..489135566 --- /dev/null +++ b/test/known-good/Python/src/lingo_imports/FederatedTestImportPackages.html @@ -0,0 +1,244 @@ + +# Test the new import statement for Lingo downloaded packages with the import path enclosed in angle brackets + + + +# Version 2: The LF file is now located in a subdirectory under "src". + + + +target + + + + + +Python + + + { + + + + timeout + + +: + + +2 + + + + + +sec + + + +} + + + + + + + +import + + + + + +Count + + + + + +from + + + < + + +library-test/Import.lf + + +> + + + + + + + +reactor + + + + + +Actuator + + + { + + + + + + +input + + + + + +results + + + + + + + + + + +reaction + + +(results) + + +{= + + + + print(f"Count: {results.value}") + + + + + + +=} + + + +} + + + + + + + +federated + + + + + +reactor + + + { + + + + + + +count + + + + + += + + + + + +new + + + + + +Count + + +() + + + + + + +act + + + + + += + + + + + +new + + + + + +Actuator + + +() + + + + + + +count + + +. + + +out + + + + + +-> + + + + + +act + + +. + + +results + + + +} + + + + + + diff --git a/test/known-good/Python/src/lingo_imports/TestImportPackages.html b/test/known-good/Python/src/lingo_imports/TestImportPackages.html new file mode 100644 index 000000000..fd3aa2ae6 --- /dev/null +++ b/test/known-good/Python/src/lingo_imports/TestImportPackages.html @@ -0,0 +1,240 @@ + +# Test the new import statement for Lingo downloaded packages with the import path enclosed in angle brackets + + + +target + + + + + +Python + + + { + + + + timeout + + +: + + +2 + + + + + +sec + + + +} + + + + + + + +import + + + + + +Count + + + + + +from + + + < + + +library-test/Import.lf + + +> + + + + + + + +reactor + + + + + +Actuator + + + { + + + + + + +input + + + + + +results + + + + + + + + + + +reaction + + +(results) + + +{= + + + + print(f"Count: {results.value}") + + + + + + +=} + + + +} + + + + + + + +main + + + + + +reactor + + + { + + + + + + +count + + + + + += + + + + + +new + + + + + +Count + + +() + + + + + + +act + + + + + += + + + + + +new + + + + + +Actuator + + +() + + + + + + +count + + +. + + +out + + + + + +-> + + + + + +act + + +. + + +results + + + +} + + + + + + diff --git a/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html b/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html index b9a307e1d..441f98be1 100644 --- a/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html +++ b/test/known-good/Python/src/modal_models/BanksCount3ModesComplex.html @@ -217,7 +217,7 @@ ] -never +neverp @@ -731,7 +731,7 @@ -> - never + neverp @@ -3553,7 +3553,7 @@ . -never +neverp diff --git a/test/known-good/Python/src/modal_models/ModalNestedReactions.html b/test/known-good/Python/src/modal_models/ModalNestedReactions.html index b7ae1ed37..825a91974 100644 --- a/test/known-good/Python/src/modal_models/ModalNestedReactions.html +++ b/test/known-good/Python/src/modal_models/ModalNestedReactions.html @@ -124,7 +124,7 @@ -never +neverp @@ -345,14 +345,14 @@ -> - never + neverp {= - never.set(True) + neverp.set(True) @@ -696,7 +696,7 @@ . -never +neverp )