这是我的简单代码段
class sample_sequence extends uvm_sequence#(sample_sequence_item);
rand int no_txn;
`uvm_object_param_utils_begin(sample_sequence_item)
`uvm_field_int(no_txn,UVM_ALL_ON)
`uvm_object_utils_end
rand sample_sequence_item sample_sequence_item_inst;
function new(string name="sample_sequence");
super.new(name);
endfunction
virtual task body();
no_txn = 10;
for(int i = 0;i<no_trn;i++) begin
sample_sequence_item_inst = sample_sequence_item::type_id::create($sformatf("sample_sequence_item_%0d",i));
sample_sequence_item_inst.addr = $urandom_range(0,20);
start_item(sample_sequence_item_inst);
finish_item(sample_sequence_item_inst);
end
endtask: body
endclass
该序列只是生成随机地址并发送给驱动程序。我想从测试中控制参数 no_txn。
我可以使用序列的层次结构来做到这一点,但是是否有任何基于 UVM 的工厂方法来覆盖它?