This works, but it is a dummy solution:
If someone can suggest a better solution, please do.
In the example from LRM the function has no input, so there may be a better solution.
module top();
byte cnt;
bit clk;
always #5 clk = ~clk;
always @ (posedge clk)
cnt <= cnt + 1;
function byte func_rd_cnt(bit dummy=1);
return cnt;
endfunction
initial
begin
$display("***** Before wait *****");
wait(cnt == 4);
$display("***** After 1st wait *****");
$display("** the function returns %d", func_rd_cnt());
wait(func_rd_cnt(clk) == 8);
$display("***** After 2nd wait *****");
end
initial #100 $finish;
initial $monitor("cnt - %0d", cnt);
endmodule