verilog学习——系统任务和函数/system tasks and functions

verilog学习——系统任务和函数/system tasks and functions

(一)Verilog显示任务/task

显示系统任务(display system tasks)用于显示信息和调试信息,以跟踪日志文件中的模拟流程,有助于更快的调试。可以通过不同的显示任务组和格式打印值。
1.显示/写入任务(tasks)
语法:

$display(<list_of_arguments>);
$write(<list_of_arguments>);

display和display 和displaywrite都按照参数列表中的出现顺序显示参数。
$write不会将换行符添加到其字符串的末尾。
2.verilog storbes
strobe在当前增量时间步长的末尾打印变量的最终值,并与strobe 在当前增量时间步长的末尾打印变量的最终值,并与strobe在当前增量时间步长的末尾打印变量的最终值,并与display具有类似的格式,

module tb;
  initial begin
    reg [7:0] a;
    reg [7:0] b;

    a = 8'h2D;
    b = 8'h2D;

    #10;                  // Wait till simulation reaches 10ns
    b <= a + 1;           // Assign a+1 value to b

    $display ("[$display] time=%0t a=0x%0h b=0x%0h", $time, a, b);
    $strobe  ("[$strobe]  time=%0t a=0x%0h b=0x%0h", $time, a, b);

    #1;
    $display ("[$display] time=%0t a=0x%0h b=0x%0h", $time, a, b);
    $strobe  ("[$strobe]  time=%0t a=0x%0h b=0x%0h", $time, a, b);

  end
endmodule
[$display] time=10 a=0x2d b=0x2d
[$strobe]  time=10 a=0x2d b=0x2e
[$display] time=11 a=0x2d b=0x2e
[$strobe]  time=11 a=0x2d b
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值