Guest User

Untitled

a guest
Apr 26th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. entity instr_ram is
  2. Port ( iCLK : in STD_LOGIC;
  3. inRST : in STD_LOGIC;
  4. iA : in STD_LOGIC_VECTOR (4 downto 0);
  5. iD : in STD_LOGIC_VECTOR (15 downto 0);
  6. iWE : in STD_LOGIC;
  7. oQ : out STD_LOGIC_VECTOR (15 downto 0));
  8. end instr_ram;
  9.  
  10. architecture Behavioral of instr_ram is
  11.  
  12. type tRAM is array (0 to 31) of STD_LOGIC_VECTOR (15 downto 0);
  13. signal sRAM: tRAM;
  14.  
  15. begin
  16.  
  17. process (iCLK) begin
  18. if (iCLK'event and iCLK='1') then
  19. if (inRST='0') then
  20. sRAM<=(x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",
  21. x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",
  22. x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",x"0000",
  23. x"0000",x"0000");
  24. else
  25. if (iWE='1') then
  26. sRAM(CONV_INTEGER(iA))<=iD;
  27.  
  28. end if;
  29. end if;
  30. end process;
  31.  
  32. oQ<=sRAM(CONV_INTEGER(iA));
  33.  
  34. end Behavioral;
Add Comment
Please, Sign In to add comment