Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.46 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. -- Uncomment the following library declaration if using
  5. -- arithmetic functions with Signed or Unsigned values
  6. --use IEEE.NUMERIC_STD.ALL;
  7.  
  8. -- Uncomment the following library declaration if instantiating
  9. -- any Xilinx leaf cells in this code.
  10. --library UNISIM;
  11. --use UNISIM.VComponents.all;
  12.  
  13. entity BCDto7Segment is
  14.     Port (
  15.         BCD: in STD_LOGIC_VECTOR(3 downto 0);
  16.         SevenSegment: out STD_LOGIC_VECTOR(6 downto 0)
  17.     );
  18. end BCDto7Segment;
  19.  
  20. architecture Behavioral of BCDto7Segment is
  21.    
  22.        
  23. begin
  24.     with BCD select -- A
  25.         SevenSegment(0) <= '0' when "0001"|"0100",
  26.                            '1' when others;
  27.     with BCD select -- B
  28.         SevenSegment(1) <= '0' when "0101"|"0110",
  29.                            '1' when others;
  30.     with BCD select -- C
  31.         SevenSegment(2) <= '0' when "0010",
  32.                            '1' when others;
  33.     with BCD select -- D
  34.         SevenSegment(3) <= '0' when "0001"|"0100"|"0111",
  35.                            '1' when others;
  36.     with BCD select -- E
  37.         SevenSegment(4) <= '1' when "0000"|"0010"|"0110"|"1000",
  38.                            '0' when others;
  39.     with BCD select -- F
  40.         SevenSegment(5) <= '0' when "0001"|"0010"|"0011"|"0111",
  41.                            '1' when others;
  42.     with BCD select -- G
  43.         SevenSegment(6) <= '0' when "0000"|"0001"|"0111",
  44.                            '1' when others;
  45.  
  46. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement