Hardware interview practice
Parameterized classes and static members
What values are printed?
Starting point
Question code
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);
endChoose one
Answer choices
- A. 3 3
- B. 2 1
- C. 2 2
- D. 1 1
