Home - DilipKrishnappa/UVM GitHub Wiki

UVM_Verbosity

In UVM there are multiple levels of verbosity. such as UVM_NONE, UVM_LOW, UVM_MEDIUM (Default), UVM_HIGH, UVM_FULL, UVM_DEBUG. The default Verbosity is UVM_MEDIUM.In case of default Verbosity level i.e. UVM_MEDIUM, any messages with UVM_HIGH or above are filtered out.

SL.NO verbosity_level Verbosity_default_value Description
1. UVM_NONE 0 The Verbosity configuration is always be printed, it cannot be disabled
2. UVM_LOW 100 The Verbosity configuration is printed if it is UVM_LOW and above i.e UVM_NONE
3. UVM_MEDIUM 200 The Verbosity configuration is printed if it is UVM_MEDIUM and above i.e UVM_NONE, UVM_LOW
4. UVM_HIGH 300 The Verbosity configuration is printed if it is UVM_HIGH and above i.e UVM_NONE, UVM_LOW, UVM_MEDIUM
5. UVM_FULL 400 The Verbosity configuration is printed if it is UVM_FULL and above i.e all above Verbose level
6. UVM_DEBUG 500 The Verbosity configuration is printed if it is UVM_DEBUG and above i.e all above verbose level
                              Table1: UVM VERBOSITY LEVEL

Example1: In this example we use simple module with verbosity level include the uvm macros and importing uvm_pkg i.e all uvm class.

code snippet:

     //Access to all uvm macros
     `include "uvm_macros.svh"
     //Access to all uvm pkg i.e all uvm class
     import uvm_pkg::*;

      module top;
       initial begin:B1
       `uvm_info("TOP", "verbosity level is uvm none i.e 0", UVM_NONE);//UVM_NONE is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", UVM_LOW);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm medium i.e 200", UVM_MEDIUM);//UVM_MEDIUM is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", UVM_LOW);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", UVM_LOW);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm none i.e 0", UVM_NONE);//UVM_NONE is LOWER THEN UVM_DEFAULT IT IS PRINTED  
        end:B1  
        endmodule      

OUTPUT:
Here in the below figure shows the output for the different verbosity level

Example1 uvm verbosity

                               Fig.1: output of verbosity level using simple module block

Github lab link

Github Output link


Example2: In this example we use simple module with Verbosity values, include the uvm macros and importing uvm_pkg i.e all uvm class.

