Can anybody please explain why that's the order of the outputs for each case?
1.
event e1, e2 ;
initial begin
fork
begin : WAITER_1
$display ( "%m waiting event e1" ) ;
@ e1
$display ( "%m received event e1" ) ;
end : WAITER_1
begin : EMITTER_1
$display ( "%m emitting event e1" ) ;
-> e1 ;
end : EMITTER_1
begin : EMITTER_2
$display ( "%m emitting event e2" ) ;
-> e2 ;
end : EMITTER_2
begin : WAITER_2
$display ( "%m waiting event e2" ) ;
@ e2
$display ( "%m received event e2" ) ;
end : WAITER_2
join_none
#10ns;
disable fork;
output:
event_m.WAITER_1 waiting event e1
event_m.EMITTER_1 emitting event e1
event_m.EMITTER_2 emitting event e2
event_m.WAITER_2 waiting event e2
event_m.WAITER_1 received event e1
2.
event e1, e2 ;
initial begin
fork
begin : WAITER_1
$display ( "%m waiting event e1" ) ;
@ e1
$display ( "%m received event e1" ) ;
end : WAITER_1
begin : EMITTER_1
$display ( "%m emitting event e1" ) ;
->> e1 ;
end : EMITTER_1
begin : EMITTER_2
$display ( "%m emitting event e2" ) ;
->> e2 ;
end : EMITTER_2
begin : WAITER_2
$display ( "%m waiting event e2" ) ;
@ e2
$display ( "%m received event e2" ) ;
end : WAITER_2
join_none
#10ns;
disable fork;
output:
event_m.WAITER_1 waiting event e1
event_m.EMITTER_1 emitting event e1
event_m.EMITTER_2 emitting event e2
event_m.WAITER_2 waiting event e2
event_m.WAITER_1 received event e1
event_m.WAITER_2 received event e2
3.
event e1, e2 ;
initial begin
fork
begin : WAITER_1
$display ( "%m waiting event e1" ) ;
wait(e1.triggered);
$display ( "%m received event e1" ) ;
end : WAITER_1
begin : EMITTER_1
$display ( "%m emitting event e1" ) ;
->> e1 ;
end : EMITTER_1
begin : EMITTER_2
$display ( "%m emitting event e2" ) ;
->> e2 ;
end : EMITTER_2
begin : WAITER_2
$display ( "%m waiting event e2" ) ;
wait(e2.triggered);
$display ( "%m received event e2" ) ;
end : WAITER_2
join_none
#10ns;
disable fork;
output:
event_m.WAITER_1 waiting event e1
event_m.EMITTER_1 emitting event e1
event_m.EMITTER_2 emitting event e2
event_m.WAITER_2 waiting event e2
event_m.WAITER_1 received event e1
event_m.WAITER_2 received event e2
Thanks!!!