Skip to content

AMBA APB · Module 1

Typical APB SoC Architecture

Where APB sits in a real SoC — downstream of the AXI/AHB bridge, fanning out to peripherals through a one-hot decode and return mux.

You now understand why APB exists, where it sits in the family, how its two-phase transfer differs from the fast buses, why it is minimal, and what it really does — register access. This chapter assembles those ideas into the standard structure of an APB subsystem in a real SoC: a bridge from the fast bus, an address decoder that turns one shared PADDR into a one-hot PSEL, and a fan-out of peripheral register banks sharing one set of common signals. This is the shape you will recognize in essentially every chip.

1. What problem is being solved?

Two concrete problems: how does a fast-bus access reach a slow peripheral, and how do many peripherals share one cheap bus — solved by a bridge and a decoder respectively.

An APB subsystem has three parts:

  • The bridge — the seam between the fast bus (AHB or AXI) and APB. It accepts a fast-bus transaction, runs the corresponding two-phase APB transfer (SETUP then ACCESS), waits on PREADY, and returns the result upstream. It is the only block that sees both protocols.
  • The address decoder — APB peripherals share one set of common signals (PADDR, PWRITE, PWDATA, PENABLE), broadcast to all of them. The decoder examines PADDR and asserts exactly one PSEL, the addressed peripheral's select, so only that peripheral responds. It also multiplexes the selected subordinate's PRDATA and PREADY back toward the bridge.
  • The peripheral fan-out — the subordinates (UART, timers, GPIO), each receiving the broadcast common signals plus their own dedicated PSEL, each driving its own PRDATA and PREADY. Each is the minimal register bank from the previous chapter.

The defining idea is broadcast-the-common-signals, select-with-one-hot-PSEL, mux-the-return — the entire topology of an APB bus.

A bridge with an integrated decoder on the left drives a shared APB bus that fans out to UART, Timer, and GPIO subordinates, each with its own PSEL, with a return mux feeding read data back.
Figure 1 — a typical APB subsystem. The bridge receives transfers from the fast bus and drives the common APB signals (PADDR, PWRITE, PWDATA, PENABLE) onto the shared bus. The address decoder examines PADDR and asserts exactly one PSEL, one per subordinate, so only the addressed peripheral responds. The common signals fan out to the UART, Timer, and GPIO, each also receiving its dedicated PSEL. On the return path, each subordinate drives its own PRDATA and PREADY, and a return multiplexer selects the addressed subordinate's PRDATA and PREADY to send back through the bridge. Broadcast the common signals, assert one PSEL (one-hot), mux the return — the standard shape of every APB subsystem.

2. Why existing buses were not the right fit

The subsystem is structured as a bridge plus a shared-and-decoded bus — not a direct connection and not a crossbar — because each alternative is wrong for the control plane.

A direct connection of the fast bus to the peripherals is impossible: the fast bus and APB speak different protocols at different speeds. A processor on the fast bus expects pipelined or decoupled behavior; APB can only do its self-contained two-phase transfer, one at a time. So the bridge must stand between them, accepting the fast-side transaction, driving the APB SETUP and ACCESS cycles, waiting on PREADY, and only then completing upstream — holding the upstream transaction without stalling unrelated fast-bus traffic.

A crossbar (every master a private path to every peripheral) is overkill for the control plane: peripheral traffic is sparse and one-at-a-time, so the parallelism a crossbar buys is wasted, and its area is large. Instead APB broadcasts one PADDR (and the other common signals) to all subordinates and selects one with a one-hot PSEL — one shared bus, one decoder, N single-bit selects. That is dramatically cheaper than a crossbar, and exactly right for traffic that never needs two peripherals accessed at once. The bridge and decoder together turn a fast-bus access into a targeted register access on a shared, cheap bus — the whole job of an APB subsystem.

A PADDR feeds a decoder that compares its page field to an address map and asserts one of three PSEL lines high, with the matching UART select high and the others low.
Figure 2 — how the decoder turns an address into a one-hot PSEL. The manager presents PADDR; the decoder examines a field of it — here bits [15:12], the per-peripheral page — and compares it to the address map (page 0 → UART, page 1 → Timer, page 2 → GPIO). It asserts exactly one PSEL, the one whose page matches, and holds the others low (the one-hot property). In the example the page equals 0, so PSEL_uart is high and the others low. An address matching no map entry asserts no PSEL and is handled by completing the transfer harmlessly rather than hanging the bus. The address decode plus one-hot PSEL fan-out is what lets many subordinates share one set of common signals.

