Advertisement
Guest User

Untitled

a guest
Mar 11th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.26 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    16:58:57 03/05/2019
  6. -- Design Name:
  7. -- Module Name:    wyswietlacz - 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. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_ARITH.ALL;
  23. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  24.  
  25. ---- Uncomment the following library declaration if instantiating
  26. ---- any Xilinx primitives in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29.  
  30. entity wyswietlacz is
  31.     Port ( sw_i : in  STD_LOGIC_VECTOR (7 downto 0);
  32.            btn_i : in  STD_LOGIC_VECTOR (3 downto 0);
  33.            led7_an_o : out  STD_LOGIC_VECTOR (3 downto 0);
  34.            led7_seg_o : out  STD_LOGIC_VECTOR (7 downto 0);
  35.            clk_i : in  STD_LOGIC);
  36. end wyswietlacz;
  37.  
  38. architecture Behavioral of wyswietlacz is
  39.     constant n : integer := 3;
  40.     signal counter : integer range 0 to n - 1 := 0;
  41.     signal clk_divided : std_logic := '0';
  42.     type t_chars is array (15 downto 0) of std_logic_vector(7 downto 0);
  43.     signal chars : t_chars;
  44.    
  45.    
  46. begin
  47.     q <= '0';
  48.      chars(0)(7 downto 1) <= "0000001";
  49.      chars(1)(7 downto 1) <= "1001111";
  50.      chars(2)(7 downto 1) <= "0010010";
  51.      chars(3)(7 downto 1) <= "0000110";
  52.      chars(4)(7 downto 1) <= "1001100";
  53.      chars(5)(7 downto 1) <= "0100100";
  54.      chars(6)(7 downto 1) <= "0100000";
  55.      chars(7)(7 downto 1) <= "0001111";
  56.      chars(8)(7 downto 1) <= "0000000";
  57.      chars(9)(7 downto 1) <= "0000100";
  58.      chars(10)(7 downto 1) <= "0000010";
  59.      chars(11)(7 downto 1) <= "1100000";
  60.      chars(12)(7 downto 1) <= "0110001";
  61.      chars(13)(7 downto 1) <= "1000010";
  62.      chars(14)(7 downto 1) <= "0110000";
  63.      chars(15)(7 downto 1) <= "0111000";
  64.      chars(15 downto 0)(0) <= (others => q);
  65.      p_clk_divider: process(clk_i)
  66.         begin
  67.             if (rising_edge(clk_i)) then
  68.                 counter <= counter + 1;
  69.                 if (counter = (n/2)) then
  70.                     clk_divided <= '1';
  71.                 elsif (counter = n-1) then
  72.                     clk_divided <= '0';
  73.                     counter <= 0;
  74.                 end if;
  75.             end if;        
  76.     end process;
  77.  
  78. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement