0% found this document useful (0 votes)
36 views16 pages

Reporting Function and Verbosity

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views16 pages

Reporting Function and Verbosity

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

@shraddha_pawankar Date:23/03/2024

Reporting Function and Verbosity

Verilog $display does not provide a Filtering facility whereas UVM


provides the Message filtering capabilities to notify only important
messages to the User.

Verbosity level is used for filtering the message so the `uvm_info


messages which possess verbositylevel less than or equal to the current
configureverbosity level will be sent to the Console.

By changing the verbosity ,printing the message can be controlled

String id or get_type_name() or get_full_name()


=> gives current class name

Default Verbosity level (UVM_MEDIUM) can be overridden by using


set_report_verbosity_level.

The uvm_report_object provides reporting functionality for UVM.


The message, error, or warning prints are very important for
debugging purposes that are being facilitated by the
uvm_report_object class.

1|Page
@shraddha_pawankar Date:23/03/2024

Report macros: UVM provides a set of macros that are wrappers around
uvm_report_* functions as shown below:

Macros Reporting functions

`uvm_info uvm_report_info

`uvm_warning uvm_report_warning

`uvm_error uvm_report_error

`uvm_fatal uvm_report_fatal

Reporting functions in UVM are essential for providing feedback and insights
into the behavior of the verification environment, allowing engineers to identify
and address issues effectively during the verification process.

Syntax:

Macros Syntax

`uvm_info `uvm_info(ID,MSG,VERBOSITY)

`uvm_warning `uvm_warning(ID,MSG)

`uvm_error `uvm_error(ID,MSG)

`uvm_fatal `uvm_fatal(ID,MSG)

Where,
ID: message tag
MSG: A text message
2|Page
@shraddha_pawankar Date:23/03/2024

VERBOSITY: If VERBOSITY is lower than configured verbosity for that reporter, it


will be printed.
Note: `uvm_warning has UVM_NONE as a default verbosity.

UVM_VERBOSITY:

3|Page
@shraddha_pawankar Date:23/03/2024

Verbosity level

UVM_NONE = 0 //lowest verbosity


UVM_LOW = 100
UVM_MEDIUM = 200
UVM_HIGH = 300

UVM_DEBUG = 500 // highest


verbosity

Note: Default Verbosity is UVM_MEDIUM

Severity for message:


 `uvm_fatal
 `uvm_error
 `uvm_warning
 `uvm_info

Can a message with the verbosity level UVM_none be disabled?


A message with the Verbosity level UVM_NONE can not be disabled. `uvm_fatal,
`uvm_error & `uvm_warning can not be filtered out via Verbosity level.

Example 1:
`include "uvm_macros.svh"
import uvm_pkg::*;

class component extends uvm_component;


`uvm_component_utils(component)

4|Page
@shraddha_pawankar Date:23/03/2024

function new(string name="",uvm_component parent);


super.new(name,parent);
endfunction

task run_phase(uvm_phase phase);


phase.raise_objection(this);

`uvm_info(get_type_name(),"THIS IS INFO",UVM_NONE)
`uvm_warning(get_type_name(),"This is warning")
`uvm_error(get_type_name(),"This is error")
`uvm_fatal(get_type_name(),"this is fatal")

phase.drop_objection(this);
endtask
endclass

//////////////////////////////////////

module tb;
initial
begin
run_test("component");
end
endmodule

Output :

5|Page
@shraddha_pawankar Date:23/03/2024

# KERNEL: UVM_INFO /home/runner/testbench.sv(14) @ 0: uvm_test_top


[component] THIS IS INFO

# KERNEL: UVM_WARNING /home/runner/testbench.sv(15) @ 0: uvm_test_top


[component] This is warning
# KERNEL: UVM_ERROR /home/runner/testbench.sv(16) @ 0: uvm_test_top
[component] This is error
# KERNEL: UVM_FATAL /home/runner/testbench.sv(17) @ 0: uvm_test_top
[component] this is fatal
# KERNEL: UVM_INFO /home/build/vlib1/vlib/uvm-
1.2/src/base/uvm_report_server.svh(869) @ 0: reporter [UVM/REPORT/SERVER]
# KERNEL: --- UVM Report Summary ---
# KERNEL:
# KERNEL: ** Report counts by severity
# KERNEL: UVM_INFO : 3
# KERNEL: UVM_WARNING : 1
# KERNEL: UVM_ERROR : 1
# KERNEL: UVM_FATAL : 1
# KERNEL: ** Report counts by id
# KERNEL: [RNTST] 1
# KERNEL: [UVM/RELNOTES] 1
# KERNEL: [component] 4

EDA Playground link: https://edaplayground.com/x/WeiT

--------------------------------------------------------------------------------------------------------

Example 2:
`include "uvm_macros.svh"
import uvm_pkg::*;

