RTL Studio Open IDE

1.1 · UVM CLASS

UVM sequence item and uvm_field macros

Define a FIFO sequence item and register fields with uvm_field macros for copy, compare, and print.

Watch on YouTube

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/end and uvm_field_int macros.
  • 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.

MacroPurpose
uvm_object_utils_begin(className) / uvm_object_utils_endRegisters 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

  1. Open RtlStudio and select this chapter; confirm files appear in Explore.
  2. Create student/tb/seq/fifo_seq_item.sv with a class extending uvm_sequence_item.
  3. Declare rand logic [31:0] data, rand bit write_en, and rand bit read_en inside the class.
  4. Add uvm_object_utils_begin(fifo_seq_item) and uvm_object_utils_end(fifo_seq_item).
  5. Inside the block, register each field with uvm_field_int(data, UVM_DEFAULT), uvm_field_int(write_en, UVM_DEFAULT), and uvm_field_int(read_en, UVM_DEFAULT).
  6. In student/tb/tb_top.sv, instantiate fifo_seq_item, call new(), randomize(), and print its convert2string() output (e.g., $display("%s", seq_item.convert2string());).
  7. 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

  1. Open the UVM workspace in the IDE. The DUT and the testbench compile together in the browser.
  2. Run the SystemVerilog simulation with Verilator and read the phase and scoreboard lines in the log.
  3. When the check is on pins rather than a print, open the VCD next to that log.
  4. 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.