Forum Discussion
Altera_Forum
Honored Contributor
13 years agovhdl code for tic tac game
i am going to do project on simple game tic tac on vhdl. I am using 9 switch and and nine led for display and 2 led to indicate the winner. i am thinking to distinguish to play by flashing of LED. if...
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- what? how about posting some code and the problems you're having/ --- Quote End --- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; entity tic_tac is port(S1,S2,S3,S4,S5,S6,S7,S8,S9: in std_logic; -- nine different switch clk : in std_logic; rst : in std_logic; G1,G2,G3,G4,G5,G6,G7,G8,G9: out std_logic; -- output diode D1,D2,D3 : out std_logic);-- standby lED and WINNER indicator led end tic_tac; architecture rtl of tic_tac is sig <= s1,s2,s3,s4,s5,s6,s7,s8,s9; count:integer:= 0; begin when rising_edge(sig); than count<= count+1; if count = '1'; elsif S1 = '1'; than G1 = '1'; elsif S2='1'; than G2 = '1'; elsif S3='1'; than G3 = '1'; elsif S4='1'; than G4 = '1'; elsif S5='1'; than G5 = '1'; elsif S6='1'; than G6 = '1'; elsif S7='1'; than G7 = '1'; elsif S8='1'; than G8 = '1'; elsif S9='1'; than G9 = '1'; end if; if count = '2'; elsif S1 = '1'; than G1 = '1'; elsif S2='1'; than G2 = '1'; elsif S3='1'; than G3 = '1'; elsif S4='1'; than G4 = '1'; elsif S5='1'; than G5 = '1'; elsif S6='1'; than G6 = '1'; elsif S7='1'; than G7 = '1'; elsif S8='1'; than G8 = '1'; elsif S9='1'; end rtl;