title: Unknown values (X) in simulation of parking lot gate
body: <p>I am designing a parking-lot gate in VHDL. When I simulate it using Quartus VWF files, I am getting unknown values (X), but I don't know why.</p>
  
  <p>Basically you just have to validate your card (<code>Sin</code>) and the gate opens for 10 seconds.
  And when a car exits the parking lot (<code>Sout</code>), it counts the total cars at the moment inside of the parking lot.
  I have created the signal <code>Ncarros</code> (to count number of cars) and <code>s_count</code> for the timer.</p>
  
  <p>It all compiles correctly. But when I'm testing it using a VWF file, this is what I get:</p>
  
  <p><a href="https://i.stack.imgur.com/N6PSk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N6PSk.png" alt="Cropped simulation output"></a></p>
  
  <p><a href="https://i.stack.imgur.com/fHMAU.png" rel="nofollow noreferrer">Original simulation output</a></p>
  
  <p>I'm using Altera Quartus Prime Lite Edition.</p>
  
  <p>Can someone check my code and tell me what I'm doing wrong? </p>
  
  <pre><code>library IEEE;
  use IEEE.STD_LOGIC_1164.all;
  use IEEE.NUMERIC_STD.all;
  
  entity MicroProj is
      port (clk      : in std_logic;
              Sin      : in std_logic;
              Sout     : in std_logic;
              cancela  : out std_logic;
              timerOut : out std_logic);
  
  end MicroProj;
  
  architecture Behavioral of MicroProj is
  
      signal Ncarros : integer := 0;
      signal s_count : integer := 0;
  
  begin
      process (Sin,Sout,clk)
      begin
          if (Sin = '0') then
              cancela &lt;= '0';
          else
              if (Ncarros &lt; 99) then
                  Ncarros &lt;= Ncarros + 1;
                  cancela &lt;= '1';
  
                  if(rising_edge(clk)) then
                      if(s_count /= 0) then
                          if(s_count = 499999999) then
                              timerOut &lt;= '1';
                              s_count &lt;= 0;
                          else
                              timerOut &lt;= '0';
                              s_count &lt;= s_count + 1;
                          end if;
                      else
                          timerOut &lt;= '0';
                          s_count &lt;= s_count + 1;
                      end if;
                  end if;
              end if;
          end if;
  
          if (Sout ='1') then
              Ncarros &lt;= Ncarros - 1;
          end if;
      end process;
  
  
  end Behavioral;
  </code></pre>