title: VHDL code for Tic tac toe game?
body: <p>I have 18 output and 9 push switches to work with and one led as output which changing its states each time the push button is pressed to automate the chance of two players. my code is not working, pls help
  my code is...expected behavour is that when momentarily in1 switch is high then play_to_play should toggle on each event of the inputs and according to play_to_play status and in1 high either ou11 or ou21 should go high i.e one player has played his chance and automatically at the next event it takes that it is player 2 chance</p>
  
  <pre><code>library IEEE;   
  use IEEE.STD_LOGIC_1164.ALL;  
  entity TicTac is     
      Port ( in1 : in  STD_LOGIC;  
             in2 : in  STD_LOGIC;  
             in3 : in  STD_LOGIC;   
             in4 : in  STD_LOGIC;  
             in5 : in  STD_LOGIC;  
             in6 : in  STD_LOGIC;  
             in7 : in  STD_LOGIC;   
             in8 : in  STD_LOGIC;   
             in9 : in  STD_LOGIC;   
                reset : in  STD_LOGIC;  
              p_to_play : out STD_Logic;   
             p1_win : out  STD_LOGIC;   
             p2_win : out  STD_LOGIC;   
             ou11 : out  STD_LOGIC;   
             ou12 : out  STD_LOGIC;   
             ou13 : out  STD_LOGIC;   
             ou14 : out  STD_LOGIC;   
             ou15 : out  STD_LOGIC;   
             ou16 : out  STD_LOGIC;   
             ou17 : out  STD_LOGIC;   
             ou18 : out  STD_LOGIC;   
             ou19 : out  STD_LOGIC;   
             ou21 : out  STD_LOGIC;   
             ou22 : out  STD_LOGIC;   
             ou23 : out  STD_LOGIC;   
             ou24 : out  STD_LOGIC;   
             ou25 : out  STD_LOGIC;  
             ou26 : out  STD_LOGIC;  
             ou27 : out  STD_LOGIC;   
             ou28 : out  STD_LOGIC;   
             ou29 : out  STD_LOGIC);   
  end TicTac;   
  architecture Behavioral of TicTac is   
  Signal temp1, temp2, temp3, temp4, temp5, temp6,temp7, temp8, temp9,p1_play :std_logic :='0';    
  signal o11,o12,o13,o14,o15,o16,o17,o18,o19,o21,o22,o23,o24,o25,o26,o27,o28,o29 :std_logic :='0';    
  signal p1win,p2win :std_logic :='0';    
  begin   
  process(in1,in2,in3,in4,in5,in6,in7,in8,in9,reset)
  begin  
  
     if ((in1'event or in2'event or in3'event or in4'event or in5'event or in6'event or in7'event or in8'event or in9'event) and
      (in1='1' or in2 ='1' or in3='1' or in4='1' or in5='1' or in6='1' or in7='1' or in8='1' or in9='1')) then     
        p1_play &lt;= not(p1_play);    
  if(reset'event and reset= '1') then  
  temp1 &lt;='0';    
  temp2 &lt;='0';   
  temp3 &lt;='0';   
  temp4 &lt;='0';   
  temp5 &lt;='0';   
  temp6 &lt;='0';   
  temp7 &lt;='0';   
  temp8 &lt;='0';  
  temp9 &lt;='0';   
  p1_play &lt;= '0';  
  p1win &lt;='0';    
  p2win &lt;='0';    
  o11 &lt;='0';    
  o12 &lt;='0';   
  o13 &lt;='0';   
  o14 &lt;='0';   
  o15 &lt;='0';   
  o16 &lt;='0';   
  o17 &lt;='0';   
  o18 &lt;='0';   
  o19 &lt;='0';   
  o21 &lt;='0';   
  o22 &lt;='0';   
  o23 &lt;='0';   
  o24 &lt;='0';   
  o25 &lt;='0';   
  o26 &lt;='0';   
  o27 &lt;='0';   
  o28 &lt;='0';   
  o29 &lt;='0';   
  end if;     
  if(in1= '1') then   
  temp1 &lt;='1';   
  end if;  
  if(in2= '1') then   
  temp2 &lt;='1';   
  end if;   
  if(in3= '1') then
  temp3 &lt;='1';
  end if;
  if(in4= '1') then
  temp1 &lt;='1';
  end if;
  if(in5= '1') then
  temp5 &lt;='1';
  end if;
  if(in6= '1') then
  temp6 &lt;='1';
  end if;
  if(in7= '1') then
  temp7 &lt;='1';
  end if;
  if(in8= '1') then
  temp8 &lt;='1';
  end if;
  if(in9= '1') then
  temp9 &lt;='1';  
  end if;    
  if(p1_play='0' and temp1='1') then    
  o11 &lt;= '1';    
  end if;    
  if(p1_play='0' and temp2='1') then   
  o12 &lt;= '1';    
  end if;    
  if(p1_play='0' and temp3='1') then
  o13 &lt;= '1';    
  end if;   
  if(p1_play='0' and temp4='1') then
  o14 &lt;= '1';   
  end if;    
  if(p1_play='0' and temp5='1') then
  o15 &lt;= '1';    
  end if;    
  if(p1_play='0' and temp6='1') then
  o16 &lt;= '1';    
  end if;    
  if(p1_play='0' and temp7='1') then
  o17 &lt;= '1';   
  end if;    
  if(p1_play='0' and temp8='1') then
  o18 &lt;= '1';    
  end if;    
  if(p1_play='0' and temp9='1') then
  o19 &lt;= '1';    
  end if;     
  if(p1_play='1' and temp1='1') then
  o21 &lt;= '1';    
  end if;   
  if(p1_play='1' and temp2='1') then
  o22 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp3='1') then
  o23 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp4='1') then
  o24 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp5='1') then
  o25 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp6='1') then
  o26 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp7='1') then
  o27 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp8='1') then
  o28 &lt;= '1';    
  end if;    
  if(p1_play='1' and temp9='1') then
  o29 &lt;= '1';    
  end if;    
  if((o11='1' and o12='1' and o13='1') or (o14='1' and o15='1' and o16='1') or (o17='1' and o18='1' and o19='1')
  or (o11='1' and o14='1' and o17='1') or (o12='1' and o15='1' and o18='1') or (o13='1' and o16='1' and o19='1')
  or (o11='1' and o15='1' and o19='1') or (o13='1' and o15='1' and o17='1')) then
  p1win &lt;='1';    
  end if;     
  if((o21='1' and o22='1' and o23='1') or (o24='1' and o25='1' and o26='1') or (o27='1' and o28='1' and o29='1')
  or (o21='1' and o24='1' and o27='1') or (o22='1' and o25='1' and o28='1') or (o23='1' and o26='1' and o29='1')
  or (o21='1' and o25='1' and o29='1') or (o23='1' and o25='1' and o27='1')) then
  p2win &lt;='1';     
  end if;   
  end if;   
  end process;   
  ou11 &lt;= o11;   
  ou12 &lt;= o12;   
  ou13 &lt;= o13;   
  ou14 &lt;= o14;   
  ou15 &lt;= o15;   
  ou16 &lt;= o16;   
  ou17 &lt;= o17;   
  
      ou18 &lt;= o18;   
      ou19 &lt;= o19;   
      ou21 &lt;= o21;  
      ou22 &lt;= o22;   
      ou23 &lt;= o23;   
      ou24 &lt;= o24;  
      ou25 &lt;= o25;   
      ou26 &lt;= o26;   
      ou27 &lt;= o27;   
      ou28 &lt;= o28;   
      ou29 &lt;= o29;   
      p_to_play &lt;= p1_play;   
      p1_win &lt;= p1win;   
      p2_win &lt;= p2win;   
      end Behavior
  
  al;      
  </code></pre>