VLSI DV Interview Puzzles · All levels

Duplicate Transactions from Handle Reuse

Scoreboard sees duplicate packets with changing fields, and old entries mutate in logs. Find why data appears to rewrite history.

Puzzle

Difficulty: Easy · Puzzle 3 of 6 · Topic: Scoreboard Puzzles: Mismatch or Ordering Bug?

Scoreboard sees duplicate packets with changing fields, and old entries mutate in logs. Find why data appears to rewrite history.

Code

systemverilog
class rsp_monitor extends uvm_component;
  uvm_analysis_port #(txn) ap;
  txn t;
  virtual task run_phase(uvm_phase phase);
    t = txn::type_id::create("t");
    forever begin
      sample_bus_into(t);
      ap.write(t); // same handle every time
    end
  endtask
endclass

Hint

Analysis ports pass object handles, not value copies.

Step-by-step solution

diagram
1) Print object handles/ids in scoreboard to confirm same pointer repeats.
2) Observe later sampling mutates previously queued entries.
3) Clone transaction before ap.write or allocate a new object each sample.
4) In scoreboard, optionally clone on receipt for defensive isolation.
5) Add checker that flags repeated handle reuse across writes.

Answer

Answer: Bug: monitor publishes the same transaction handle repeatedly; subscribers see mutated duplicates. Fix: clone/new transaction per write boundary.

Why candidates get it wrong

Compare logic can look broken even though ingestion semantics are wrong.

Interviewer follow-up

Which side should own defensive cloning: producer, consumer, or both?

Related topics