
#################################################################################################
案例 1
module tb;
function automatic void myfunc(input [7:0] x,
output [7:0] y,
output [15:0] z);
$display(“x = %0d”, x);
$display(“y = %0d”, y);
$display(“z = %0d”, z);
z = x + y - 1;
endfunction
initial begin
byte unsigned a = 3;
byte unsigned b = 3;
byte unsigned c = 3;
myfunc(a,b,c);
$display(“c = %0d”, c);
end
endmodule
运行的结果
x = 3
y = x
z = x
c = 0
#################################################################################################
案例 2
module tb;
function automatic void myfunc(input [7:0] x,
input [7:0] y,
output [15:0] z);
x = 3
y = 3
z = x
c = 5
#################################################################################################
案例3
module tb;
function automatic void myfunc(input [7:0] x,
input [7:0] y,
output [15:0] z);
x = 3
y = 3
z = 3
c = 3
最后
以上就是失眠荷花最近收集整理的关于function的input和output的理解的全部内容,更多相关function内容请搜索靠谱客的其他文章。
发表评论 取消回复