ROM, how?

M

Maurice SAAB

Guest
Hello:
how to instantiate a ROM with its content in a test-bench?

thanks
 
Maurice SAAB <morisaab@yahoo.fr> wrote:

> how to instantiate a ROM with its content in a test-bench?

I don't know about test bench, but I do ROM with a constant array:


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all; -- for the unsigned type

entity i3601 is port (
Q : out std_logic_vector(3 downto 0);
A : in std_logic_vector(7 downto 0);
CS1, CS2 : in std_logic);
end entity i3601;

architecture i3601 of i3601 is
type ROM is array(0 to 255) of std_logic_vector(3 downto 0);
constant ROM1: ROM := (
X"1", X"2", X"3",
OTHERS => X"0");
begin
Q <= ROM1(to_integer(unsigned(A))) when (CS1 or CS2)='0' else X"F";
end architecture i3601;

Having the OTHERS => X"0" at the end, even if you fill the whole
array, allows the last element to have a trailing comma.

C allows array initialization to have a trailing comma, but not VDHL.

For some reason that I don't know, you have to use type.

Just declaring a constant of the appropriate type doesn't work.

-- glen
 

Welcome to EDABoard.com

Sponsor

Back
Top