15 Sequence-Driver-Sequencer communication in UVM

我们分别讨论了sequece_item、sequence、sequencer和driver。在本节中,我们将讨论他们如何相互talk,sequencer如何给driver提供从sequence里的sequence item。在开始阅读本节之前,请确保您了解sequencer和driver中使用的所有方法。(参考:UVM seqeuencer和UVM driver ). 

1 Sequencer-Driver Connections

sequencer和driver使用双向TLM接口相互通信,以传输REQ和RSP序列项。

driver的uvm_seq_iem_pull _port和相应的sequencer的uvm_seq_item_pull_export连接。这个TLM接口提供了一个工具,可以使用实现的API检索REQ item并返回RSP项。
注:

  1. uvm_seq_item_pull_port和uvm_secq_itemp_pull_export都是带有REQ和RSP sequence item的参数化类。
  2. driver和sequencer之间的TLM连接是一对一的。这意味着没有多个sequencer连接到单个driver,也没有多个driver连接到单个sequencer。

connections:driver和sequence在UVM agent的connect_phase中连接。

<driver_inst>.seq_item_port.connect(<sequencer_inst>.seq_item_export);

seq_item_port和seq_iem_export分别是uvm_seq_itemp_pull_port和uvm_sseq_tem_pull_export的实例句柄(instance handle)。 

2 Sequence-Driver-Sequencer communication Approaches

基于sequence和driver可用的各种方法,进一步解释所有组合。

方法A:Using get_next_item and item_done methods in the driver

方法B:Using get and put methods in driver

2.1 A. Using get_next_item and item_done methods in the driver

2.1.1 Without RSP packet

  1. 创建一个sequence item,并使用create_item函数在工厂中注册。
  2. wait_for_grant向sequencer发出请求,并等待sequencer的授权。当sequencer授予sequence时返回。
  3. 对sequence item进行随机化,并使用send_request将其发送到sequencer。wait_for_grant和send_request方法之间不能有任何仿真时间延迟。sequencer在REQ FIFO的帮助下将sequence item转发给driver。这将取消阻止get_next_item()调用,driver将接收序列sequence item。
  4. 来自sequence的wait_for_item_done()调用被阻止,直到driver响应。
  5. 同时,driver使用virtual interface句柄将sequence item驱动到DUT。完成后,将调用item_done方法。这将从sequence中取消阻止wait_for_item_done方法。
  6. 如果必须从driver向sequence发送响应,则使用RSP项作为参数调用item_done(RSP)。RSP项目通过sequencer在RSP FIFO的帮助下与sequence通信。调用get_response方法以获取响应很重要。如果DUT没有发送RSP项目,则此步骤是可选的,不是必需的。 
// Driver Code
class driver extends uvm_driver#(seq_item);`uvm_component_utils(driver)function new(string name = "driver", uvm_component parent = null);super.new(name, parent);endfunctionfunction void build_phase(uvm_phase phase);super.build_phase(phase);endfunctiontask run_phase (uvm_phase phase);forever beginseq_item_port.get_next_item(req);`uvm_info(get_type_name(), "After get_next_item call", UVM_LOW);#50; // Driving delay. Assuming time taken to drive RTL signalsseq_item_port.item_done();`uvm_info(get_type_name(), "After item_done call", UVM_LOW);endendtask
endclass// Sequence Code
class base_seq extends uvm_sequence #(seq_item);seq_item req;`uvm_object_utils(base_seq)function new (string name = "base_seq");super.new(name);endfunctiontask body();`uvm_info(get_type_name(), "Base seq: Inside Body", UVM_LOW);//req = seq_item::type_id::create("req");// or$cast(req, create_item(seq_item::get_type(), m_sequencer, "req"));wait_for_grant();assert(req.randomize());send_request(req);`uvm_info(get_type_name(), "Before wait_for_item_done", UVM_LOW);wait_for_item_done();`uvm_info(get_type_name(), "After wait_for_item_done", UVM_LOW);endtask
endclass

Output:

UVM_INFO testbench.sv(21) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Base seq: Inside Body
UVM_INFO testbench.sv(28) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Before wait_for_item_done
UVM_INFO driver.sv(15) @ 0: uvm_test_top.env_o.agt.drv [driver] After get_next_item call
UVM_INFO driver.sv(19) @ 50: uvm_test_top.env_o.agt.drv [driver] After item_done call
UVM_INFO testbench.sv(30) @ 50: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] After wait_for_item_done
2.1.2 With RSP packet

