20+ câu trắc nghiệm Thiết kế hệ thống số dùng HDL có đáp án

Which of the following is true about the following code segment? integer x, y; initial begin x = 15; y = 10; end initial repeat (x) $display (“x=%d”, x); initial while (y < 12) begin y = y

12/21

Which of the following is true about the following code segment?

integer x, y;

initial

begin

x = 15;

y = 10;

end

initial

repeat (x) $display (“x=%d”, x);

initial

while (y < 12)

begin

y = y + 1;

x = x - 1;

end

It cannot be determined exactly how many times the value of ‘x’ will be printed

The simulation will print the current value of ‘x’ 15-times

The simulation will print the current value of ‘x’ 13-times

The simulation will always display 15 as the value of ‘x’

Giải thích

Chọn đáp án B.