Advertisement
Guest User

RomH

a guest
Jun 27th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.69 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_arith.all;
  4.  
  5. entity romH is
  6. generic(
  7.     address_length: natural := 3
  8. );
  9. port(
  10.     clk: in std_logic;
  11.     rom_enable: in std_logic;
  12.     address: in std_logic_vector((address_length - 1) downto 0);
  13.     data_output: out std_logic
  14. );
  15. end romH;
  16.  
  17. architecture arch of romH is
  18.     type rom_type is array (0 to (2**(address_length) -1)) of std_logic;
  19.    
  20.     -- set the data on each adress to some value
  21.     constant mem: rom_type:=
  22.     (
  23.         '1', '0', '1', '1',
  24.         '0', '1', '0', '1'
  25.     );
  26. begin
  27.  
  28. process(clk) is
  29. begin
  30.     if(rising_edge(clk) and rom_enable = '1') then
  31.         data_output <= mem(conv_integer(unsigned(address)));
  32.     end if;
  33. end process;
  34.  
  35. end arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement