Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.03 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use ieee.std_logic_unsigned.all;
  5.  
  6. entity memory is
  7. Port ( DO: in STD_LOGIC_VECTOR(15 downto 0);
  8.          A: in STD_LOGIC_VECTOR(31 downto 0);
  9.          S_MAR: in STD_LOGIC;
  10.          S_MBR: in STD_LOGIC;
  11.          WR: in STD_LOGIC;
  12.          RD: in STD_LOGIC;
  13.          AD: out STD_LOGIC_VECTOR(31 downto 0);
  14.          D: out STD_LOGIC_VECTOR(15 downto 0);
  15.          DI: out STD_LOGIC_VECTOR(15 downto 0));
  16.          
  17. end memory;
  18.  
  19. architecture behaviour of memory is
  20.  
  21. signal MAR: STD_LOGIC_VECTOR(31 downto 0);
  22. signal MBR: STD_LOGIC_VECTOR(15 downto 0);
  23. signal bDI: STD_LOGIC_VECTOR(15 downto 0);
  24.  
  25. begin
  26.  
  27. process(DO, A, S_MAR, S_MBR, WR, RD) is
  28.  
  29.  
  30.  
  31.     begin
  32.    
  33.         if (S_MAR = '1') then MAR <= A; end if;--zapis adresu
  34.         if (S_MBR = '1') then MBR <= DO; end if;    -- zapis danych
  35.         if (RD = '1') then bDI <= MBR; end if; --odczyt z MBR do DI
  36.         if (WR = '1') then MBR <= DO; --zapis z DO do MBR
  37.         else MBR <= "ZZZZZZZZZZZZZZZZ";
  38.         end if;
  39.  
  40.    
  41.     end process;
  42.    
  43. DI <=bDI;
  44. AD  <=MAR;
  45. D  <=MBR;
  46.  
  47. end behaviour;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement