If I have 100 sequence classes and I want to use “my_seq” object, then do I need to assign all 100 sequences as the below instead of just one assignment in the base class? because all “my_seq” has extended from base class. so I thought that I assigned it in the base class and I can use it without assigning to each extended class.
Your question is very confusing as you re-use the same class name (my_base_class) so it’s difficult to understand what you are trying to accomplish.
If you have many different sequences defined, I wouldn’t declare/create them in the base test, as they will be test specific. You should only declare/create the required sequences in each test.
Each sequence is extended by my_base_seq.
In the example, my_seq0_seq is not declared with “my_reg_model my_ral;”. This is because the declaration was made in “my_base_seq” and it was expanded to create my_seq0_seq.
If the objects declared in my_base_seq are available in the extended sequence, then I can declare as the below.
As cgales pointed out your wording is a bit confusing, why not just use config_db to set the RAL model and then in your base sequence you can get it with config_db get (please do not take the code as working example is just an idea)
//In the env class
uvm_config_db#(ral_model)::set(null, "*", "ral_model", ral_model);
// in the sequence
if ( !uvm_config_db#(int)::get(get_sequencer(), "", "ral_model", seq_ral_model))
You don’t want to use the config_db() in this case. The best technique is to add a function in your base test which assigns ral_model to the sequence my_ral handle.
Again, you don’t want to instantiate every sequence in the base_test class. You should only use the required sequences in each derived test.
class my_base_seq extends uvm_sequence;
my_reg_model my_ral;
...
my_ral = my_reg_mode::type_id_create("my_ral", this);
...
endclass
class my_seq0_seq; extends my_base_seq;
...
virtual task body();
...
my_ral.DATA.read(status, rdata);
...
endclass
class my_seq1_seq extends my_base_seq;
...
virtual task body();
...
my_ral.DATA.read(status, rdata);
...
endclass
class my_seq2_seq extends my_base_seq;
...
virtual task body();
...
my_ral.DATA.read(status, rdata);
...
endclass
class my_base_test extends uvm_test;
...
// Only have environment & config objects
// Don't create any sequences in the base test - they are test specific
function void build_phase(uvm_phase phase);
...
endfunction
function assign_ral(my_base_seq seq);
seq.my_ral = ral_env.model;
endfunction
function void connect_phase(uvm_phase phase);
...
...
endfunction
endclass
class my_test1 extends my_base_test;
task run_phase(uvm_phase phase);
my_seq1_seq seq1 = my_seq1_seq::type_id::create("seq1");
my_seq2_seq seq2 = my_seq2_seq::type_id::create("seq2");
assign_ral(seq1);
assign_ral(seq2);
seq1.start(env.agent.seqr);
seq2.start(env.agent.seqr);
endtask
endclass