10. UVM Environment

本文介绍了UVM中的env类层次结构,如何创建和注册自定义env类,以及如何在top_env中实例化多个env。重点涉及组件创建、配置管理与TLM连接。
摘要由CSDN通过智能技术生成

环境为agents, scoreboards和其他验证组件(包括有助于在 SoC 级别重用块级环境组件的其他环境类)提供良好的层次结构和容器。用户定义的 env 类必须从 uvm_env 类扩展。

10.1 uvm_env class hierarchy

类声明:

virtual class uvm_env extends uvm_component;

 用户定义的env类声明:

class <env_name> extends uvm_env;

10.2 How to create a UVM env?

steps:

  1. 创建一个从 uvm_env 扩展的用户定义的 env 类,并将其注册到工厂中。
  2. 在build_phase中,实例化agent、其他验证组件,并使用配置数据库来set/get配置变量。
  3. 在connect_phase中,使用TLM接口连接monitor,scoreboard和其他功能覆盖组件。

10.3 UVM Environment example

class env extends uvm_env;
  `uvm_component_utils(env)
  agent agt;
  scoreboard sb;
  func_cov fcov;
 
  function new(string name = "env", uvm_component parent = null);
    super.new(name, parent);
  endfunction
  
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    agt = agent::type_id::create("agt", this);
    sb = scoreboard::type_id::create("sb", this);
    fcov = func_cov::type_id::create("fcov", this);
  endfunction
  
  function void connect_phase(uvm_phase phase);
    // connect agent and scoreboard using TLM interface    
    // Ex. agt.mon.item_collect_port.connect(sb.item_collect_export);
  endfunction
endclass

10.4 How to instantiate multiple env in top_env?

class top_env extends uvm_env;
  env env_o[3];
  `uvm_component_utils(top_env)
 
  function new(string name = "top_env", uvm_component parent = null);
    super.new(name, parent);
  endfunction
 
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    foreach(env_o[i])
      env_o[i] = env::type_id::create("$sformatf("env_o_%0d", i)", this);
  endfunction
  ...
endclass

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值