Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/16/2019 06:41:44 PM
  6. -- Design Name:
  7. -- Module Name: ssd - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24. use IEEE.STD_LOGIC_SIGNED.ALL;
  25.  
  26. -- Uncomment the following library declaration if using
  27. -- arithmetic functions with Signed or Unsigned values
  28. --use IEEE.NUMERIC_STD.ALL;
  29.  
  30. -- Uncomment the following library declaration if instantiating
  31. -- any Xilinx leaf cells in this code.
  32. --library UNISIM;
  33. --use UNISIM.VComponents.all;
  34.  
  35. entity ssd is
  36. Port( data : in std_logic_vector (15 downto 0);
  37. clk : in std_logic;
  38. cat : out std_logic_vector (6 downto 0);
  39. an : out std_logic_vector (3 downto 0));
  40. end ssd;
  41.  
  42. architecture Behavioral of ssd is
  43.  
  44. signal count : std_logic_vector (15 downto 0) := x"0000";
  45. signal digit : std_logic_vector (3 downto 0) := x"0";
  46.  
  47. begin
  48.  
  49. process (clk)
  50. begin
  51. if rising_edge(clk) then
  52. count <= count + 1;
  53. end if;
  54. end process;
  55.  
  56. process (data, count(15 downto 14))
  57. begin
  58. case count(15 downto 14) is
  59. when "00" => digit <= data(3 downto 0); an <= "1110";
  60. when "01" => digit <= data(7 downto 4); an <= "1101";
  61. when "10" => digit <= data(11 downto 8); an <= "1011";
  62. when others => digit <= data(15 downto 12); an <= "0111";
  63. end case;
  64. end process;
  65.  
  66. process (digit)
  67. begin
  68. case digit is
  69. when x"0" => cat <= "1000000";
  70. when x"1" => cat <= "1111001";
  71. when x"2" => cat <= "0100100";
  72. when x"3" => cat <= "0110000";
  73. when x"4" => cat <= "0011001";
  74. when x"5" => cat <= "0010010";
  75. when x"6" => cat <= "0000010";
  76. when x"7" => cat <= "1111000";
  77. when x"8" => cat <= "0000000";
  78. when x"9" => cat <= "0010000";
  79. when x"A" => cat <= "0001000";
  80. when x"B" => cat <= "0000011";
  81. when x"C" => cat <= "0100111";
  82. when x"D" => cat <= "0100001";
  83. when x"E" => cat <= "0000110";
  84. when others => cat <= "0001110";
  85. end case;
  86. end process;
  87.  
  88. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement