Skip to question and answer

Hardware interview practice

UVM get_next_item and item_done Handshake

MediumUVM ComponentsMultiple choice

What is wrong with this driver loop?

Question code
forever begin
  seq_item_port.get_next_item(req);
  drive(req);
  seq_item_port.get_next_item(req);
end

Answer choices

  1. A. The driver must call item_done exactly once for the first get_next_item before requesting another item
  2. B. Nothing; get_next_item implicitly completes the prior item
  3. C. drive must be a function rather than a task
  4. D. A driver may call get_next_item only once in its lifetime

Concise answer

The answer and the key reason

The loop requests a second item before completing the first. After each successful `get_next_item(req)`, the driver must finish driving that request and call `item_done()` exactly once before another `get_next_item`. Otherwise the sequencer-driver handshake can stall or report a protocol violation.

Deeper explanation

Work through the implementation and tradeoffs

`get_next_item` grants the driver access to one sequence item while the sequencer retains an outstanding handshake for it. Driving the pins does not tell the sequencer that processing is complete. The explicit `item_done` call closes that transaction and allows the sequence’s completion path and sequencer arbitration to progress.

The usual loop is therefore get, drive, then complete before repeating. Error and reset branches must preserve that pairing as well; abandoning a granted item can leave the originating sequence blocked. APIs such as `get` use different completion semantics, but they should be chosen deliberately rather than mixed with an incomplete `get_next_item` protocol.

What to remember

  • One item may be outstanding
  • Driving does not complete it
  • Call item_done before repeating

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 Connect a UVM Sequencer and DriverUVM ComponentsHow a UVM Analysis Port WorksReference ModelsHow to Build an Out-of-Order UVM Scoreboard