uvm_root:uvm组件的根节点,所有parent为null的component都继承于uvm_root,下图表明uvm_root也继承于component。
uvm_top:uvm_root的唯一实例,由系统自动创建。由于uvm_root是一个类,需要使用new才可创建,因此下文将介绍uvm_root创建的流程:
1、在uvm_root类里使用const声明了uvm_top的常量,编译时采用类::的方式调用静态的get函数完成对uvm_top的创建。
const uvm_root uvm_top = uvm_root::get();
2、在uvm_root的get函数先用静态函数get创建一个核心服务类uvm_coreservice_t,返回cs的get_root函数。
3、在uvm_coreservice_t的get_root中返回m_get_uvm_root函数。
4、在uvm_root的m_get_uvm_root函数中创建并返回了uvm_root的实例。
# class uvm_root
static function uvm_root get();
uvm_coreservice_t cs = uvm_coreservice_t::get();
return cs::get_root();
endfunction
static function uvm_root m_uvm_get_root();
if(m_inst==null)begin
m_inst = new();
void'(uvm_domain::get_common_domain());
m_inst.m_domain = uvm_domain::get_uvm_domain();
end
return m_inst;
endfunction
#class uvm_coreserve_t
static function uvm_coreservice_t get();
if(inst==null)
inst = new();
return inst;
endfunction
static function uvm_root get_root();
return uvm_root::m_uvm_get_root();
endfunction
综上所述,uvm_top最终是通过uvm_root的m_get_uvm_root创建,但是执行途中创建了uvm_coreservice_t。
uvm_coreservice_t是核心服务类,所有全局服务都包含在该类中,如factorty机制,消息报告机制等。