SCL Reference: loop Statement
The SCL loop statement provides looping capability.
loop scl statements exit when booleanExpression // optional end loop;
The boolean expression is what you would expect it to be. Here are a few examples:
//infinite loop (no exit when) loop RD1 <= '0'; wait on RD1; end loop; //clock until pc == foo label loop RD0 <= '0'; wait 4 ic; RD0 <= '1'; wait 4 ic; exit when PC == foo; end loop; //unadorned exit (yeah this is contrived!) loop AN1 <= 3500 mv; exit; // unconditional exit end loop;
Note that a loop can have more than one exit when condition:
//multiple exit conditions loop wait on RD1; RD0 <= '0'; exit when STATUS.Z == 0; exit when RD2 == '0'; end loop;
Microchip Technology acquires Atmel