Skip to question and answer

Hardware interview practice

How to Drive a Ready/Valid Interface Correctly

MediumUVM ComponentsOpen ended

Implement the core of a UVM driver for a single-beat ready/valid interface. Present one sequence item, hold its payload stable while stalled, and finish the item only after a real handshake.

Worked case

Example

Input
driver owns payload A; sampled ready values on successive clocks are X,0,1
Output
report unknown ready; hold valid/data A; then complete exactly one handshake on the third edge

Explanation: Only known-high ready accepts the beat; X and zero both preserve the same asserted payload and defer item_done().

Reasoning requirements

  1. A beat completes only on a sampled clock edge where valid and ready are both exactly 1.
  2. Once valid is asserted, data and control must not change until that handshake.
  3. Treat X or Z on ready as not-ready and report it instead of accepting the beat.
  4. Leave the interface idle between items unless a separate pipelining policy says otherwise.

Concise answer

The answer and the key reason

The driver should fetch one item, drive its payload and valid once, and wait at clocking-block sample points until ready is exactly 1. It must keep every driven field unchanged during backpressure, lower valid after acceptance, and call item_done only after the handshake edge.

Deeper explanation

Work through the implementation and tradeoffs

A ready/valid transfer exists only on a clock edge that samples both controls high. Therefore a stalled beat is still the same in-flight beat: valid stays asserted and payload and control stay unchanged. Repeatedly rewriting the payload inside the wait loop risks presenting multiple logical values before any one of them has been accepted.

A clocking block gives the testbench defined drive and sample regions, avoiding races with the DUT. Treat an unknown or high-impedance ready as refusal and report it, because optimistic acceptance would hide interface corruption. Once the accepting edge occurs, return the bus to idle and then notify the sequencer that the item is complete.

What to remember

  • Handshake only on valid and ready
  • Hold payload stable during stalls
  • Acknowledge after acceptance

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

RTL DesignHow to Build a Synchronous FIFO in SystemVerilogClock Domain CrossingClock-Domain Crossing Strategies for ASIC InterviewsReset DesignAsync Assert, Sync Deassert Reset