Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  4.  
  5. entity ram128x32 is
  6. Port ( address : in STD_LOGIC_VECTOR(6 downto 0);
  7. rdata : out STD_LOGIC_VECTOR(31 downto 0);
  8. wdata : in STD_LOGIC_VECTOR(31 downto 0);
  9. wen : in STD_LOGIC;
  10. clk : in STD_LOGIC;
  11. reset : in STD_LOGIC;
  12. ce : in STD_LOGIC;
  13. en : in STD_LOGIC);
  14. end ram128x32;
  15.  
  16. architecture Behavioral of ram128x32 is
  17. type ram_file_t is array (0 to 127) of std_logic_vector(31 downto 0);
  18. signal ram_file_s : ram_file_t := (others => (others => '0'));
  19. begin
  20. ram: process (clk) is begin
  21. if rising_edge(clk) and ce = '1' then
  22. if reset = '1' then
  23. ram_file_s <= (others => (others => '0'));
  24. elsif en = '1' and wen = '1' then
  25. ram_file_s(conv_integer(address)) <= wdata;
  26. end if;
  27. rdata <= ram_file_s(conv_integer(address));
  28. end if;
  29. end process;
  30. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement