What you practice
Mission: reg_model frontdoor write() one-liner (5.4). Control APB registers with a single RAL frontdoor write() instead of raw bus sequences. It is in Frontdoor — 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
Today you will use UVM RAL’s frontdoor mechanism to write registers via high-level reg_model.ctrl_reg.write() calls instead of manually driving APB bus signals.
Learning objectives
- Understand how UVM RAL’s
frontdoormaps register operations to bus transactions. - Use
reg_model.ctrl_reg.write(status, value, UVM_FRONTDOOR)to trigger APB writes. - Verify APB protocol signals (
PSEL,PENABLE,PADDR,PWDATA) appear correctly. - Distinguish between direct (
UVM_BACKDOOR) and frontdoor (UVM_FRONTDOOR) register access.
Theory
UVM RAL provides two ways to access registers: backdoor (direct HDL path) and frontdoor (via bus protocol). Frontdoor uses a registered adapter (apb_ral_adapter) to translate reg_item into apb_sequence_item, then drives the virtual interface. This mimics real software-driven register access.
| Access Type | Path | Use Case |
|---|---|---|
UVM_BACKDOOR | Direct memory read/write via reg_block::configure(..., .path("backdoor")) | Debug, reset values |
UVM_FRONTDOOR | adapter → sequencer → driver → vif | Realistic bus protocol testing |
The frontdoor path for a write() call is: reg_model.ctrl_reg.write(..., UVM_FRONTDOOR) → apb_ral_adapter::reg2bus() → apb_sequence → apb_driver → vif.psel, vif.penable, etc.
Practice
Open RtlStudio and select this chapter. Files appear in Explore — no manual setup needed.
- Open
student/tb/tb_top.svin the editor. - In the
initialblock, aftertest.build_phase(phase);, add a call toreg_model.ctrl_reg.write(status, 32'h5, UVM_FRONTDOOR);to trigger a frontdoor write. - Optionally add
reg_model.data_reg.write(status, 32'hDEADBEEF, UVM_FRONTDOOR);after the first write. - Run Simulation from the left sidebar.
- Check the Log panel for
INFO:lines confirming APB transactions. - Open the Waveform tab to verify
PSEL,PENABLE,PADDR,PWDATAfollow APB protocol.
Summary
You practiced controlling APB registers using a single high-level RAL write() call with UVM_FRONTDOOR, bypassing low-level bus sequences. This approach leverages the RAL adapter to automatically translate register operations into APB protocol signals like PSEL and PENABLE. The key takeaway is that frontdoor access enables clean, reusable register control without manual sequence coding.
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 Mission: reg_model frontdoor write() one-liner. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.