Programación Específica > Lenguaje de Descripción de Hardware VHDL

 memoria rom en vhdl

(1/1)

acorona:
Programa que muestra por 4 leds, el valor almacenado en cada una de las direcciones de memoria
para acceder alas direcciones se pulsa un push buton el cual incrementa un contador el cual ira leyendo los diferentes valores guardados
tarjeta utilizada basys 2
si desean el archivo ucf o cualquier aclaracion  enviar un correo a tico_x@live.com.mx


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.Std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
use IEEE.numeric_std.all;

entity rams_21b is
    Port ( clk : in  STD_LOGIC;
           en : in  STD_LOGIC;
           data : out  STD_LOGIC_VECTOR (3 downto 0));
end rams_21b;

architecture Behavioral of rams_21b is
type rom_type is array (0 to 15) of std_logic_vector (3 downto 0);
constant ROM : rom_type :=(x"0",x"1",x"2",x"3",x"4",x"5",
                           "0110","0111","1000","1001","1010",
                           "1011","1100","1101","1110","1111");

signal addr : std_logic_vector(3 downto 0);
begin
process (clk)
begin
if (clk'event and clk = '1') then
if (en = '1') then
addr <= addr +1;
else
addr <= addr -1;
end if;
end if;
end process;
data <= ROM(conv_integer(addr));
end Behavioral;

Navegación

[0] Índice de Mensajes

Ir a la versión completa