RTL Studio Open IDE

3.5 · UVM CLASS

UVM subscriber and covergroup on analysis port

Encapsulate functional coverage in a subscriber with a FIFO full/empty covergroup on the analysis port.

Watch on YouTube

What you practice

UVM subscriber and covergroup on analysis port (3.5). Encapsulate functional coverage in a subscriber with a FIFO full/empty covergroup on the analysis port. It is in Subscriber — Part 3 · Env and Coverage of the UVM Masterclass. Assemble the verification environment, compare data, and hunt coverage.

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 capture functional coverage in a UVM subscriber connected to a monitor’s analysis port, using a covergroup that samples FIFO status flags.

Learning objectives

  • Understand the role of uvm_subscriber in UVM coverage collection.
  • Define a covergroup with coverpoints for FIFO full and empty flags.
  • Connect the subscriber’s analysis port to the monitor’s analysis port in the environment.
  • Call sample() in the subscriber’s write() method to record coverage.
  • Verify coverage collection via simulation logs.

Theory

UVM subscribers are passive components that consume data from an analysis port, commonly used for coverage and scoreboard logging. A covergroup defines coverage points and bins; it must be instantiated and sampled explicitly, typically inside the write() method of a subscriber.

ComponentPurpose
uvm_subscriber #(T)Generic consumer of T-type items from an analysis port
covergroupGroups coverpoints/bins to collect functional coverage
sample()Explicit method call to record a coverage snapshot
write(T item)Virtual method invoked when an item arrives on the analysis port

The subscriber is connected to the monitor’s analysis port in the environment’s connect_phase(). The covergroup instance is sampled each time write() is called, ensuring coverage is collected for every transaction.

Practice

Open this chapter in RtlStudio. Files appear automatically in Explore.

  1. Open student/tb/tb_top.sv — it already imports coverage infrastructure and runs fifo_base_test.
  2. In the fifo_env class (defined in golden/tb/env/fifo_env.sv), locate the connect_phase() method and confirm u_coverage is connected to u_monitor.ap.
  3. In the fifo_coverage subscriber (defined in golden/tb/env/fifo_coverage.sv), locate the write() method.
  4. In fifo_coverage, instantiate a covergroup cg_fifo with coverpoints for full_flag and empty_flag (booleans extracted from the fifo_seq_item).
  5. In the write() method, call cg_fifo.sample() after extracting flags from the item.
  6. Run Simulation and verify INFO: log output.

Summary

You implemented a UVM subscriber to capture transaction data from the monitor’s analysis port and encapsulated functional coverage using a covergroup. You defined coverpoints for FIFO status flags and ensured the covergroup was sampled inside the subscriber’s write() method. You connected the subscriber to the monitor in the environment’s connect_phase, completing the coverage collection pipeline. This reinforced how UVM components interact to gather functional coverage without affecting the DUT or test logic.

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 subscriber and covergroup on analysis port. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.