当前位置:网站首页>UVM——Callback
UVM——Callback
2022-07-02 10:41:00 【weixin_ forty-five million seven hundred and four thousand five】
step
1、 take UVM Callback Method is embedded in the component .
2、 Create a basic UVM Callback Class for extension .
3、 Extend the required... From the class created in the previous step Callback class .
4、 Instantiate and register at the top level Callback object .
Code example
step 1, First , stay driver Association implementation in Callback Class of method ( The most basic UVM Callback class ).
class my_driver extends uvm_driver #(my_transaction);
`uvm_component_utils(my_driver)
`uvm_register_cb(my_driver, driver_base_callback);
virtual dut_interface m_vif;
int unsigned pad_cycles;
// Parameters 1 Specify which type will be used Callback
// Parameters 2 Appoint Callback Method will be implemented in which class
`uvm_register_cb(my_driver, driver_base_callback)
function new(string name = "my_driver", uvm_component parent);
super.new(name, parent);
endfunction
...
virtual task run_phase(uvm_phase phase);
logic [7:0] temp;
repeat(15) @(m_vif.driver_cb);
forever begin
seq_item_port.get_next_item(req);
`uvm_info("DRV_RUN_PHASE", {
"\n", "Driver now send the transaction \n", req.sprint() }, UVM_MEDIUM)
// Use `uvm_do_callbacks Macro to call callback Method
`uvm_do_callbacks(my_driver, driver_base_callback, pre_send(this))
'''
`uvm_do_callbacks(my_driver, driver_base_callback, post_send())
seq_item_port.item_done();
end
endtask
endclass
next , Create a basic UVM Callback Class for extension .
typedef class my_driver;
class driver_base_callback extends uvm_callback;
function new(string name = "driver_base_callback");
super.new(name);
endfunction
virtual task pre_send(my_driver drv);
endtask
virtual task post_send();
endtask
endclass
then , Expand what you need Callback class .
class driver_error_callbacks extends driver_base_callback;
function new(string name = "driver_error_callbacks");
super.new(name);
endfunction
virtual task pre_send(my_driver drv);
drv.req.payload.push_back(5'b10101);
endtask
endclass
class driver_info_callbacks extends driver_base_callback;
function new(string name = "driver_info_callbacks");
super.new(name);
endfunction
virtual task post_send();
`uvm_info("DRIVER_CALLBACK", "This information is for UVM Callback test !!!", UVM_MEDIUM)
endtask
endclass
Last , Instantiate and register in the top level Callback object .
class my_test_driver_error extends my_test;
`uvm_component_utils(my_test_driver_error)
// Statement Callback Class handle
driver_error_callbacks drv_err_cb;
function new(string name = "", uvm_component parent);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
drv_err_cb = new();
// towards driver Register new in callback object
// uvm_callbacks#(my_driver, driver_base_callback) Provide component lookup
// add(m_env.m_agent.m_driv, drv_err_cb) Call for callback Method specifies an implementation callback Class of method .
uvm_callbacks#(my_driver, driver_base_callback)::add(m_env.m_agent.m_driv, drv_err_cb);
endfunction
endclass
When running the simulation ,driver Two of them callback Methods all execute , In this case post_send() No function .
边栏推荐
- JS reduce accumulator
- 4. Random variables
- pytest学习--base
- js setTimeout()与面试题
- allure--常用配置项
- Retrofit's callback hell is really vulnerable in kotlin synergy mode!
- [unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
- What is the significance of the college entrance examination
- 测试--面试题总结
- Importing tables from sqoop
猜你喜欢

Mongodb quickly get started with some simple operations of mongodb command line

Feature (5): how to organize information

MongoDB-快速上手MongoDB命令行的一些简单操作

axis设备的rtsp setup头中的url不能带参

Pytest learning --base

2021-10-02

4.随机变量

Edge computing accelerates live video scenes: clearer, smoother, and more real-time

01安装虚拟机

Pytest framework implements pre post
随机推荐
简洁、快速、节约内存的Excel处理工具EasyExcel
Vscode auto format
数据库字典Navicat自动生成版本
SAP Spartacus express checkout design
记录 AttributeError: ‘NoneType‘ object has no attribute ‘nextcall‘
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Flink calculates topn hot list in real time
4. Random variables
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
Basic usage of mock server
MYSQL关键字
14. Code implementation of semaphore
07数据导入Sqoop
01-spooldir
Use WinDbg to statically analyze dump files (summary of practical experience)
传输优化抽象
2021-10-02
Pywin32 opens the specified window
Pytest framework implements pre post
[Lua] summary of common knowledge points (including common interview sites)