在我的验证环境中,我设置了一些可重用的公共序列:
class common_sequence(type T = uvm_sequence) extends uvm_sequence#(uvm_sequence_item);
`uvm_object_param_utils(common_sequence_t#(T))
function new(string name="common_sequence");
super.new(name);
endfunction
T sequence;
virtual task body();
`uvm_do(sequence);
endtask
endclass我想创造一些类似的东西,我可以通过在一个事件。
class common_sequence_with_event(type T = uvm_sequence, type E = uvm_event) extends uvm_sequence#(uvm_sequence_item);
`uvm_object_param_utils(common_sequence_t#(T,E))
function new(string name="common_sequence");
super.new(name);
endfunction
T sequence;
E event;
virtual task body();
event.wait_trigger();
`uvm_do(sequence);
endtask
endclass我将通过测试将此事件设置为:
class my_test extends uvm_test;
`uvm_component_utils(my_test)
uvm_event my_event;
function new(string name = "my_test", uvm_component parent=null);
super.new(name,parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_event my_event = new ("my_event");
endfunction
virtual function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
// Schedule sequences with sequencers
uvm_config_db#(uvm_object_wrapper)::set(this,
"env.my_agent.sequencer.reset_phase",
"default_sequence",
common_sequence#(reset_sequence)::get_type());
uvm_config_db#(uvm_object_wrapper)::set(this,
"env.my_agent.sequencer.main_phase",
"default_sequence",
common_sequence_with_event#(my_sequence, my_event )::get_type());
endfunction
endclass我得到了编译错误:类专门化参数必须是common_sequence_with_event#(my_sequence,my_event)行的常量。
我猜这意味着传递给类的参数必须是常量。因此,在这种情况下,为什么它接受作为参数传入的reset_sequence。
还有,有没有更好的方法来做我想要达到的目标?
发布于 2014-06-19 23:32:39
类型参数必须传递类型。my_event是一个变量,而不是类型。您没有显示my_sequence或reset_sequence的声明,但我假设它们是类类型。您需要参数E吗?是不是永远都是uvm_event
https://stackoverflow.com/questions/24314100
复制相似问题