Sequence Library

I want to configure all the sequences added in the sequence library. what are the ways to do it?

In reply to Nandakumari:
https://verificationacademy.com/cookbook/config/configuringsequences

In reply to dave_59:

//collection of multiple sequences
class seq_library extends uvm_sequence_library#(apb_sequence_item);

//factory registration
uvm_object_utils(seq_library) uvm_sequence_library_utils(seq_library)
randc int slave_id;

apb_seq_config seq_cfg;

function new(string name = “seq_library”);
super.new(name);
seq_cfg = apb_seq_config::type_id::create(“seq_cfg”);
//adding sequences here
// add_typewide_sequence(apb_base_sequence::get_type());
// add_typewide_sequence(apb_wr_sequence::get_type());
//add_typewide_sequence(apb_rd_sequence::get_type());
add_typewide_sequence(apb_wr_rd_seq::get_type());

endfunction

constraint slave_no_con {slave_id inside {[0:`NO_SLAVES]};}

virtual task body();
//storing seq config class in db
seq_cfg.configure(slave_id);
uvm_config_db #(apb_seq_config)::set(null,“*”, “apb_seq_config”, seq_cfg);

 super.body();

endtask

endclass:seq_library

//base sequence code

class apb_base_sequence extends uvm_sequence#(apb_sequence_item);

`uvm_object_utils(apb_base_sequence)

apb_seq_config seq_cfg;

//variables to hold configured addresses
bit[ADDR_WIDTH - 1 : 0] start_addr; bit [ADDR_WIDTH - 1 : 0] end_addr;
int count;

function new (string name = “”);
super.new(name);
endfunction :new

virtual task body();

if ( !uvm_config_db#(apb_seq_config)::get(null, “*”, “apb_seq_config”, seq_cfg) )
`uvm_error(get_type_name(), “Failed to get config object”)
start_addr = seq_cfg.SLAVE_ADDRESS_MIN;
end_addr = seq_cfg.SLAVE_ADDRESS_MAX;
count = seq_cfg.count;

   `uvm_info(get_full_name(),$sformatf("MIN ADDR = %0d,MAX_ADDR = %0d",start_addr,end_addr),UVM_LOW);

endtask :body

endclass :apb_base_sequence

is it okay that the sequence have a dependency on sequence library like this? is there any other better ways to make this sequence more configurable and reusable?

In reply to Nandakumari:

You don;t need UVM’s sequence library. See https://verificationacademy.com/forums/uvm/can-we-use-sequence-libraries-sequences-running-different-sequencers#reply-110964

1 Like