Ready/Valid Handshakes: Simple Protocol, Subtle Bugs

uses one synchronous AXI-style channel and treats a beat as the full payload, including any sidebands

EDA Academy

Ready/Valid Handshakes: Simple Protocol, Subtle Bugs

We often start debugging a streaming interface by searching for the missing data word. Start one step earlier. Find the clock edge at which a block claims it accepted or retired that word. If the handshakes on both sides of a buffer tell different stories, the first divergence usually narrows the search to a small piece of RTL.

This walkthrough uses one synchronous AXI-style channel and treats a beat as the full payload, including any sidebands. For AXI itself, check the specification for channel dependencies and reset requirements.

01. The One-Cycle Contract

Every rising edge asks the same question. Were VALID and READY both high when the edge sampled them?

  • If yes, the destination accepted one beat.

  • If either was low, zero beats crossed the interface.

Track this with a local event such as fire = valid && ready, qualified by your reset policy. Use the event to advance the state associated with that particular interface.

In the example, VALID is high at three consecutive edges, but only E2 also has READY high. The receiving side therefore records exactly one transfer.

02. Who Controls What?

The source drives VALID and the entire payload. The destination drives READY. Both sides can observe the handshake and update their own state after the sampling edge.

A FIFO illustrates why the roles belong to ports.

  • At the input it is a destination and advertises capacity.

  • At the output it is a source and advertises an available beat.

A pass-through module therefore has two independent handshake events to consider. Review each interface separately before reasoning about the module as a whole, especially if a beat can be accepted upstream while the downstream port is stalled.

03. VALID Must Not Wait for READY

An AXI-style source must be able to offer a pending beat while READY is low. A destination is allowed to wait until it observes VALID before asserting READY, subject to its interface timing rules. If a source also waits for READY, both sides can stay idle despite having work to do.

A regression with READY tied high will hide this bug.

  1. Start one test with READY low, queue a beat, and check that VALID eventually appears based on the source's own availability rules.

  2. Then assert READY and confirm that the pending beat transfers once.

04. Hold VALID Until the Transfer Completes

Once presented, a beat must remain offered through the edge at which it is accepted. Treat VALID as the presence of an outstanding beat. While READY is low, the source retains that beat. At the accepting edge it can retire the beat and either present another one or go idle after the edge.

The same rule applies even if the source has already accepted work from its own upstream stage. Keep the input acceptance and output acceptance events distinct so an internal queue update cannot accidentally clear an offer the destination has yet to accept.

05. DATA Must Stay Stable Under Backpressure

During a stall, preserve every field that describes the pending beat. This can include data, byte enables, a packet boundary marker, an ID, or user metadata, depending on the interface. A stable data bus can still carry the wrong beat if LAST changes early.

Check the complete payload bundle across stalled edges, including the edge that releases the stall. Once the beat transfers, the next one may carry different fields. A useful debug view shows VALID and READY beside the packed payload so changes in less visible sidebands are easy to spot.

06. The One-Cycle Pulse Bug

A source pulses VALID when a result arrives, then clears it unconditionally.

  • With READY high, the output appears correct.

  • With READY low on that edge, no transfer takes place. If the result was stored nowhere else, it is now lost.

The fix is to retain the pending result and hold VALID through acceptance. Check how a second result is handled while the first is stalled. The producer needs backpressure or enough buffering for the traffic it can actually generate. A single hold register can preserve one pending beat and has a finite capacity.

07. When Both Sides Change at Once

  • At E1 the destination samples A because VALID and READY are both high.

  • After E1 the source presents B and the destination lowers READY.

  • At E2 B remains pending, and at E3 B is accepted.

Watch the distinction between values sampled at the edge and values driven after the edge. A trace that mixes these viewpoints can make it look like the receiver sampled B at E1.

On a queue, also check simultaneous enqueue and dequeue. Both pointers can advance while occupancy stays constant, provided both port handshakes actually occurred.

08. Back-to-Back Transfers

When VALID and READY are high at consecutive rising edges, each edge accepts a beat. VALID can stay high across the entire burst. The payload may change between accepted beats, including when two consecutive beats happen to have identical values. Count edges with a handshake to distinguish those cases.

A design that inserts an idle cycle after every acceptance caps its local rate at one beat every two clocks even when both sides have work and capacity. Test a continuous stream with an always-ready destination to expose that avoidable throughput loss.

09. Throughput, Latency, and Bubbles

  • Measure latency per beat between two named events, such as input acceptance and output acceptance.

  • Measure throughput as accepted beats per clock over a stated window.

These metrics can move independently. A pipeline register can add a cycle of latency while preserving one beat per cycle in steady state.

In the six-edge example, four beats cross the interface. One idle edge comes from missing source data and another comes from downstream backpressure. Count VALID low and READY low separately to learn which side limited progress in a particular run.

10. Combinational READY Paths and Hidden Loops

Custom interfaces sometimes pass backpressure combinationally through a chain of stages. That can create a long timing path toward the source.

A combinational cycle is a separate problem and occurs when dependencies form a closed loop, such as a source deriving VALID from READY while a destination derives READY from VALID. The source behavior also violates the AXI-style contract. AXI interfaces have a separate restriction on combinational paths between their inputs and outputs.

Review the composed netlist and its timing paths alongside the local RTL, especially when integrating reusable blocks.

11. Elastic Buffers and Skid Buffers

  • An elastic stage stores beats and tracks whether storage is occupied.

  • A skid buffer uses spare capacity to absorb a beat when downstream stalls and upstream still sees READY.

With one edge of backpressure delay and at most one additional acceptance in that interval, reserve room for that extra beat. For instance, a two-slot stage holding A can accept B into its spare slot just as downstream stalls. The next edge blocks C until capacity is available again.

Implementation choices determine bypass latency, whether READY is registered, and sustained throughput.

12. Reset and Recovery Corner Cases

Decide what happens to in-flight beats when reset occurs.

  • A flush policy clears the corresponding valid state and discards buffered beats.

  • A preserve or retry policy needs explicit coordination across the affected blocks.

Qualify transfer counting with the agreed reset state, and test reset while a beat is stalled. If related blocks leave reset on different edges, exercise the resulting startup sequence and ensure a beat is accepted only by a live destination.

In a flush design, stored payload bits may still contain old data as long as cleared validity prevents their use.

13. Assertions That Catch the Real Bugs

First assert that a sampled stall implies VALID and the full payload remain stable at the next edge, with reset handling defined.

Then check end-to-end behavior. For an ordered buffer, compare each accepted output against the oldest accepted input and track occupancy as accepted inputs minus accepted outputs within a reset epoch. Counts can agree while a payload is duplicated and another is lost, so compare beat identity too.

Bounded progress checks need an explicit service assumption. If READY can remain low forever, the protocol alone cannot guarantee delivery.

14. Final Checklist — Trust the Handshake, Verify the State

  • In review, identify who drives each signal and mark the exact sampling edge.

  • Trace every state update that consumes or retires a beat back to its own handshake.

  • Verify that stalls preserve the full payload and that an always-ready destination can accept consecutive beats when the design promises full throughput.

  • Review the READY timing path, available storage, and reset behavior with the neighboring blocks in view.

  • In verification, combine local stall assertions with an ordered scoreboard.

  • Run a one-edge stall, a long stall, a full-buffer restart, and a reset with a pending beat.

An assertion and a scoreboard serve different purposes

Source-side assertion

Here is a source-side check for a synchronous interface with active-low reset. Bind it where VALID, READY and the packed payload are sampled together.

assert property (@(posedge clk) disable iff (!rst_n)
  (valid && !ready) |=> (valid && $stable(payload)));

The next sampled edge may be the acceptance edge. The expression still checks the original payload on that edge. For a DUT output this is a guarantee to assert. For an external input in a formal proof it may be an environment assumption, with a separate check on the upstream block.

Ordered scoreboard

  • For a registered ordered buffer, push a copy of the full input on each input handshake.

  • On each output handshake, pop and compare the oldest outstanding beat.

  • Model same-edge pass-through explicitly if the design supports it, and clear or reconcile the model according to the reset policy.

  • Use sequence tags in stimulus when identical payloads would otherwise obscure a duplicate or a dropped beat.

Targeted sequence

Run a targeted sequence before turning on random traffic.

  1. First queue A against READY low.

  2. Then accept A and present B on the following cycle.

  3. Stall B at the buffer boundary, fill the available slots, and restart the destination.

  4. Repeat the run with reset while B is pending.

  5. Compare input and output handshake logs alongside occupancy.

The first edge where those records disagree is the best place to inspect the RTL.

Download PDF

Comments