Verilog:常用的系统任务(Verilog: common system tasks)

(1)数据显示任务:$display, $write

功能:以指定格式输出数据

格式:    $display(“输出文本说明%d”, p1),第一个参数控制输出格式, 会自动换行

    $write(“输出文本说明%d”, p),不会自动换行,在一行内输出

(2)文件输出

  2.1) 打开文件

    定义句柄:integer handle;

    handle = $fopen(“文件名”)

    tips:句柄是和对象对应的32位无符号整数值。对象可以          映射到唯一的句柄,句柄也可以映射到唯一的对象。

  2.2) 写文件

  $fdisplay,$fmonitor,$fwrite,$fstrobe都可用于文件写入

  注意与$display,$write的区别

  $fdisplay(句柄,”数据或文本”);

  2.3) 关闭文件

  $fclose(句柄)

————————

(1) Data display task: $display, $write

Function: output data in specified format

Format:     $ Display (“output text description% d”, P1), the first parameter controls the output format and will wrap automatically

$write (“output text description% d”, P), will not wrap automatically, and will be output in one line

(2) File output

2.1) open file

Definition handle: integer handle;

Handle = $fopen (“file name”)

Tips: handle is 32-bit unsigned integer value corresponding to object. Object can            To a unique handle, a handle can also be mapped to a unique object.

2.2) writing documents

$fddisplay, $fmmonitor, $fwrite, $fstrobe can be used for file writing

Note the difference between $display and $write

$fddisplay (handle, “data or text”);

2.3) close the file

$Fclose (handle)