Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.64 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5. ENTITY part1 is
  6. Port(clk,RD: IN std_logic;
  7.       addr: IN std_logic_vector(1 downto 0);
  8.       data_out: out std_logic_vector(7 downto 0));
  9. end;
  10.  
  11. ARCHITECTURE arch of part1 is
  12. Type rom_array is array (0 to 3) of std_logic_vector(7 downto 0);
  13. constant rom: rom_array := (x"C0",
  14.                                      x"D1",
  15.                                      x"E2",
  16.                                      x"F3");
  17. Begin
  18.     Process(clk, addr)
  19.         Begin
  20.             if (clk' event and clk ='0') then
  21.                 if (RD = '1') then
  22.                 Data_out <= rom (to_integer( unsigned(addr)));
  23.                 elsif (RD = '0') then Data_out <= "ZZZZZZZZ";
  24.             end if; end if;
  25.         end process;
  26. end arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement