What you practice
UVM sequence item and uvm_field macros (1.1). Define a FIFO sequence item and register fields with uvm_field macros for copy, compare, and print. It is in Sequence Item — Part 1 · Stimulus Generation of the UVM Masterclass. Create randomized transactions and deliver them safely to the DUT.
The UVM bench compiles in that same browser SystemVerilog simulator. You edit the test in the IDE, run Verilator, and read the log beside the waveform.
What you will learn
You will define a UVM sequence item class for the FIFO DUT and register its fields using uvm_field_int macros to enable automatic copy, compare, and print functionality.
Learning objectives
- Declare a
uvm_sequence_item-derived class with random fields. - Register fields using
uvm_object_utils_begin/endanduvm_field_intmacros. - Instantiate, randomize, and print a sequence item in a testbench.
- Understand the role of sequence items as stimulus templates in UVM.
Theory
UVM sequence items model transactions—data packets or operations—used to drive DUT inputs. They are typically randomized to generate diverse test scenarios. The uvm_field_int macros automate common operations like copy(), compare(), and print() by introspecting registered fields.
| Macro | Purpose |
|---|---|
uvm_object_utils_begin(className) / uvm_object_utils_end | Registers the class with the UVM factory and starts field registration |
uvm_field_int(field, UVM_DEFAULT) | Registers an integral field for automatic copy/compare/print |
Sequence items must extend uvm_sequence_item and be declared rand for randomization.
Practice
- Open RtlStudio and select this chapter; confirm files appear in Explore.
- Create
student/tb/seq/fifo_seq_item.svwith a class extendinguvm_sequence_item. - Declare
rand logic [31:0] data,rand bit write_en, andrand bit read_eninside the class. - Add
uvm_object_utils_begin(fifo_seq_item)anduvm_object_utils_end(fifo_seq_item). - Inside the block, register each field with
uvm_field_int(data, UVM_DEFAULT),uvm_field_int(write_en, UVM_DEFAULT), anduvm_field_int(read_en, UVM_DEFAULT). - In
student/tb/tb_top.sv, instantiatefifo_seq_item, callnew(),randomize(), and print itsconvert2string()output (e.g.,$display("%s", seq_item.convert2string());). - Run Simulation and check the Log panel for the printed sequence item.
Summary
You defined a FIFO sequence item by extending uvm_sequence_item and registered its fields using uvm_object_utils and uvm_field_int macros. You declared rand data, write_en, and read_en fields to model valid FIFO transaction patterns. The UVM field macros automatically handle cloning, printing, and comparison for the sequence item. You instantiated, randomized, and printed an instance of fifo_seq_item, observing its field values in the simulation log.
Run it in the Verilog IDE
- Open the UVM workspace in the IDE. The DUT and the testbench compile together in the browser.
- Run the SystemVerilog simulation with Verilator and read the phase and scoreboard lines in the log.
- When the check is on pins rather than a print, open the VCD next to that log.
- Edit the sequence, driver, or scoreboard in the IDE and rerun. You stay in the same simulator.
The lesson is done when the simulation matches UVM sequence item and uvm_field macros. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.