Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.30 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.NUMERIC_STD.ALL;
  4.  
  5. -- Uncomment the following library declaration if using
  6. -- arithmetic functions with Signed or Unsigned values
  7. --use IEEE.NUMERIC_STD.ALL;
  8.  
  9. -- Uncomment the following library declaration if instantiating
  10. -- any Xilinx primitives in this code.
  11. --library UNISIM;
  12. --use UNISIM.VComponents.all;
  13.  
  14. entity Beep is
  15.     Port ( E : in  STD_LOGIC;
  16.            Clk : in  STD_LOGIC;
  17.            Start : out  STD_LOGIC;
  18.            Addr : out  STD_LOGIC_VECTOR (3 downto 0);
  19.            Cmd : out  STD_LOGIC_VECTOR (3 downto 0);
  20.            DATA : out  STD_LOGIC_VECTOR (11 downto 0));
  21. end Beep;
  22.  
  23. architecture Behavioral of Beep is
  24.    signal temp : UNSIGNED (4 downto 0):="00000";
  25.    signal licznik : UNSIGNED (10 downto 0):="00000000000";
  26.    signal st : STD_LOGIC:='0';
  27. begin
  28.    Addr<="1111"; --wszystkie kanaly
  29.    Cmd<="0011";  --komenda update
  30.    process (Clk, E)
  31.    begin
  32.    if rising_edge(Clk) and E='1' then
  33.       if licznik = X"000" then st<='1';
  34.          else st<='0';
  35.       end if;
  36.       licznik <= licznik + 1;
  37.       if licznik = X"61B" then
  38.          temp <= temp + 1;
  39.          licznik<="00000000000";
  40.       end if;
  41.      end if;
  42.    end process;
  43.  
  44. DATA<=STD_LOGIC_VECTOR(temp) & "0000000";
  45. Start<=st;
  46.      
  47. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement