mirror of https://github.com/zachjs/sv2v.git
25 lines
540 B
Systemverilog
25 lines
540 B
Systemverilog
|
|
module top;
|
||
|
|
function automatic integer bar;
|
||
|
|
input integer inp;
|
||
|
|
begin
|
||
|
|
if (inp == 0)
|
||
|
|
bar = 0;
|
||
|
|
else
|
||
|
|
bar = 1 + foo(inp - 1);
|
||
|
|
end
|
||
|
|
endfunction
|
||
|
|
function automatic integer foo;
|
||
|
|
input integer inp;
|
||
|
|
begin
|
||
|
|
if (inp == 0)
|
||
|
|
foo = 0;
|
||
|
|
else
|
||
|
|
foo = 1 + bar(inp - 1);
|
||
|
|
end
|
||
|
|
endfunction
|
||
|
|
initial begin
|
||
|
|
$display("%d", foo(10));
|
||
|
|
$display("%d", bar(11));
|
||
|
|
end
|
||
|
|
endmodule
|