Monday 2 September 2019

System Verilog tasks to generate vcd file

Many times in verification activity, people requires to generate vcd file and mostly it is required by designers to see the value changes of design variables. So let's see, more about vcd file in system verilog.
2 types of vcd file can be generated through system verilog:

  1. 4 state: which represent changes of variable values 0, 1, x and z
  2. Extended: with 4 state values, it shows strength information

Below are the more details about generation of vcd files:

  • Generation for 4 state vcd file:

          Following are few useful system verilog tasks, that can be used for 4 state vcd file:

    • $dumpfile("file_name.vcd") => To generate vcd file with specified name. It is passed as its argument. If its not provided then default file name would be "dump.vcd".
    • $dumpvars(0, top) => To specify which variables to be dumped into vcd file. It has 2 arguments but no arguments are specified then it dumps all variables of the design.

                   First argument indicates the hierarchy level below each specified module instance to be dumped. 
      • 0 indicates dump of all variables in the specified module and all module instances and sub-instances specified in the current module.
      • 1 indicates dump all the variable of current module
      • 2 indicates dump all the variable of current module and the instances specified in the current module. It will not dump submodule information.
      • ..... 
                    Second argument indicates the scope/hierarchy of the design to dump.
    • $dumpoff => To suspend dumping information in the vcd file.
    • $dumpon => To resume dumping information in the vcd file.
    • $dumpall => Dump all selected variables when this task in invoked otherwise variables are dumped only when their values are changed.
    • $dumplimit(file_size_in_bytes) => To specify the size limit of vcd file.
  • Generation of Extended vcd file:

          Following are few useful system verilog tasks, that can be used for extended vcd file:
    • $dumpports(module_identifier, "file_name.vcd") => To dump ports and specify the vcd file name. Only modules can be provided, not variables. More than one module can be provided by comma separation.
    • $dumpportsoff("file_name.vcd") => To suspend port dumping information in vcd file.
    • $dumpportson("file_name.vcd") => To resume port dumping information in vcd file. 
    • $dumpportsall("file_name.vcd") => To dump all selected ports at a time when this method is called.
    • $dumpportslimit(file_size_in_bytes, "file_name.vcd") => To specify the size limit of the file and the file name of vcd to be dumped.