Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.24 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use work.all;
  5.  
  6. entity guess_game is
  7. port(inputs : in std_logic_vector(7 downto 0);
  8. set : in std_logic; -- Set predefined value
  9. show : in std_logic; -- Show predefined value
  10. try : in std_logic; -- Evaluate guess
  11. hex1 : out std_logic_vector(6 downto 0); -- 7-seg ones
  12. hex10: out std_logic_vector(6 downto 0) -- 7-seg tens
  13. );
  14. end;
  15.  
  16. architecture guess_game_arc of guess_game is
  17. signal activate: std_logic_vector(1 downto 0); --All the signals between all the entities.
  18. signal secretvalue,mux_t: std_logic_vector(7 downto 0);
  19. signal sigmux: std_logic_vector(13 downto 0);
  20. begin
  21. k1: entity work.latch_a port map(output => secretvalue , set => set , input => inputs);
  22. k2: entity work.compare_logic port map(try=>try , result => secretvalue, mux_act=> activate, guess => inputs);
  23. k3: entity work.mux port map(show=>show, input=>inputs, secret => secretvalue, show_output=>mux_t);
  24. k4: entity work.bintohex port map(bin=>mux_t(3 downto 0), Sseg=>sigmux(13 downto 7));
  25. k5: entity work.bintohex port map(bin=>mux_t(7 downto 4), Sseg=>sigmux(6 downto 0));
  26. k6: entity work.muxto port map(muxout(13 downto 7) => hex10, muxout(6 downto 0) => hex1, activate => activate, muxin => sigmux);
  27. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement