2020-08-09 04:43:47 +02:00
|
|
|
module top;
|
|
|
|
|
generate
|
2021-06-17 21:21:16 +02:00
|
|
|
if (1) begin : x
|
2020-08-09 04:43:47 +02:00
|
|
|
integer x;
|
|
|
|
|
function z;
|
|
|
|
|
input x;
|
|
|
|
|
z = ~x;
|
|
|
|
|
endfunction
|
|
|
|
|
end
|
|
|
|
|
endgenerate
|
|
|
|
|
initial x.x = 1;
|
|
|
|
|
generate
|
2021-06-17 21:21:16 +02:00
|
|
|
if (1) begin : y
|
2020-08-09 04:43:47 +02:00
|
|
|
function z;
|
|
|
|
|
input x;
|
|
|
|
|
z = x;
|
|
|
|
|
endfunction
|
|
|
|
|
integer x = 0;
|
|
|
|
|
initial begin
|
|
|
|
|
#1;
|
|
|
|
|
$display("x = %b", x);
|
|
|
|
|
$display("z(x) = %b", z(x));
|
|
|
|
|
$display("y.x = %b", top.x.x);
|
|
|
|
|
$display("y.z(x) = %b", top.x.z(x));
|
|
|
|
|
$display("y.z(y.x) = %b", top.x.z(top.x.x));
|
|
|
|
|
$display("y.z(z(y.x)) = %b", top.x.z(z(top.x.x)));
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
endgenerate
|
|
|
|
|
endmodule
|