Advertisement
Guest User

Untitled

a guest
May 16th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.57 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    10:22:35 03/22/2018
  6. -- Design Name:
  7. -- Module Name:    RAM
  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_unsigned.all;
  23.  
  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 RAM is
  34.     Port ( read_adr : in  STD_LOGIC_VECTOR (9 downto 0);
  35.            write_adr : in  STD_LOGIC_VECTOR (9 downto 0);
  36.            CLK_50 : in  STD_LOGIC;
  37.            input_data : in  STD_LOGIC_VECTOR (8 downto 0);
  38.            output_data : out  STD_LOGIC_VECTOR (8 downto 0);
  39.            write_enable : in  STD_LOGIC);
  40. end RAM;
  41.  
  42. architecture Behavioral of RAM is
  43. type ram_type is array (0 to 799) of std_logic_vector (8 downto 0);
  44. signal RAM: ram_type;
  45. begin
  46. process (CLK_50)
  47. begin
  48.    if (CLK_50'event and CLK_50 = '1') then
  49.       if (write_enable = '1') then
  50.          RAM(conv_integer(write_adr)) <= input_data;
  51.       end if;
  52.       output_data <= RAM(conv_integer(read_adr));
  53.    end if;
  54. end process;
  55.  
  56.  
  57. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement