AMBA APB · Module 3
PSEL — The Subordinate Select
PSEL, the per-subordinate select — its one-per-subordinate fan-out, the one-hot decode the bridge owns, and why exactly one PSEL high is what names the active subordinate.
Module 2 told you APB is point-to-multipoint and that a decoder asserts "exactly one PSEL" to name the selected subordinate. That is the right role, but to drive or sample PSEL correctly in real RTL you need its exact contract: how many PSEL lines exist, who drives them, when each one is high, and how long it stays high inside a single transfer. PSEL is the per-subordinate select line — one dedicated line for each subordinate — that the bridge holds high across both phases of a transfer to name the single active target. The one idea to carry: PSEL is high in the setup cycle and the access cycle (it does not toggle between them like PENABLE), and exactly one of the N PSEL lines is high at any instant — anything else is a hardware bug.
1. What problem is being solved?
The problem is picking exactly one subordinate out of many on a shared, broadcast bus, and naming it for the whole duration of the transfer.
A real APB fan-out hangs a UART, some timers, and GPIO off one bridge. PADDR, PWRITE, and PWDATA are driven once and broadcast to every subordinate in parallel — cheap, but ambiguous: every subordinate sees the same address, so which one should respond? APB answers with a dedicated select line per subordinate:
PSELhigh on a subordinate means "this access is aimed at you — decode it, and if it completes, act on it and drive the return."PSELlow means "this access is not yours — ignore the broadcast, drive nothing on the shared return."
That single per-subordinate bit is what turns a broadcast into a point-to-point conversation. Without it, a broadcast bus would have no way to designate a target, and the shared return path (PRDATA, PREADY) would have no defined owner.
2. Why the lifecycle view is not enough
Module 2 named PSEL's role — the one-hot select that picks "the subordinate." That is true, but a role is not a signal contract. To wire PSEL into a real bridge or check it in a real subordinate, the topology view leaves three signal-level facts unstated:
- One
PSELper subordinate, and it is high across both phases. There is not one sharedPSELbut N of them — one dedicated line per subordinate. And within a transfer, the selected subordinate'sPSELrises in the setup cycle and stays high through the access cycle until completion. It does not pulse for one cycle and it does not toggle between phases. This is the sharp contrast withPENABLE, which is low in setup and only high in access. - The decoder is combinational, owned by the bridge, and driven straight from
PADDR. EachPSELline is a pure combinational decode of an address page field — no register, no FSM state of its own. The bridge owns the decode; a subordinate never drives its ownPSEL. - One-hot is an instantaneous invariant, not just a per-transfer one. At every instant a transfer is in progress, exactly one
PSELis high. Two high — even transiently from overlapping address windows — is contention on the shared return, not a slow transfer.
Knowing the role tells you what PSEL means; knowing the contract tells you what PSEL looks like on the wire across both phases — which is what you need to build or debug a transfer.
3. The signal's mental model
The model: PSEL is the spotlight that stays on the one performer for the entire act, not just the climax.
Picture a stage with several performers. The manager broadcasts the same cue (PADDR, PWRITE, PWDATA) to all of them, but a single spotlight — the decoder — picks out exactly one. That spotlight switches on the moment the act begins (the setup cycle) and stays on the same performer through the whole act, including the climax (the access cycle), until the act finishes. The other performers stand in the dark with their PSEL low. The crucial detail: the spotlight does not blink off between "begin" and "climax" — it is continuously on the selected subordinate, which is exactly why PSEL is high in both phases.
Three refinements make the model precise:
- One spotlight, exactly one performer lit — one-hot. The decoder guarantees that exactly one
PSELis high while a transfer is live. The lit performer is the definition of "the selected subordinate." - The spotlight stays on across the whole act.
PSELis high in setup (wherePENABLEis low — the decode window) and in access (wherePENABLEis high), holding through any wait states until completion. It is not a one-cycle pulse. - Lit means "your turn," not "done."
PSELhigh means the access is aimed at this subordinate; completion is the separate conditionPSEL,PENABLE, andPREADYall high. A subordinate usesPSELto know the transfer is its own, not that it is finished.
4. Real SoC / hardware context
In a real chip, each PSEL line is the output of a small combinational address decoder at the bridge. The decoder reads a page field of PADDR, compares it against the address map, and drives high the single psel_* whose page matches — every other psel_* stays low. There is no FSM state inside PSEL itself: it is a pure function of the address (gated by a bus-level select), which is why it tracks the address window for the whole transfer rather than pulsing.
// One-hot PSEL fan-out (teaching sketch — not a full bridge).
// From a bus-level select and the PADDR page field, assert exactly ONE psel_*.
logic sel; // bus-level: a transfer is targeting the APB space
logic [3:0] page; // PADDR[15:12] — the per-peripheral page
localparam logic [3:0] UART_PAGE = 4'h0, TIMER_PAGE = 4'h1, GPIO_PAGE = 4'h2;
// Each PSEL is the gated page match. Because the pages are mutually exclusive,
// AT MOST ONE psel_* is ever high at a time — 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);Two facts fall straight out of that decode. First, because the page values are mutually exclusive, at most one equality holds for any address, so the one-hot property is structural — it comes from the address map, not from a runtime check. Second, because sel and page stay stable for the whole transfer (the address holds across setup and access), the asserted psel_* holds high across both phases automatically — no extra logic is needed to keep the select alive through the access cycle.
On the subordinate side, PSEL is the gate that says "this transfer is mine." A correct subordinate qualifies everything it does on its own PSEL: it only decodes the broadcast when PSEL is high, and only commits at completion (PSEL and PENABLE and PREADY all high). Crucially, because its PSEL is high in both phases, the subordinate uses the setup cycle (PSEL high, PENABLE low) to decode and prepare, and the access cycle (PSEL high, PENABLE high) to perform — the same select line spanning both.
5. Engineering tradeoff table
PSEL is a deliberately minimal, per-subordinate signal. Each property trades a capability APB does not need for the simplicity it does.
PSEL property | What it gives up | What it buys | Why it is correct for APB |
|---|---|---|---|
| One dedicated line per subordinate | A shared encoded select bus | A trivial, decoded per-peripheral gate | One select wire per peripheral is nearly free |
Combinational decode from PADDR | Registered / pipelined selection | Zero-latency, glitch-bounded selection | Slow sparse traffic needs no pipelined decode |
| High across both phases | A one-cycle select pulse | A full setup-cycle decode window | The held select is what makes two-phase work |
| One-hot (exactly one high) | Multi-target broadcast writes | A single legal driver of the shared return | Two drivers on shared PRDATA/PREADY is contention |
| Bridge-driven, address-derived | Subordinate-chosen selection | One owner of the address map and decode | Centralizing the map keeps one-hot easy to guarantee |
The throughline: PSEL does one job — name the single active subordinate, for the whole transfer — and does it as a pure combinational decode of the address. Holding it across both phases is what gives the subordinate its decode window; keeping it one-hot is what keeps the shared return single-driver.
6. Common RTL / waveform mistakes
7. Interview framing
PSEL is a favourite because a precise answer proves you understand selection at the signal level, and a vague one ("it selects the slave") proves you do not. Interviewers ask "when is PSEL high?", "how does PSEL differ from PENABLE?", or "what happens if two PSEL are high?"
The strong answer states the contract, not just the role: PSEL is a per-subordinate select — one dedicated line per subordinate — driven by the bridge as a combinational decode of a PADDR page field, and the selected subordinate's PSEL is high across both the setup and access phases, held until PREADY completes the transfer. Then deliver two depth points. First, the PSEL-vs-PENABLE distinction: PSEL is high in setup where PENABLE is low, and that single cycle is the subordinate's decode window. Second, the one-hot invariant: exactly one PSEL is high at a time because the shared return has exactly one legal driver, so two PSEL high is contention — usually from overlapping address windows, fixed in the map, not with extra logic. Connecting "shared return path" to "must be one-hot," and "high in both phases" to "the decode window," is exactly what separates an engineer who can debug an APB waveform from one who cannot.
8. Q&A
9. Practice
- Draw the waveform. For one transfer, draw
PSEL,PENABLE, andPREADYacross all cycles. Mark the setup cycle, the access cycle, and the one cycle wherePSELis high andPENABLEis low. - Contrast the pair. From memory, state the value of
PSELand ofPENABLEin the setup cycle and in the access cycle, and explain what the difference in the setup cycle buys the subordinate. - Fan out the decode. Given pages
0x0 → UART,0x1 → Timer,0x2 → GPIOand an address with page0x2, write whichpsel_*is 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. - Gate the commit. Write the condition a subordinate should use to capture a write, and explain why gating on
PSELalone would commit in the setup cycle, before the access is performed.
10. Key takeaways
PSELis the per-subordinate select: one dedicated line for each subordinate, and exactly one of the N lines is high at a time — one-hot — naming the single active target.PSELis high across both phases. It rises in the setup cycle and holds through the access cycle until completion — unlikePENABLE, which is low in setup and high only in access.- The setup cycle —
PSELhigh,PENABLElow — is the decode window. It exists only becausePSELrises first and holds whilePENABLEwaits a cycle. - It is bridge-driven, a pure combinational decode of
PADDR. EachPSELis the gated page match; the held address keeps the select alive across both phases for free. PSELnames the target, not the finish. A write commits, and read data is valid, only whenPSEL,PENABLE, andPREADYare all high — never onPSELalone.- A non-one-hot
PSELis a contention bug, not a slow path. TwoPSELhigh means two subordinates drive the sharedPRDATA/PREADY— usually from overlapping address windows, fixed in the address map.