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
    • Why Flow Control
    • On/Off Flow Control
    • Credit-Based Flow Control
    • Credit Initialisation
    • The Credit Loop and Buffer Sizing
    • Credit Classes and Pools
    • Credit Return Latency and Batching
    • Credit Bugs
    • Window Flow Control
    • Rate-Based Shaping
    • Hop-by-Hop or End-to-End
    • Lossless or Lossy
    • Switching Modes
    • Head-of-Line Blocking
    • Choosing Flow Control
    • Protocols Compared: Flow Control
    • Drills: Flow Control
  • 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
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 4: Flow Control
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 4: Flow Control
  4. Choosing Flow Control

Part 4 · Flow Control · Principal (P)

Choosing Flow Control

A decision guide for any link: which flow-control mechanism fits, how to size it, and the questions a principal engineer asks in review.

On this page

    Note

    Level: Principal (P) · Answers: How much may I send before I hear back?

    Before this: The Credit Loop and Buffer Sizing, Skid Buffers

    A new subsystem has five links: a register bus, a 64-bit stream between neighbouring blocks, a 3 mm path with four pipeline stages, a chip-to-chip link, and a DMA port into shared memory. A review asks one question for each: why this flow control and not another? "We always use valid/ready" is not an answer. This lesson turns Part 4 into a method.

    Given a link, how do you choose its flow control and prove it is sized correctly?

    The obvious answer, and why it breaks

    The obvious approach is to use one mechanism everywhere, usually whichever the team knows best. It works until a link's round trip grows, or a shared resource needs protecting, or losses become possible, and then the familiar mechanism quietly costs throughput or correctness. The choice follows from a few properties of the link, and the same few questions settle it every time.

    The idea: four questions

    1. How late does the sender hear that the receiver is full? Within a cycle: valid/ready. A few cycles: valid/ready with skid buffers, or on/off with headroom. Many cycles: credits.

    2. Can data be lost on the way? If yes, delivery needs acknowledgements and a window bounding what may need resending (Part 10), plus credits or on/off for the receiver's buffer.

    3. Is the resource shared with traffic that must be protected? Add a rate limit (token bucket) at the sources, and separate queues or classes so one source's back-pressure does not block another's.

    4. Is the path multi-hop? Decide hop-by-hop versus end-to-end control, switching mode, and how to keep one slow endpoint from filling shared buffers.

    Flowchart. First question: does the stop signal arrive within one cycle? Yes gives valid/ready; a few cycles gives valid/ready with skid buffers or on/off with headroom; many cycles gives credits sized at bandwidth times round trip. Then: can data be lost? If yes, add acknowledgements and a window. Then: is the resource shared with protected traffic? If yes, add a token bucket at sources and separate queues per class. Then: is it multi-hop? If yes, per-hop credits plus end-to-end limits and a switching mode. Every path ends with sizing and checking the invariant.
    A decision guide: each question adds a mechanism; every path ends with sizing and an invariant to check.

    Worked example: the five links

    Link

    Late by

    Choice

    Sizing

    Register bus

    0 cycles

    Wait states (the target holds the transfer open)

    None: one transfer at a time

    Neighbour stream, 64-bit

    0 cycles

    valid/ready

    None

    3 mm path, 4 stages

    4 cycles each way

    valid/ready with a skid buffer per stage, or credits end to end

    Skid: 2 entries per stage. Credits: B ≥ RTT

    Chip-to-chip link

    Tens of cycles; bit errors possible

    Credits per class, plus a replay window

    B ≥ bandwidth × RTT per class; window ≥ bandwidth × ACK RTT

    DMA into shared memory

    Varies

    Credits or valid/ready, plus a token bucket

    R = the DMA's share; S from what other clients can tolerate

    For the 3 mm path, the two options cost about the same storage. Credits keep the stages simple forward registers and concentrate the buffer at the receiver; skid buffers keep every stage self-contained. The calculation below shows both.

    Diagram
    3 mm path: 4 forward stages, 4 return stages, 1 cycle each end (illustrative)
    Skid buffers: 4 stages x 2 entries                     = 8 entries, spread out
    Credits:      RTT = 4 + 4 + 2 = 10 cycles -> B >= 10   = 10 entries at the receiver,
                  plus 4 plain forward registers (no ready path to time)

    The review checklist

    • What counts, and what frees it? Slots freed by consumption (credits), data freed by acknowledgement (window), tokens freed by time (rate).

    • Every term in the round trip, including return-path batching, clock-domain crossings and the receiver's own latency.

    • The conservation invariant, asserted every cycle in simulation, and an idle-state check that works in silicon.

    • Initialisation and reset: who advertises first, and what happens if one side resets alone.

    • Isolation: which traffic must never wait for which, and where it shares a buffer.

    • Lossless or lossy, and if lossless, the deadlock argument (Part 9).

    How real protocols chose

    Protocol

    Late by

    Mechanism

    APB

    0

    Wait states

    AXI, AXI-Stream

    0 per channel

    valid/ready per channel

    PCI Express

    Many cycles; lossy wires

    Credits per type and class, plus a replay window in the data link layer

    Ethernet

    Long links; congestion

    Lossy by default; PAUSE or priority flow control optionally; end-to-end window in TCP

    Each protocol's choice follows the four questions. The comparison page sets more of them side by side.

    What breaks

    A subsystem team (illustrative) standardised on valid/ready with skid buffers for every link, including one that later grew to a 20-cycle round trip after floorplanning. Each extra pipeline stage got its own skid buffer, and the link worked at full rate, but it held 40 entries of storage scattered across the route, and its ready path still had to be re-timed at every stage. Credits would have needed about 20 entries at the receiver and no ready path at all. The lesson was not that skid buffers are wrong; it was that the choice must be revisited when the round trip changes.

    Why this matters

    Principal lens. Treat flow control as part of the architecture specification, with a row per link: the mechanism, the round trip and its terms, the sizing, the classes, the invariant and the reset story. Most flow-control failures in silicon are not exotic; they are a round trip that grew, a return path that was optimised, a class that shares a buffer, or a reset that was not thought through. A table reviewed at every floorplan change catches all four.

    Interview

    Asked: "How do you choose between valid/ready and credits?"

    Weak answer: Credits are for PCIe, valid/ready is for AXI.

    Strong answer: By how late the sender learns the receiver is full. If within a cycle, valid/ready. If a few cycles, valid/ready with skid buffers, about two entries per stage. If many cycles, credits, with the receiver buffer at least bandwidth times the credit round trip, because a per-cycle ready would arrive too late and every stage would need a buffer. Then I add what the link needs beyond that: a replay window if data can be lost, a token bucket if the resource is shared, separate classes for traffic that must not block each other.

    Follow-ups: (1) At what round trip would you switch to credits? (2) What would you put in the review table for each link?

    Check yourself A link's round trip grows from 2 to 16 cycles after floorplanning. What should be revisited?

    The mechanism and the sizing: skid buffers per stage now add up to far more storage than a single credit buffer of about 16 entries, and the ready path must be timed at every stage.

    Check yourself Which question decides whether a link needs a window as well as credits?

    Whether data can be lost on the way. If it can, delivery needs acknowledgements and a window bounding unacknowledged data; credits alone only protect the buffer.

    Check yourself A DMA shares memory with a display engine. What flow-control piece protects the display?

    A rate limit (token bucket) at the DMA's port, with its burst size chosen from what the display can tolerate, plus separate queues so the DMA's back-pressure does not block display traffic.

    Key takeaways

    • Choose flow control from four questions: how late the stop arrives, whether data can be lost, whether the resource is shared, and whether the path is multi-hop.

    • Every choice ends with sizing from the round trip and an invariant to check.

    • Keep a per-link flow-control table in the specification, and revisit it when the round trip changes.

    Keep going

    Next: Protocols Compared: Flow Control. How a dozen protocols answer "how much may I send before I hear back?", side by side.

    Related topics

    • Part 4 overview: Flow Control

    Previous

    65 / 234

    Next: Protocols Compared: Flow Control

    Up next

    Up nextProtocols Compared: Flow Control

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Why Flow Control
    • On/Off Flow Control
    • Credit-Based Flow Control