我是靠谱客的博主 失眠荷花,这篇文章主要介绍function的input和output的理解,现在分享给大家,希望可以做个参考。

在这里插入图片描述

#################################################################################################
案例 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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(101)

评论列表共有 0 条评论

立即
投稿
返回
顶部