尝试将数据从记分板传递到序列时出现错误,如何摆脱它?
I am getting an error while trying to pass the data from scoreboard to sequence, how to get rid of it?
我是 UVM 的新手,我正在尝试验证内存设计,我尝试 运行 多次写入序列,然后读取相同次数的序列,以便我可以读取相同的地址我正在写信给,并进行比较。为此,我尝试创建一个从 uvm_object 扩展而来的新 class,并带有一个队列来存储我正在写入的地址,以便我可以在读取序列中使用它们,并且我正在实例化此 class 在记分牌中,然后通过 uvm_config_db 将 class 的句柄发送到读取序列,现在的问题是我能够在队列中存储地址但无法获得 class 句柄读序列......这是正确的检查方法还是有更好的方法来检查内存的写入和读回,请帮助我!
完整代码 link(尚未完成):https://www.edaplayground.com/x/3iTr
相关代码片段:
这是我创建的 class 来存储地址
class address_list extends uvm_object;
reg[7:0]addr_q[$];
function new(string name);
super.new(name);
endfunction
endclass;
在我的记分牌中,我将带有地址队列的 class 句柄传递给读取序列,这是记分牌
中的片段
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
在我的读取序列中,我正在尝试获取句柄
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_))
一个导致你的错误。一个可能会导致您无法在数据库中找到您要查找的内容。
这(字面意思是 this
)导致了您的错误。您正在从 uvm_sequence
派生的 class 调用 get
。 get
的第一个参数期望从 uvm_component
派生出 class。您的问题是序列不是测试台层次结构的一部分,因此您不能将序列用作 uvm_config_db
中对 get
(或 set
)的调用的第一个参数。相反,惯例是使用序列 运行 所在的定序器,它通过调用序列的 get_sequencer()
方法返回。这解决了您的问题:
if(!uvm_config_db#(address_list)::get(get_sequencer(), "", "address", addr_))
之所以有效,是因为您在调用 set
时使用了通配符。
请注意,我还删除了引号之间的 space。这可能不会给您带来问题,因为您在调用 set
时使用了通配符,但通常此字符串应该为空或应该是真正的分层路径。 (set
和 get
调用的层次结构输入分为第一个参数 - SystemVerilog 层次结构路径 - 和第二个 - 表示层次结构路径的字符串)。
uvm_config_db
基本上是为了在组件之间传递配置。
为了将数据从记分板传递到序列,您可以使用 uvm_event
。
- 使用
event.trigger(address_list)
在计分板中触发事件
- 序列等待事件使用
event.wait_for_trigger_data(address_list)
我是 UVM 的新手,我正在尝试验证内存设计,我尝试 运行 多次写入序列,然后读取相同次数的序列,以便我可以读取相同的地址我正在写信给,并进行比较。为此,我尝试创建一个从 uvm_object 扩展而来的新 class,并带有一个队列来存储我正在写入的地址,以便我可以在读取序列中使用它们,并且我正在实例化此 class 在记分牌中,然后通过 uvm_config_db 将 class 的句柄发送到读取序列,现在的问题是我能够在队列中存储地址但无法获得 class 句柄读序列......这是正确的检查方法还是有更好的方法来检查内存的写入和读回,请帮助我!
完整代码 link(尚未完成):https://www.edaplayground.com/x/3iTr 相关代码片段: 这是我创建的 class 来存储地址
class address_list extends uvm_object;
reg[7:0]addr_q[$];
function new(string name);
super.new(name);
endfunction
endclass;
在我的记分牌中,我将带有地址队列的 class 句柄传递给读取序列,这是记分牌
中的片段 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
在我的读取序列中,我正在尝试获取句柄
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_))
一个导致你的错误。一个可能会导致您无法在数据库中找到您要查找的内容。
这(字面意思是 this
)导致了您的错误。您正在从 uvm_sequence
派生的 class 调用 get
。 get
的第一个参数期望从 uvm_component
派生出 class。您的问题是序列不是测试台层次结构的一部分,因此您不能将序列用作 uvm_config_db
中对 get
(或 set
)的调用的第一个参数。相反,惯例是使用序列 运行 所在的定序器,它通过调用序列的 get_sequencer()
方法返回。这解决了您的问题:
if(!uvm_config_db#(address_list)::get(get_sequencer(), "", "address", addr_))
之所以有效,是因为您在调用 set
时使用了通配符。
请注意,我还删除了引号之间的 space。这可能不会给您带来问题,因为您在调用 set
时使用了通配符,但通常此字符串应该为空或应该是真正的分层路径。 (set
和 get
调用的层次结构输入分为第一个参数 - SystemVerilog 层次结构路径 - 和第二个 - 表示层次结构路径的字符串)。
uvm_config_db
基本上是为了在组件之间传递配置。
为了将数据从记分板传递到序列,您可以使用 uvm_event
。
- 使用
event.trigger(address_list)
在计分板中触发事件
- 序列等待事件使用
event.wait_for_trigger_data(address_list)