当前位置:网站首页>UVM——双向通信
UVM——双向通信
2022-07-24 10:39:00 【Bunny9__】
UVM——双向通信
1. 概述
- 与单向通信相同的是,双向通信(bidirectional communication)的两端也分为initiator和targer,但是数据流向在端对端之间是双向的;
- 双向通信中的两端同时扮演着producer和consumer的角色,而initiator作为request发起方,在发起request之后,还会等待response返回;
- UVM双向端口分为一下类型:
- uvm_blocking_transport_PORT
- uvm_nonblocking_transport_PORT
- uvm_transport_PORT
- uvm_blocking_master_PORT
- uvm_nonblocking_master_PORT
- uvm_master_PORT
- uvm_blocking_slave_PORT
- uvm_nonblocking_slave_PORT
- uvm_slave_PORT
2. 分类
- 双向端口按照通信握手方式分类:
- transport双向通信方式
- master和slave双向通信方式
- transport端口通过transp()方法,可以在同一方法调用过程中完成REQ和RSP的发出和返回;
- master和slave的通信方式必须分别通过put、get和peek的调用,使用两个方法才可以完成一次握手通信;
- master端口和slave端口的区别在于,当initiator作为master时,他会发起REQ送至target端,然后再从target端获取RSP;当initiator使用slave端口时,它会先从target端获取REQ,然后将RSP送至target端;
- 对于master端口或者slave端口的实现方式,类似于单向通信方式,只是imp端口所在的组件需要实现的方法更多了;
3. transport
class comp1 extends uvm_component;
uvm_blocking_transport_port #(itrans, otrans) bt_port;
`uvm_component_utils(comp1)
...
task run_phase(uvm_phase phase);
itrans itr;
otrans otr;
int trans_num = 2;
for(int i = 0; i < trans_num; i++) begin
itr = new("itr", this);
itr.id = i;
itr.data = 'h10 + i;
this.bt_port.transport(itr, otr);
`uvm_info("TRSPT", $sformatf("put itrans id: 'h0x, data: 'h0x | get otrans id: 'h0x, data: 'h0x", itr.id, itr.data, otr.id, otr.data), UVM_LOW)
end
endtask
endclass
class comp2 extends uvm_component;
uvm_blocking_transport_imp #(itrans, otrans, comp2) bt_imp;
`uvm_component_utils(comp2)
...
task transport(itrans req, output otrans rsp);
rsp = new("rsp", this);
rsp.id = req.id;
rsp.data = req.data << 8;
endtask
endclass
class env1 extends uvm_env;
comp1 c1;
comp2 c2;
`uvm_component_utils(env1)
...
function void build_phase(uvm_phase phase);
super.build_phase(phase);
c1 = comp1::type_id::create::("c1", this);
c2 = comp2::tyoe_id::create::("c2", this);
endfunction: build_phase
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
c1.bt_port.connect(c2.bt_imp);
endfunction: connect_phase
endclass


- comp1是initiator,comp2是target,事先定义好的传输类型itrans和otrans
- 例化端口
- 在target一侧定义对应import需要具备的方法,transport()
- 在顶层环境做连接
边栏推荐
- MySQL performance optimization (IV): how to use indexes efficiently and correctly
- MySQL - multi column index
- In depth analysis of common cross end technology stacks of app
- CMS vulnerability recurrence - ultra vires vulnerability
- What is NFT? How to develop NFT system?
- Interpretation of websocket protocol -rfc6455
- Domain Driven practice summary (basic theory summary and analysis + Architecture Analysis and code design + specific application design analysis V) [easy to understand]
- 图像处理:RGB565转RGB888
- MySQL - 多列索引
- MySQL - 更新表中的数据记录
猜你喜欢
随机推荐
Design of dual machine hot standby scheme
协议圣经-谈端口和四元组
Partition data 2
Scope usage in POM file dependency
[dish of learning notes dog learning C] evaluation expression
谷歌联合高校研发通用模型ProteoGAN,可设计生成具有新功能的蛋白质
ZOJ 2770 differential restraint system -- 2 -- May 20, 2022
pom文件dependency中的 scope用法
Kotlin advanced
[electronic device note 3] capacitance parameters and type selection
Adobe Substance 3D Designer 2021软件安装包下载及安装教程
图像处理:RGB565转RGB888
zoj1137+作业1--2022年5月28日
ECCV 2022 | 清华提出首个嵌入光谱稀疏性的Transformer
Mina framework introduction "suggestions collection"
Sentinel flow control quick start
Nirvana rebirth! Byte Daniel recommends a large distributed manual, and the Phoenix architecture makes you become a God in fire
Machine learning quiz (11) verification code recognition test - deep learning experiment using QT and tensorflow2
每日三题 7.21
binlog、iptables防止nmap扫描、xtrabackup全量+增量备份以及redlog和binlog两者的关系









