-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2409 from lf-lang/fix-action-present-bug
Fix action is_present field not being reset
- Loading branch information
Showing
6 changed files
with
202 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule reactor-c
updated
5 files
+6 −0 | core/environment.c | |
+2 −2 | core/federated/RTI/rti.Dockerfile | |
+19 −5 | core/reactor_common.c | |
+7 −0 | include/core/environment.h | |
+1 −1 | lingua-franca-ref.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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"); | ||
} | ||
=} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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 | ||
} | ||
|
||
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 | ||
} |