0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

什么是UVM environment?

jf_78858299 来源:芯片验证工程师 作者:验证哥布林 2023-03-21 11:35 次阅读

什么是UVM environment?

UVM environment包含多个可重用的验证组件,并根据test case的需求进行相应的配置。例如,UVM environment可能具有多个agent(对应不同的interface)、scoreboard、functional coverage collector和一些checker。

对于一个复杂的数字系统,UVM environment可能还集成其他一些较小的UVM environment,这些相对较小的验证环境用于对各个子系统/模块进行验证。所以,被集成的子模块/系统验证环境中的很多组件和sequence都是可以复用的。

为什么验证组件不直接放在test case中?

从技术上讲,一些验证组件可以直接在用户定义的testcase(uvm_test类)中实例化。

class base_test extends uvm_test;  `uvm_component_utils(base_test)
apb_agent m_apb_agent; spi_agent m_spi_agent;
base_scoreboard m_base_scbd;
virtual function void build_phase(uvm_phase phase);// Instantiate agents and scoreboard endfunctionendclass

但是,不建议这样做:test case不能够复用,因为它们依赖于特定的验证环境,针对每个testcase都开发一个uvm environment比较低效。 简单来说,uvm environment存在的意义就是不同的testcase都使用同一套验证环境代码 ,是为了验证环境的复用性考虑的。

因此,始终建议开发一个比较通用的,适用所有test case的验证环境, 然后在多个test case中实例化该验证环境类uvm environment。此外,不同的testcase可以配置、启动、禁用验证环境中的各种配置,可能是激励的随机机制、agent的active/passive模式,也可能是scoreboard的开关。

图片

创建 UVM environment的步骤

  • 创建一个继承自uvm_env的自定义类,注册到工厂,并调用 new函数
// my_env is user-given name for this class that has been derived from "uvm_env"class my_env extends uvm_env;
// [Recommended] Makes this driver more re-usable `uvm_component_utils (my_env)
// This is standard code for all componentsfunction new (string name = "my_env", uvm_component parent = null);super.new (name, parent); endfunction
// Code for rest of the steps come hereendclass
  • 声明和构建验证环境中各个验证组件


// apb_agnt and other components are assumed to be user-defined classes that already exist in TBapb_agnt  m_apb_agnt;func_cov   m_func_cov;scbd     m_scbd;env_cfg   m_env_cfg;
// Build components within the "build_phase"virtual function void build_phase (uvm_phase phase);super.build_phase (phase); m_apb_agnt = apb_agnt::type_id::create ("m_apb_agnt", this); m_func_cov = func_cov::type_id::create ("m_func_cov", this); m_scbd = scbd::type_id::create ("m_scbd", this);
// [Optional] Collect configuration objects from the test class if applicableif (uvm_config_db #(env_cfg)::get(this, "", "env_cfg", m_env_cfg)) `uvm_fatal ("build_phase", "Did not get a configuration object for env")
// [Optional] Pass other configuration objects to sub-components via uvm_config_dbendfunction

  • 在自定义uvm_env类的connect_phase中根据需要连接各个验证组件


virtual function void connect_phase (uvm_phase phase);  // A few examples:// Connect analysis ports from agent to the scoreboard// Connect functional coverage component analysis ports// ...endfunction

UVM Environment 示例(对应上面提到的的验证环境图)

class my_top_env extends uvm_env;   `uvm_component_utils (my_env)
agent_apb m_apb_agt; agent_wishbone m_wb_agt;
env_register m_reg_env; env_analog m_analog_env [2];
scoreboard m_scbd;
function new (string name = "my_env", uvm_component parent); super.new (name, parent);endfunction
virtual function void build_phase (uvm_phase phase); super.build_phase (phase);// Instantiate different agents and environments here m_apb_agt = agent_apb::type_id::create ("m_apb_agt", this); m_wb_agt = agent_wishbone::type_id::create ("m_wb_agt", this);
m_reg_env = env_register::type_id::create ("m_reg_env", this); foreach (m_analog_env[i]) m_analog_env[i] = env_analog::type_id::create ($sformatf("m_analog_env%0d",m_analog_env[i]), this);
m_scbd = scoreboard::type_id::create ("m_scbd", this);endfunction
virtual function void connect_phase (uvm_phase phase);// Connect between different environments, agents, analysis ports, and scoreboard here endfunctionendclass

其中env_analog或env_register中也可以有一些agent和scoreboard。 可以看到UVM在可重用性方面很强大,主要取决于这种分层结构和TLM连接。 也正是因为这种复用,可以分别独立验证env_analog和env_register,而在更加上层的验证环境my_top_env中,可能只需要关注子系统之间的交互。

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • UVM
    UVM
    +关注

    关注

    0

    文章

    181

    浏览量

    19023
  • 代码
    +关注

    关注

    30

    文章

    4603

    浏览量

    67371
  • 数字系统
    +关注

    关注

    0

    文章

    124

    浏览量

    20756
收藏 人收藏

    评论

    相关推荐

    什么是uvm_reg_field?

    uvm_reg_field是什么
    发表于 12-17 06:10

    数字IC验证之“什么是UVM”“UVM的特点”“UVM提供哪些资源”(2)连载中...

    原文链接:https://zhuanlan.zhihu.com/p/345775995大家好,我是一哥,上章内容主要讲述两个内容,芯片验证以及验证计划。那本章我们主要讲述的内容有介绍什么是uvm
    发表于 01-21 16:00

    什么是uvmuvm的特点有哪些呢

    大家好,我是一哥,上章内容我们介绍什么是uvmuvm的特点以及uvm为用户提供了哪些资源?本章内容我们来看一看一个典型的uvm验证平台应该是什么样子的,来看一个典型的
    发表于 02-14 06:46

    谈谈UVM中的uvm_info打印

      uvm_info宏的定义如下:  `define uvm_info(ID,MSG,VERBOSITY) \  begin \  if (uvm_report_enabled(VERBOSITY
    发表于 03-17 16:41

    UVM中seq.start()和default_sequence执行顺序

      1. 问题  假如用以下两种方式启动sequence,方法1用sequence的start()方法启动seq1,方法2用UVM的default_sequence机制启动seq2。那么seq1
    发表于 04-04 17:15

    Agilent Environment and Social

    Agilent Environment and Social Responsibility Report
    发表于 08-12 10:47 15次下载

    Modelsim uvm库编译及执行

    第一句话是设置uvm环境变量,指定uvm的dpi位置。 第二句话是创建work工作目录。 第三句话是编译源文件,并且通过-L指定几个编译库。 第三句是执行仿真,调用uvmuvm
    的头像 发表于 12-01 11:25 3510次阅读
    Modelsim <b class='flag-5'>uvm</b>库编译及执行

    UVM学习笔记(一)

    driver应该派生自uvm_driver,而uvm_driver派生自uvm_component。
    的头像 发表于 05-26 14:38 1009次阅读
    <b class='flag-5'>UVM</b>学习笔记(一)

    创建Environment

    uvm environment 类是一个包含多个可重用的验证组件的类,它定义了测试用例所需的验证组件的配置。
    的头像 发表于 06-04 16:28 372次阅读
    创建<b class='flag-5'>Environment</b>类

    UVM里的6个常见参数介绍分析

    UVM预先定义了六个详细程度; UVM_NONE到UVM_DEBUG。这些级别只不过是整数枚举值
    的头像 发表于 06-06 12:33 3138次阅读
    <b class='flag-5'>UVM</b>里的6个常见参数介绍分析

    UVM中的uvm_do宏简析

    uvm_do宏及其变体提供了创建、随机化和发送transaction items或者sequence的方法。
    的头像 发表于 06-09 09:36 3520次阅读
    <b class='flag-5'>UVM</b>中的<b class='flag-5'>uvm</b>_do宏简析

    UVMuvm_config_db机制背后的大功臣

    本次讲一下UVM中的uvm_config_db,在UVM中提供了一个内部数据库,可以在其中存储给定名称下的值,之后可以由其它TB组件去检索。
    的头像 发表于 06-20 17:28 947次阅读

    UVMuvm_config_db机制背后的大功臣

    本次讲一下UVM中的uvm_config_db,在UVM中提供了一个内部数据库,可以在其中存储给定名称下的值,之后可以由其它TB组件去检索。
    的头像 发表于 06-29 16:57 787次阅读

    一文详解UVM设计模式

    本篇是对UVM设计模式 ( 二 ) 参数化类、静态变量/方法/类、单例模式、UVM_ROOT、工厂模式、UVM_FACTORY[1]中单例模式的补充,分析静态类的使用,UVM中资源池的
    的头像 发表于 08-06 10:38 1093次阅读
    一文详解<b class='flag-5'>UVM</b>设计模式

    UVM设计中的sequence启动方式有哪几种呢?

    本篇介绍UVM中的sequence,这是UVM中最基础的部分。对于前面介绍的uvm_callback, uvm_visitor等,很少被使用到或者也只有搭建平台的人会使用。
    的头像 发表于 08-17 10:07 1957次阅读
    <b class='flag-5'>UVM</b>设计中的sequence启动方式有哪几种呢?