[uvm sequence专题] objection in sequence (sequence中objection的用法以及UVM1.1d 1.2的区别)
objection in sequence (sequence中objection的用法以及UVM1.1d 1.2的区别)
1 前言
在UVM中,除了在各个task phase中会出现控制objection的情况,在default sequence的执行中需要进行objection的控制。objection会在以下环境中配置
- 各个component 的phase中
- sequence中
本文将介绍以下内容
- default sequence中objection的配置
- UVM1.1d 与 UVM1.2 中sequence objection 配置的区别
2 default sequence 中objection的配置
2.1 何时需要配置sequence的objection?
If you are using "default sequence", you have to implement objection in sequence class.
简而言之就是当使用default sequence的时候,需要在sequence中配置objection。
2.2 为什么需要在sequence中配置objection?
对于default sequence 而言,配置方法如下:
uvm_config_db #(uvm_object_wrapper)::set(this, "env.i_agt.sqr.main_phase", "default_sequence", user_sequence::get_type());
将对应sequence配置到sequencer中的某个phase中后,phas的执行需要objection,这句config没有配置objection,因此需要在sequence中手动配置,而对于在显式启动的sequence而言
sequence_inst.start()
,其通常是在phase内部调用的,phase内部会raise/drop objection,因此无需在sequence中配置objection。
对于UVM1.1d而言,需要手动配置sequence中raise/drop objection
对于UVM1.2而言,增加了自动raise/drop objection
2.3 如何在sequence中配置objection
2.3.1 for uvm1.1d
对UVM1.1d 版本而言,starting phase这个成员变量还在,使用pre_body和post_body中添加raise/drop objection的方法:
其中,成员变量staring phase指的是当前处于哪个component的phase
class wr_rd_seq extends uvm_sequence#(mem_seq_item);
task pre_body();
// raise objection if started as a root sequence
if(starting_phase != null)
starting_phase.raise_objection(this);
endtask
task body();
`uvm_do_with(req,wr_en==1);
`uvm_do_with(req,rd_en==1);
endtask
task post_body();
// drop objection if started as a root sequence
if(starting_phase != null)
starting_phase.drop_objection(this);
endtask
endclass
2.3.1 for uvm1.2
对于UVM1.2 starting phase这个变量处于废弃状态,且设计的目的也打算省略掉这个在调用default sequence中需要手动raise/drop的过程,增加了新的自动objection控制的功能。
Variable uvm_sequence_base::starting_phase is deprecated and replaced by two new methods, set_starting_phase and get_starting_phase, which prevent starting_phase from being modified in the middle of a phase. This change is not backward-compatible with UVM 1.1, though variable starting_phase, although deprecated, has not yet been removed from the base class library.
(但其实starting phase这个成员变量还在),要实现objection的自动raise/drop,只需要在 sequence的new函数中添加
set_automatic_phase_objection(1)
即可。
function new(string name = "base_sequence");
super.new(name);
`ifdef UVM_POST_VERSION_1_1
set_automatic_phase_objection(1); // UVM-1.2 & IEEE UVM Only!
`endif
endfunction : new