UVM测试结束机制
task mabu_scoreboard::main_phase(uvm_phase phase);
forever begin
# 1ns;
if(extip_rd_req_cnt - extip_rd_rsp_cnt >= `MABU_READ_OST_NUM) begin
hit_rd_max_outstanding = 1;
`uvm_info(get_type_name(),"reach read outstanding threshold!",UVM_NONE);
end else begin
hit_rd_max_outstanding = 0;
end
if(extip_wr_req_cnt - extip_wr_rsp_cnt >= `MABU_WRITE_OST_NUM) begin
hit_wr_max_outstanding = 1;
`uvm_info(get_type_name(),"reach write outstanding threshold!",UVM_NONE);
end else begin
hit_wr_max_outstanding = 0;
end
end endtask
永远
循环是在耗时的阶段执行的(main_phase
)。由于main_phase
不引起异议,该测试可以正确终止。
task mabu_scoreboard::main_phase(uvm_phase phase);
forever begin
# 1ns;
if(extip_rd_req_cnt - extip_rd_rsp_cnt >= `MABU_READ_OST_NUM) begin
hit_rd_max_outstanding = 1;
`uvm_info(get_type_name(),"reach read outstanding threshold!",UVM_NONE);
end else begin
hit_rd_max_outstanding = 0;
end
if(extip_wr_req_cnt - extip_wr_rsp_cnt >= `MABU_WRITE_OST_NUM) begin
hit_wr_max_outstanding = 1;
`uvm_info(get_type_name(),"reach write outstanding threshold!",UVM_NONE);
end else begin
hit_wr_max_outstanding = 0;
end
end endtask
The forever
loop is executed in a time-consuming phase (main_phase
). The test can get terminated correctly because the main_phase
does not raise an objection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个开始耗时的UVM阶段,必须至少提出一个反对意见,以防止该阶段被终止。终止一个阶段意味着所有
uvm_component
执行该阶段的过程将被杀死。在您的记分牌示例中,我们必须假设一些其他组件会提出对
main_phase
的反对,否则forever
循环永远不会完成其第一次迭代。最好使用run_phase
进行整个测试需要执行的过程。除了产生时钟外,您的UVM测试台在您的UVM测试台上有任何延迟是不良的做法。 UVM TestBench应该是基于交易的,唯一的延迟应该在于生成时钟。
Forever
具有1NS轮询延迟的循环对性能尤其不利。更好的方法是阻止等待活动。One starting a time-consuming UVM phase, there must be at least one objection raised to prevent that phase from being terminated. Terminating a phase means the process of all
uvm_component
s executing that phase will be killed.In your scoreboard example, we would have to assume some other component raises an objection to the
main_phase
, otherwise theforever
loop would never complete its first iteration. It's better to use therun_phase
for a process that needs to execute for the entire test.Having any kind of delay in your UVM testbench except for generation of the clock is a bad practice. A UVM testbench is supposed to be transaction based and the only delays should be in generating your clocks. A
forever
loop with a 1ns polling delay is especially bad for performance. A much better approach is to blocking waiting for an event.是的,这是正确的。由于记分牌中的
main_phase
未调用rise_objection
,因此计分板不会阻止测试结束。您的大多数测试台组件都不会引起异议。在您的测试中(从
uvm_test
延长的类)是在其耗时的阶段提出异议。Yes, that is correct. Since the
main_phase
in your scoreboard does not callraise_objection
, the scoreboard will not prevent the test from ending.Most of your testbench components will not raise objections. It is common for your test (the class extended from
uvm_test
) to raise objections in its time-consuming phase.