title: VHDL Simulation Stopping by itself
body: <p>I dont get this, simulation just stops after "taster" signal becomes "1", no idea why. In Xilinx IDE package testbench.</p>
  
  <pre><code>entity komb is
      Port ( reset : in  STD_LOGIC;
             clk : in  STD_LOGIC;
             levo_ndesno : in  STD_LOGIC;
             dogadjaj : in  STD_LOGIC;
             taster : in  STD_LOGIC;
             tr_cifra : out  STD_LOGIC_VECTOR (3 downto 0);
             cifra : out  STD_LOGIC_VECTOR (6 downto 0);
             otvori : out  STD_LOGIC;
             greska : out  STD_LOGIC);
  end komb;
  
  architecture Behavioral of komb is
  
  type tab is array(0 to 9) of std_logic_vector(6 downto 0);
  signal tabela_cifara : tab;
  
  type niz is array(0 to 3) of integer;
  signal sifra : niz;
  signal tr_sif : niz;
  
  type state_type is (s12, s11, s10, s9, s8, s7, s6, s5, s4, s3, s2, s1, s0);
  signal state_reg, next_state : state_type;
  
  signal cnt_cif : integer;
  
  
  constant fclk : integer := 1;
  constant jedna_sekunda : integer := 10*fclk;
  signal counter : integer;
  
  begin
  
  sifra(3) &lt;= 3;
  sifra(2) &lt;= 5;
  sifra(1) &lt;= 9;
  sifra(0) &lt;= 2;
  
  state_transition: process(clk, reset)
  begin
      if (reset = '1') then
          state_reg &lt;= s0;
      elsif (clk'event and clk = '1') then
          state_reg &lt;= next_state;
      end if;
  end process;
  
  counter_process : process(clk, reset, state_reg, counter)
  begin
      if (reset = '1') then 
          counter &lt;= jedna_sekunda;
      else
          if(clk'event and clk='1') then
              if (state_reg = s12) then
                  if (counter = 0) then
                      counter &lt;= jedna_sekunda;
                  else
                      counter &lt;= counter - 1;
                  end if;
              end if;
          end if;
      end if;     
  end process;
  
  next_state_logic: process(state_reg, dogadjaj, taster, cnt_cif, levo_ndesno, counter)
  begin
      case state_reg is
          when s0 =&gt;
                  if (dogadjaj = '0') then
                      next_state &lt;= s0;
                  else
                      next_state &lt;= s1;
                  end if;
  
          when s1 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s2;
                  else
                      next_state &lt;= s3;
                  end if;
              end if;
  
          when s2 =&gt; 
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s4;
                  else 
                      next_state &lt;= s1;
                  end if;
              end if;
  
          when s3 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s1;
                  else 
                      next_state &lt;= s5;
                  end if;
              end if;
  
          when s4 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if(levo_ndesno = '1') then
                      next_state &lt;= s6;
                  else 
                      next_state &lt;= s2;
                  end if;
              end if;
  
          when s5 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if(levo_ndesno = '1') then
                      next_state &lt;= s3;
                  else 
                      next_state &lt;= s7;
                  end if;
              end if;
  
          when s6 =&gt; 
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s8;
                  else 
                      next_state &lt;= s4;
                  end if;
              end if;
  
          when s7 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s5;
                  else
                      next_state &lt;= s9;
                  end if;
              end if;
  
          when s8 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s10;
                  else
                      next_state &lt;= s6;
                  end if;
              end if;
  
          when s9 =&gt; 
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s7;
                  else
                      next_state &lt;= s10;
                  end if;
              end if;
  
          when s10 =&gt;
              if (taster = '1') then
                  next_state &lt;= s11;
              else
                  if (levo_ndesno = '1') then
                      next_state &lt;= s9;
                  else 
                      next_state &lt;= s8;
                  end if;
              end if;
  
          when s11 =&gt;
              if (cnt_cif &lt; 4) then
                  next_state &lt;= s1;
              else
                  next_state &lt;= s12;
              end if;
  
          when s12 =&gt;
              if (counter = 0) then
                  next_state &lt;= s0;
              else
                  next_state &lt;= s12;
              end if;
      end case;       
  end process;
  
  output_logic: process(state_reg, cnt_cif, tabela_cifara)
  variable xxcif : integer;
  begin
          case state_reg is
              when s0 =&gt;
                  cifra &lt;= tabela_cifara(0);
                  cnt_cif &lt;= 1;
                  otvori &lt;= '0';
                  greska &lt;= '0';
                  tr_cifra &lt;= "0001";
                  tr_sif(0) &lt;= 0;
                  tr_sif(1) &lt;= 0;
                  tr_sif(2) &lt;= 0;
                  tr_sif(3) &lt;= 0;
  
              when s1 =&gt;
                  cifra &lt;= tabela_cifara(0);
                  xxcif := 0;
                  case cnt_cif is
                      when 1 =&gt;
                          tr_cifra &lt;= "0001";
                      when 2 =&gt;
                          tr_cifra &lt;= "0011";
                      when 3 =&gt;
                          tr_cifra &lt;= "0111";
                      when 4 =&gt;
                          tr_cifra &lt;= "1111";
                      when others =&gt;
                          tr_cifra &lt;= "0000";
                  end case;
  
              when s2 =&gt;
                  cifra &lt;= tabela_cifara(9);
                  xxcif := 9;
  
              when s3 =&gt;
                  cifra &lt;= tabela_cifara(1);
                  xxcif := 1;
  
              when s4 =&gt;
                  cifra &lt;= tabela_cifara(8);
                  xxcif := 8;
  
              when s5 =&gt;
                  cifra &lt;= tabela_cifara(2);
                  xxcif := 2;
  
              when s6 =&gt;
                  cifra &lt;= tabela_cifara(7);
                  xxcif := 7;
  
              when s7 =&gt;
                  cifra &lt;= tabela_cifara(3);
                  xxcif := 3;
  
              when s8 =&gt;
                  cifra &lt;= tabela_cifara(6);
                  xxcif := 6;
  
              when s9 =&gt;
                  cifra &lt;= tabela_cifara(4);
                  xxcif := 4;
  
              when s10 =&gt;
                  cifra &lt;= tabela_cifara(5);
                  xxcif := 5;
  
              when s11 =&gt;
                  tr_sif(cnt_cif-1) &lt;= xxcif;
                  cnt_cif &lt;= cnt_cif + 1;
  
              when s12 =&gt;
                  cifra &lt;= tabela_cifara(0);
                  if ((tr_sif(0) = sifra(0)) and (tr_sif(1) = sifra(1)) and (tr_sif(2) = sifra(2)) and (tr_sif(3) = sifra(3))) then
                      otvori &lt;= '1';
                  else
                      greska &lt;= '1';
                  end if;
  
          end case;                       
  end process;
  
  tabela_cifara(0) &lt;= "1111110";
  tabela_cifara(1) &lt;= "0110000";
  tabela_cifara(2) &lt;= "1101101";
  tabela_cifara(3) &lt;= "1111001";
  tabela_cifara(4) &lt;= "0110011";
  tabela_cifara(5) &lt;= "1011011";
  tabela_cifara(6) &lt;= "1011111";
  tabela_cifara(7) &lt;= "1110000";
  tabela_cifara(8) &lt;= "1111111";
  tabela_cifara(9) &lt;= "1111011";
  
  
  end Behavioral;
  </code></pre>
  
  <p>Here's my simple test bench program:</p>
  
  <pre><code>stim_proc: process
     begin        
        -- hold reset state for 100 ns.
        reset &lt;= '1';
  
          wait for 10 ns; 
  
          reset &lt;= '0';
  
        wait for 10 ns;
  
        -- insert stimulus here 
          dogadjaj &lt;= '1';
          wait for clk_period;
          dogadjaj &lt;= '0';
          wait for 10 ns;
          levo_ndesno &lt;= '1';
  
          wait for 100ns;
          taster &lt;= '1';
          wait for 10ns;
          --taster &lt;= '0';
  
        wait for 200ns;
     end process;
  </code></pre>
  
  <p>Please help :)</p>