3. APB mental model

The model: APB is a party line, and PSEL is the name you call to get one listener to answer.

Picture an old shared telephone line where everyone hears every call, but each household has a distinct ring. The common signals (PADDR, PWRITE, PWDATA, PENABLE) are the conversation, heard by everyone. PSEL is the ring: the decoder rings exactly one household (asserts one select), and only that household picks up. The others hear the conversation but stay silent because they were not rung. When the answering household speaks back (PRDATA, PREADY), the return multiplexer makes the bridge hear the right household.

The model makes the properties intuitive:

  • Broadcast is cheap. Putting the conversation on a shared line costs one set of wires, not one per household — why APB broadcasts and selects with PSEL instead of a private bus per subordinate.
  • One-hot keeps it correct. Exactly one household is rung, so exactly one answers — no collisions. If the decoder asserted two selects, two subordinates would drive the return at once: a bug. One-hot discipline prevents it.
  • An unrung line is silent. Dial a number no one answers to (an unmapped address) and no household picks up. A well-designed bridge completes the transfer harmlessly — typically returning zero — so the caller is not left waiting forever (no bus hang).

4. Real SoC placement & hardware context

In RTL, the decoder and return mux are small and almost mechanical. Here is the canonical shape for a three-peripheral subsystem — one shared PADDR/PSEL in, a dedicated select out per subordinate, and the return paths in:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
// APB address decode + return mux — the heart of an APB subsystem.
// One PSEL per subordinate (one-hot), and the selected subordinate's
// PRDATA/PREADY routed back toward the bridge/manager.
module apb_decode #(
  parameter int DATA_W = 32
)(
  input  logic [31:0]       paddr,        // shared address from the bridge
  input  logic              psel,         // bridge has a live transfer to route
  // one dedicated select per subordinate (one-hot)
  output logic              psel_uart,
  output logic              psel_timer,
  output logic              psel_gpio,
  // return paths driven by each subordinate
  input  logic [DATA_W-1:0] prdata_uart, prdata_timer, prdata_gpio,
  input  logic              pready_uart, pready_timer, pready_gpio,
  // muxed result back toward the manager
  output logic [DATA_W-1:0] prdata,
  output logic              pready
);

The address map is a set of constants — each peripheral owns a page of the address space, picked out by a field of PADDR. The selects are pure combinational decode, gated by psel so nothing is selected when the bridge has no transfer:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
  // Each peripheral owns a 4 KB window; address bits [15:12] pick which one.
  localparam logic [3:0] UART_PAGE  = 4'h0;   // 0x...0xxx
  localparam logic [3:0] TIMER_PAGE = 4'h1;   // 0x...1xxx
  localparam logic [3:0] GPIO_PAGE  = 4'h2;   // 0x...2xxx
 
  wire [3:0] page = paddr[15:12];
 
  // One-hot select: only the addressed subordinate sees PSEL asserted, and
  // only while the bridge is actually driving a transfer (psel).
  assign psel_uart  = psel & (page == UART_PAGE);
  assign psel_timer = psel & (page == TIMER_PAGE);
  assign psel_gpio  = psel & (page == GPIO_PAGE);

The return mux selects the addressed subordinate's read data and ready. Crucially, the default arm handles an unmapped address — completing the transfer with a benign value so a stray access cannot hang the bus:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
  // Return mux: route the selected subordinate's PRDATA/PREADY back. The
  // default arm makes an unmapped access complete harmlessly instead of
  // hanging — no subordinate would drive PREADY otherwise.
  always_comb begin
    unique case (page)
      UART_PAGE:  begin prdata = prdata_uart;  pready = pready_uart;  end
      TIMER_PAGE: begin prdata = prdata_timer; pready = pready_timer; end
      GPIO_PAGE:  begin prdata = prdata_gpio;  pready = pready_gpio;  end
      default:    begin prdata = '0;           pready = 1'b1;         end
    endcase
  end
endmodule

Combined with the minimal subordinate from the previous chapter and a bridge, that is a working APB subsystem — small logic hosting a chip's entire peripheral fan-out.

