And for the sake of completeness, a piece of working code.
I put the wait in each case statement because I wanted to simulate a function call.
module sub(ref int toto, input event my_ev);
int ml = 0;
int fou = 0;
int kol = 0;
int count = 0;
always
begin
case (toto)
3:
begin
ml++;
fou = 54;
$display("hh %d %d",fou,count);
#5 wait(my_ev.triggered);
$display("out of 3 case");
end
5:
begin
kol++;
fou = 89;
$display("polo %d %d",fou,count);
#5 wait(my_ev.triggered);
$display("out of 5 case");
end
default:
begin
count++;
$display("default case %d",toto);
#5 wait(my_ev.triggered);
$display("out of default case %d fin",toto,$time);
end
endcase
end
endmodule
module main();
int ki = 0;
event my_ev;
sub sub(ki,my_ev);
initial
begin
#5 ki = 4;
->my_ev;
#5 ki = 3;
->my_ev;
#5 ki = 5;
->my_ev;
$display("FINISH");
end
endmodule