Advertisement
Guest User

Untitled

a guest
May 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.16 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  4. use IEEE.NUMERIC_STD.ALL;
  5.  
  6. entity Ram is
  7.     Port ( CLK : in STD_LOGIC;
  8.            WE : in STD_LOGIC;
  9.            ADDR_READ_X : in STD_LOGIC_VECTOR(10 downto 0);
  10.            ADDR_WRITE : in STD_LOGIC_VECTOR(10 downto 0);
  11.            DATA_IN : in STD_LOGIC_VECTOR(8 downto 0);
  12.            DATA_OUT : out STD_LOGIC_VECTOR(8 downto 0)
  13.          );
  14. end Ram;
  15.  
  16. architecture behavioral of Ram is
  17.     type ram_type is array (0 to 799) of STD_LOGIC_VECTOR(8 downto 0);  
  18.     signal ram : ram_type :=
  19.      ( 0 to 99 => "000000000",
  20.      100 to 199 => "000001111",
  21.      200 to 299 => "000111111",
  22.      300 to 399 => "010011111",
  23.     400 to 499 => "100011111",
  24.      500 to 599 => "111100000",
  25.      600 to 699 => "111111000",
  26.      700 to 799 => "111111111");
  27.      
  28. begin
  29.     process(CLK)
  30.      begin
  31.         if(CLK'event and CLK = '1')then
  32.             --if(WE = '1')then
  33.              -- ram(conv_integer(ADDR_WRITE)) <= DATA_IN;
  34.             --end if;
  35.             if(ADDR_READ_X < 800)then
  36.              DATA_OUT <= ram(conv_integer(ADDR_READ_X));
  37.             end if;
  38.         end if;
  39.     end process;
  40. end behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement