What will be the behavior of the above SystemVerilog code?
module tb;
initial begin
bit [3:0] i; //i = 0 to 15
for(i = 0; i < 16; i++) begin
#1ns;
$display("i %0b", i);
end
end
endmodule
i is:
bit [3:0] i;Range:
0 to 15Execution:
i=0 → print
i=1 → print
...
i=15 → printThen loop increment happens:
i++Binary:
1111 + 1 = 0000Now condition:
i < 16is always true because i can only hold values:
0-15So the loop never terminates.