Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.81 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 mux2 is
  7.  
  8.  
  9.     port
  10.     (
  11.         -- Input ports
  12.         hex1    : out  std_logic_vector(6 downto 0);
  13.         hex10   : out std_logic_vector(6 downto 0);
  14.         player: in std_logic
  15.  
  16.        
  17.     );
  18. end mux2;
  19.  
  20.  
  21.  
  22.  
  23. architecture mux2_impl of mux2 is
  24. signal  a1  :  std_logic_vector(6 downto 0);
  25. signal  a10 :  std_logic_vector(6 downto 0);
  26. signal  b1 :  std_logic_vector(6 downto 0);
  27. signal  b10 :  std_logic_vector(6 downto 0);
  28.  
  29. begin
  30.  
  31.     aa: entity guess_game port map(
  32.         seg1=>a1,
  33.         seg10=>a10);
  34.        
  35.     bb: entity guess_game port map(
  36.         seg1=>b1,
  37.         seg10=>b10);
  38.    
  39.     process(player,a1,a10,b1,b10) is
  40.         begin
  41.         if player = "1" then
  42.             hex1 <= a1;
  43.             hex10 <=a10;
  44.         else
  45.             hex1 <= b1;
  46.             hex10 <= b10;
  47.         end if;
  48.     end process;
  49.  
  50.  
  51. end mux2_impl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement