当前位置:网站首页>UVM - usage of common TLM port
UVM - usage of common TLM port
2022-07-02 10:41:00 【weixin_ forty-five million seven hundred and four thousand five】
put Pattern
producer call consumer Medium heavy duty put Method , Send data to consumer. The code example is as follows .
The code example here is monitor towards reference model send data .
monitor
class my_monitor extends uvm_monitor;
`uvm_component_utils(my_monitor);
virtual dut_interface m_vif;
uvm_blocking_put_port #(my_transaction) m2r_port;
function new(string name = "", uvm_component parent);
super.new(name, parent);
this.m2r_port = new("m2r_port", this);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
`uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
if(!uvm_config_db#(virtual dut_interface)::get(this, "", "vif", m_vif))begin
`uvm_fatal("CONFIG_FATAL", "Monitor can not get the interface !!!")
end
endfunction
virtual task run_phase(uvm_phase phase);
my_transaction tr;
...
`uvm_info("Monitor", "Now monitor send the transaction to the reference model!", UVM_MEDIUM)
this.m2r_port.put(tr);
endtask
endclass
reference model
stay reference model It's overloaded put Mission . The task is monitor In the called .
class my_reference_model extends uvm_component;
`uvm_component_utils(my_reference_model)
uvm_blocking_put_imp #(my_transaction, my_reference_model) i_m2r_imp;
function new(string name = "", uvm_component parent);
super.new(name, parent);
this.i_m2r_imp = new("i_m2r_imp", this);
endfunction
task put(my_transaction tr);
`uvm_info("REF_REPORT", {
"\n", "master agent have been sent a transaction:\n", tr.sprint()}, UVM_MEDIUM)
endtask
endclass
stay env Connect two ports in .
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
`uvm_info("ENV", "Connect the agent and reference model...", UVM_MEDIUM)
m_agent.m_a2r_export.connect(ref_model.i_m2r_imp);
endfunction
get Pattern
monitor
class my_monitor extends uvm_monitor;
`uvm_component_utils(my_monitor);
virtual dut_interface m_vif;
uvm_blocking_get_imp #(my_transaction, my_monitor) m2r_imp;
my_transaction tr_fifo[$];
function new(string name = "", uvm_component parent);
super.new(name, parent);
this.m2r_imp = new("m2r_imp", this);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
`uvm_info("TRACE", $sformatf("%m"), UVM_HIGH)
if(!uvm_config_db#(virtual dut_interface)::get(this, "", "vif", m_vif))begin
`uvm_fatal("CONFIG_FATAL", "Monitor can not get the interface !!!")
end
endfunction
virtual task run_phase(uvm_phase phase);
my_transaction tr;
...
`uvm_info("Monitor", {
"\n", "Monitor Got An Input Transaction: \n", tr.sprint()}, UVM_MEDIUM)
tr_fifo.push_back(tr);
endtask
task get(output my_transaction s_tr);
while(tr_fifo.size() == 0) @(m_vif.imonitor_cb);
s_tr = tr_fifo.pop_front();
`uvm_info("Monitor", {
"\n", "Now monitor send the transaction to the reference model: \n",s_tr.sprint()}, UVM_MEDIUM)
endtask
endclass
Here in monitor Medium and heavy load get Method , stay reference model Call in .
reference model
class my_reference_model extends uvm_component;
`uvm_component_utils(my_reference_model)
uvm_blocking_get_port #(my_transaction) i_m2r_port;
function new(string name = "", uvm_component parent);
super.new(name, parent);
this.i_m2r_port = new("i_m2r_port", this);
endfunction
virtual task run_phase(uvm_phase phase);
`uvm_info("REF_MODEL_RUN", "reference model running !", UVM_MEDIUM)
forever begin
my_transaction item;
i_m2r_port.get(item);
`uvm_info("REF_REPORT", {
"\n", "master agent have been sent a transaction:\n", item.sprint()}, UVM_MEDIUM)
end
endtask
endclass
stay reference model Call in get Method .
stay env Middle link
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
`uvm_info("ENV", "Connect the agent and reference model...", UVM_MEDIUM)
ref_model.i_m2r_port.connect(m_agent.m_a2r_export);
endfunction
FIFO Pattern
monitor Port definition and put Model as
reference model Port definition and get Model as
stay env Define a fifo, Connect the two ports .
env
class my_env extends uvm_env;
`uvm_component_utils(my_env)
master_agent m_agent;
env_config m_env_cfg;
my_reference_model ref_model;
uvm_tlm_analysis_fifo #(my_transaction) magt2ref_fifo;
function new(string name = "", uvm_component parent);
super.new(name, parent);
magt2ref_fifo = new("magt2ref_fifo", this);
endfunction
...
virtual function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
`uvm_info("ENV", "Connect the agent to fifo...", UVM_MEDIUM)
m_agent.m_a2r_export.connect(this.magt2ref_fifo.blocking_put_export);
`uvm_info("ENV", "Connect the reference model to fifo...", UVM_MEDIUM)
ref_model.i_m2r_port.connect(this.magt2ref_fifo.blocking_get_export);
endfunction
endclass
边栏推荐
- This article takes you to learn in detail what is fiber to home FTTH
- AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
- Stm32 et développement de moteurs (système supérieur)
- stm32和電機開發(上比特系統)
- Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
- 2021-09-12
- 转换YV12到RGB565图像转换,附YUV转RGB测试
- Flink calculates topn hot list in real time
- Flutter——Canvas自定义曲线图
- Sus system availability scale
猜你喜欢

12.进程同步与信号量

Flink实时计算topN热榜
![[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open](/img/09/a75ce6742d787c640b8066e0e8e694.png)
[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open

【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格

Operator-1初识Operator

Blender ocean production

01 install virtual machine

【虚幻4】UMG组件的简介与使用(更新中...)

【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
随机推荐
12. Process synchronization and semaphore
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
Flutter环境配置保姆级教程,让doctor一绿到底
Pywin32打开指定窗口
1287_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
Excuse me, is it cost-effective to insure love life patron saint 2.0 increased lifelong life insurance? What are the advantages of this product?
[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
Ks009 implement pet management system based on SSH
Mongodb quickly get started with some simple operations of mongodb command line
Pytest-- test report allure configuration
JS settimeout() and interview questions
对话吴纲:我为什么笃信“大国品牌”的崛起?
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
stm32和电机开发(上位系统)
[Fantasy 4] introduction and use of UMG components (under update...)
Introduction to MySQL 8 DBA foundation tutorial
简洁、快速、节约内存的Excel处理工具EasyExcel
SQOOP 1.4.6 INSTALL