FPGA Center


While-loop is an expression which includes sequential and repetitive stataments.

loop_name: while condition loop
                         end loop loop_name;

Operations declared in the loop continues as long as the defined condition remains. The initial value is assigned to the variable accoring to the declared condition, before while-loop begins. The condition defined in the first line is repeated at each loop. ─▒f condition is not TRUe, the number of repeats is increased one. Otherwise the loop ends.(EXAMPLE 1)

A while-loop can be used instead of a loop which includes a conditional exit statment. (EXAMPLE 2)


P2 : process (In_z)
variable  Z1:= 1;
  D1: while Z1 <= 99 loop
        Out_z (Z1) <= In_z (Z1 +8);
        Z1:= Z1 + 1;
      end loop D1;
end process P2;

Loop in the example continues as ong as variable Z1 does not exceed 99. If Z1 become 100 loop ends. Another way of representation of this while-loop statement is as follows:


D1: loop
     Out_z (Z1) <= In_z (Z1 +8);    
     Z1:= Z1 +1;
    exit D1 when Z1 > 99;
end loop D1;








Home | Fpga | VHDL | VHDL Dictionary | Digital Design | Simulation | PCB | Examples | Contact Us
Copyright © 2010 - 2013 FPGAcenter. All Rights Reserved.