-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attributes for action and connection buffers (#198)
* This PR adds attributes for specifying the max num pending events for actions and the max buffer size for connections * Simple formatting
- Loading branch information
Showing
10 changed files
with
117 additions
and
10 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
target uC { | ||
platform: Native | ||
} | ||
|
||
main reactor { | ||
|
||
@max_pending_events(10) | ||
logical action a:int | ||
|
||
state received:int=0 | ||
|
||
reaction(startup) -> a {= | ||
for (int i = 0; i<10; i++) { | ||
lf_schedule(a, MSEC(i), i); | ||
} | ||
=} | ||
|
||
reaction(a) {= | ||
validate(a->value == self->received++); | ||
printf("Action scheduled wtih %d\n", a->value); | ||
=} | ||
|
||
reaction(shutdown) {= | ||
validate(self->received == 10); | ||
=} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target uC { | ||
platform: Native, | ||
timeout: 200 msec | ||
} | ||
|
||
reactor R1 { | ||
output out: int | ||
timer t(0, 10 msec) | ||
state cnt: int = 0; | ||
|
||
reaction(t) -> out {= | ||
if (self->cnt < 10) { | ||
printf("Hello from R1 at %ld\n", env->get_elapsed_physical_time(env)); | ||
lf_set(out, self->cnt++); | ||
} | ||
=} | ||
} | ||
|
||
reactor R2 { | ||
input in:int | ||
state cnt:int = 0 | ||
reaction(in) {= | ||
printf("Got %d\n", in->value); | ||
validate(in->value == self->cnt++); | ||
=} | ||
|
||
reaction(shutdown) {= | ||
validate(self->cnt == 10); | ||
=} | ||
} | ||
|
||
main reactor { | ||
r1 = new R1() | ||
r2 = new R2() | ||
|
||
@buffer(10) | ||
r1.out -> r2.in after 100 msec | ||
} |