code snippet:

     //Access to all uvm macros
     `include "uvm_macros.svh"
     //Access to all uvm pkg i.e all uvm class
     import uvm_pkg::*;

      module top;
       initial begin:B1
       `uvm_info("TOP", "verbosity level is uvm none i.e 0", 0);//UVM_NONE is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", 100);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm medium i.e 200", 200);//UVM_MEDIUM is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", 100);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm low i.e 100", UVM_LOW);//UVM_LOW is LOWER THEN UVM_DEFAULT IT IS PRINTED  
         #5;  
       `uvm_info("TOP", "verbosity level is uvm none i.e 0", UVM_NONE);//UVM_NONE is LOWER THEN UVM_DEFAULT IT IS PRINTED  
        end:B1  
        endmodule      

OUTPUT:
Here, in this figure we know that we can also pass the default verbosity level values instead of using uvm verbosity level.

Example2

                      Fig.2: output of verbosity level values using simple module

Github lab link

Github Output link


Important Notes:

  • A message with the Verbosity level UVM_NONE cannot be disabled.
  • Verbosity level cannot filter out the uvm_fatal, uvm_error & uvm_warning.

We can set the Verbosity level of a uvm_component individually or hierarchically using following commands:

command:
class_handle_name.set_report_verbosity_level(UVM_VERBOSITY);
Example:
env.set_report_verbosity_level(UVM_HIGH);

Example.3:To set the verbosity level of uvm_component and print the statements.here in this code we not used any phases so the uvm_report is not generated. code snippet:

         //Access the uvm macros
         `include "uvm_macros.svh"
         // Access the uvm package i.e uvm class
          import uvm_pkg::*;

        //component class
        class dilip extends uvm_driver;

        rand bit[3:0] d;
       //factory registration
       `uvm_component_utils(dilip);

        //All component in the uvm base class as default constructor expecting two arguments
        function new(string name = "", uvm_component parent);
        super.new(name,parent);
        endfunction

        task display();
       //start of test sequence
       $display("");
       $display("[%0t] \t Default verbosity level of uvm is %0d[UVM_MEDIUM]",$time,UVM_MEDIUM);
       $display("");
       #1;
      //The verbosity level lowest then UVM_DEFAULT VERBOSITY will be printed
     `uvm_info("DILIP", $sformatf("[UVM_NONE]value of d is %0d",d), UVM_NONE);
       $display("");
      #2;
      //The verbosity level lowest then UVM_DEFAULT VERBOSITY will be printed
      `uvm_info("DILIP", $sformatf("[UVM_LOW]value of d is %0d",d), UVM_LOW);
       $display("");
       #3;
      //The verbosity level lowest then UVM_DEFAULT VERBOSITY will be printed
      `uvm_info("DILIP", $sformatf("[UVM_MEDIUM]value of d is %0d", d),UVM_MEDIUM);
       $display("");
       #4;
      //The verbosity level higher then the UVM_DEFAULT VERBOSITY then it will not printed
      `uvm_info("DILIP", $sformatf("[UVM_HIGH]value of d is %0d",d), UVM_HIGH);
       $display("");
       #5;
     //The verbosity level higher then the UVM_DEFAULT VERBOSITY then it will not printed
     `uvm_info("DILIP", $sformatf("[UVM_FULL]value of d is %0d",d), UVM_FULL);
      $display("");
     #6;
     //The verbosity level higher then the UVM_DEFAULT VERBOSITY then it will not printed
     `uvm_info("DILIP", $sformatf("[UVM_DEBUG]value of d is %0d",d), UVM_DEBUG);
     $display("");

 //end of test sequence
   endtask
   endclass

  module tb;

 //class handle 
   dilip dk;

  initial begin:B1
               
  //Here we creating the object, using factory overriding
  dk = dilip::type_id::create("dk",null);

  //TO SET THE UVM VEROSITY LEVEL
  dk.set_report_verbosity_level(UVM_DEBUG);
 //object.randomize();
  void'(dk.randomize());
 //object.method
  dk.display();
 end:B1

 endmodule:tb

output:

Here in the given below figure shows the output for setting the versobite level. The verbosite level is set by using set_report_verbosity_level(UVM_DEBUG). so that all verbosite level are displayed. the verbosity level is only used for `uvm_info severity.

example7

                                        Fig.3: shows the output of verbosite level

github code link:

github output link:


Example.4: To set the verbosity level of uvm_component and print the statements

        //Access the all uvm macros
        `include "uvm_macros.svh"
       //Access the uvm package i.e uvm class
        import uvm_pkg::*;

        //component class
       class driver extends uvm_driver;

       //factory registration
       `uvm_component_utils(driver); 

      //All component in the uvm base class as default constructor expecting two arguments
      function new(string name = "", uvm_component parent);
      super.new(name,parent);
       endfunction

    //Build phase responsible for building all the lower level components, execute in bottom-up manner
     virtual function void build_phase(uvm_phase phase);
     super.build_phase(phase);
     endfunction 

    //run phase execute in the parallel run phase comes under task
    task run_phase(uvm_phase phase);
    super.run_phase(phase);

   //start of test sequence
   phase.raise_objection(this);

   #1;
  `uvm_info("DRV", "verbosity level is uvm none i.e 0", UVM_NONE); //lowest then UVM_DEFAULT VERBOSITY will be printed
   #2;
   `uvm_info("DRV", "verbosity level is uvm low i.e 100", UVM_LOW); //lowest then UVM_DEFAULT VERBOSITY will be printed
   #3;
  `uvm_info("DRV", "verbosity level is uvm medium i.e 200", UVM_MEDIUM);  //lowest then or equal to  UVM_DEFAULT VERBOSITY will be printed
   #4;
 `uvm_info("DRV", "verbosity level is uvm high i.e 300", UVM_HIGH); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed
  #5;
 `uvm_info("DRV", "verbosity level is uvm full i.e 400", UVM_FULL); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed
  #6;
  `uvm_info("DRV", "verbosity level is uvm  Debug i.e 500", UVM_DEBUG); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed

    //end of test sequence
   phase.drop_objection(this);
   endtask 
   endclass

  module tb;
 //class handle
  driver drv;
 
 initial begin

