Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

while loop iteration error

Hi all again!

I'm trying to use a while-loop statement in my code, but it wouldn't compile. I created a separate project to simplify the loop statement but it didn't help.

Here is the code:

library IEEE; 
use IEEE.std_logic_1164.all; 
use IEEE.std_logic_unsigned.all; 
 
entity whiler is 
port( clk:in std_logic; 
      reset:in std_logic; 
      outer:out std_logic); 
end whiler; 
 
architecture behavior of whiler is 
begin 
     
    process 
        variable index : integer := 0; 
    begin 
        wait until rising_edge(clk); 
        if (reset = '1') then 
            outer <= '0'; 
        elsif (reset = '0') then 
            while index < 6 loop 
                outer <= '1'; 
                index := index + 1; 
            end loop; 
        end if; 
    end process; 
end behavior;

I get an error stating that the loop must end within 10k iterations, but as far as I can tell this loop should only run through 6 times, so i can't tell whats throwing this error.

Sorry if this seems a simple problem, i'm still pretty new to this language.

Thanks for your time,

Zammy

14 Replies