Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5. entity new_game is
  6. port ( turn : in std_logic;
  7. legal_play : in std_logic;
  8. stack_num : in std_logic_vector( 5 downto 0 );
  9. address: out std_logic_vector( 5 downto 0 );
  10. get_card : out std_logic_vector(5 downto 0);
  11. next_turn : out std_logic);
  12. TYPE state_signal IS (S0, S1, S2, DONE);
  13. SIGNAL state : state_signal;
  14.  
  15. begin
  16. signal add : std_logic_vector (5 downto 0);
  17. add = "000000";
  18. state_update : process (Clock, reset)
  19. begin
  20. if Clock = '1' and Clock'EVENT then
  21. case state is
  22. when S0 =>
  23. if turn = '1' then
  24. state <= S1; else state <= S0;
  25. end if;
  26. when S1 =>
  27. if legal_play = '1' then
  28. state <= DONE;
  29. elsif stack_num > add then
  30. add <= add + "000001";
  31. state <= S1;
  32. else state <= S2; end if;
  33. when S2 =>
  34. state <= DONE;
  35. when DONE =>
  36. state <= S0;
  37. end case;
  38. end if;
  39. end process;
  40.  
  41. output_logic : process(state)
  42. begin
  43. case state is
  44. when S0 =>
  45. address = "000000";
  46. get_card = "000000";
  47. next_turn = '0';
  48. when S1 =>
  49. address = add;
  50. when S2 =>
  51. players_mode <= "11";
  52. play_deck_mode <= "10";
  53. player_Enable <= '1';
  54. AI_Enable <= '0';
  55. request_deal <= '1';
  56. turn <= '0';
  57. WHEN DONE =>
  58. players_mode <= "00";
  59. play_deck_mode <= "00";
  60. player_Enable <= '0';
  61. AI_Enable <= '0';
  62. request_deal <= '0';
  63. end case;
  64. end process;
  65. end behav;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement