Advertisement
madegoff

DistRAM32M

May 20th, 2024
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5.  
  6. entity RAM32M is
  7. port (
  8. WCLK : in std_logic;
  9. ADDRA : in std_logic_vector(4 downto 0);
  10. ADDRB : in std_logic_vector(4 downto 0);
  11. ADDRC : in std_logic_vector(4 downto 0);
  12. ADDRD : in std_logic_vector(4 downto 0);
  13. DID : in std_logic_vector(1 downto 0);
  14. DOA : out std_logic_vector(1 downto 0);
  15. DOB : out std_logic_vector(1 downto 0);
  16. DOC : out std_logic_vector(1 downto 0);
  17. DOD : out std_logic_vector(1 downto 0);
  18. WED : in std_logic
  19. );
  20. end entity;
  21.  
  22. architecture rtl of RAM32M is
  23.  
  24. type ram_type is array (31 downto 0) of std_logic_vector(1 downto 0);
  25. signal RAM: ram_type;
  26.  
  27. begin
  28.  
  29. --schreiben in D Port, WED: enable signal fuers Schreiben--
  30. synchronesschreiben: process(WCLK)
  31. begin
  32. if (rising_edge(WCLK)) then
  33. if (WED = '1') then
  34. RAM(to_integer(unsigned(ADDRD))) <= DID;
  35. end if;
  36. end if;
  37.  
  38. end process;
  39.  
  40. DOA <= RAM(to_integer(unsigned(ADDRA)));
  41. DOB <= RAM(to_integer(unsigned(ADDRB)));
  42. DOC <= RAM(to_integer(unsigned(ADDRC)));
  43. DOD <= RAM(to_integer(unsigned(ADDRD)));
  44.  
  45.  
  46. end architecture
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement