UVM 测试台 - 什么是“UVM"?将两个不同的驱动程序连接到同一接口的方法? [英] UVM testbench - What is the "UVM" way to connect two different drivers to same interface?

查看:48
本文介绍了UVM 测试台 - 什么是“UVM"?将两个不同的驱动程序连接到同一接口的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的测试平台中,我有一个需要驱动的接口.该接口可以以两种不同的模式驱动,每种模式都有自己的驱动协议和事务类型.

In my Testbench, I have an interface that I need to drive. The interface can be driven in 2 different modes, with each mode having its own driver protocol and transaction type.

到目前为止,我已经分别设计了两个 uvm_agents.现在,我需要一种方法来交换一个或另一个,具体取决于我正在运行的测试用例.我也想以最符合 UVM 理念的方式做到这一点.

So far, I have designed both uvm_agents separately. Now, I need a way to swap one or the other in, depending on the testcase I am running. I also want to do this in the way that best fits with UVM philosophy.

我能想到的最好方法是:在我的 uvm_env 中,从测试中获取一个 uvm_db_config 参数,该参数表示ModeA"或ModeB",并基于此将代理的 is_active 设置为UVM_ACTIVE"和适当的UVM_PASSIVE".

My best method that I could come up with is: in my uvm_env, getting a uvm_db_config parameter from the test that says either "ModeA" or "ModeB", and based on that, setting is_active for the agents to "UVM_ACTIVE" and "UVM_PASSIVE" appropriately.

我想对这种方法发表意见.

I would like an opinion on this method.

向我建议的一种方法是保留一个通用的 uvm_agent,并根据配置实例化 uvm_driver/uvm_sequencer.不太确定这个方法,因为它看起来很乱.

A way suggested to me was to keep a common uvm_agent, and instantiate the uvm_driver/uvm_sequencer based on the configuration. Not too sure about this method as it looks messy.

推荐答案

我也建议像 Tudor 一样,只使用一个代理.但随后我会使用继承,声明一个 base_driver 和一个 base_sequencer(它们可能具有来自 ModeA 或 ModeB 驱动程序和/或排序器的通用功能),并且 ModeA 和 ModeB 单元将扩展这些基本单元.然后,在代理中,并在每个测试中使用 uvm_config_db 设置中的标志,您将在实例化一个或另一个之间进行选择:

I would also suggest, like Tudor, to use only one agent. But then I would use inheritance, declaring a base_driver and a base_sequencer (that may have common functionalities from both ModeA or ModeB drivers and/or sequencers), and ModeA and ModeB units would extend those base ones. Then, in the agent, and using a flag in the uvm_config_db set in each test, you would select between instantiating one or the other:

基本驱动程序:

class my_proj_base_driver extends uvm_driver#(my_proj_tr);
[...]

ModeA 驱动程序:

ModeA driver:

class my_proj_ModeA_driver extends my_proj_base_driver;
[...]

ModeB 驱动程序:

ModeB driver:

class my_proj_ModeB_driver extends my_proj_base_driver;
[...]

在代理中:

[...]

my_proj_base_driver driver;
bit modeAorB // 0 for A, 1 for B

[...]

if (!uvm_config_db#(bit)::get(this,"","modeAorB", modeAorB))
  `uvm_fatal("NOMODE","No mode set for this agent")

if(!modeAorB)
  driver = my_proj_ModeA_driver::type_id::create(.name("driver"), .parent(this));
else
  driver = my_proj_ModeB_driver::type_id::create(.name("driver"), .parent(this));

音序器也一样.

这篇关于UVM 测试台 - 什么是“UVM"?将两个不同的驱动程序连接到同一接口的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