Mohammed,
Rather than a two dimensional array, you want an array of
an array. It is in some ways similar to a multidimensional
array. One problem with multidimensional arrays is that
you cannot slice them. Format for array of array is:
architecture RTL of ... is
type RomType is array (natural range <>) of std_logic_vector(2 downto 0);
signal ROM : RomType(0 to 7) := (
"000", "001", "010", "011", "100", "101", "110", "111") ;
begin
Y <= ROM(to_integer(unsigned(addr(2 downto 0)))) ;
end RTL ;
Of course, when you mentioned two dimensional aray, this may
been what you are thinking, however, a two dimensional array is
different and in this case harder to use (as you have to iterate
through each bit in the output assignment rather than assigning
the entire array).
By now, both coding styles you mentioned should be recognized
by most synthesis tools. I would start with one of these two.
If it did not meet the quality of results I expected, I would
look into ROM parts in the technology (FPGA/ASIC) you are using.
Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training private.php?do=newpm&u=
SynthWorks Design Inc.
http://www.SynthWorks.com
1-503-590-4787
Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
> There are many ways to create a rom in vhdl.
>
> 1) Can be created by declaring a constant of two dimensional array
> and
> 2) As a function which has a simple case statement for all the index
> values .
>
> and many more...
>
> I would like to know if there is any other way and which is better
> for simulation & synthesis among all and why ?
>
> Thanks a lot.