title: VHDL code not running properly on Nexys2
body: <p>This code selects either the leds or the 7 segment display to show it's 8-bit data that i feed in through the switches. I select the led or the 7 segment through a push button.  When I try to run it on my nexys2 board the led part works fine but as i press the pushbutton the selected 7segment glows and changes its value with the led glowing as well. Also the 7 segment changes it's value only when i press the pushbuton again. I am a newbie and i think I am having trouble making a good logic or what is the issue? any help would be appreciated!</p>
  
  <pre><code>library IEEE;
  use IEEE.STD_LOGIC_1164.ALL;
  use IEEE.NUMERIC_STD.ALL;
  
  
  entity selector is 
  Port ( clk: in STD_LOGIC;
  sel : in  STD_LOGIC;
  comb : in STD_LOGIC_VECTOR (7 downto 0);
  segment : out  STD_LOGIC_VECTOR (3 downto 0);
  number : out  STD_LOGIC_VECTOR (6 downto 0);
  led: out STD_LOGIC_VECTOR (7 downto 0));
  end selector;
  
  architecture Behavioral of selector is
  
  begin
  process (clk, comb, sel) begin
      if (clk'event and clk = '1') then
          if sel = '1' then
              segment &lt;= "1110";
                  case (comb) is 
              when "00000000" =&gt; number &lt;= "0000001"; --0
              when "00000001" =&gt; number &lt;= "1001111"; --1
              when "00000010" =&gt; number &lt;= "0010010"; --2
              when "00000011" =&gt; number &lt;= "0000110"; --3
              when "00000100" =&gt; number &lt;= "1001100"; --4
              when "00000101" =&gt; number &lt;= "0100100"; --5
              when "00000110" =&gt; number &lt;= "0100000"; --6
              when "00000111" =&gt; number &lt;= "0001111"; --7
              when "00001000" =&gt; number &lt;= "0000000"; --8
              when "00001001" =&gt; number &lt;= "0000100"; --9
              when others =&gt; number &lt;= "1111111"; -- off
          end case;
      elsif sel = '0' then 
                  case (comb) is 
              when "00000000" =&gt; led &lt;= "00000000"; --0
              when "00000001" =&gt; led &lt;= "00000001"; --1
              when "00000010" =&gt; led &lt;= "00000011"; --2
              when "00000011" =&gt; led &lt;= "00000111"; --3
              when "00000100" =&gt; led &lt;= "00001111"; --4
              when "00000101" =&gt; led &lt;= "00011111"; --5
              when "00000110" =&gt; led &lt;= "00111111"; --6
              when "00000111" =&gt; led &lt;= "01111111"; --7
              when "00001000" =&gt; led &lt;= "11111111"; --8
              when others =&gt; led &lt;= "00000000"; -- off
                  end case;
      end if;
  end if;
  end process;
  
  end Behavioral;
  </code></pre>