sv的automatic

本文通过三个实验,详细分析了在SystemVerilog中不使用`automatic`关键字时,`function`和`task`在并行执行时可能出现的问题,以及它们在不同情况下的表现。实验结果显示,未加`automatic`的`function`在并行调用时可能会导致数据冲突,而`task`在未加延时的情况下不会出现问题,但加了延时后,局部变量的值可能会受到影响。
摘要由CSDN通过智能技术生成

实验 1 没有加automatic
module tb;
function void myfunc(input [7:0] x,
input [7:0] y,
output [15:0] z);
$display(“x = %0d”, x);
$display(“y = %0d”, y);
$display(“z = %0d”, z);

                z = x + y - 1;
                $display("z = %0d", z);                

endfunction
function void myfunc_new(input [7:0] x,
input [7:0] y,
output [15:0] z);
int tmp = 10;

                $display("x = %0d", x);
                $display("y = %0d", y);
                $display("z = %0d", z);           
                tmp = x*y;
                $display("tmp = %0d", tmp);
                z = tmp - 1;                  

endfunction

task mytask(input [7:0] xx,
input [7:0] yy,
output [15:0] zz);
int tmp = 10;
$display(“xx = %0d”,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值