我已读过'seven separate sequence styles speed stimulus scenarios',并想尝试分层顺序。在这里,我有两个原子序列FifoPush和FifoPop都从FifoSeqBase延伸。另外,我想创建称为FifoPushPop20的更高级别的抽象序列,先执行FifoPush,再执行FifoPop。但是,测试台无法按照我想要的方式工作,并且花了我一些时间才能找出错误-两种错别字!
class FifoSeqBase extends uvm_sequence #(FifoTransact);
`uvm_object_utils(FifoSeqBase)
...
endclass
class FifoPush extends FifoSeqBase;
`uvm_object_utils(FifoPush)
...
endclass
class FifoPop extends FifoSeqBase;
`uvm_object_utils(FifoPush) <- typo #1
...
endclass
在我的FifoPushPop20序列中,启动了两个序列,但进行了第二次输入错误,如下所示:
class FifoPushPop20 extends FifoSeqBase;
...
task body();
FifoPush push = FifoPush::type_id::create("push");
FifoPush pop = FifoPop::type_id::create("pop"); <- typo #2
push.start(m_sequencer);
pop.start(m_sequencer);
...
endtask
endclass
当我有两次以上所示的错别字时,没有编译或运行时错误。我可以解释一下为什么在编译时或运行时未检测到此错误吗?发生的是即使我使用了FifoPop :: type_id :: create(“ pop”),“ typo#2”实际上创建了FifoPush类型的对象,而不是FifoPop对象。
答案 0 :(得分:1)
您很幸运/很不幸*您两次都错了。更正其中任何一个,并且代码无法编译。对于这两种错别字,第一个宏扩展为一堆与FifoPush
类相关的东西,而不是FifoPop
类,这恰好是(a)仍然合法,并且(b)被第二个错字。
*适当删除
提供一个MCVE总是很好:
`include "uvm_macros.svh"
module M;
import uvm_pkg::*;
class FifoTransact extends uvm_sequence_item;
`uvm_object_utils(FifoTransact)
function new (string name = "");
super.new(name);
endfunction
endclass
class FifoSeqBase extends uvm_sequence #(FifoTransact);
`uvm_object_utils(FifoSeqBase)
function new (string name = "");
super.new(name);
endfunction
task body; endtask
endclass
class FifoPush extends FifoSeqBase;
`uvm_object_utils(FifoPush)
function new (string name = "");
super.new(name);
endfunction
endclass
class FifoPop extends FifoSeqBase;
`uvm_object_utils(FifoPush) // <- typo #1
function new (string name = "");
super.new(name);
endfunction
endclass
class FifoPushPop20 extends FifoSeqBase;
`uvm_object_utils(FifoPushPop20)
function new (string name = "");
super.new(name);
endfunction
task body;
FifoPush push = FifoPush::type_id::create("push");
FifoPush pop = FifoPop::type_id::create("pop"); // <- typo #2
push.start(m_sequencer);
pop.start(m_sequencer);
endtask
endclass
endmodule