2020-01-11 22:22:07 +01:00
|
|
|
module top;
|
|
|
|
|
function f;
|
|
|
|
|
input x;
|
|
|
|
|
begin
|
|
|
|
|
f = 1'b1 ^ x;
|
|
|
|
|
$display("f(%b) called", x);
|
|
|
|
|
end
|
|
|
|
|
endfunction
|
2020-01-12 03:06:09 +01:00
|
|
|
task t;
|
|
|
|
|
input x;
|
|
|
|
|
$display("t(%b) called", x);
|
|
|
|
|
endtask
|
2020-01-11 22:22:07 +01:00
|
|
|
|
|
|
|
|
initial begin : block
|
|
|
|
|
reg x;
|
|
|
|
|
x = f(0);
|
|
|
|
|
$display("%b", x);
|
|
|
|
|
$display("%b", 32'd1);
|
|
|
|
|
$display("%b", 32'd1);
|
|
|
|
|
$display("%b", 32'd3);
|
2020-01-12 03:06:09 +01:00
|
|
|
x = f(1);
|
|
|
|
|
x = f(0);
|
|
|
|
|
t(1);
|
2020-01-11 22:22:07 +01:00
|
|
|
end
|
|
|
|
|
endmodule
|