module tb;
initial begin
`uvm_info("INFO","This is INFO",UVM_NONE);

6|Page
@shraddha_pawankar Date:23/03/2024

`uvm_info("INFO","This is INFO",UVM_LOW);
`uvm_warning("WARN", "This is Warning");
`uvm_error("ERROR", "This is Error")
`uvm_fatal("FATAL", "This is fatal error");
end
Endmodule

Output:
# KERNEL: UVM_INFO /home/runner/testbench.sv(8) @ 0: reporter [INFO] This is
INFO
# KERNEL: UVM_INFO /home/runner/testbench.sv(9) @ 0: reporter [INFO] This is
INFO
# KERNEL: UVM_WARNING /home/runner/testbench.sv(10) @ 0: reporter [WARN]
This is Warning
# KERNEL: UVM_ERROR /home/runner/testbench.sv(11) @ 0: reporter [ERROR]
This is Error
# KERNEL: UVM_FATAL /home/runner/testbench.sv(13) @ 0: reporter [FATAL] This
is fatal error
# KERNEL: UVM_INFO /home/build/vlib1/vlib/uvm-1800.2-
2017/src/base/uvm_report_server.svh(886) @ 0: reporter [UVM/REPORT/SERVER]
# KERNEL: --- UVM Report Summary ---
# KERNEL:
# KERNEL: ** Report counts by severity
# KERNEL: UVM_INFO : 3
# KERNEL: UVM_WARNING : 1
# KERNEL: UVM_ERROR : 1
# KERNEL: UVM_FATAL : 1
# KERNEL: ** Report counts by id
# KERNEL: [ERROR] 1
# KERNEL: [FATAL] 1
# KERNEL: [INFO] 2
# KERNEL: [UVM/RELNOTES] 1
# KERNEL: [WARN] 1

EDA playground link: https://www.edaplayground.com/x/CAtM

7|Page
@shraddha_pawankar Date:23/03/2024

Example 3:
`include "uvm_macros.svh"
import uvm_pkg::*;

module tb;
initial begin
//`uvm_info("INFO","This is INFO",UVM_NONE);
//`uvm_info("INFO","This is INFO",UVM_LOW);
`uvm_info("INFO","This is INFO",UVM_HIGH);
`uvm_warning("WARN", "This is Warning");
`uvm_error("ERROR", "This is Error");
`uvm_fatal("FATAL", "This is fatal error"); end
endmodule

Output:
# KERNEL: UVM_WARNING /home/runner/testbench.sv(10) @ 0: reporter [WARN]
This is Warning
# KERNEL: UVM_ERROR /home/runner/testbench.sv(11) @ 0: reporter [ERROR]
This is Error
# KERNEL: UVM_FATAL /home/runner/testbench.sv(12) @ 0: reporter [FATAL] This
is fatal error
# KERNEL: UVM_INFO /home/build/vlib1/vlib/uvm-
1.2/src/base/uvm_report_server.svh(869) @ 0: reporter [UVM/REPORT/SERVER]
# KERNEL: --- UVM Report Summary ---
# KERNEL:
# KERNEL: ** Report counts by severity
# KERNEL: UVM_INFO : 1
# KERNEL: UVM_WARNING : 1
# KERNEL: UVM_ERROR : 1
8|Page
@shraddha_pawankar Date:23/03/2024

# KERNEL: UVM_FATAL : 1
# KERNEL: ** Report counts by id
# KERNEL: [ERROR] 1
# KERNEL: [FATAL] 1
# KERNEL: [UVM/RELNOTES] 1
# KERNEL: [WARN] 1
# KERNEL:
# RUNTIME: Info: RUNTIME_0068 uvm_root.svh (135): $finish called.

Eda playground link : https://www.edaplayground.com/x/ryPN

IF WE USED UVM_HIGH VERBOSITY,THERE IS NOTHING AT THE OUTPUT,


IGNORING THE STRING.
IF WE USED `UVM FATAL $FINISH AUTOMATICALLY CALLED

Example: Printing variable with reporting mechanism

`include "uvm_macros.svh"
import uvm_pkg::*;

module tb;
integer data1 = 50;
reg [15:0] data2= 16'h1234;

initial begin
`uvm_info("INFO",$sformatf("data1=%0d",data1),UVM_NONE)
`uvm_info("INFO",$sformatf("data1=%0b",data1),UVM_NONE)
`uvm_info("INFO",$sformatf("data2=%0d",data2),UVM_NONE)
`uvm_info("INFO",$sformatf("data2=%0b",data2),UVM_NONE)

9|Page
@shraddha_pawankar Date:23/03/2024

