-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
bugSomething isn't workingSomething isn't working
Description
target C;
reactor Destination (bank_index:int = 0, name:string = "DST") {
input req:int;
output rsp:int;
reaction (req) -> rsp {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Sending back response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, req->value
);
lf_set (rsp, req->value);
=}
}
reactor Source (bank_index:int = 0, name:string = "Source") {
output req:int;
input rsp:int;
state msg:int = 0;
reaction (startup) -> req {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Scheduling request:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, self->msg
);
lf_set (req, self->msg);
=}
reaction (rsp) {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Receiving response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, rsp->value
);
=}
}
reactor pass_through (bank_index:int = 0, name:string = "PassThrough") {
input in_req:int;
output out_rsp:int;
reaction (in_req) -> out_rsp {=
fprintf ( stderr, "(%lld, %u) physical_time:%lld "
"%s [%d] Sending back response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, in_req->value
);
lf_set (out_rsp, in_req->value);
=}
}
reactor Selector (bank_index:int = 0, name:string = "Selector") {
input in_req:int;
output out_rsp:int;
pt = new pass_through();
initial mode Init {
reaction (startup) -> history (DST_1), history (DST_2) {=
printf ("(%lld, %u) physical_time:%lld "
"%s POP startup",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name
);
lf_set_mode(DST_1);
=}
}
mode DST_1 {
dst1 = new Destination(name = "DST_1");
in_req -> pt.in_req;
pt.out_rsp -> dst1.req;
dst1.rsp -> out_rsp;
}
mode DST_2 {
dst2 = new Destination(name = "DST_2");
in_req -> pt.in_req;
pt.out_rsp -> dst2.req;
dst2.rsp -> out_rsp;
}
}
main reactor {
src = new Source();
sel = new Selector();
src.req -> sel.in_req;
sel.out_rsp -> src.rsp;
}
Passthrough reactor sitting inside Selector reactor is not accessible inside Modes. If we move pass through reactor inside each mode it works fine.
target C;
reactor Destination (bank_index:int = 0, name:string = "DST") {
input req:int;
output rsp:int;
reaction (req) -> rsp {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Sending back response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, req->value
);
lf_set (rsp, req->value);
=}
}
reactor Source (bank_index:int = 0, name:string = "Source") {
output req:int;
input rsp:int;
state msg:int = 0;
reaction (startup) -> req {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Scheduling request:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, self->msg
);
lf_set (req, self->msg);
=}
reaction (rsp) {=
printf ("(%lld, %u) physical_time:%lld "
"%s [%d] Receiving response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, rsp->value
);
=}
}
reactor pass_through (bank_index:int = 0, name:string = "PassThrough") {
input in_req:int;
output out_rsp:int;
reaction (in_req) -> out_rsp {=
fprintf ( stderr, "(%lld, %u) physical_time:%lld "
"%s [%d] Sending back response:%d\n",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name, self->bank_index, in_req->value
);
lf_set (out_rsp, in_req->value);
=}
}
reactor Selector (bank_index:int = 0, name:string = "Selector") {
input in_req:int;
output out_rsp:int;
initial mode Init {
reaction (startup) -> history (DST_1), history (DST_2) {=
printf ("(%lld, %u) physical_time:%lld "
"%s POP startup",
lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(),
self->name
);
lf_set_mode(DST_1);
=}
}
mode DST_1 {
dst1 = new Destination(name = "DST_1");
pt1 = new pass_through();
in_req -> pt1.in_req;
pt1.out_rsp -> dst1.req;
dst1.rsp -> out_rsp;
}
mode DST_2 {
dst2 = new Destination(name = "DST_2");
pt2 = new pass_through();
in_req -> pt2.in_req;
pt2.out_rsp -> dst2.req;
dst2.rsp -> out_rsp;
}
}
main reactor {
src = new Source();
sel = new Selector();
src.req -> sel.in_req;
sel.out_rsp -> src.rsp;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working