// Driver Code
class driver extends uvm_driver#(seq_item);`uvm_component_utils(driver)function new(string name = "driver", uvm_component parent = null);super.new(name, parent);endfunctionfunction void build_phase(uvm_phase phase);super.build_phase(phase);endfunctiontask run_phase (uvm_phase phase);forever beginseq_item_port.get_next_item(req);`uvm_info(get_type_name(), "After get_next_item call", UVM_LOW);#50; // Driving delay. Assuming time taken to drive RTL signalsreq.rsp_b = 1;seq_item_port.item_done(req);`uvm_info(get_type_name(), "After item_done call", UVM_LOW);endendtask
endclass// Sequence Code
class base_seq extends uvm_sequence #(seq_item);seq_item req;`uvm_object_utils(base_seq)function new (string name = "base_seq");super.new(name);endfunctiontask body();`uvm_info(get_type_name(), "Base seq: Inside Body", UVM_LOW);//req = seq_item::type_id::create("req");// or$cast(req, create_item(seq_item::get_type(), m_sequencer, "req"));wait_for_grant();assert(req.randomize());send_request(req);`uvm_info(get_type_name(), "Before wait_for_item_done", UVM_LOW);wait_for_item_done();`uvm_info(get_type_name(), "After wait_for_item_done", UVM_LOW);get_response(req);`uvm_info(get_type_name(), $sformatf("After get_response: rsp_b = %0d", req.rsp_b), UVM_LOW);endtask
endclass

 Output:

UVM_INFO testbench.sv(21) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Base seq: Inside Body
UVM_INFO testbench.sv(28) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Before wait_for_item_done
UVM_INFO driver.sv(15) @ 0: uvm_test_top.env_o.agt.drv [driver] After get_next_item call
UVM_INFO driver.sv(20) @ 50: uvm_test_top.env_o.agt.drv [driver] After item_done call
UVM_INFO testbench.sv(30) @ 50: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] After wait_for_item_done
UVM_INFO testbench.sv(32) @ 50: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] After get_response: rsp_b = 1

2.2 B. Using get and put methods in driver

  1. Create a sequence item and register in the factory using the create_item function call.
  2. The wait_for_grant issues the request to the sequencer and wait for the grant from the sequencer. It returns when the sequencer has granted the sequence.
  3. Randomize the sequence item and send it to the sequencer using send_request call. There should not be any simulation time delay between wait_for_grant and send_request method call. The sequencer forwards the sequence item to the driver with the help of REQ FIFO. This unblocks the get() call and the driver receives the sequence item.
  4. The wait_for_item_done() call from the sequence gets blocked until the driver calls the get method.
  5. Once the get method is called, the wait_for_item_done() call from sequence gets unblocked immediately without caring about driving the virtual interface.
  6. The get_response call is necessary to call that completes the communication. The get_response method is blocked until the driver calls put(RSP).
  7. In the meantime, the driver drives the sequence item to the DUT using a virtual interface handle. Once it is completed, the put(RSP) method is called. This unblocks the get_response method from the sequence. The RSP item is communicated to the sequence by a sequencer with help of RSP FIFO. 
// Driver Code
class driver extends uvm_driver#(seq_item);`uvm_component_utils(driver)function new(string name = "driver", uvm_component parent = null);super.new(name, parent);endfunctionfunction void build_phase(uvm_phase phase);super.build_phase(phase);endfunctiontask run_phase (uvm_phase phase);forever beginseq_item_port.get(req);`uvm_info(get_type_name(), "After get call", UVM_LOW);#50; // Driving delay. Assuming time taken to drive RTL signalsreq.rsp_b = 1;seq_item_port.put(req);`uvm_info(get_type_name(), "After put call", UVM_LOW);endendtask
endclass// Sequence Code
class base_seq extends uvm_sequence #(seq_item);seq_item req;`uvm_object_utils(base_seq)function new (string name = "base_seq");super.new(name);endfunctiontask body();`uvm_info(get_type_name(), "Base seq: Inside Body", UVM_LOW);//req = seq_item::type_id::create("req");// or$cast(req, create_item(seq_item::get_type(), m_sequencer, "req"));wait_for_grant();assert(req.randomize());send_request(req);`uvm_info(get_type_name(), "Before wait_for_item_done call", UVM_LOW);wait_for_item_done();`uvm_info(get_type_name(), "After wait_for_item_done call", UVM_LOW);get_response(req);`uvm_info(get_type_name(), $sformatf("After get_response: rsp_b = %0d", req.rsp_b), UVM_LOW);endtask
endclass

Output:

UVM_INFO testbench.sv(21) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Base seq: Inside Body
UVM_INFO testbench.sv(28) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] Before wait_for_item_done call
UVM_INFO driver.sv(15) @ 0: uvm_test_top.env_o.agt.drv [driver] After get call
UVM_INFO testbench.sv(30) @ 0: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] After wait_for_item_done call
UVM_INFO driver.sv(20) @ 50: uvm_test_top.env_o.agt.drv [driver] After put call
UVM_INFO testbench.sv(32) @ 50: uvm_test_top.env_o.agt.seqr@@bseq [base_seq] After get_response: rsp_b = 1

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/305751.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

