AMBA APB · Module 2
APB Bus Topology
APB as a point-to-multipoint bus — one shared address/control/data bus, one PSEL per subordinate, a decoder selecting exactly one, and why a non-one-hot select is a bug.
You already know APB has a manager and subordinates and that the manager drives every transfer. This chapter answers the question that role-naming leaves open: how are the many subordinates physically wired to the one manager, and how is exactly one of them picked? The answer is APB's topology — point-to-multipoint: one manager drives a single shared bus broadcast to every subordinate, with one dedicated PSEL per subordinate, and a decoder that asserts exactly one PSEL at a time. The single idea to carry: the lifecycle's "selected subordinate" is only well-defined when PSEL is one-hot — exactly one high — and a select that is not one-hot is a hardware bug, not a slow transfer.
1. What problem is being solved?
The problem is connecting one manager to many slow subordinates on a single cheap bus, while keeping exactly one of them the unambiguous target of each transfer.
A real APB subsystem hangs a fan-out of peripherals — a UART, a couple of timers, some GPIO — off one bridge. Giving each peripheral its own private point-to-point link back to the manager would multiply wires and logic across the whole fan-out, which is exactly the cost APB exists to avoid. So APB shares: address, control, and write data are driven once and broadcast to every subordinate in parallel. But broadcasting creates a new problem — if all subordinates see the same address and write strobe, which one should actually respond? APB solves this with a per-subordinate select line, PSEL, and a decoder that turns the address into exactly one asserted select. The topology, then, is two ideas working together:
- One shared bus, broadcast to all.
PADDR,PWRITE, andPWDATAare common signals every subordinate observes. - One dedicated
PSELper subordinate, exactly one high. The decoder reads the address and selects a single target; only that subordinate acts and drives the return.
2. Why the previous mental model is not enough
Knowing the manager/subordinate roles tells you who drives — but it does not tell you how many subordinates share the wires or how exactly one is chosen, and without those the lifecycle has no defined target.
The role view answers "the manager initiates, the subordinate responds." It is silent on the structural facts a real bus turns on: there is not one subordinate but many, they share one set of broadcast signals, and something must resolve the broadcast down to a single responder. If you skip the topology, the very first step of the transfer lifecycle — "the selected subordinate is presented the access" — becomes undefined, because selected has no meaning until you know how selection works. Two facts only the topology makes precise:
- The selected subordinate is named by a one-hot
PSEL. "The subordinate" in any APB sentence is shorthand for "the one subordinate whosePSELis currently high." If zero or two are high, there is no single selected subordinate and the lifecycle's contract breaks. - The shared return path has exactly one legal driver. Because every subordinate's
PRDATAandPREADYfeed a shared return back to the manager, exactly one subordinate may drive it at a time — which is the same as sayingPSELmust be one-hot. Topology and correctness are the same statement.
3. APB transfer mental model
The model: APB is one address being called out over a public-address system, with each subordinate wearing a numbered badge — and only the subordinate whose number is called steps forward.
The manager broadcasts the same announcement (PADDR, PWRITE, PWDATA) into a room full of subordinates; everyone hears it. What makes the system work is the badge check: a decoder reads the address, matches it to exactly one badge, and lights exactly that subordinate's select line. Only the called subordinate steps forward to act and to answer back; everyone else stays seated. Call out an address that matches no badge and nobody steps forward; accidentally light two badges and two people step forward at once and start talking over each other — which is precisely the failure this chapter is about.
Three refinements make the model precise:
- Broadcast is shared; selection is dedicated. One set of address/control/data wires is heard by all; the
PSELlines are private, one per subordinate. Sharing keeps the bus cheap; the dedicated selects keep the target unambiguous. - Exactly one badge lights — one-hot. The decoder's job is to guarantee that the asserted-
PSELcount is always exactly one when a transfer is in progress. That one-hot guarantee is the definition of "the selected subordinate." - Only the called subordinate answers. The return path (
PRDATA,PREADY) is shared too, so only the selected subordinate may drive it. One badge lit means one driver — clean. Two badges lit means two drivers — contention.
4. Real SoC / hardware context
In a real chip this topology is built by an address decoder sitting at the bridge, between the shared PADDR and the fan-out of PSEL lines. The decoder examines a field of the address — a per-peripheral "page" — and asserts exactly one psel_* line, the one whose page matches the address map. Everything else about the topology is just wires: the shared bus fans out to every subordinate, and the per-subordinate selects fan out one-to-one.
The decode itself is small combinational logic. From an incoming bus-level select and a page field, it asserts one and only one per-subordinate select — a one-hot output. Here is the focused shape of that decode (a teaching sketch, not a full decoder or production bridge):
// One-hot PSEL decode (teaching sketch). From the address page, assert exactly
// ONE psel_* line, gated by the incoming bus-level select. Not a full module.
module apb_psel_decode (
input logic sel, // bus-level: a transfer is targeting APB
input logic [3:0] page, // PADDR[15:12] — the per-peripheral page
output logic psel_uart,
output logic psel_timer,
output logic psel_gpio
);
localparam logic [3:0] UART_PAGE = 4'h0, TIMER_PAGE = 4'h1, GPIO_PAGE = 4'h2;
// Each select is the gated match of one page. Because the page values are
// mutually exclusive, AT MOST ONE psel_* is ever high — the one-hot property.
assign psel_uart = sel & (page == UART_PAGE);
assign psel_timer = sel & (page == TIMER_PAGE);
assign psel_gpio = sel & (page == GPIO_PAGE);
endmoduleThe one-hot property here is not enforced by extra logic — it falls out of the address map. Because UART_PAGE, TIMER_PAGE, and GPIO_PAGE are distinct values, at most one equality holds for any page, so at most one psel_* is high. That is also where the bug comes from: if two peripherals were assigned overlapping address windows, two equalities could hold at once and two selects would assert together — the topology would no longer be one-hot. The correctness of the bus rests on the discipline of the address map, not on a runtime check.
5. Engineering tradeoff table
The point-to-multipoint topology is a set of deliberate choices that keep the fan-out cheap at the cost of capabilities the control plane does not need.
| Topology choice | What it gives up | What it buys | Why it is correct for APB |
|---|---|---|---|
| Shared broadcast bus | Per-subordinate isolation | One set of wires for the whole fan-out | Slow, sparse traffic does not need private links |
One dedicated PSEL per subordinate | A few extra select wires | An unambiguous, decoded target | A single select line per peripheral is nearly free |
| One-hot select (exactly one high) | Multi-target broadcast writes | A single legal driver of the shared return | Two drivers on shared PRDATA/PREADY is contention |
| Shared, muxed return path | Concurrent responses | Cheap return wiring; one answer at a time | APB serializes anyway — only one transfer is live |
| Decode lives at the bridge | Distributed addressing | One place owns the address map | Centralizing the map makes one-hot easy to guarantee |
The throughline: APB shares everything it safely can — address, data, and the return path — and pays only for the one thing sharing cannot provide, an unambiguous target. That one paid-for thing is the per-subordinate PSEL, and keeping it one-hot is what makes the whole shared structure correct.
6. Common RTL / architecture / waveform mistakes
7. Interview framing
This is where an interviewer checks whether you understand APB as a structure, not just a signal list. The classic prompts are "draw how three peripherals connect to one APB manager" and "what happens if two PSEL lines are high at once?" — both probing the one-hot idea.
The strong answer names the topology and then the invariant. Topology: point-to-multipoint — one manager drives a single shared address/control/write-data bus broadcast to all subordinates, plus one dedicated PSEL per subordinate; the return (PRDATA, PREADY) is shared and muxed back. Invariant: a decoder reads the address and asserts exactly one PSEL — one-hot — so a single subordinate is the target and the single legal driver of the shared return. Then deliver the depth point: a non-one-hot PSEL (two high) is contention on the shared return, usually caused by overlapping address windows, and the fix is in the address map, not in adding logic. What the interviewer is really testing is whether you connect "shared return path" to "must be one-hot" — the realization that the topology and its correctness condition are the same statement.
8. Q&A
9. Practice
- Label the wires. Draw one manager and three subordinates. Mark which signals are shared/broadcast and which are per-subordinate, and draw the muxed return path back to the manager.
- Decode by hand. Given pages
0x0 → UART,0x1 → Timer,0x2 → GPIOand an address with page0x1, state whichPSELis high and which are low, and name the selected subordinate. - Break the map. Assign UART and Timer overlapping address windows. For an address in the overlap, state how many
PSELlines assert, what happens on the sharedPRDATA/PREADY, and what the manager reads. - Spot the bug. A waveform shows
PSEL_uartandPSEL_gpioboth high in the same cycle andPRDATAreading X. Explain, in topology terms, exactly what is wrong and where the fix belongs. - No-match behavior. An address matches no page in the map. State which
PSELlines assert and describe how a well-designed bridge completes the access without hanging the bus.
10. Key takeaways
- APB is point-to-multipoint: one manager drives one shared bus broadcast to many subordinates, not a bundle of private point-to-point links.
- Address, control, and write data are shared;
PSELis per-subordinate. Sharing keeps the fan-out cheap; one dedicated select per subordinate keeps the target unambiguous. - A decoder asserts exactly one
PSEL— one-hot — from the address. That single high line names the selected subordinate; selection is an address decode, not a race. - The shared return path has exactly one legal driver, which is the same statement as "
PSELmust be one-hot." Topology and correctness are one idea. - A non-one-hot
PSELis a bug, not a slow path. TwoPSELhigh means two subordinates drive the sharedPRDATA/PREADYat once — contention and an X on the return. - One-hot correctness lives in the address map. It usually breaks because of overlapping address windows, so the fix is mutually exclusive page assignments, not extra logic.