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. create() Honors Override, new() Bypasses

VLSI DV Interview Puzzles · All levels

create() Honors Override, new() Bypasses

With a type override installed, compare object types produced by `type_id::create` and direct `new`.

On this page

    Puzzle

    Difficulty: Easy · Puzzle 2 of 6 · Topic: Factory Override Puzzles

    With a type override installed, compare object types produced by `type_id::create` and direct `new`.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    class base_item extends uvm_sequence_item;
      `uvm_object_utils(base_item)
      function new(string name="base_item"); super.new(name); endfunction
    endclass
    class fast_item extends base_item;
      `uvm_object_utils(fast_item)
      function new(string name="fast_item"); super.new(name); endfunction
    endclass
    
    initial begin
      base_item::type_id::set_type_override(fast_item::get_type());
      base_item a, b;
      a = base_item::type_id::create("a");
      b = new("b");
      $display("a=%s b=%s", a.get_type_name(), b.get_type_name());
    end

    Hint

    Only factory-mediated creation can consult override tables.

    Step-by-step solution

    Diagram
    1) `a` is created through factory API, so type override maps it to `fast_item`.
    2) `b = new(...)` directly constructs declared class and never checks factory.
    3) Output is `a=fast_item b=base_item`.

    Answer

    Answer: `create()` returns overridden type; direct `new()` always returns declared type and ignores factory.

    Why candidates get it wrong

    Using `new` in reusable components silently defeats test-level overrides.

    Interviewer follow-up

    Where in your environment code would replacing `new` with `create` have highest leverage?

    Related topics

    • Back to Factory Override Puzzles

    • OOP & Testbench Puzzles section

    Previous

    49 / 210

    Next: Replace Flag in Repeated set_type_override

    Up next

    Up nextReplace Flag in Repeated set_type_override

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Wildcard Instance Path Precedence
    • Component Override in build_phase
    • Override Timing Relative to create Calls