私の検証環境では、再利用できるようにいくつかの一般的なシーケンスを設定しています。
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
コンパイル エラー: class specialization parameter must be constant for the common_sequence_with_event#(my_sequence, my_event) 行が表示されます。
これは、クラスに渡されるパラメーターは定数でなければならないことを意味していると思います。したがって、この場合、パラメーターとしても渡される reset_sequence を受け入れるのはなぜですか。
また、私が達成したいことを行うためのより良い方法はありますか?