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
      • Global Static vs Per-Specialization Static
      • Same Specialization via typedef Alias
      • Integral Parameter Specializations Split Statics
      • Invariance of Parameterized Type Assignment
      • Static Function Counters Per Specialization
      • Wrong UVM Macro for Parameterized Object
    • 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

‹Parameterized Class Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. OOP & Testbench Puzzles
  4. Parameterized Class Puzzles
  5. Integral Parameter Specializations Split Statics

VLSI DV Interview Puzzles · All levels

Integral Parameter Specializations Split Statics

A class is parameterized by depth. Predict statics for depth 8 vs depth 16.

On this page

    Puzzle

    Difficulty: Easy · Puzzle 3 of 6 · Topic: Parameterized Class Puzzles

    A class is parameterized by depth. Predict statics for depth 8 vs depth 16.

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    class fifo_cfg #(int DEPTH = 8);
      static int instances = 0;
      function new();
        instances++;
      endfunction
    endclass
    
    initial begin
      fifo_cfg#(8)  a = new();
      fifo_cfg#(8)  b = new();
      fifo_cfg#(16) c = new();
      $display("d8=%0d d16=%0d", fifo_cfg#(8)::instances, fifo_cfg#(16)::instances);
    end

    Hint

    Each unique parameter value forms a different specialization type.

    Step-by-step solution

    Diagram
    1) Two objects are created for specialization `fifo_cfg#(8)` => its static is 2.
    2) One object is created for specialization `fifo_cfg#(16)` => its static is 1.
    3) Statics are independent because specializations are distinct types.

    Answer

    Answer: Output is `d8=2 d16=1`.

    Why candidates get it wrong

    People sometimes assume all integer-parameter variants share one static namespace.

    Interviewer follow-up

    How would you create one truly global instance counter for all DEPTH values?

    Related topics

    • Back to Parameterized Class Puzzles

    • OOP & Testbench Puzzles section

    Previous

    44 / 210

    Next: Invariance of Parameterized Type Assignment

    Up next

    Up nextInvariance of Parameterized Type Assignment

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Global Static vs Per-Specialization Static
    • Static Function Counters Per Specialization
    • Wrong UVM Macro for Parameterized Object