Advertisement
Quebonamade

Gituwa

Jun 8th, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.10 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    12:29:38 04/24/2019
  6. -- Design Name:
  7. -- Module Name:    sound_3_3 - 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. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. --use IEEE.NUMERIC_STD.ALL;
  27.  
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32.  
  33. entity sound_3_3 is
  34.     Port ( CLK : in  STD_LOGIC;
  35.            SOUND : out  STD_LOGIC);
  36. end sound_3_3;
  37.  
  38. architecture Behavioral of sound_3_3 is
  39. signal counter : STD_LOGIC_VECTOR (23 downto 0);
  40. signal tym : STD_LOGIC;
  41. signal nr_stanu :  STD_LOGIC_VECTOR (3 downto 0);                   JEŻELI LICZBA STANÓW SIĘ NIE ZMIEŚCI, TUTAJ TEŻ TRZEBA ZMIENIĆ
  42. begin                                                               ILOŚĆ BITÓW
  43.  
  44.     process(CLK)
  45.         begin
  46.             if rising_edge(CLK) then
  47.                 counter<=counter+1;
  48.                 if(counter=6250000) then                            TU ZMIENIACIE CZĘSTOTLIWOŚĆ (50000000/CZĘSTOTLIWOŚĆ/2)
  49.                 counter<="000000000000000000000000";
  50.                 tym<=not tym;
  51.                 end if;
  52.             end if;
  53.         end process;
  54.    
  55.     process(tym)
  56.                 begin
  57.                         if rising_edge(tym) then
  58.                         nr_stanu<=nr_stanu+1;
  59.                         if nr_stanu=9 then                          TU TRZEBA ZMIENIĆ ODPOWIEDNIO NUMER STANU
  60.                                 nr_stanu<="0000";
  61.                         end if;
  62.                 end if;
  63.     end process;
  64.    
  65.     with nr_stanu select                                            TU DOPISUJECIE STANY I TAM GDZIE JEST WYSOKI TO JEDEN A NISKI TO ZERO
  66.             SOUND <='1' when "0000",
  67.             '0' when "0001",
  68.             '1' when "0010",
  69.             '1' when "0011",
  70.             '0' when "0100",
  71.             '1' when "0101",
  72.             '1' when "0110",
  73.             '1' when "0111",
  74.             '0' when "1000",
  75.             '0' when "1001",
  76.             '0' when others;
  77.  
  78. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement