I'm having some problems with for-loop statement in verilog.
reg [31:0] i;
initial begin
for (i=2; i > 0; i = i - 1) begin
$display ("%d\n", i);
end
end
This code runs without any problem, but if I change the middle condition to i >= 0, the program runs repeatedly without no hope of stopping.
I don't understand why this happen!
PS: The full code can be found here: http://pastebin.com/3LX0Mkg0
ibeing interpreted as an unsigned number? In this case,0-1=2^32-1 > 0which would explain the infinite loop.