`uvm_info("INFO",$sformatf("data1=%0x",data1),UVM_NONE)
`uvm_info("INFO",$sformatf("data1=%0x",data2),UVM_NONE)
end
endmodule

Output:
# KERNEL: UVM_INFO /home/runner/testbench.sv(10) @ 0: reporter [INFO]
data1=50
# KERNEL: UVM_INFO /home/runner/testbench.sv(11) @ 0: reporter [INFO]
data1=110010
# KERNEL: UVM_INFO /home/runner/testbench.sv(12) @ 0: reporter [INFO]
data2=4660
# KERNEL: UVM_INFO /home/runner/testbench.sv(13) @ 0: reporter [INFO]
data2=1001000110100
# KERNEL: UVM_INFO /home/runner/testbench.sv(14) @ 0: reporter [INFO]
data1=32
# KERNEL: UVM_INFO /home/runner/testbench.sv(15) @ 0: reporter [INFO]
data1=1234

EDA playground link: https://edaplayground.com/x/nBwf

Que 1) What happen if verbosity level as UVM_HIGH in `uvm_info


Ans : Nothing at the output to UVM_HIGH i.e ignoring the string
If we want to display then by using
set_report_verbosity_level(UVM_HIGH);

Change the existing verbosity level

Code :
`include "uvm_macros.svh"
import uvm_pkg::*;

class abc extends uvm_component;


10 | P a g e
@shraddha_pawankar Date:23/03/2024

rand int a;

`uvm_component_utils(abc)

function new(string name="",uvm_component parent);


super.new(name,parent);
endfunction
task display();
`uvm_info("INFO",$sformatf("a=%0d",a),UVM_HIGH)
endtask

endclass

module top;
abc h1;
initial begin
h1=abc::type_id::create("h1",null);
h1.randomize();
h1.display();
end
endmodule

Output :
OUTPUT:

No message will be displayed

Eda playground link : https://edaplayground.com/x/pGVS

11 | P a g e
@shraddha_pawankar Date:23/03/2024

Case 2: If we want to display then by using


set_report_verbosity_level(UVM_HIGH);

Change the existing verbosity level.

Code:

`include "uvm_macros.svh"

import uvm_pkg::*;

class abc extends uvm_component;

rand int a;

int b=2;

`uvm_component_utils(abc)

function new(string name="",uvm_component parent);

super.new(name,parent);

endfunction

task display();

`uvm_info("INFO",$sformatf("a=%0d",a),UVM_HIGH)

12 | P a g e
@shraddha_pawankar Date:23/03/2024

`uvm_info("INFO",$sformatf("b=%0b",b),UVM_HIGH)

endtask

endclass

module top;

abc h1;

initial begin

h1=abc::type_id::create("h1",null);

h1.set_report_verbosity_level(UVM_HIGH);

h1.randomize();

h1.display();

end

endmodule

Output :

# KERNEL: UVM_INFO /home/runner/testbench.sv(16) @ 0: h1 [INFO] a=-


1919469369
# KERNEL: UVM_INFO /home/runner/testbench.sv(17) @ 0: h1 [INFO] b=10

Eda playground link : https://edaplayground.com/x/sA9L

13 | P a g e
@shraddha_pawankar Date:23/03/2024

Assume that you have four variables initialized to the constant values as mentioned
below. Use UVM_INFO to display the values of the variables on the Console in the
hexadecimal Format. 1) reg [3:0] a = 4'b1010 2) reg [15:0 ] b = 16'h1122 3) integer
c =12; 4) reg d = 1;

`include "uvm_macros.svh"

import uvm_pkg::*;

module tb;
reg [3:0] a=4'b1010; reg[15:0]

b=16'h1122;

integer c=12;reg

d = 1; initial

begin

`uvm_info("INFO",$sformatf("a=%0h",a),UVM_LOW)
`uvm_info("INFO",$sformatf("b=%0h",b),UVM_LOW)
`uvm_info("INFO",$sformatf("c=%0h",c),UVM_LOW)

`uvm_info("INFO",$sformatf("d=%0h",d),UVM_LOW)

end

endmodule

14 | P a g e
@shraddha_pawankar Date:23/03/2024

Output:
# KERNEL: UVM_INFO /home/runner/testbench.sv(12) @ 0: reporter [INFO] a=a
# KERNEL: UVM_INFO /home/runner/testbench.sv(13) @ 0: reporter
[INFO] b=1122# KERNEL: UVM_INFO /home/runner/testbench.sv(14) @
0: reporter [INFO] c=c
# KERNEL: UVM_INFO /home/runner/testbench.sv(15) @ 0: reporter [INFO] d=1

EDA Playground link: https://edaplayground.com/x/c7uJ

-------------------------------------------------------------------------------------------------------------

15 | P a g e
@shraddha_pawankar Date:23/03/2024

16 | P a g e

You might also like