当前位置:网站首页>UVM: message mechanism
UVM: message mechanism
2022-06-29 00:50:00 【Starry and】
Catalog
Conventional Systemverilog Regular use $display() Print information , and uvm Contains several specific printing methods , Details can be automatically printed , No need to reuse $display() Appoint
1. Message printing method
UVM All message printing methods come from uvm_report_object class , and uvm_component Class inherits from uvm_report_object class , So all of them component Both contain message printing methods and setting methods
Here are the prototypes of common methods , In fact, all methods are essentially called uvm_report, You can check the source code .
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_report_object.svh
class uvm_report_object extends uvm_object; //...
virtual function void uvm_report( uvm_severity severity,
string id,
string message,
int verbosity = (severity == uvm_severity'(UVM_ERROR)) ? UVM_LOW :
(severity == uvm_severity'(UVM_FATAL)) ? UVM_NONE : UVM_MEDIUM,
string filename = "",
int line = 0,
string context_name = "",
bit report_enabled_checked =0);
virtual function void uvm_report_info( string id,
string message,
int verbosity = UVM_MEDIUM,
string filename = "",
int line = 0,
string context_name = "",
bit report_enabled_checked = 0);
virtual function void uvm_report_warning( string id,
string message,
int verbosity = UVM_MEDIUM,
string filename = "",
int line = 0,
string context_name = "",
bit report_enabled_checked = 0);
virtual function void uvm_report_error( string id,
string message,
int verbosity = UVM_LOW,
string filename = "",
int line = 0,
string context_name = "",
bit report_enabled_checked = 0);
virtual function void uvm_report_fatal( string id,
string message,
int verbosity = UVM_NONE,
string filename = "",
int line = 0,
string context_name = "",
bit report_enabled_checked = 0);
//...
endclass
Then the input variables are explained
● string id: Indicates that the message is printed ID, Can be used to inform the message control method , Which message to control
● string message: The message to be printed
● string filename : The name of the file where the message is printed
● int line: Print the line number of the file where the message is located
1.1. int verbosity Filtration degree
Redundancy , Or called Filtration degree , Indicates the filter level of the message . The higher the filtration level , The easier it is not to display this message
As always parameter Constant means , Defined as
typedef enum{
UVM_NONE = 0,
UVM_LOW = 100,
UVM_MEDIUM = 200,
UVM_HIGH = 300,
UVM_FULL = 400,
UVM_DEBUG = 500
} uvm_verbosity;
various component All have their own Filtration threshold , The default is UVM_MEDIUM, If the filtering degree of a message ≤ Filtration threshold , Will print , Otherwise you don't print .
uvm_report Method specific input , Indicates the severity of the message or Security level
1.2. uvm_severity severity Security level
With parameter Constant means , Yes UVM_INFO、UVM_WARNING、UVM_ERROR and UVM_FATAL, Capital must be written.
Corresponding to uvm_report_info、uvm_report_warning、uvm_report_error and uvm_report_fatal Four ways .
If the security level is fatal After the message is printed , Stop the simulation immediately
1.3. Example
Here's an example
class my_driver extends uvm_driver;
`uvm_component_utils("my_driver")
function new(string name = "my_driver", uvm_component parent);
super.new(name,parent);
endfunction
virtual task main_phase(uvm_phase phase);
...
uvm_report_info("data1","data is derived", UVM_LOW) //ID by "data1", The printed content is "data is derived", The security level is UVM_INFO, The filtering level is UVM_LOW
...
endtask
endclass
The printed information formula is :UVM_INFO From sv file ( Number of lines of message statements in the file )@ Print time : Indexes [ID Number ] Printed information
for example
UVM_INFO my_driver.sv(20)@48500000:drv[data1]data is drived
2. Message control
2.1. Filter grade control
That is, the filter level of some message statements is uniformly controlled
The function prototype , Be careful uvm_component Class in uvm_report_object Class adds the setting of hierarchical regression to all methods .
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_report_object.svh
// Get the filter level according to the security level
function int get_report_verbosity_level(uvm_severity severity=UVM_INFO, string id="");
function int get_report_max_verbosity_level();
function void set_report_verbosity_level (int verbosity_level);
function void set_report_id_verbosity (string id, int verbosity);
function void set_report_severity_id_verbosity (uvm_severity severity,string id, int verbosity);
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_component.svh
function void set_report_verbosity_level_hier (int verbosity_level);
function void set_report_id_verbosity_hier (string id, int verbosity);
function void set_report_severity_id_verbosity_hier (uvm_severity severity,string id, int verbosity);
Example
env.i_agt.drv.get_report_verbosity_level(); // obtain drv Filtering threshold of
env.i_agt.drv.set_report_verbosity_level(UVM_HIGH); //drv The filtering threshold of is set to UVM_HIGH
env.i_agt.set_report_verbosity_level_hier(UVM_HIGH); //i_agt And all the filtering thresholds of its child nodes are set to UVM_HIGH
env.i_agt.set_report_id_verbosity("drv",UVM_HIGH); // Set up ID by "drv" Of component The filtration threshold of is UVM_HIGH
env.i_agt.set_report_id_verbosity("sqr",UVM_HIGH); // obtain ID by "sqr" Of component The filtration threshold of is UVM_HIGH
env.set_report_id_verbosity_hier("i_agt",UVM_HIGH); // obtain ID by "i_agt" And its son component The filtration thresholds of all are UVM_HIGH
2.2. Document control
The printed message can be saved in the log file
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_report_object.svh
function int get_report_file_handle(uvm_severity severity, string id);
function void set_report_default_file (UVM_FILE file);
function void set_report_id_file (string id, UVM_FILE file);
function void set_report_severity_file (uvm_severity severity, UVM_FILE file);
function void set_report_severity_id_file (uvm_severity severity, string id,
UVM_FILE file);
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_component.svh
function void set_report_id_file_hier (string id, UVM_FILE file);
function void set_report_severity_file_hier (uvm_severity severity, UVM_FILE file);
function void set_report_severity_id_file_hier (uvm_severity severity, string id,
UVM_FILE file);
2.3. behavior control
That is to control the behavior of messages , It is also defined by enumerating constants
typedef enum
{
UVM_NO_ACTION = 'b000000, // No action
UVM_DISPLAY = 'b000001, // display messages
UVM_LOG = 'b000010, // write file
UVM_COUNT = 'b000100, // Count to a certain value , And stop the simulation
UVM_EXIT = 'b001000, // Exit simulation
UVM_CALL_HOOK = 'b010000, // Call callback function
UVM_STOP = 'b100000 // Stop simulation
} uvm_action_type;
The default behavior of each security level is shown in the following table
| severity | default action |
|---|---|
| UVM_INFO | UVM_DISPLAY |
| UVM_WARNING | UVM_DISPLAY |
| UVM_ERROR | UVM_DISPLAY 丨 UVM_COUNT |
| UVM_FATAL | UVM_DISPLAY 丨 UVM_EXIT |
through ** or |** Implementing the merging of actions
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_report_object.svh
function int get_report_action(uvm_severity severity, string id);
function void set_report_severity_action (uvm_severity severity,uvm_action action);
function void set_report_id_action (string id, uvm_action action);
function void set_report_severity_id_action (uvm_severity severity,
string id, uvm_action action);
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_component.svh
function void set_report_severity_action_hier (uvm_severity severity,uvm_action action);
function void set_report_id_action_hier (string id, uvm_action action);
function void set_report_severity_id_action_hier (uvm_severity severity,
string id, uvm_action action);
Example
class comp1 extends uvm_component;
`uvm_component_utils(comp1);
function void build_phase(uvm_phase phase);
f = $fopen("logfile",w);
set_report_default_file (f);
set_report_severity_action_hier(UVM_INFO,UVM_DISPLAY|UVL_LOG);
set_report_severity_action_hier(UVM_ERROR,UVM_DISPLAY|UVL_LOG|UVM_COUNT);
endclass
UVM_COUNT
It means counting the end of simulation , It can be set as follows UVM_ERROR Count threshold of
function void set_report_max_quit_count(int max_count);
2.4. Safety class overload
`uvm_info, `uvm_warning, `uvm_error, `uvm_fatal Can be overloaded with each other , The methods involved are as follows
//...\questasim64_2020.1\verilog_src\uvm-1.2\src\base\uvm_report_object.svh
function void set_report_severity_override(uvm_severity cur_severity,
function void set_report_severity_id_override(uvm_severity cur_severity,
string id,
uvm_severity new_severity);
env.i_agt.drv.set_report_severity_override(UVM_WARNING, UVM_ERROR); // take drv be-all uvm_warning Replace with uvm_error
env.i_agt.drv.set_report_severity_id_override(UVM_WARNING, "my_driver", UVM_ERROR); // Joined the id
边栏推荐
- 使用.Net驱动Jetson Nano的OLED显示屏
- Reprint: VTK notes - clipping and segmentation - irregular closed loop clipping -vtkselectpolydata class (black mountain old demon)
- How to carry token authentication in websocket JS connection
- Daily question 1: missing numbers
- Introduction to JVM working principle
- [communication] wide band source DOA estimation method based on incoherent signal subspace (ISM)
- Install MySQL on Windows platform (with Navicat premium 12 "using" tutorial)
- Two ways to set up a single Nacos load balancing ribbon polling policy weight
- 光纤滑环价格过高的原因
- 大型网站架构基础之笔记
猜你喜欢

Ensemble de données sur les visages masqués et méthode de génération des visages masqués

企业和IT领导者对创新的误解

Program environment and pretreatment

广度度优先搜索实现抓牛问题

BMFONT制作位图字体并在CocosCreator中使用

狼人杀休闲游戏微信小程序模板源码/微信小游戏源码

Daily practice: delete duplicates in the ordered array

旋转接头安装使用注意事项
![[MCU club] design of GSM version of range hood based on MCU [simulation design]](/img/8c/933ebfaeec63c0d1ffe361cb2bb91a.jpg)
[MCU club] design of GSM version of range hood based on MCU [simulation design]
![[image registration] SAR image registration based on particle swarm optimization Improved SIFT with matlab code](/img/b5/02979b50db885f0606dce455182ac4.jpg)
[image registration] SAR image registration based on particle swarm optimization Improved SIFT with matlab code
随机推荐
Précautions d'installation et d'utilisation des joints rotatifs
sql入门
What is redis
ES6:let、const、箭头函数
Summary of the 25-year-old Ma Nong who graduated three years ago
Ensemble de données sur les visages masqués et méthode de génération des visages masqués
Roson's QT journey 80 qurl class
Reference materials in the process of using Excel
Drawing ECG curve with WPF
滑环电机是如何工作的
EasyCVR新建用户后,视频调阅页面不能点击的问题修复
Is it safe to open an account on great wisdom
Single machine multi instance MySQL master-slave replication
Notes on the infrastructure of large websites
狼人杀休闲游戏微信小程序模板源码/微信小游戏源码
基于.NetCore开发博客项目 StarBlog - (13) 加入友情链接功能
FATAL ERROR: Could not find ./bin/my_print_defaults的解决办法
Résumé de Manon, 25 ans, diplômé en trois ans
Haskell configuring vs code development environment (june2022)
If you can play these four we media operation tools, the sideline income of 6000+ is very easy