DescriptionQ386
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);
end02
