RTL Studio Open IDE

5.5 · UVM CLASS

Mission: APB register field coverage 100%

Exercise all APB register fields via UVM RAL and reach 100% field coverage with LCOV.

Watch on YouTube

What you practice

Mission: APB register field coverage 100% (5.5). Exercise all APB register fields via UVM RAL and reach 100% field coverage with LCOV. It is in RAL coverage — Part 5 · AMBA APB and UVM RAL of the UVM Masterclass. APB protocol, register abstraction, and the roadmap to AXI.

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 drive every bit field of APB registers via UVM RAL sequences and collect functional coverage to reach 100% field coverage.

Learning objectives

  • Use UVM RAL to model APB registers and fields.
  • Write frontdoor sequences to read/write all register fields.
  • Add covergroups to sample field values and close coverage to 100%.
  • Verify coverage via LCOV and simulation logs.

Theory

APB registers are memory-mapped via paddr, pwdata, and pwrite. RAL provides a register abstraction layer to access them via frontdoor (APB protocol) or backdoor (DPI). Field coverage requires sampling each bit field (e.g., Enable, Reset, FIFO_Full) across all legal values.

RegisterOffsetFields (bits)Purpose
CTRL0x00Enable(0), Reset(1)Control bits
STAT0x04FIFO_Full(0), Empty(1)Status bits
DATA0x08Payload[31:0]Data payload

Frontdoor access uses the APB protocol via apb_write and apb_read tasks. Backdoor access uses reg_model.REG.FIELD.read(status, value, .path(UVM_BACKDOOR)). Covergroups must sample fields individually (e.g., coverpoint ctrl.enable), not just the register value.

Practice

Open RtlStudio and select this chapter. Files appear in Explore; no project setup needed.

  1. Open student/tb/tb_top.sv in the editor.
  2. Extend the initial block to write and read all register fields: CTRL (0x00), STAT (0x04), DATA (0x08).
  3. Add coverpoints in the RAL model or a dedicated coverage component to sample Enable, Reset, FIFO_Full, Empty, and Payload fields.
  4. Ensure stimulus writes all legal field combinations (e.g., write 0x0, 0x1, 0x2, 0x3 to CTRL).
  5. Run Simulation and check Log for INFO: PASS and per-field coverage completion.

Summary

Students practiced full register field coverage by extending RAL sequences to read and write all CTRL, STAT, and DATA register bits. They added covergroups to the register model or a dedicated coverage component to sample field transitions and ensured 100% LCOV coverage. The key takeaway is that systematic frontdoor access via UVM RAL enables precise, traceable coverage closure for APB registers.

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 Mission: APB register field coverage 100%. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.