What you practice
AMBA APB: PSEL, PENABLE, PWRITE timing (5.1). Learn APB SETUP/ACCESS timing and verify slave behavior in simulation. It is in APB protocol — 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 the APB protocol timing model: SETUP phase with PSEL asserted alone, and ACCESS phase with both PSEL and PENABLE asserted, while PWRITE selects read/write direction.
Learning objectives
- Understand APB SETUP and ACCESS phase timing rules.
- Identify when
PENABLEmust be asserted relative toPSEL. - Distinguish read (
PWRITE=0) and write (PWRITE=1) phases in APB transactions. - Verify APB slave behavior via simulation timing and logs.
Theory
APB uses a two-phase handshake: SETUP and ACCESS. In SETUP, PSEL is asserted while PENABLE is low; in ACCESS, PENABLE rises on the next clock edge while PSEL remains high. PWRITE determines whether PWDATA is driven (write) or PRDATA is sampled (read).
| Phase | PSEL | PENABLE | PWRITE | Data direction |
|---|---|---|---|---|
| SETUP | 1 | 0 | X | Address/setup |
| ACCESS | 1 | 1 | 0/1 | Read or Write |
The slave must assert PREADY during ACCESS to indicate completion; PSLVERR indicates error.
Practice
Open this chapter in RtlStudio; all files appear in Explore.
- Open
student/tb/tb_top.svin the editor. - Add stimulus to drive
PSEL,PENABLE,PWRITE,PADDR, andPWDATAduring SETUP and ACCESS phases. - Ensure
PENABLEis low during SETUP, then high during ACCESS on the next clock edge. - Run Simulation and verify
INFO:logs appear in the Log panel. - Open the Waveform tab to inspect
PSEL,PENABLE, andPWRITEtiming alignment.
Summary
You practiced driving APB timing signals—PSEL, PENABLE, and PWRITE—using a finite state machine in the APB driver to correctly transition from SETUP to ACCESS phases. You verified correct register access timing by observing PENABLE assertion only during the ACCESS phase, with PSEL held high and PWRITE reflecting the operation type. This reinforced the fundamental APB protocol requirement that PENABLE must be stable and valid only during the data transfer phase, ensuring reliable slave interaction. The VCD waveform confirmed that all timing constraints were met, validating the driver’s compliance with the APB specification.
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 AMBA APB: PSEL, PENABLE, PWRITE timing. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.