How to set sequence field in all sequences of uvm_sequence_library

Hi

probably some casting newbie question:

i have sequences inherit from a base sequence class which have a some field (int myint)
created a uvm_sequence_library from those sequence

i want to set this myint for all sequences of library - so i created a function in library to initiate it

but i get the following error during elaboration
Error-[MFNF] Member not found
file.sv, 60
“this.sequences[i].”
Could not find member ‘myint’ in class ‘uvm_object_wrapper’, at
“/foundary/software/synopsys/vcs/Q-2020.03-SP2/etc/uvm-1.2/base/uvm_factory.svh”,

Note - without this initialization process - seq_lib works great

Sequences and lib :


class my_base_sequence extends uvm_sequence #(some_type);
     int myint;
...

class new_seq1 extends my_base_sequence ;    
.....

class new_seq2 extends my_base_sequence ;    
.....


class my_seq_lib extends uvm_sequence_library #(some_type);
  //  .....
    function new (string name = "bs_400g_jtag_seq_lib");
        super.new(name);
        add_typewide_sequence(new_seq1 ::get_type());
        add_typewide_sequence(new_seq2 ::get_type());
        init_sequence_library();        
    endfunction : new
    
    function set_int();
        foreach (sequences[i]) begin
                sequences[i].myint = 3;
            end 
    endfunction
//    ......
endclass

Test :


class my_test extends my_base_test;

  my_seq_lib seq_lib;
  
   virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    seq_lib = my_seq_lib::type_id::create("seq_lib", this );    
    uvm_config_db#(uvm_sequence_base)::set(this, "my_env.m_vseqr.m_my_seqr.main_phase", "default_sequence", seq_lib);
    seq_lib.selection_mode = UVM_SEQ_LIB_RAND;  
    seq_lib.print();
  endfunction : build_phase

  task main_phase(uvm_phase phase);
    seq_lib.set_int();
    seq_lib.start(..., null);
   //.....
  endtask
// .....
endclass

Thanks
n.

In reply to Noam Elbaum:

Comments:

  • Please use code tags. I have added them for you.
  • The uvm_sequence_library doesn’t store any instances of your sequences. It stores the sequence types, and will create a specific instance when selecting a random (or specified) sequence type. This is why you are getting an error.
  • Don’t use uvm_sequence_library/default_sequence. Create and start the required sequence(s) in your test. This gives you better control over your test sequence behavior.

In reply to cgales:

thanks - not using uvm_sequence_library means i need to shuffle and miss other goodies which are in a sequence library - but probably i’ll follow your guideline
thanks again