Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
    • How to Dissect a Protocol
    • UART
    • SPI
    • I2C
    • APB
    • AHB
    • AXI4
    • AXI-Stream
    • PCI Express
    • DDR
    • CHI
    • Ethernet
    • USB
    • UCIe
    • CXL
    • Protocols Compared: Protocols Dissected
    • Drills: Protocols Dissected
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 16: Protocols Dissected
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 16: Protocols Dissected
  4. PCI Express

Part 16 · Protocols Dissected · Senior (S)

PCI Express

PCI Express dissected through the twenty questions: embedded clocks and block codes, credits instead of ready, posted and non-posted transactions, a producer-consumer ordering table, link-level replay, LTSSM training, power states and compliance. The protocol that uses almost every mechanism in this course, and why.

On this page

    Note

    Level: Senior (S) · Answers: How do real protocols answer the fifteen questions?

    Before this: AXI4, Credit-Based Flow Control

    A graphics card from one vendor plugs into a motherboard from another, over a connector and traces that neither designed, at 32 gigatransfers per second per lane. It must find the other side, train the link, agree on speed and width, survive bit errors without losing a packet, keep producer-consumer ordering for software written decades ago, sleep when idle, and pass a compliance test. PCI Express is what a protocol looks like when every one of the fifteen questions matters.

    How does PCI Express answer each question, and which constraint drives each answer?

    Constraints first: what PCI Express had to work with

    Constraint

    PCI Express

    C1 Distance and medium

    Boards, connectors and cables: lossy channels at very high rates

    C2 Bandwidth and latency

    Very high bandwidth per lane (fact P17), latency in hundreds of nanoseconds

    C3 Wires

    Few: one differential pair each way per lane, 1 to 32 lanes (fact P13)

    C4 Topology

    Point-to-point links forming a tree through switches

    C5 Who builds each side

    Any vendor; must interoperate across generations; compliance tested (fact P37)

    The transaction layer handles meaning, flow control and ordering; the data link layer makes each link reliable; the physical layer moves bits and trains the link. Only the physical layer is actually wired; the upper layers talk through it.

    PCI Express's answers to the fifteen questions

    Each answer links to the lesson that explains the idea behind it.

    #

    Question

    Answer

    1

    When is the data valid?

    Clock embedded in the data and recovered by CDR; SKP ordered sets compensate for clock differences (fact P11) (1.4)

    2

    Where does a message start and end?

    8b/10b (Gen1-2), 128b/130b blocks (Gen3-5), 256-byte flits (Gen6), with framing tokens (facts P8, P10, P12, P23) (2.6)

    3

    Is the receiver ready?

    No ready signal: a sender may transmit only with credits for the receiver's buffers (4.3)

    4

    How much may I send before I hear back?

    Six credit types (posted, non-posted, completion; header and data), initialised with InitFC and returned with UpdateFC (facts P1 to P4) (4.6)

    5

    What exactly is being asked?

    Memory, I/O, configuration and message requests; posted writes and non-posted reads; atomics; no request crosses 4 KB (facts P9, P15, P19, P22) (5.7)

    6

    How many requests can be in flight?

    Many outstanding non-posted requests matched by tag; completions may be split and may return out of order across tags (facts P24, P25) (6.8)

    7

    In what order do results become visible?

    The producer-consumer ordering table, with relaxed ordering and ID-based ordering as opt-outs (facts P20, P21, P28) (7.6)

    8

    Who gets the wire?

    Point-to-point links joined by switches; traffic classes mapped to virtual channels (fact P27) (8.8)

    9

    Why can it hang?

    Posted writes must be able to pass non-posted requests and completions, which breaks the classic request/response deadlock (fact P28) (9.4)

    10

    What if bits go wrong?

    Non-flit mode (Gen1 to Gen5): per-TLP LCRC, 12-bit sequence numbers, ACK/NAK and go-back-N replay. Flit mode (Gen6, 64 GT/s): 256-byte flits with FEC and a flit CRC; sequence numbers, ACK/NAK and replay work per flit and TLPs carry no LCRC. Both: optional end-to-end ECRC, AER reporting (facts P5 to P7, P10, P30, P40) (10.11)

    11

    How do the two sides agree at start-up?

    LTSSM: Detect, Polling, Configuration to L0, with Recovery for retraining and speed changes; software enumeration through configuration space (facts P32, P33) (11.4)

    12

    How do we save power without losing data?

    Device states D0 to D3cold, link states L0s, L1 (with substates), L2; ASPM; WAKE# or beacon (fact P34) (12.2)

    13

    What if there are several copies of one value?

    Not a coherence protocol; DMA is normally snooped by the host, and No Snoop opts out (fact P21); CXL adds coherence on the same physical layer (13.7)

    14

    Who is allowed to ask?

    Requester IDs, ACS, ATS and PASID with the host IOMMU, SR-IOV, and IDE link encryption (fact P35) (14.3)

    15

    How do we know it is correct?

    PCI-SIG compliance workshops and the Integrators List (fact P37) (15.8)

    The choices that define PCI Express

    • Layering: physical, data link and transaction layers each answer separate questions, so generations can change encoding without changing transactions. Gen1 to Gen5 changed only the physical layer (8b/10b, then 128b/130b). Gen6's flit mode went further and changed the data link layer too: reliability moved from per-TLP LCRC and sequence numbers to per-flit CRC, FEC and replay (fact P40). The transaction layer, and so software, stayed the same.

    • Reliable links, lossless fabric: per-link replay plus credits mean no TLP is dropped for errors or congestion.

    • Software compatibility: the ordering model and configuration space preserve the behaviour of the PCI bus that software was written for.

    • Interoperability machinery: training, negotiation, enumeration and compliance exist because any vendor's part must work with any other's.

    What breaks

    An endpoint (illustrative) advertised more completion credits than its buffer could hold, assuming the host would never have that many reads outstanding. Under a new driver with deeper queues, completions arrived faster than it could drain, its buffer overflowed and data was corrupted silently. The fix was in the endpoint's read side, not its credits: endpoints must advertise infinite completion credits (fact P3), so an endpoint has to limit its outstanding reads to the completions its buffer can always sink.

    Why this matters

    Senior lens. PCI Express shows how far each mechanism must go when the constraints are severe: lossy channels force training, equalisation and replay; unknown partners force negotiation, enumeration and compliance; software history forces the ordering table. When you learn a new high-speed protocol, compare it with PCIe question by question: most choices are the same, and the differences point at a different constraint.

    Interview

    Asked: "Why does PCIe have both credits and ACK/NAK?"

    Weak answer: They do the same thing for safety.

    Strong answer: They answer different questions at different layers. Credits are transaction-layer flow control: the sender may only send a TLP if the receiver has advertised buffer space for its type, so the fabric never drops packets for congestion, with six credit types so posted, non-posted and completions don't block each other. ACK/NAK is the data link layer's reliability: in non-flit mode each TLP carries a sequence number and LCRC (in Gen6 flit mode the same job is done per 256-byte flit, with FEC in front), the receiver acknowledges good ones and NAKs bad ones, and the sender replays from its replay buffer. One prevents overflow, the other recovers corruption.

    Follow-ups: (1) What breaks if posted writes cannot pass non-posted requests? (2) Where does ECRC fit?

    Check yourself Which PCIe layer would change if a new generation used a different line code?

    Only the physical layer; transactions, credits and ordering are unchanged. (Gen6 did more than change the line code: its flit mode also reworked the data link layer's framing and replay, still without changing transactions.)

    Check yourself Why must posted writes be able to pass non-posted requests?

    Otherwise a non-posted request waiting for a completion can block the posted writes the completer needs to make progress, a deadlock.

    Key takeaways

    • PCIe answers every question: embedded clocks, block codes, credits, posted and non-posted transactions, ordering table, replay, training, power, security, compliance.

    • Layering lets each generation change the lower layers (the physical layer, and in Gen6 flit mode the data link layer too) while keeping transactions and software unchanged.

    • Severe constraints (lossy channels, unknown partners, legacy software) explain its complexity.

    Keep going

    Next: Lesson 16.10, DDR. A memory interface where the controller decides everything and the DRAM just keeps time.

    Related topics

    • Part 16 overview: Protocols Dissected

    Previous

    215 / 234

    Next: DDR

    Up next

    Up nextDDR

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • How to Dissect a Protocol
    • UART
    • SPI