Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 21:32:05 04/28/2017
  6. -- Design Name:
  7. -- Module Name: ram128x32 - 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. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  23.  
  24. entity ram128x32 is
  25. Port ( address : in STD_LOGIC_VECTOR(6 downto 0);
  26. rdata : out STD_LOGIC_VECTOR(31 downto 0);
  27. wdata : in STD_LOGIC_VECTOR(31 downto 0);
  28. wen : in STD_LOGIC;
  29. clk : in STD_LOGIC;
  30. reset : in STD_LOGIC;
  31. ce : in STD_LOGIC;
  32. en : in STD_LOGIC);
  33. end ram128x32;
  34.  
  35. architecture Behavioral of ram128x32 is
  36. type ram_file_t is array (0 to 127) of std_logic_vector(31 downto 0);
  37. signal ram_file_s : ram_file_t := (others => (others => '0'));
  38. begin
  39. ram: process (clk) is begin
  40. if rising_edge(clk) and ce = '1' then
  41. if reset = '1' then
  42. ram_file_s <= (others => (others => '0'));
  43. elsif en = '1' and wen = '1' then
  44. ram_file_s(conv_integer(address)) <= wdata;
  45. end if;
  46. rdata <= ram_file_s(conv_integer(address));
  47. end if;
  48. end process;
  49. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement