当前位置: 首页 > news >正文

sequence的启动

sequence的启动

seq的start通过传递sqr句柄实现启动;

image

 但是这种方式将接口暴露在外,不被提倡。

启动以后,seq会调用uvm_do之类的宏向其传递的句柄开始发送事件给sqr;

而driver将通过TLM取得sqr接收的数据,并驱动到端口上。

UVM1.1中sequence的启动

对于UVM1.1来说,启动sequence可以通过default_sequence完成;

在顶层模块设置

 uvm_config_db#(uvm_object_wrapper)::set(this,"i_agt.sqr.main_phase","default_sequence",my_sequence::type_id::get());

之后,在uvm_sequence这个基类中,有一个变量名为starting_phase,

它的类型是uvm_phase,sequencer在启动default_sequence时,会:

 task my_sequencer::main_phase(uvm_phase phase);seq.starting_phase = phase;seq.start(this); endtask

之后即可通过判断starting_phase的状态决定 

starting_phase.raise_objection(this);和starting_phase.drop_objection(this);

class my_sequence extends uvm_sequence #(my_transaction);   my_transaction m_trans;  virtual task body();if(starting_phase != null)starting_phase.raise_objection(this);repeat (10) begin`uvm_do(m_trans)end#1000;if(starting_phase != null)starting_phase.drop_objection(this);endtask`uvm_object_utils(my_sequence)
endclass

uvm从1.1d到1.2再到IEEE1800.2,有了很多变化。尤其是从1.1d到1.2,在objection的使用上有了一些关键性变化。

在uvm进入到1.2后,starting_phase不在推荐使用。

更为重要的是,不仅仅是不再推荐,而且如果以default sequence的方式启动以后,

default sequence被启动以后,starting_phase依然会是null,如果沿用以前的代码,整个平台就起不来了

解决方法一:

添加:

starting_phase = get_starting_phase();

class my_sequence extends uvm_sequence#(my_transaction);`uvm_object_utils(my_sequence)virtual task body();// ── 1. 取到真正的 phase 句柄starting_phase = get_starting_phase();// ── 2. 用它来管理 objectionif (starting_phase != null)starting_phase.raise_objection(this);// ── 3. 你的事务逻辑repeat (10) begin`uvm_do(m_trans)end#1000;// ── 4. 最后 drop objectionif (starting_phase != null)starting_phase.drop_objection(this);endtask
endclass

  

uvm_sequence_base::set_automatic_phase_objection

function my_sequence::new(string name="unnamed");super.new(name);set_automatic_phase_objection(1);
endfunction : new

执行顺序

start() is executed--! Objection is raised !--pre_start() is executedpre_body() is optionally executedbody() is executedpost_body() is optionally executedpost_start() is executed--! Objection is dropped !--
start() unblocks

 

使用方法:

顶层 testbench 中设置 default_sequence(必须):

uvm_config_db#(uvm_object_wrapper)::set(this,"env.agent.sequencer.main_phase","default_sequence",my_sequence::type_id::get());

告诉 sequencer 在某个 phase 自动启动哪个 sequence(否则需要自行在某个phase里写入,比如下面这种):

task my_sequencer::main_phase(uvm_phase phase);my_sequence seq;phase.raise_objection(this);seq = my_sequence::type_id::create("seq");seq.start(this); phase.drop_objection(this);
endtask

  

 

http://www.sczhlp.com/news/572.html

相关文章:

  • L. Dynamic Convex Hull 题解
  • 最左前缀原则和覆盖索引相关问题
  • 【LeetCode 142】算法:环形链表 II
  • Gin框架介绍
  • 正则表达式中的元字符
  • 7/27
  • I2C
  • 小新Pad2022刷机记录
  • 每日随笔
  • 01API语法与路由配置详解
  • 图 - -刘-j-x
  • 02路由配置与参数解析详解
  • 03Gin中间件开发与鉴权实践
  • day27
  • 浅析扫描线
  • 入门
  • CRUD
  • 暑期周总结(五)
  • 用 Python 实现多干扰线图像验证码的识别系统
  • Python 实现多干扰线图像验证码识别
  • 学习链接
  • helm环境快速部署实战
  • PlantUML绘制时序图
  • Datawhale AI夏令营 Dify入门 Task05 智能客服
  • ICPC 2024 网络赛(I)
  • LED控制原理
  • 【ESP8266】Vscode + platformIo + Esp8266 新建工程 关键步骤
  • Revo Uninstaller Pro专业版领取:2025最佳Windows软件卸载工具
  • 北大 2024 强基数学
  • 付老师名言