Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • OOP & Testbench Puzzles25
    • Handle and Copy Puzzles
      • Shallow Copy in Nested Payload
      • Queue of Handle Cells Still Aliases
      • Analysis Port Lifetime Reuse
      • Null Handle During Partial Deep Copy
      • Handle Equality vs Content Equality
      • Clone Without Overridden do_copy
    • Virtual Method Puzzles
    • Parameterized Class Puzzles
    • Factory Override Puzzles
    • OOP & Testbench Puzzles: Tricky Q&A
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Handle and Copy Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. OOP & Testbench Puzzles
  4. Handle and Copy Puzzles
  5. Analysis Port Lifetime Reuse

VLSI DV Interview Puzzles · All levels

Analysis Port Lifetime Reuse

A monitor reuses one transaction object every cycle and sends it over analysis port. Why does scoreboard history show all entries with the final sample value?

On this page

    Puzzle

    Difficulty: Medium · Puzzle 3 of 6 · Topic: Handle and Copy Puzzles

    A monitor reuses one transaction object every cycle and sends it over analysis port. Why does scoreboard history show all entries with the final sample value?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    class mon extends uvm_component;
      `uvm_component_utils(mon)
      uvm_analysis_port #(tr) ap;
      tr t;
      function new(string name, uvm_component parent);
        super.new(name, parent);
        ap = new("ap", this);
      endfunction
      task run_phase(uvm_phase phase);
        t = tr::type_id::create("t");
        forever begin
          @(posedge vif.clk);
          t.addr = vif.addr;
          ap.write(t);
        end
      endtask
    endclass
    
    function void sb::write(tr t);
      exp_q.push_back(t);
    endfunction

    Hint

    Ask whether `write()` transfers a new object or the same handle.

    Step-by-step solution

    Diagram
    1) `ap.write(t)` passes a handle, not a deep-copied object.
    2) Scoreboard stores that same handle each cycle, so queue entries alias one object.
    3) Next cycle updates `t.addr`, and all previously stored handles appear to change.
    4) Clone in monitor before write, or clone in subscriber on receipt.

    Answer

    Answer: All entries alias the same reused object handle; the scoreboard never captured immutable snapshots.

    Why candidates get it wrong

    Assuming TLM analysis behaves like pass-by-value instead of pass-by-handle.

    Interviewer follow-up

    Where should cloning happen for best performance and ownership clarity: monitor, analysis FIFO, or scoreboard?

    Related topics

    • Back to Handle and Copy Puzzles

    • OOP & Testbench Puzzles section

    Previous

    32 / 210

    Next: Null Handle During Partial Deep Copy

    Up next

    Up nextNull Handle During Partial Deep Copy

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Shallow Copy in Nested Payload
    • Handle Equality vs Content Equality
    • Clone Without Overridden do_copy