当前位置:网站首页>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 .
边栏推荐
- [pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
- Considerations for Apache deploying static web page projects
- Delivery mode design of Spartacus UI of SAP e-commerce cloud
- 从MediaRecord录像中读取H264参数
- sqoop创建job出现的一系列问题解决方法
- Postman--使用
- 大华设备播放过程中设置播放速度
- stm32和电机开发(上位系统)
- Blender体积雾
- Sum the two numbers to find the target value
猜你喜欢
随机推荐
02-taildir source
Importing tables from sqoop
4. Random variables
ERROR 1118 (42000): Row size too large (> 8126)
拆解美图SaaS:开着飞机换引擎
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
Allure -- common configuration items
2021-10-02
js promise. all
Use WinDbg to statically analyze dump files (summary of practical experience)
Stm32 et développement de moteurs (système supérieur)
Pytest learning --base
【虚幻4】从U3D到UE4的转型之路
Pywin32 opens the specified window
12.进程同步与信号量
JS reduce accumulator
【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
【Lua】常见知识点汇总(包含常见面试考点)
[jetbrain rider] an exception occurred in the construction project: the imported project "d:\visualstudio2017\ide\msbuild\15.0\bin\roslyn\microsoft.csh" was not found
[Fantasy 4] the transformation from U3D to UE4