Advertisement
stiansjogren

sine_table_controller

May 10th, 2016
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.71 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 01.05.2016 16:54:33
  6. -- Design Name:
  7. -- Module Name: sine_table_controller - 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.numeric_std.all;
  25.  
  26.  
  27. -- Uncomment the following library declaration if using
  28. -- arithmetic functions with Signed or Unsigned values
  29. --use IEEE.NUMERIC_STD.ALL;
  30.  
  31. -- Uncomment the following library declaration if instantiating
  32. -- any Xilinx leaf cells in this code.
  33. --library UNISIM;
  34. --use UNISIM.VComponents.all;
  35.  
  36. entity sine_table_controller is
  37.     Port ( clk : in STD_LOGIC;
  38.            generate_enable : in STD_LOGIC;
  39.            addr : out STD_LOGIC_VECTOR (12 downto 0);
  40.            amplitude : out STD_LOGIC_VECTOR (2 downto 0));
  41. end sine_table_controller;
  42.  
  43. architecture Behavioral of sine_table_controller is
  44.  
  45. signal cnt : std_logic_vector (10 downto 0);
  46. signal cnt_tmp : std_logic_vector(10 downto 0);
  47.  
  48. begin
  49.     cnt <= "00000000000";
  50.     addr <= "0000000000000";
  51.    
  52.     amplitude <= "010";
  53.     process(clk)
  54.     begin
  55.         if(generate_enable = '1') then
  56.             addr(10 downto 0) <= cnt;
  57.             cnt_tmp <= cnt;
  58.             if(cnt < "10111011011") then
  59.                 cnt <= std_logic_vector( unsigned(cnt_tmp) + 1 );
  60.             else
  61.                 cnt <= "00000000000";
  62.             end if;
  63.         end if;
  64.     end process;
  65. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement