What you practice
Why UVM RAL maps registers to objects (5.2). Map APB registers (CTRL/STAT/DATA) to uvm_reg objects in a register block. It is in RAL concept — 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
This lesson explains how hardware registers (CTRL, STAT, DATA) are abstracted as UVM register objects, enabling software-like register access in verification environments.
Learning objectives
- Understand the purpose of UVM RAL (Register Abstraction Layer) in verification.
- Recognize how register addresses, access types, and fields map to
uvm_regobjects. - See how a register block (
uvm_reg_block) ties together registers and memory maps. - Connect the register model to an APB driver via a virtual interface.
Theory
UVM RAL maps hardware registers to software objects so verification components can read/write registers using high-level APIs instead of raw protocol transactions.
| Hardware Concept | UVM RAL Equivalent |
|---|---|
| Register address | uvm_reg::get_address() |
| Read/Write access | uvm_reg_field::access (e.g., "RW", "RO") |
| Register block | uvm_reg_block containing multiple uvm_reg instances |
| Memory map | uvm_reg_map associated with a bus agent (e.g., APB) |
A register model (apb_reg_block) is built once and reused across tests to perform register-level stimulus (e.g., reg_model.ctrl_reg.write(status, 0xABCD)), decoupling test logic from protocol details.
Practice
Open RtlStudio and select this chapter. Files appear automatically in Explore.
- Open
student/tb/tb_top.svin the editor. - Add register model declarations and build logic using
uvm_regAPIs. - Declare
apb_reg_block,uvm_reg ctrl_reg,uvm_reg stat_reg, anduvm_reg data_regwith correct addresses (0x00, 0x04, 0x08) and access types (RW, RO, RW). - In the
build()method, create the register map, instantiate each register, add fields (e.g.,uvm_reg_fieldforctrl_reg[7:0]), and connect the map to the APB agent viauvm_config_db. - Run Simulation and verify log output matches Expected Results below.
Summary
You practiced building an APB register model using UVM RAL, declaring three registers—ctrl_reg, stat_reg, and data_reg—aligned with the hardware memory map. You configured each register’s access type, address offset, and field policies to match the physical register behavior. The key takeaway is that UVM RAL transforms hardware registers into software-accessible objects, enabling structured, reusable verification of register-level functionality. This abstraction bridges hardware design and verification, making register access predictable and testable.
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 Why UVM RAL maps registers to objects. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.