At the whole-chip level, the APB subsystem is always the leaf tier, reached through a bridge. The path from a processor to a peripheral register is a chain: the CPU issues a load/store to a peripheral's address; the main interconnect (AXI on a large chip, AHB on a small one) decodes it and routes it to the APB bridge; the bridge runs the slow two-phase APB transfer and waits on PREADY; the addressed register is read or written, and on a read the data returns along the same chain. The upper tiers vary with chip scale; the APB leaf does not — only the bridge's upstream protocol changes. This makes the APB subsystem a self-similar block you can drop beneath any interconnect.

A left-to-right chain: CPU, interconnect (with memory), APB bridge, APB bus, and peripheral register banks, with a forward path and a read-data return path.
Figure 3 — the path from CPU to an APB peripheral register. The CPU issues a load or store; the main interconnect (AXI on a large chip, AHB on a small one), which also connects memory, decodes the address and routes a peripheral access to the APB bridge; the bridge runs the slow two-phase APB transfer and waits on PREADY; the addressed peripheral register bank is read or written, and read data returns along the same path. APB always sits at the end of the chain — the leaf tier — reached through one bridge, however the fast tiers above are arranged.

5. Engineering tradeoffs

The subsystem's structure embodies several clean tradeoffs.

ChoiceUpsideCost / caveat
Shared broadcast + one-hot PSELCheap — one bus, one decoder, N selects (vs a crossbar)Serial: one subordinate accessed at a time (right for control traffic)
One bridge for the whole fan-outSimple; contains the slow worldAll peripheral accesses serialize through it (fine — traffic is sparse; very large chips use several APB buses)
default arm on unmapped addressesRobust — no bus hang on a stray accessA few extra gates (always worth it)
Generous, aligned address windowsTrivial decode (compare a few high bits); room per peripheralConsumes address space (usually the right trade)

The throughline: the APB subsystem optimizes for cheap, robust, sparse register access across a large fan-out — shared signals and one-hot select for cheapness, a single contained bridge for simplicity, and a default arm for robustness. Every choice matches the control-plane traffic it carries.

6. Common RTL / architecture mistakes

7. Interview framing

Interviewers use the subsystem to test whether you can assemble the pieces into a working structure and reason about its failure modes — the difference between knowing the signals and knowing the system.

The strong answer describes the three-part structure — bridge, decoder, fan-out — and the broadcast / one-hot-PSEL / mux-the-return topology, then volunteers the two robustness points: that PSEL must be one-hot (or contention results) and that the decoder needs a default for unmapped addresses (or the bus hangs). Tracing a single store from CPU through the bridge and decoder to a subordinate's ACCESS-phase capture demonstrates end-to-end fluency. What interviewers are really probing is how it is built and how it breaks — overlapping windows cause PSEL contention; a missing default hangs the bus — which is exactly the integration-level competence the question is built to find.

8. Q&A

9. Practice

  1. Draw the subsystem. Sketch a bridge, decoder, and three subordinates, and label which signals are broadcast and which are per-subordinate.
  2. Decode an address. Given the page map in the SystemVerilog above, state which PSEL is asserted for address 0x4000_1010, and which register offset within that peripheral it targets.
  3. Trace a store. Walk a CPU store to a GPIO register through the chain: interconnect, bridge SETUP/ACCESS, decoder one-hot select, subordinate capture, return.
  4. Break the map. Describe two address-map mistakes (a missing default and an overlap) and the exact failure each produces.

10. Key takeaways

  • An APB subsystem is bridge + decoder + peripheral fan-out. The bridge translates the fast-bus transaction into the two-phase APB transfer; the decoder selects the target; the subordinates are minimal register banks.
  • The topology is broadcast, one-hot PSEL, mux-the-return. Common signals are shared across all subordinates; a single decoder asserts exactly one PSEL; the return path multiplexes the selected subordinate's PRDATA/PREADY.
  • PSEL must be one-hot. Overlapping windows that assert two selects cause contention on the shared return signals — prevent it with a clean map and a one-hot assertion.
  • The decoder needs a default for unmapped addresses. Otherwise no PREADY is driven and the bus hangs; the default arm completes a stray access safely, like a default slave.
  • APB is always the leaf tier, reached through one bridge. The fast tiers above vary with chip scale; the subsystem's internal structure does not — only the bridge's upstream protocol does.
  • The subsystem is small, self-similar, and universal. Recognize this block and you can read the peripheral subsystem of almost any SoC — and you know where to look (the address map and the bridge's PREADY handling) when a peripheral access misbehaves.