统信UOS linux下opencv应用编译时的头文件和库文件路径查找设置方法

☞ ░ 前往老猿Python博客 ░ https://blog.csdn.net/LaoYuanPython 一、引言 老猿原来进行的C和C开发主要是基于windows环境的&#xff0c;目前要在统信UOS操作系统环境下编译opencv应用程序&#xff0c;其环境设置与windows环境下变化很多&#xff0c;今天就来介绍一下在统…

去水印一般用什么软件?这六款软件分享给你

随着数字时代的洪流滚滚&#xff0c;我们时常在网络海洋中遨游&#xff0c;寻找那一抹惊艳的风景&#xff0c;然而&#xff0c;版权的大旗下&#xff0c;水印如同微型的堡垒&#xff0c;屹立在图片与视频的角落。它们或许是一道风景的瑕疵&#xff0c;或许是遮挡真相的云雾。于…

实习知识整理13:在购物车界面点击提交订单进入订单信息界面

在这块主要就是对前端传到后端的数据的处理&#xff0c;然后由后端再返还到新的前端界面 首先点击下单按钮后&#xff0c; 提交购物车中所选中的信息 因为前端是将name定义为 cartList[0].cartId &#xff0c;cartList[1].cartId 形式的 所以后端需要重新定义一个类来进行封装…

Rustdesk如何编译代码实现,客户端只能被控,不能去控制别人?防止自建服务器被白嫖

环境&#xff1a; RustDesk1.1.9 自建服务器 问题描述&#xff1a; Rustdesk如何编译代码实现&#xff0c;构建客户端只能被控&#xff0c;不能去控制别人&#xff1f;防止自建服务器被白嫖。 解决方案&#xff1a; 详细方案&#xff0c;有需要私聊

ThinkPHP6.0任意文件上传 PHPSESSION 已亲自复现

ThinkPHP6.0任意文件上传 PHPSESSION 已亲自复现 漏洞名称漏洞描述影响版本 漏洞复现环境搭建安装thinkphp6漏洞信息配置 漏洞利用 修复建议 漏洞名称 漏洞描述 2020年1月10日&#xff0c;ThinkPHP团队发布一个补丁更新&#xff0c;修复了一处由不安全的SessionId导致的任意文…

Typescript -- 类型兼容

类型兼容性 typscript中的类型兼容是基于结构子类型的&#xff08;子类型兼容和赋值兼容&#xff09;&#xff0c;即只使用其成员来判定是兼容&#xff0c;这是根据JavaScript的特性设计的&#xff0c;因为js中有很多匿名对象&#xff0c;只要y的所有成员都能在对象x中能找到&…

nginx源码分析-1

使用gdb查看函数上下文&#xff1a; gdb attach nginx的work线程 监听端口状态时&#xff1a; 断点打在ngx_http_process_request 并通过浏览器触发请求时&#xff1a;

作业--day38

1.定义一个Person类&#xff0c;包含私有成员&#xff0c;int *age&#xff0c;string &name&#xff0c;一个Stu类&#xff0c;包含私有成员double *score&#xff0c;Person p1&#xff0c;写出Person类和Stu类的特殊成员函数&#xff0c;并写一个Stu的show函数&#xff…

Springboot实现登录注册

功能&#xff1a;1、实现用户的登录 2、实现用户的注册以及重名的判断 LoginControl&#xff1a; package com.example.demo.controls;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; imp…

C#上位机与欧姆龙PLC的通信06---- HostLink协议(FINS版)

1、介绍 对于上位机开发来说&#xff0c;欧姆龙PLC支持的主要的协议有Hostlink协议&#xff0c;FinsTcp/Udp协议&#xff0c;EtherNetIP协议&#xff0c;本项目使用Hostlink协议。 Hostlink协议是欧姆龙PLC与上位机链接的公开协议。上位机通过发送Hostlink命令&#xff0c;可…

《数据库开发实践》之触发器

一、什么是触发器&#xff1f; 1.概念&#xff1a; 简单来说触发器就是一种特殊的存储过程&#xff0c;在数据库服务器触发事件的时候会自动执行其SQL语句集。 2.构成四要素&#xff1a; &#xff08;1&#xff09;名称&#xff1a;要符合标识符命名规则 &#xff08;2&am…

NFC物联网智能锁安全测试研究

针对短距离无线通信在物联网智能锁实际运用中的安全机制问题&#xff0c;通过理论分析和实际操作演示潜在的攻击流程&#xff0c;发现其存在的安全漏洞并提出可行的加固方法&#xff0c;并对加固后的通信系统进行CPN建模与安全性分析&#xff0c;对无线通信协议的安全性能提升、…