I was reading about SV Merging events from this website. The code is as follows:
module events_ex;
event ev_1; //declaring event ev_1
initial begin
fork
//process-1, triggers the event
begin
#40;
$display($time,"\tTriggering The Event");
->ev_1;
end
//process-2, wait for the event to trigger
begin
$display($time,"\tWaiting for the Event to trigger");
#60;
@(ev_1.triggered);
$display($time,"\tEvent triggered");
end
join
end
initial begin
#100;
$display($time,"\tEnding the Simulation");
$finish;
end
endmodule
The result for the same is:
0 Waiting for the Event to trigger
40 Triggering The Event
100 Ending the Simulation
In this particular code, the trigger is being executed first at 40 time units, then the waiting is applied at 60 time units. It is known that, if the trigger executes first, then the waiting process remains blocked. If I use #60 wait(ev_1.triggered); in the line 17 this can be resolved. However, it is still showing the same result? I want to know the concept behind this.