//Here we creating the object, using factory overriding
 drv = driver::type_id::create("drv",null);

 //TO SET THE UVM VERBOSITY LEVEL 
drv.set_report_verbosity_level(UVM_DEBUG);
run_test();
end
endmodule

OUTPUT:
Here, in the below figure shows the output for verbosity level where we set the level of verbosity, the run_test(); will give the UVM_report about severity, the verbosity level is used only for `uvm_info. if we do not set verbosity level it will by default execute the statement which is equal to UVM_MEDIUM and above verbosity levels

Example3

                                   Fig.4: Shows the output for setting the verbosity level

Github lab code link:

Github output link:


To Know the default value of the UVM_verbosity_level we use the below command
Command:
class_handle.get_report_verbosity_level()
Example4:
drv.get_report_verbosity_level()

Example.5: To get the UVM Default verbosity level of uvm_component and print the statements

        //Access the all uvm macros
        `include "uvm_macros.svh"
       //Access the uvm package i.e uvm class
        import uvm_pkg::*;

        //component class
       class driver extends uvm_driver;

       //factory registration
       `uvm_component_utils(driver); 

      //All component in the uvm base class as default constructor expecting two arguments
      function new(string name = "", uvm_component parent);
      super.new(name,parent);
       endfunction

    //Build phase responsible for building all the lower level components, execute in bottom-up manner
     virtual function void build_phase(uvm_phase phase);
     super.build_phase(phase);
     endfunction 

    //run phase execute in the parallel run phase comes under task
    task run_phase(uvm_phase phase);
    super.run_phase(phase);

   //start of test sequence
   phase.raise_objection(this);

   $display("[%0t] \t Default verbosity level of uvm is %0d",$time,UVM_MEDIUM); //lowest then UVM_DEFAULT VERBOSITY will be printed
   #1;
  `uvm_info("DRV", "verbosity level is uvm none i.e 100", UVM_NONE); //lowest then UVM_DEFAULT VERBOSITY will be printed
   #3;
   #2;
   `uvm_info("DRV", "verbosity level is uvm low i.e 200", UVM_LOW); //lowest then UVM_DEFAULT VERBOSITY will be printed
   #3;
  `uvm_info("DRV", "verbosity level is uvm medium i.e 300", UVM_MEDIUM); //lowest then or equal to  UVM_DEFAULT VERBOSITY will be printed
   #4;
 `uvm_info("DRV", "verbosity level is uvm high i.e 400", UVM_HIGH); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed
  #6;
  #5;
 `uvm_info("DRV", "verbosity level is uvm full i.e 500", UVM_FULL); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed
  #6;
  `uvm_info("DRV", "verbosity level is uvm debug i.e 600", UVM_DEBUG); //higher the verbosity value  then UVM_DEFAULT VERBOSITY will not be printed

    //end of test sequence
   phase.drop_objection(this);
   endtask 
   endclass

  module tb;
 //class handle
  driver drv;
initial begin

//Here we creating the object, using factory overriding
 drv = driver::type_id::create("drv",null);

//To Know the UVM_DEFAULT_VERBOSITE VALUE
void'(drv.get_report_verbosity_level());
 
  run_test();
  end
  endmodule

OUTPUT:
Here, in the below figure shows the output for default verbosity level of uvm. it will print or gives the information about the statement whose verbosity level is equal to or less than UVM_MEDIUM. To know the default verbosity in the uvm will use a command drv.get_report_verbosity_level(). The run_test() will give the UVM_REPORT details.

Example4

                                  Fig.5: Shows the output for getting the default verbosity level

Github lab code link:

Github output link: