Skip to question and answer

Hardware interview practice

How a Ready/Valid Skid Buffer Handles Backpressure

HardRTL DesignOpen ended

Design a two-entry ready/valid skid buffer that can accept one extra item after downstream stalls, keeps output data stable while stalled, and removes the combinational ready path from downstream to upstream.

Worked case

Example

Input
start with occupancy=1 and front=A
cycle 1: s_valid=1,B; m_ready=0
cycle 2: s_valid=1,C; m_ready=1 (buffer is full)
cycle 3: s_valid=1,C; m_ready=1
Output
cycle 1: B is accepted into the second slot; output A stays stable; occupancy=2
cycle 2: A retires, s_ready=0 so C is not accepted; occupancy=1
cycle 3: B retires and C is accepted; occupancy remains 1

Explanation: The second slot captures B after the stall. Because ready is registered from occupancy, a pop observed while full cannot simultaneously admit C on cycle 2.

Reasoning requirements

  1. Accept input only on s_valid && s_ready and retire output only on m_valid && m_ready.
  2. Preserve ordering across push-only, pop-only, and simultaneous push/pop cycles.
  3. Drive s_ready from registered occupancy rather than combinationally from m_ready; when already full, a newly observed pop cannot also accept a replacement that edge.
  4. When m_valid is high and m_ready is low, hold m_valid and m_data stable.

Concise answer

The answer and the key reason

Implement the buffer as a two-entry FIFO with registered occupancy. Set upstream ready whenever occupancy is below two, output the head entry whenever occupancy is nonzero, and update storage from the four push/pop combinations. A stalled output keeps its head value unchanged; a full buffer may insert one bubble because ready cannot anticipate a same-edge pop.

Deeper explanation

Work through the implementation and tradeoffs

Compute push only from s_valid and registered-capacity s_ready, and pop only from m_valid and m_ready. A push into an empty buffer fills the head; a second push fills the spare slot. A pop from two entries promotes the spare. When one entry is simultaneously popped and replaced, the incoming item becomes the new head.

Deriving s_ready solely from occupancy breaks the long combinational path from downstream ready to upstream ready. The tradeoff is deliberate: at occupancy two, an output handshake cannot also authorize an unadvertised input handshake on that edge, so the buffer can briefly bubble at the full boundary. Stability assertions should cover every downstream stall.

What to remember

  • Use depth-two occupancy
  • Freeze output under stall
  • Expect a full-boundary bubble

Practice the complete prompt

Explain it first, then compare the reviewed solution.

Open this exact question in the practice bank to attempt it, check your reasoning, and access the full member solution.Practice this question

Keep practicing

UVM ComponentsHow to Drive a Ready/Valid Interface CorrectlyRTL DesignHow to Build a Synchronous FIFO in SystemVerilogClock Domain CrossingClock-Domain Crossing Strategies for ASIC Interviews