Welcome to the APB (Advanced Peripheral Bus) Master-Slave implementation in Verilog RTL! π― This project demonstrates the full APB protocol including master and slave FSM-based logic with memory operations, protocol error detection, address range validation, and extensive modular testbenches.
π‘ Built as part of my self-learning and internship experience in the field of VLSI Design Verification using EDA Playground.
- π Project Structure
- π§ What is APB?
- π§© Features
- π§ͺ Simulation Guide
- π¬ Testcase Scenarios
- π Waveform Debugging
- π Learning Outcomes
- π§ Future Enhancements
- π¨βπ» Author
- π License
APB (Advanced Peripheral Bus) is part of the AMBA protocol suite from ARM, ideal for connecting low-power peripherals such as timers, UART, GPIOs.
- PCLK β Clock
- PRESETn β Reset (active-low)
- PADDR β Address bus
- PWDATA β Write data
- PRDATA β Read data
- PWRITE β Write enable
- PSEL β Slave select
- PENABLE β Transfer phase control
- PREADY β Slave ready response
- PSLVERR β Slave Error indicator π¨
- FSM with states: IDLE β SETUP β ENABLE
- Accepts transfer signal to start transactions
- Supports both read (READ_WRITE=0) and write (READ_WRITE=1) operations
- Transfers address and data only in correct state
- Receives read data when PREADY is high
- FSM: IDLE β SETUP β ENABLE
- Implements a 256-byte internal memory π§
- Valid address range: 0x05 to 0xF1
- Detects protocol violations (e.g., PENABLE high in SETUP)
- Responds with PSLVERR=1 for invalid address or protocol error
- Handles wait state using PREADY
You can run this project on EDA Playground directly:
π Click Here to Simulate APB Master on EDA Playground π Click Here to Simulate APB Slave on EDA Playground
Each scenario can be simulated using $test$plusargs()
:
Plusarg | Description |
---|---|
+WRITE_CONT |
Continuous write to multiple valid addresses π |
+READ_CONT |
Continuous read from valid addresses π |
+WRITE_RANDOM |
Random data and address write β¨ |
+DEF_MEM_LOC |
View default memory content after reset π§Ό |
+FINAL_MEM |
Dump full memory after transactions π |
+PSLVERR_AT_WRITE |
Invalid address write triggers PSLVERR π¨ |
+PSLVERR_AT_READ |
Invalid address read triggers PSLVERR π |
+WRITE_PENAB1_AT_IDLE |
Protocol error (PENABLE=1 during IDLE) |
+READ_PENAB1_AT_IDLE |
Protocol error on read |
+RST_CHECK |
Check memory reset functionality and data clearance π |
+NO_XFER_PSEL_ONLY |
PSEL toggled without PENABLE (no real transfers) β |
+BURST_WRITE_INVALID |
Back-to-back writes without deasserting PENABLE β |
Plusarg | Description |
---|---|
+SINGLE_WRITE |
Single write transaction initiated by master βοΈ |
+SINGLE_READ |
Single read transaction by master π§ |
+WRITE_AT_PREADY_LOW |
Write attempt when PREADY is low (ignored) π |
+READ_AT_PREADY_LOW |
Read attempt when PREADY is low (ignored) π |
+TRANSFER_LOW |
Transfer signal permanently low (no transaction) β |
+RST_CHECK |
Reset applied during active transfer (reset test) π |
+RANDOM_WRITE |
Random address and data write from master π² |
+WRITE_CONT |
Continuous writes (3 back-to-back) from master πΎ |
Single Write and Single Read Operation - APB Master
Write and Read Operation - APB Slave
Slave Error Response - APB Slave
Protocol Violation - APB Slave
Run more testcases from EDA Playground!
β¨ Designed and verified a full-fledged APB master-slave interface
π οΈ Practiced FSM-based control logic in Verilog
β
Gained hands-on debugging with plusargs and $monitor()
π§ Understood protocol behavior and bus transactions
π Simulated and analyzed waveform using GTKWave
- β Integrate APB Master + Slave in one top module
- β Add configurable wait states for PREADY
- π Add burst transfer support (APB 3.0 feature)
- π‘οΈ Add assertion checks (SVA)
- π APB to AHB Bridge
- π Open-source toolchain integration
Dutt Panchal