What you practice
UVM sequence and uvm_do in body() (1.2). Generate FIFO write transactions with a UVM sequence using uvm_do in body(). It is in Sequence — 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 learn how to generate stimulus using a UVM sequence with uvm_do inside the body() task, enabling structured, repeatable transaction injection into a testbench.
Learning objectives
- Understand the role of
uvm_sequenceanduvm_sequencerin stimulus generation. - Use
uvm_do(req)to create, randomize, and send sequence items. - Structure a burst of FIFO transactions in a repeatable recipe.
- Verify stimulus delivery via testbench
$displaycheckpoints.
Theory
UVM sequences encapsulate stimulus generation logic. The body() task is where transactions are produced and sent to the sequencer. uvm_do(req) is a macro that performs three steps: req = fifo_seq_item::type_id::create("req"); req.randomize(); start_item(req); finish_item(req);. This pattern ensures each transaction is randomized and sent in order. Sequences run on a sequencer instance and interact with the DUT via the virtual interface bound through uvm_config_db.
| Macro | Action |
|---|---|
uvm_do(req) | Create, randomize, start, finish item |
uvm_do_with(req, { constraints }) | Create, randomize with inline constraints |
start_item(req) / finish_item(req) | Manual alternative to uvm_do |
Practice
- Open RtlStudio and select this chapter — confirm files appear in Explore.
- Open
student/tb/tb_top.sv— it already contains the testbench skeleton with sequencer and sequence instantiation. - Create
student/tb/seq/fifo_sequence.svextendinguvm_sequence #(fifo_seq_item). - Implement
body()withrepeat (5) uvm_do(req);followed by$display("req fields: ..."). - Run Simulation and verify
INFO:logs show 5 transactions andINFO: PASS.
Summary
Students implemented a UVM sequence to generate a burst of five randomized FIFO transactions using the uvm_do macro within the body() method. They verified correct behavior by printing each request’s fields after sending it, confirming that sequence item creation, randomization, and transmission occurred as expected. The key takeaway is that uvm_do` simplifies the common pattern of generating and sending sequence items in a concise and readable way.
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 and uvm_do in body(). Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.