UVM Components Interview Questions

Questions on Agents, Drivers, Monitors, Scoreboards, and Environments.

Beginner Level

What constitutes a standard UVM Agent?

An Agent contains: Sequencer (Stimulus flow), Driver (Pin wiggling), and Monitor (Pin observation). It has an `is_active` config to determine if it's Active (all 3) or Passive (Monitor only).

Intermediate Level

How does the Driver ask for data?

Using `seq_item_port`. Standard flow:

  1. `seq_item_port.get_next_item(req);` (Blocks until item available)
  2. `drive(req);`
  3. `seq_item_port.item_done();` (Signals completion)

Advanced Level

How do you implement an Out-of-Order Scoreboard? (Code Snippet)

Use an Associative Array (Pool) to store expected transactions, using a unique ID (like a tag or address) as the Key.

class my_scoreboard extends uvm_scoreboard;
  my_pkt expected_pool[int]; // Keyed by ID
  function void write_exp(my_pkt pkt);
    expected_pool[pkt.id] = pkt;
  endfunction
  function void write_act(my_pkt pkt);
    if (expected_pool.exists(pkt.id)) begin
       if (expected_pool[pkt.id].compare(pkt)) 
         `uvm_info("PASS", "Match", UVM_LOW)
       else 
         `uvm_error("FAIL", "Mismatch")
       expected_pool.delete(pkt.id);
    end else begin
       `uvm_error("FAIL", "Unexpected ID received")
    end
  endfunction
  function void check_phase(uvm_phase phase); // End of Sim check
    if(expected_pool.size() > 0) 
      `uvm_error("FAIL", $sformatf("%0d Dropped packets", expected_pool.size()))
  endfunction
endclass
Can you execute a Sequence on a Driver?

No. Sequences run on Sequencers. The Driver only consumes *Sequence Items* (Transactions). The Sequencer bridges the gap.