Chapter 12 UVM Component
12.1 继承UVM Component
- 测试平台可以分为三大部分:structure,sequences,data:
- structure:描述测试平台的各组件并将其组合在一起;
- sequences:描述送往DUT的命令的序列;
- data:描述送往DUT的命令中的仿真数据;
UVM component是testbench structure的基础,测试平台中所有的组件都扩展自uvm_component类。
- 想要使用UVM必须使用uvm_components,4个步骤:
- 继承(extents) uvm_compnent类,或者uvm_component的子类;
- 使用宏`uvm_component_utils(类名),将继承的子类注册到uvm的factory;
- 至少要声明最小size的uvm_component new()函数;
- 如果需要,重构uvm_component的各种phase;
class scoreboard extends uvm_component; //1. 扩展uvm_component或者其子类
`uvm_component_utils(scoreboard); //2. 使用uvm_component_utils将定义的子类注册到factory
virtual interface tynialu_bfm bfm;
function new(string name, uvm_component parent); //3. 最小规格的构造函数,可以扩展出更多内容
super.new(name,component); //至少要调用super.new()函数
endfunction : new //string类型变量name,uvm_component类型变量parent
//uvm_component中的各种phase method 单独介绍
endclass
12.1 UVM Component phase
- 扩展自uvm_component的所有子类都继承了componnet的各种phase方法,UVM按照一定的顺序调用这些phase,我们可以根据需求重构这些phase,并依靠UVM的调用顺序实现功能。
- 所有的UVM phase都只有一个类型为uvm_phase,名称为phase的参数;这里介绍5个常见的phase:(后续更新单独phase介绍章节)
- function void build_phase(uvm_phase phase)
从上至下(top-down)建立测试平台,必须在此pha