Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ386
Page ↗
Q386DVDesignASIC interview problem

Parameterized classes and static members

TechniquesSystemVerilogAdvanced OOP
DifficultyMedium
TopicSV
LanguageSystemVerilog
Format4 choices
01

Problem

What values are printed?

Class declarationSystemVerilog
class Counter #(type T = int);
  static int count = 0;
  function new(); count++; endfunction
endclass
Counter #(int) a, b; Counter #(byte) c;
initial begin
  a = new; b = new; c = new;
  $display("%0d %0d", Counter#(int)::count, Counter#(byte)::count);
end
02

Answer choices (4)