FPGARelated.com
Forums

ModelSim & Constant

Started by Alexis GABIN January 23, 2005
Hi,

I want to know if it is possible to watch a constant in the Modelsim 
waveform viewer because I tried to make a model of ROM memory with an array 
of std_logic_vector but when I adress the array it don't give me the right 
value (it seem to choose the first or the final one). So I would like to 
verify if Modelsim put the right value in the memory
the declaration of the memory look like this:

--declaration of a memory subtype
type TYPE_RAM is array (512 downto 0) of
    std_logic_vector(7 downto 0);
--declaration of the memory and his contents
constant ram1: TYPE_RAM :=
(
std_logic_vector(to_unsigned(10#1#,8)),
std_logic_vector(to_unsigned(10#2#,8)),
std_logic_vector(to_unsigned(10#3#,8)),
std_logic_vector(to_unsigned(10#0#,8)),
others => ("11111111")

);

--read at the adress wanted
data_out <= ram1(to_integer(unsigned(adress_ram)));

and when i simulate this i got the value of data_out= "11111111" for all 
value of adress_ram
and i would like to verify the contents of ram1.
How could I see it with modelsim??

Thanks.

Alexis 


Alexis GABIN wrote:

> Hi, > > I want to know if it is possible to watch a constant in the Modelsim > waveform viewer because I tried to make a model of ROM memory with an array > of std_logic_vector but when I adress the array it don't give me the right > value (it seem to choose the first or the final one). So I would like to > verify if Modelsim put the right value in the memory > the declaration of the memory look like this: > > --declaration of a memory subtype > type TYPE_RAM is array (512 downto 0) of
^^^^^^^^^^^^^ I dare to say for arrays of any type one will mostly want to declare 0 to 2**N-1 (in your case, 0 to 511). I was having the very same problem a few weeks ago just because of that. I also thed to automaticaly type downto when coding arrays but in this particular category the outcome is clearly not what one wants though it's sintaticaly correct. HTH. Elder.
Argh!!

You are right Elder, how stupid I am,
baka baka baka!!
lol
moreover I took exemple from an old file I have done during my last 
internship and in this file I used 0 to 2xx too
Thank You for correcting my error.

Alexis

"Elder Costa" <elder.costa@terra.com.br> a &#4294967295;crit dans le message de news: 
35iba7F4npp6qU1@individual.net...
> Alexis GABIN wrote: > >> Hi, >> >> I want to know if it is possible to watch a constant in the Modelsim >> waveform viewer because I tried to make a model of ROM memory with an >> array of std_logic_vector but when I adress the array it don't give me >> the right value (it seem to choose the first or the final one). So I >> would like to verify if Modelsim put the right value in the memory >> the declaration of the memory look like this: >> >> --declaration of a memory subtype >> type TYPE_RAM is array (512 downto 0) of > ^^^^^^^^^^^^^ > I dare to say for arrays of any type one will mostly want to declare 0 to > 2**N-1 (in your case, 0 to 511). I was having the very same problem a few > weeks ago just because of that. I also thed to automaticaly type downto > when coding arrays but in this particular category the outcome is clearly > not what one wants though it's sintaticaly correct. > > HTH. > > Elder. > > >