function
function <type> <name> (<args>);
<statements>
endfunctionmodule function_tb;
int a, b;
initial begin
b = 1; a = sum(3, 6, b);
$display("a = %0d, b = %0d ", a, b);
$display("sum(3, 6, b) = %0d", sum(3, 6, b));
$display("b = %0d", b);
end
function bit[7:0] sum (input int x, y, z);
z++;
return x+y;
endfunction
endmoduleLast updated