System verilog function argument output

I saw that we can use output argument in function argument list as long as it doesn’t consume sim time,

function void sample(input int a, output int b);
b = a;
endfunction : sample

but in LRM it says “It shall be illegal to call a function with output , inout or ref arguments in an event expression, in an expres-
sion within a procedural continuous assignment, or in an expression that is not within a procedural statement.
However, a const ref function argument shall be legal in this context”

I didn’t understand this statement can someone please explain?

In reply to Mahantha Deeksha S B:

A function can never consume time.

A procedural statement is anywhere you could put a begin/end block.

always @(event_expression)
  begin
    statement1;
    statement2;
  end

This a process that gets triggered by the event expression. Once the process is running, the statements get executed in order. A function call may be a part of the statement, but nothing about the statement can affect the flow of the process. A function could be called a simple statement without a return value.

But anywhere outside of a procedural context, the function must have a return value, and it’s assumed that is the only way to output a value. That way the compiler can assume all function arguments are inputs the function without having to locate and expand its definition.

So,
Where ever we use function without return value inside procedural block it should not affect the flow, And if used it should return some value,
like

function int try(input int a, output int b ,c);
    b = a;
    c = a;
    return 1;
endfunction : try
  
  initial begin
    int b;
    @(try(5,b,c));
  end

right dave?

In reply to Mahantha Deeksha S B:

An SystemVerilog function must always return without any delay or interruptions. That is regardless of whether it returns a value or not. That is regardless of whether it is used inside a procedural block or not.

I think you are confusing the fact that an event control is a procedural statement, but the event_expression does not get evaluated in a procedural context.

A continuous assignment is not a procedural context.

assign a = f1(b,c) + f2(d,e);

When called, functions f1 and f2 must return a value. The two functions get called at time 0, and any time b,c,d or e’s value change. The must return their value immediately without interrupting the expression evaluation.

begin
@(f1(b,c) + f2(d,e))
$display(“done”);
end

An event control is procedural statement that always interrupts the process flow. The event_expresion gets evaluated from that point on just like a continuous assignment. Anytime an operand in the expression changes it value, the expression gets reevaluated. It’s only when the event_expression changes it value can the process resume.

In your last example, the function try always returns 1, so the process will never resume.

In reply to dave_59:
understood thank you dave,