-
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 #2294 from lf-lang/gedf
Fix deadline inference, test GEDF, and remove chain ID
- Loading branch information
Showing
7 changed files
with
74 additions
and
71 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
Submodule reactor-c
updated
26 files
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,54 @@ | ||
/** | ||
* This test ensures that level 2 reaction with a tighter deadline runs before a level 1 reaction | ||
* with a looser deadline when there is no dependency between these reactions. This is the correct | ||
* behavior of the GEDF scheduler, so the scheduler is set to GEDF_NP. | ||
*/ | ||
target C { | ||
timeout: 200 ms, | ||
scheduler: GEDF_NP, | ||
workers: 1 | ||
} | ||
|
||
reactor Periodic(period: time = 50 ms, name: string = "Unnamed") { | ||
timer trigger(0, period) | ||
|
||
output t: time | ||
|
||
reaction(trigger) -> t {= | ||
instant_t start_time = lf_time_physical_elapsed(); | ||
lf_set(t, start_time); | ||
lf_print("%s started at physical time: " PRINTF_TIME, self->name, start_time); | ||
=} | ||
} | ||
|
||
reactor Probe(dl: time = 2 ms, name: string = "Unnamed") { | ||
input i: time | ||
output t: time | ||
|
||
reaction(i) -> t {= | ||
instant_t start_time = lf_time_physical_elapsed(); | ||
lf_set(t, start_time); | ||
lf_print("%s started at physical time: " PRINTF_TIME, self->name, start_time); | ||
=} deadline(dl) {= | ||
instant_t start_time = lf_time_physical_elapsed(); | ||
lf_set(t, start_time); | ||
lf_print("%s VIOLATED DEADLINE at physical time: " PRINTF_TIME, self->name, start_time); | ||
=} | ||
} | ||
|
||
main reactor { | ||
task1 = new Periodic(period = 50 ms, name="task1") | ||
detector1 = new Probe(dl = 50 ms, name="detector1") | ||
|
||
task1.t -> detector1.i | ||
task2 = new Periodic(period = 50 ms, name="task2") | ||
detector2 = new Probe(dl = 25 ms, name="detector2") | ||
|
||
task2.t -> detector2.i | ||
|
||
reaction(task1.t, detector2.t) {= | ||
if (task1.t->is_present && detector2.t->is_present && task1.t->value < detector2.t->value) { | ||
lf_print_error_and_exit("EDF policy violated. detector2 should execute before task1 when both are triggered."); | ||
} | ||
=} | ||
} |