User guide
22-45
SystemVerilog Design Constructs
You can specify default values for:
• Input ports
• Inout and ref ports (one-value arguments only; constant
arguments not supported)
• Automatic tasks/functions
• Task/functions contained in classes or methods of classes
• Dynamic/Associative arrays (available with +svtb switch only)
• export and import tasks and functions in interfaces
In the following example the function func1 has two integer
parameters whose default values are 100 and 300 respectively. This
function returns an integer value. This function is defined in module
m and is called in an initial block of module “m”;
module m;
function int func1(int x = 100, int y = 300);
return (x + y);
endfunction
initial
func1 ();
endmodule
The function func1 receives the default value of the arguments as if
the function call were written:
func1(100, 300);
The same function func1 can be called with a single argument:
initial
func1(2);