13.5.2 Pass by reference
Arguments passed by reference are not copied into the subroutine area, rather, a reference to the original
argument is passed to the subroutine. The subroutine can then access the argument data via the reference.
Arguments passed by reference shall be matched with equivalent data types (see 6.22.2). No casting shall be
permitted. To indicate argument passing by reference, the argument declaration is preceded by the ref
keyword. It shall be illegal to use argument passing by reference for subroutines with a lifetime of static.
The general syntax is as follows:
subroutine( ref type argument );
For example, the preceding example can be written as follows:
function automatic int crc( ref byte packet [1000:1] );
for( int j= 1; j <= 1000; j++ ) begin
crc ^= packet[j];
end
endfunction
Why is the ref argument in a static function illegal? Is it because it is pointing to a memory location and the memory allocation happens during runtime?
I’m trying to gain some understanding on what is not available at for a static function to have a ref argument.
Thank you.