Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Patmos platform on static-schedule-single-thread branch by direct Makefile #2315

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/c/reactor-c
110 changes: 110 additions & 0 deletions test/C/src/static/ADASModel.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/** FIXME: Turn this program into a test case. */
target C {
timeout: 1 sec,
scheduler: STATIC,
build-type: Debug,
single-threaded: true
}

preamble {=
typedef int c_frame_t;
typedef int l_frame_t;
=}

realtime reactor Camera {
output out: {= c_frame_t =}
state frame: {= c_frame_t =}
timer t(0, 17 msec) // 60 fps

@wcet("93572 nsec") // RPI4
reaction(t) -> out {=
// Capture a frame.
//lf_print("Camera reaction");
self->frame = 1;
lf_set(out, self->frame);
=}
}

realtime reactor LiDAR {
output out: {= l_frame_t =}
state frame: {= l_frame_t =}
timer t(0, 34 msec) // 30 fps

@wcet("97942 nsec") // RPI4
reaction(t) -> out {=
// Capture a frame.
// lf_print("LiDAR Reaction");
self->frame = 2;
lf_set(out, self->frame);
=}
}

realtime reactor Brakes {
input inADAS: int
state brakesApplied: int = 0

// RPI4
@wcet("5037 nsec")
reaction(inADAS) {=
// Actuate brakes.
// lf_print("Brakes reaction");
self->brakesApplied = 1;
=}
}

reactor ADASProcessor {
input in1: {= l_frame_t =}
input in2: {= c_frame_t =}
input a_in: int
output out1: int
output out2: int
output a_out: int
state requestStop: int

// RPI4
@wcet("5592 nsec")
reaction(in1, in2) -> a_out {=
// ... Detect danger
// and request stop.
// lf_print("ADASProcessor reaction 1");
lf_set_present(a_out);
self->requestStop = 1;
=}

// RPI4
@wcet("6741 nsec")
reaction(a_in) -> out1, out2 {=
// lf_print("ADASProcessor reaction 2");
if (self->requestStop == 1) {
lf_set_present(out1);
lf_set_present(out2);
}
=} deadline(20 msec) {=
// lf_print("Deadline reaction");
=}
}

reactor Dashboard {
input in: int
state received: int

// RPI4
@wcet("4815 nsec")
reaction(in) {=
// lf_print("Dashboard reaction");
self->received = 1;
=}
}

main reactor ADASModel {
c = new Camera()
l = new LiDAR()
p = new ADASProcessor()
b = new Brakes()
d = new Dashboard()
l.out -> p.in1
c.out -> p.in2
p.out2 -> d.in
p.out1 -> b.inADAS after 5 msec
p.a_out -> p.a_in after 50 msec
}
2 changes: 2 additions & 0 deletions test/C/src/static/ScheduleTest.lf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ target C {
// workers: 2,
timeout: 100 sec,
fast: true,
build-type: Debug,
single-threaded: true,
tracing: false
}

preamble {=
Expand Down
11 changes: 5 additions & 6 deletions test/C/src/static/SimpleConnection.lf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ reactor Source {
state s:int = 0
reaction(t) -> out {=
lf_set(out, self->s);
lf_print("Sent %d @ %lld", self->s++, lf_time_logical_elapsed());
self->s++;
// lf_print("Sent %d @ %lld", self->s, lf_time_logical_elapsed());
=}
reaction(t) -> out {=
int v = -1 * self->s;
Expand All @@ -29,14 +30,14 @@ reactor Sink {
state last_received:int = 0
reaction(in) {=
self->last_received = in->value;
lf_print("Received %d @ %lld", in->value, lf_time_logical_elapsed());
// lf_print("Received %d @ %lld", in->value, lf_time_logical_elapsed());
=}
reaction(shutdown) {=
if (self->last_received != EXPECTED) {
fprintf(stderr, "FAILURE: Expected %d, Received %d\n", EXPECTED, self->last_received);
// fprintf(stderr, "FAILURE: Expected %d, Received %d\n", EXPECTED, self->last_received);
exit(1);
} else {
lf_print("Successfully received %d", self->last_received);
// lf_print("Successfully received %d", self->last_received);
}
=}
}
Expand All @@ -45,6 +46,4 @@ main reactor {
source = new Source()
sink = new Sink()
source.out -> sink.in after 2 sec
// source.out -> sink.in after 500 msec
// source.out -> sink.in
}