Advertisement
HimikoWerckmeister

Untitled

Feb 25th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_arith.all;
  4.  
  5. entity RF8x4 is
  6. port(s,t,d: in std_logic_vector(2 downto 0);
  7. lr, clk: in std_logic;
  8. rd: in std_logic_vector(3 downto 0);
  9. rs, rt: out std_logic_vector(3 downto 0));
  10. end RF8x4;
  11.  
  12. architecture behav of RF8x4 is
  13. type memory is array(0 to 7) of std_logic_vector(3 downto 0);
  14.  
  15. begin
  16. process is
  17. variable s_locn,t_locn,d_locn: natural;
  18. variable R: memory;
  19. begin
  20. if clk = '1' then
  21. if lr = '0' then
  22. s_locn := to_integer(s);
  23. rs <= R(s_locn);
  24. t_locn := to_integer(t);
  25. rt <= R(t_locn);
  26. else
  27. s_locn := to_integer(s);
  28. rs <= R(s_locn);
  29. t_locn := to_integer(t);
  30. rt <= R(t_locn);
  31. d_locn := to_integer(d);
  32. R(d_locn) := rd;
  33. end if;
  34. end if;
  35. wait on clk;
  36. end process;
  37.  
  38.  
  39. end behav;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement