Dumping Dynamic Objects (Class Instances) Into FSDB and Displaying in nWave
专栏:ExASIC May 6, 2024, 10:37 a.m. 586 阅读
Dumping Dynamic Objects (Class Instances) Into FSDB and Displaying in nWave

Description

In Verdi interactive mode, you can directly add an alive object of the current simulation scope and see the value and the value changes of the members in nWave. Verdi dumps the value to the inter.fsdb file in the background when you try to add it to the waveform. (Where inter.fsdb is the default FSDB file used in interactive mode.)

In Verdi post-processing mode, once dynamic objects are dumped into an FSDB, you can see them in the nWave window, which is Verdi Waveform view.

Following introduce (I) how to dump dynamic objects and (II) how to view them in the nWave window in post-processing mode.

I. Dump Dynamic Objects

  • If you are using VCS/Verdi provided UVM library as your base UVM library, following steps help you dump *uvm_pkg*.uvm_component into FSDB:

    • Add the following compilation options:

      -debug_access+class at least 
      -ntb_opts uvm<version> 
      +define+UVM_VERDI_COMPWAVE

    • Add the runtime option:

      +UVM_VERDI_TRACE=" HIER+COMPWAVE"

Then, all the classes extended from uvm_component (which are often the members of the UVM testbench hierarchy) are dumped to FSDB directly.

  • Additionally, two dumping tasks are used to dump objects of class into FSDB and then show them in nWave: $fsdbDumpClassObject and $fsdbDumpvars+class. Based on SV various and flexible coding, $fsdbDumpClassObject uses the class scope (where the class definition is) to dump instanced objects and $fsdbDumpvars+class uses the hierarchy path to dump a variable which datatype is class and belongs to an HDL scope. Note that, unlike HDL signals, dynamic objects often cost more. Thus, more steps and settings tend to remind you to use them carefully.

The following table shows the summary and usage for the two dumping tasks:

fsdbDumpClassObjectfsdbDumpvars+class
Based onBe definition-tend implemented and available based on the class definitionBased on instanced hierarchy path
Supports Target- A class located in a specified scope: All instanced objects will be dumped, each one has its own object ID
- Specific object ID of a class locates in a specified scope: only the instanced object with the object ID will be dumped
An object with a specific hierarchy path, that is, a variable for which the original data type is class and is declared in a specific hierarchy path
Syntax$fsdbDumpClassObject(<class scope>, [,+object_level=<value>])$fsdbDumpvars (<hierarchy path>, +class
[, +object_level=<value>])
Required Settingsetenv FSDB_ENABLE_EXPAND_CLASS 1 # enables dumping variable in class object and expanding them in nWavesetenv FSDB_ENABLE_CLASS 1
setenv FSDB_ENABLE_EXPAND_CLASS 1 # enables dumping variable in class object and expanding them in nWave
Optional Settingsetenv FSDB_VARIANT_SIZE_ARRAY 1 # enables dumping queue, dynamic array, and associative array inside a class objectsetenv FSDB_VARIANT_SIZE_ARRAY 1 # enables dumping queue, dynamic array, and associative array inside a class object
Compilation option+debug_access+all for vcs compilation+debug_access+all or +debug_access+class for vcs compilation
Available ReleaseStarting from Verdi R-2020.12Starting from Verdi S-2021.09


The following examples show you how to use the dumping tasks by specifying a class scope or a class variable.

Example 1:
Dumping a UVM component and a UVM sequence using fsdbDumpClassObject

//Use ubus as the example. The following codes are in top-level

`include "ubus_pkg.sv" //includes all ubus uvc for bench structure

module ubus_tb_top;
  import uvm_pkg::*;
  import ubus_pkg::*;
  `include "test_lib.sv" //includes all tests and sequence

  initial begin
     run_test();
end

endmodule

A. Dumping instanced objects of ubus_master_driver

  1. Clarify the scope: The code of ubus_master_driver is in ubus_pkg, which is imported in module ubus_tb_top. The scope is as follows:

    "ubus_pkg.ubus_master_driver"; // all instanced objects of ubus_master_driver
    "ubus_pkg.ubus_master_driver@1"; //only ubus_master_driver@1 object

  2. Call the dumping task in the initial block of ubus_tb_top module:

        initial begin
            $fsdbDumpClassObject("ubus_pkg.ubus_master_driver@1");   
    	end

  3. Set environment variable:

      > setenv FSDB_ENABLE_EXPAND_CLASS 1

  4. Add -debug_access+all compile-time option and perform compilation and simulation

B. Dumping instanced objects of executing sequence, loop_read_modify_write_seq, and see inside <n> level instanced objects

  1. Clarify the scope: The code of loop_read_modify_write_seq is included in test_lib.sv, which is included in the module ubus_tb_top. The scope is as follows:

    "ubus_tb_top.loop_read_modify_write_seq"

  2. Call the dumping task (and specify object_level to 2) in the initial block of the ubus_tb_top module:

    initial begin    
    	$fsdbDumpClassObject("ubus_tb_top.loop_read_modify_write_seq",         
    	                                       "+object_level=2"); 
    end

  3. Set the environment variable:

      > setenv FSDB_ENABLE_EXPAND_CLASS 1

  4. Add -debug_access+all compile-time option and perform compilation and simulation

    Example 2: Dumping a class variable declared in a module using fsdbDumpvars

//The following codes are in top-level 
module test();   
	import test_pkg::*; //includes the class definition of “generator”   
	
	class foo; 

	endclass   

	generator gen_i; 
	foo foo_i; 

endmodule

Dumping instances gen_i or foo_i are available:

  1. Clarify the hierarchy path. The hierarchies are,

        "test.gen_i"     
    	"test.foo_i"

  2. Call the dumping tasks in the initial block of test module

        initial begin
            $fsdbDumpvars("test.gen_i", "+class", "+object_level=1");         
    	       $fsdbDumpvars("test.foo_i", "+class", "+object_level=2");     
    	end

  3. Set the environment variables:

    	> setenv FSDB_ENABLE_CLASS
      	> setenv FSDB_ENABLE_EXPAND_CLASS 1

  4. Add -debug_access+all or -debug_access+class compile-option and perform compilation and simulation

II. View Objects in nWave Window


Once the dynamic objects are dumped to the FSDB, you can add and view them in the nWave window.

Before invoking Verdi, set the following environment variable to enable nWave supporting dynamic object features:

setenv VERDI_ENHANCE_DYNAMIC_OBJECT


The following table shows the features that are enabled using the environment variable:

Environment VariableEnables Feature
VERDI_ENHANCE_DYNAMIC_OBJECT- Showing UVM hierarchy path in nWave
- “Filtering internal attributes” is available
- RMB: Add to Waveform is available if the object exists in FSDB


After invoking Verdi (note that in S-2021.09, -lca is required to support VERDI_ENHANCE_DYNAMIC_OBJECT features), open the FSDB and use the following methods to add objects into nWave:

  • In the nWave window with opened FSDB file, choose Signal -> Get Signals command to open the "Get Signals" window. Like selecting HDL signals, select the objects you need from the belonged scope in $object_root. For example:
    image.png#100%

  • In the opened uvm_hier_tree window, select a component that you need and use the RMB -> Add to Waveform
    image.png#100%

  • After adding one object, you can expand it by double-clicking on it:
    image.png#100%







感谢阅读,更多文章点击这里:【专栏:ExASIC】
最新20篇 开设专栏