Embedded hardware: AMBA bus, memory and peripherals
AMBA (ARM Microcontroller Bus Architecture) defines on-chip bus families (AXI, AHB, APB) and related concepts (masters, slaves, arbitration, bursts, memory-mapped peripherals, DMA and wait-states) used to connect CPU, memory and peripherals in embedded systems.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
AMBA bus standards are the common way CPU cores, memories and peripherals are connected on an SoC. Engineers use AMBA knowledge when designing bus interconnects, mapping peripherals into memory, sizing buses for throughput and latency, and choosing arbitration and DMA strategies to meet real-time requirements.
Key ideas
Start with definitions (I define each term before use):
- AMBA: Advanced Microcontroller Bus Architecture — a family of on-chip bus protocol specifications from ARM for connecting components inside a System-on-Chip (SoC).
- Master: a bus agent that initiates a transaction (example: CPU, DMA controller).
- Slave: a bus agent that responds to a transaction (example: memory, UART peripheral).
- Interconnect: the wiring and logic that links masters and slaves and implements arbitration and routing.
- Arbiter: logic that decides which master gets the bus when multiple masters request it.
- Memory-mapped I/O: a method where peripherals are assigned fixed address ranges so the CPU reads/writes them using ordinary load/store instructions.
- DMA (Direct Memory Access): a master that transfers data between memory and peripherals without CPU intervention.
- Wait state: an extra clock cycle inserted when a slave cannot complete a transfer in one cycle.
- Burst transfer: a sequence of consecutive data transfers where address increments and arbitration/overhead is reduced.
- Handshake: a pair of signals (commonly VALID and READY in AMBA-AXI) used to transfer data when both sides agree.
AMBA bus families (short, exact definitions and assumptions):
- APB (Advanced Peripheral Bus): a low-performance, low-pin-count bus for simple peripherals. Assumes single-cycle address phase followed by an enable; simple control signals are PSEL, PENABLE, PWRITE, PREADY. APB is not pipelined.
- AHB (Advanced High-performance Bus / AHB-Lite): a single-clock-edge, pipelined bus for higher performance. Key signals include HADDR, HWDATA, HRDATA, HWRITE, HREADY (indicates slave ready), and HBURST for bursts. Assumes single arbiter and multiple masters; AHB-Lite is single-master simplified variant.
- AXI (Advanced eXtensible Interface): a flexible, high-performance, fully pipelined and burst-capable interconnect with independent read and write channels. Uses VALID/READY handshakes on five channels: AR (read address), R (read data), AW (write address), W (write data), B (write response). Supports multiple outstanding transactions and configurable burst lengths; ordering is preserved per ID while completions may be out of order across different IDs (full AXI). Common subsets: AXI4-Lite (single-beat, no bursts, simpler control) and AXI4-Stream (no addresses, streaming data with VALID/READY).
Exact, exam-style statements students should be able to write:
- A transfer on an AXI channel completes on the clock edge when VALID is high from the source and READY is high from the sink. (Assumption: both signals are properly synchronised to the same clock domain.)
- In APB, a peripheral access requires an address/setup cycle (PSEL=1) followed by an enable cycle (PENABLE=1). The slave asserts PREADY when data is valid.
- An arbiter can implement strict priority (highest priority master always wins), round-robin (fair access by rotating priority), or time-division (fixed timeslice). State the choice and implications for worst-case latency when designing real-time systems.
What to draw in exam diagrams (describe exactly):
- For a simple AMBA AHB/AXI diagram: Draw three blocks labelled Master0 (CPU), Master1 (DMA), Peripheral slave block (Memory, UART). Between masters and slaves draw a central block labelled "Interconnect / Arbiter". Draw arrows from masters to interconnect labelled HADDR/ARADDR, HWRITE/AW, HWDATA/WDATA; arrows from interconnect to slaves labelled same. Show a separate read-data path back to masters labelled HRDATA/RDATA. Add control signals near interconnect: VALID, READY, HREADY, PSEL, PENABLE.
Derivations commonly asked: latency and throughput relationship. Start from cycles-per-transfer and clock frequency, include wait states and bus efficiency when computing sustained throughput.
Formulas
Peak throughput (bytes/s) = (bus_width_bits / 8) * f_clock * transfers_per_cycle — bus_width_bits is bus data width in bits, f_clock in Hz, transfers_per_cycle typically 1 for single-beat.
Sustained throughput = Peak throughput * efficiency — efficiency ∈ (0,1] accounts for protocol overhead and gaps between bursts.
Access latency (s) = (base_cycles + wait_states) / f_clock — base_cycles is the cycles required by a perfect slave (often 1 for simple single-cycle), wait_states is added cycles.
Burst transfer time (s) = (address_phase_cycles + data_cycles_per_beat * beats + wait_overheads) / f_clock — use this to compute multi-beat transfers.
Symbols:
- bus_width_bits: data bus width (bits), unit bits
- f_clock: clock frequency, unit Hz
- transfers_per_cycle: number of data transfers completed per clock cycle (dimensionless)
- efficiency: dimensionless fraction
- base_cycles, wait_states, address_phase_cycles, data_cycles_per_beat, beats: counts of clock cycles
Worked examples
- Throughput of a 32-bit AXI data channel
- Given: 32-bit data bus, clock 100 MHz, assume one data transfer per cycle and 90% sustained efficiency.
- Formula:
Sustained throughput = (bus_width_bits / 8) * f_clock * transfers_per_cycle * efficiency. - Numbers:
(32 / 8) * 100e6 * 1 * 0.9 = 4 * 100e6 * 0.9 = 360e6bytes/s. - Final answer: 360 MB/s.
- Read latency with wait states
- Given: CPU on AHB at 50 MHz (f_clock = 50e6 Hz). A memory slave takes 120 ns to return data from when address is presented. How many wait states? What is read latency in cycles and seconds? Assume base_cycles = 1.
- One clock period = 1 / 50e6 = 20 ns.
- Memory time 120 ns requires ceil(120 / 20) = 6 cycles to complete. Subtract base_cycles 1 → wait_states = 5.
- Access latency = (1 + 5) / 50e6 = 6 / 50e6 = 120e-9 s.
- Final answer: 6 cycles = 120 ns.
- Address decoding and peripheral selection (model-answer style)
- Given: 32-bit address space. Map Flash at 0x0000_0000–0x0FFF_FFFF (256 MiB), SRAM at 0x2000_0000–0x2000_FFFF (64 KiB), UART at 0x4000_1000–0x4000_100F. For address 0x2000_0034 which peripheral is selected and what offset? Show steps.
- Check range: 0x2000_0034 ∈ 0x2000_0000–0x2000_FFFF → selects SRAM.
- Offset = 0x2000_0034 − 0x2000_0000 = 0x0034 = 52 decimal.
- Final answer: SRAM selected, offset 0x34 (52).
Common mistakes
- Treating burst transfers as free of protocol overhead — you must include address phase and possible arbitration gaps in sustained throughput.
- Using peak throughput in scheduling without accounting for bus efficiency and arbitration losses.
- Incorrectly calculating wait states by dividing times without ceiling to integer cycles.
For your exam
Question types you will get:
- Definitions: define AMBA, AXI, AHB, APB, master, slave, arbiter, DMA.
- Short notes: differences between AXI and AHB, APB use-cases, advantages of burst transfers, pros/cons of arbitration algorithms.
- Derivations: derive throughput and latency formulas from cycles and clock; show how wait states affect latency.
- Numericals: compute throughput, compute wait states from given response times, address decoding and offset calculations.
- Diagrams: draw bus interconnect showing masters, arbiter, slaves, and label key signals (HADDR/ARADDR, HWDATA/WDATA, HRDATA/RDATA, VALID, READY, HREADY, PSEL, PENABLE). What full-marks answers include:
- Clear definitions (bolded terms), assumptions stated (clock frequency, base cycles, whether pipelining is allowed), correct formulas written, step-by-step arithmetic with units, final answer boxed or bolded, and a correct diagram with labelled signals if requested.
Quick check
- What two signals form the fundamental handshake in AXI for transferring data?
- In APB which two signals indicate an active peripheral access and its enable phase?
- How many bytes per second is a 64-bit bus at 125 MHz at 100% efficiency? Answers: VALID and READY; PSEL and PENABLE; (64/8)125e6 = 8125e6 = 1,000,000,000 bytes/s = 1 GB/s.
Note to reviewer: I have aimed to be precise about signal names and timing behaviour but I list items to verify below.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?