当前位置:网站首页>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 .
边栏推荐
猜你喜欢

数据库字典Navicat自动生成版本

MPLS experiment

KS009基于SSH实现宠物管理系统
![[Fantasy 4] introduction and use of UMG components (under update...)](/img/33/7e3b74192b7fd73d5145f85e061d1f.png)
[Fantasy 4] introduction and use of UMG components (under update...)

01安装虚拟机

Message mechanism -- getting to know messages and message queues for the first time

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

pytest学习--base

【MySQL】连接MySQL时出现异常:Connection must be valid and open

1287_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
随机推荐
AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
02-taildir source
js promise.all
传输优化抽象
[SUCTF2018]followme
Shutter - canvas custom graph
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
4.随机变量
js promise. all
Feature (5): how to organize information
LeetCode+ 76 - 80 暴搜专题
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
判断数组中是否存在重复元素
Basic usage of mock server
Flutter——Canvas自定义曲线图
session-cookie与token
Stm32 et développement de moteurs (système supérieur)
使用Windbg静态分析dump文件(实战经验总结)
记录 AttributeError: ‘NoneType‘ object has no attribute ‘nextcall‘