我在尝试将数据从记分板传递到序列时出错,如何摆脱它? [英] I am getting an error while trying to pass the data from scoreboard to sequence, how to get rid of it?

查看:30
本文介绍了我在尝试将数据从记分板传递到序列时出错,如何摆脱它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 UVM 的新手,我正在尝试验证内存设计,在该设计中我尝试多次运行写入序列,然后是相同次数的读取序列,以便我可以读取我正在写入的相同地址,并且相比.为此,我尝试创建一个从 uvm_object 扩展的新类,并带有一个队列来存储我正在写入的地址,以便我可以在读取序列中使用它们,并在记分板中实例化这个类,然后将类的句柄发送到通过 uvm_config_db 读取序列,现在的问题是我能够在队列中存储地址但无法在读取序列中获取类句柄......这是检查的正确方法还是有更好的方法来检查从内存中写入和读取,请帮帮我!

I am new to UVM and I am trying to verify a memory design where I am trying to run a write sequence multiple times followed by read sequence same number of times so that I could read the same addresses I am writing to, and compare. For this I tried to create a new class extended from uvm_object with a queue to store the addresses I am writing to, so that I could use them in read seq and I am instantiating this class in the scoreboard and then sending the handle of class to the read sequence via uvm_config_db, now the issue is I am able to store addresses in queue but unable to get the class handle in read sequence ......Is this the right way of checking or is there some better way to check the write and read back from memory, please help me !

完整代码链接(尚未完成):https://www.edaplayground.com/x/3iTr相关代码片段:这是我创建的用于存储地址的类

entire code link (yet to complete): https://www.edaplayground.com/x/3iTr Relevant code snippets: This is the class I created to store the addresses

        class address_list extends uvm_object;
        reg[7:0]addr_q[$];
        function new(string name);
        super.new(name);
        endfunction 
        endclass;

在我的记分板中,我将带有地址队列的类的句柄传递给读取序列,这是记分板的片段

In my scoreboard, I am passing the handle of class with address queue to the read sequence, here is the snippet from scoreboard

       virtual function void write(mem_seq_item pkt);
       if(pkt.wr_en==1)
       begin
       pkt_qu_write.push_back(pkt);
       addr.addr_q.push_back(pkt.addr);
     uvm_config_db#(address_list)::set(uvm_root::get(),"*","address",addr); 
       end
       if(pkt.rd_en==1)
       pkt_qu_read.push_back(pkt);
        `uvm_info(get_type_name(),$sformatf("Adder list is 
 %p",addr.addr_q),UVM_LOW)
    endfunction : write

在我的阅读序列中,我试图获得句柄

In my read sequence, I am trying to get the handle

     virtual task body();
     repeat(3)
    `uvm_do(wr_seq)
     if(!uvm_config_db#(address_list)::get(this, " ", "address", addr_))
    `uvm_fatal("NO_VIF",{"virtual interface must be set for:",get_full_name(),".addr_"}); 

    `uvm_info(get_type_name(),$sformatf("ADDR IS %p",addr_),UVM_LOW)

     repeat(3)
     `uvm_do(rd_seq)
     endtask

Error-[ICTTFC] Incompatible complex type usage
mem_sequence.sv, 137 {line where i try to get from uvm_config_db}
Incompatible complex type usage in task or function call.
The following expression is incompatible with the formal parameter of the 
function. The type of the actual is 'class $unit::wr_rd_sequence', while 
the
type of the formal is 'class uvm_pkg::uvm_component'. Expression: this
Source info: uvm_config_db# 
(_vcs_unit__3308544630::address_list)::get(this, 
 " ", "address", this.addr_)

推荐答案

这一行有两个问题:

if(!uvm_config_db#(address_list)::get(this, " ", "address", addr_))

一个导致您的错误.一个可能会导致您无法在数据库中找到您要查找的内容.

One is causing your error. One might lead to you not being able to find what you're looking for in the database.

这(字面意思是this)导致了您的错误.您正在从从 uvm_sequence 派生的类中调用 get.get 的第一个参数是从 uvm_component 派生的类.您的问题是序列不是测试平台层次结构的一部分,因此您不能使用序列作为调用 get(或 set)的第一个参数代码>uvm_config_db.相反,约定是使用运行序列的序列器,它通过调用序列的 get_sequencer() 方法返回.这可以解决您的问题:

This (literally this) is causing your error. You are calling get from a class derived from uvm_sequence. The first argument to get is expecting a class derived from uvm_component. Your problem is that a sequence is not part of the testbench hierarchy, so you cannot use a sequence as the first argument to a call to get (or set) in a uvm_config_db. Instead the convention is to use the sequencer that the sequence is running on, which is returned by a call to the sequence's get_sequencer() method. This solves your problem:

if(!uvm_config_db#(address_list)::get(get_sequencer(), "", "address", addr_))

这是有效的,因为您在调用 set 时使用了通配符.

This works because you used a wildcard when you called set.

请注意,我还删除了引号之间的空格.这可能不会给您带来问题,因为您在调用 set 时使用了通配符,但通常此字符串应该为空或应该是真正的分层路径.(setget 调用的层次结构输入在第一个参数 - SystemVerilog 层次结构路径 - 和第二个 - 代表层次结构路径的字符串之间拆分).

Notice that I also removed the space from between the quotes. That might not give you a problem, because you used the wildcard when you called set, but in general this string should either be empty or should be a real hierarchical path. (The hierarchy input to the set and get calls is split between the first argument - a SystemVerilog hierarchical path - and the second - a string representing a hierarchical path).

这篇关于我在尝试将数据从记分板传递到序列时出错,如何摆脱它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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