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
    • Virtual Method Puzzles
    • Parameterized Class Puzzles
    • Factory Override Puzzles
      • Type Override vs Instance Override Specificity
      • create() Honors Override, new() Bypasses
      • Replace Flag in Repeated set_type_override
      • Wildcard Instance Path Precedence
      • Component Override in build_phase
      • Override Timing Relative to create Calls
    • 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

‹Factory Override Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. OOP & Testbench Puzzles
  4. Factory Override Puzzles
  5. Wildcard Instance Path Precedence

VLSI DV Interview Puzzles · All levels

Wildcard Instance Path Precedence

An exact instance override and a wildcard instance override both match one path. Which type is created?

On this page

    Puzzle

    Difficulty: Hard · Puzzle 4 of 6 · Topic: Factory Override Puzzles

    An exact instance override and a wildcard instance override both match one path. Which type is created?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    class base_item extends uvm_object;
      `uvm_object_utils(base_item)
      function new(string name="base_item"); super.new(name); endfunction
    endclass
    class dbg_item extends base_item;
      `uvm_object_utils(dbg_item)
      function new(string name="dbg_item"); super.new(name); endfunction
    endclass
    class perf_item extends base_item;
      `uvm_object_utils(perf_item)
      function new(string name="perf_item"); super.new(name); endfunction
    endclass
    
    initial begin
      base_item::type_id::set_inst_override(
        perf_item::get_type(),
        "uvm_test_top.env.agent*.seqr.main_phase"
      );
      base_item::type_id::set_inst_override(
        dbg_item::get_type(),
        "uvm_test_top.env.agent0.seqr.main_phase"
      );
      $display("a0=%s",
        base_item::type_id::create("a0", null, "uvm_test_top.env.agent0.seqr.main_phase").get_type_name());
      $display("a1=%s",
        base_item::type_id::create("a1", null, "uvm_test_top.env.agent1.seqr.main_phase").get_type_name());
    end

    Hint

    Exact path match is more specific than wildcard match.

    Step-by-step solution

    Diagram
    1) agent0 path matches both wildcard and exact entries.
    2) Factory selects the more specific exact instance override for agent0 -> `dbg_item`.
    3) agent1 only matches wildcard -> `perf_item`.

    Answer

    Answer: `a0=dbg_item` and `a1=perf_item` due to exact instance-path precedence over wildcard.

    Why candidates get it wrong

    Assuming wildcard registration order alone determines result leads to incorrect predictions.

    Interviewer follow-up

    How would you debug this at runtime using factory print/debug APIs?

    Related topics

    • Back to Factory Override Puzzles

    • OOP & Testbench Puzzles section

    Previous

    51 / 210

    Next: Component Override in build_phase

    Up next

    Up nextComponent Override in build_phase

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Type Override vs Instance Override Specificity
    • create() Honors Override, new() Bypasses
    • Override Timing Relative to create Calls