Filling large ROMs

X

Xin Xiao

I have a constant ROM, and I would like to initialize it. The problem is
that the ROM is very large and I only need to initialize, say, the first 10
positions or so. How can I initialize the first 10 positions and fill the
rest with zeros? Maybe with the "others" reserved word? Do you have an
example?
 
D

David Spencer

Xin Xiao said:
I have a constant ROM, and I would like to initialize it. The problem is
that the ROM is very large and I only need to initialize, say, the first
10 positions or so. How can I initialize the first 10 positions and fill
the rest with zeros? Maybe with the "others" reserved word? Do you have an
example?

If you only need to use the first few locations of a ROM, then perhaps a
smaller ROM is in order.
 
X

Xin Xiao

I solved it!

constant array : t_array :=
( 0 => "111111111",
1 => "101010101",
...
others => "000000000");
 
M

Mark McDougall

Xin said:
I have a constant ROM, and I would like to initialize it. The problem is
that the ROM is very large and I only need to initialize, say, the first
10 positions or so. How can I initialize the first 10 positions and fill
the rest with zeros? Maybe with the "others" reserved word? Do you have
an example?

That will likely slow down your simulation. There are techniques for
populating sparse arrays to be used as memory in simulation, you could
apply a similar technique for your ROM...

Regards,
 
J

jihan.rezwan

That will likely slow down your simulation. There are techniques for
populating sparse arrays to be used as memory in simulation, you could
apply a similar technique for your ROM...

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266

I have a similar problem. I'm trying to declare and initialize an
array of constants with this statement:

constant RCONtable: array (10 downto 1) of std_logic_vector (7 downto
0) :=
( x"01", x"02", x"04", x"08", x"10", x"20", x"40", x"80", x"1b",
x"36" );


but the compiler doesn't like it :(

Please help me!
 
M

Mark McDougall

I have a similar problem. I'm trying to declare and initialize an array
of constants with this statement:

constant RCONtable: array (10 downto 1) of std_logic_vector (7 downto
0) := ( x"01", x"02", x"04", x"08", x"10", x"20", x"40", x"80", x"1b",
x"36" );

type RCONtable_t is array (natural range <>) of std_logic_vector(7 downto 0);
constant RCONtable : RCONtable_t(2 downto 1) := ( X"01", X"02" );

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top