SiliconFix Logo

Mastering AMBA CHI: Part 4—Flow Control & Deadlocks

4 min read

In a vast Network-on-Chip (NoC) carrying thousands of concurrent, multi-phase transactions, congestion is inevitable. Without rigid mechanisms to manage traffic and resolve contention, a CHI interconnect would quickly succumb to deadlock—a state where transactions circularly depend on resources held by one another, causing the entire SoC to permanently halt.

AMBA CHI implements robust flow control at both the Link layer and the Protocol layer, alongside strict topological rules to guarantee forward progress.

Link-layer flow control governs the physical transmission of flits across a single hop (e.g., from an RN-F to its adjacent router, or between two routers in a mesh). It is a backpressure mechanism designed to prevent physical buffer overflows.

CHI utilizes a credit-based system.

  1. Credit Initialization: Upon reset, the receiving node informs the transmitting node how many flit buffers are available for a specific virtual channel (e.g., 8 buffers for the REQ channel). The transmitter holds a credit counter set to 8.
  2. Flit Transmission: Every time the transmitter sends a flit, it decrements its credit counter. If the counter reaches zero, the transmitter must halt transmission on that channel.
  3. Credit Return (LCrd): As the receiver processes flits and frees up buffer space, it sends Link Credit (LCrd) tokens back to the transmitter. The transmitter increments its counter, allowing transmission to resume.

Because LCrd operates strictly point-to-point, it handles local physical congestion but cannot resolve logical protocol-level blockages.

Protocol-Layer Flow Control: Retries and PCrd

Protocol-layer congestion occurs when logical resources at the target node (typically the HN-F) are exhausted. For example, if the HN-F can track a maximum of 128 outstanding requests, and it receives the 129th request, it cannot process it, even if link-layer buffers are empty.

CHI manages this via the Retry Mechanism and Protocol Credits (PCrd).

The Retry Sequence

  1. An RN-F sends a request (e.g., ReadShared) without a Protocol Credit.
  2. The HN-F receives the request but has no available tracker entries.
  3. The HN-F sends a RetryAck (Retry Acknowledge) response back to the RN-F on the RSP channel. The RN-F must now wait.
  4. Eventually, an older transaction completes, freeing a tracker entry at the HN-F.
  5. The HN-F sends a Protocol Credit (PCrdGrant) to the waiting RN-F.
  6. The RN-F re-transmits its request, this time tagging it to indicate it is consuming a granted PCrd. The HN-F is now guaranteed to accept it.

This two-tiered approach ensures that network routing buffers remain unclogged (handled by LCrd) even when destination processing resources are saturated (handled by PCrd).

Deadlock Avoidance Strategies

Deadlock in a coherency protocol usually arises from cyclic dependencies. A classic example: A Request (REQ) generates a Snoop (SNP). The Snoop requires a Response (RSP) to complete. If the RSP channel is blocked by traffic waiting for the REQ channel to drain, the system deadlocks.

CHI enforces strict, unbreakable rules to prevent this.

Message Class Separation

The four channels (REQ, SNP, RSP, DAT) are physically or virtually segregated. The protocol specification dictates strict dependency rules. For instance:

  • A node must always be able to sink (consume) an incoming RSP or DAT flit, regardless of the state of its REQ or SNP transmitters.
  • Responses can never be blocked by Requests.

This ensures that the “completion paths” (RSP and DAT) always drain. If the completion paths drain, outstanding transactions will eventually finish, freeing resources for new Requests.

Protocol Loopbacks

A specific topological deadlock risk occurs when a Home Node must issue a transaction back through the exact same network port it arrived on. This is common when an HN-F and an SN-F reside behind the same NoC router.

To handle this, CHI often requires implementation-specific buffering or virtual channels (VCs) dedicated to loopback traffic. By placing outbound traffic from the HN-F to the SN-F on a higher-priority, non-blocking virtual channel, the routing layer ensures that cyclical routing dependencies do not result in physical deadlocks.

With flow control and deadlock avoidance securing the foundation, the final part of this series will examine how CHI leverages this stable platform to perform highly advanced, system-level operations.