UVM Sequence Library
A UVM sequence library (uvm_sequence_library) is a container that holds many sequences and runs them in a chosen order — random, in sequence, or by a user policy. It lets a test exercise a large, varied mix of traffic without hand-coding the order, which is central to building reusable, randomised regressions.
Registering and selecting
Sequences register themselves into a library with `uvm_add_to_seq_lib, and the library’s selection_mode (UVM_SEQ_LIB_RAND, UVM_SEQ_LIB_RANDC, UVM_SEQ_LIB_ITEM, UVM_SEQ_LIB_USER) decides how many and which run. This is reference syntax — UVM requires the vendor UVM library to elaborate:
class rd_seq extends uvm_sequence #(bus_item);
`uvm_object_utils(rd_seq)
`uvm_add_to_seq_lib(rd_seq, my_seq_lib) // join the library
// ... body() ...
endclass
class my_seq_lib extends uvm_sequence_library #(bus_item);
`uvm_object_utils(my_seq_lib)
`uvm_sequence_library_utils(my_seq_lib)
function new(string name=""); super.new(name); init_sequence_library(); endfunction
endclass
// in the test:
my_seq_lib lib = my_seq_lib::type_id::create("lib");
lib.selection_mode = UVM_SEQ_LIB_RAND; // pick sequences at random
lib.min_random_count = 10; lib.max_random_count = 20;
lib.start(env.agent.sequencer);The payoff is stimulus reuse at scale: drop a new sequence into the library and it automatically becomes part of the randomised mix in every test that runs the library — no test edits required.
Share your question in comments or talk to our mentor team for batch guidance.
Compile and simulate this in the browser — no install. Edit the code and re-run instantly.
Learn Verilog with mentors, labs and placement support
This free series is maintained by the ChipXpert training team in Hyderabad & Bengaluru. Go deeper with instructor-led courses on real EDA tools.
Explore VLSI Courses