The issue is that your two variables (a and b), are declared as ‘reg a,b’ which are single bits. Your loop wants to count to 4, which overflows your a variable, resulting in an infinite loop.
Declare a and b as int and your will see the behavior you expect.