Easy way to define lots of zeroes

P

Peter Bluer

Guest
Hi,

Please could someone help with the following:

I have an output on an entity which is a std_ulogic_vector(31 DOWNTO 0) and
is called data_out.
Within the VHDL I have a std_ulogic called c_store.
At one point I want to do data_out <= "0000000000000000000000000000000" &
c_store;
(so all zeroes apart from the lsb which is replaced by the value of
c_store).

Is there any better way of defining it so I don't have to put in all those
zeroes?

ie: somehow using OTHERS => '0' etc.

Hope this makes sense,

Thanks.
 
Put this inside a process:

data_out <= (others => '0');
data_out(0) <= c_store;

I think this would work too (more generic):

data_out <= (others => '0');
data_out(c_store'range) <= c_store;
 
Peter Bluer wrote:

I have an output on an entity which is a std_ulogic_vector(31 DOWNTO
0) and is called data_out. Within the VHDL I have a std_ulogic called
c_store. At one point I want to do data_out <=
"0000000000000000000000000000000" & c_store; (so all zeroes apart
from the lsb which is replaced by the value of c_store).

Is there any better way of defining it so I don't have to put in all
those zeroes?
<http://www.codecomments.com/archive378-2005-10-659444.html>

--
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
 
Hi,

jens schrieb:
Put this inside a process:

data_out <= (others => '0');
data_out(0) <= c_store;
maybe you should try
data_out <= (0 => c_store, others => '0');
to short your code by one statement :). This should work even outside a
process.

bye Thomas
 
Thanks very much for all the replies.

"Peter Bluer" <bluepeter@postmaster.co.uk> wrote in message
news:vM68g.249143$8Q3.4415@fe1.news.blueyonder.co.uk...
Hi,


Thanks.
 

Welcome to EDABoard.com

Sponsor

Back
Top