signal <= (others => '0')


P

Pasacco

dear

It is for me unclear to understand differences between the following

signal <= '00000000'; # assuming 8 bit signal
signal <= (others => '0';
signal <= (others => (others => '0'));

GIMY, but so far unsuccesful to find --:

Could anyone comment for this?
Thankyou in advance
 
Ad

Advertisements

E

Engineering Guy

Pasacco said:
dear

It is for me unclear to understand differences between the following

signal <= '00000000'; # assuming 8 bit signal
signal <= (others => '0';
signal <= (others => (others => '0'));

GIMY, but so far unsuccesful to find --:

Could anyone comment for this?
Thankyou in advance
Well they have something in common - all of them are incorrect.
First of all, signal is a keyword and cannot be used as identifier so
in the following I will use s instead of signal.

s <= '00000000'; -- is erroneous because of use ' instead of "
s <= (others => '0'; -- is missing a closing )
s <= (others => (others => '0')); -- is illegal for a vector
-- (2 dimensional array required)

Use of others in aggregate makes your code generic. Thus you won't have
to replace all "00000000" with "00" when you change your mind and
vectors should be only 2 bits wide.
The last variant is even more powerful. If you take for example 128x8
variable and you want to initialize it to all 0s you will spend a while
typing the initializer.

EG
 
Ad

Advertisements

A

aaaaaa

case 1 : "00000000" is an assignment to a 8 bit signal . In this type of
assignment you have to assign all the bits.
Case 2 : In this type of assignment all the bits of signal will be
assigned '0' .
case 3 : this type of assignment is used in two dimentional array
assignments .

I think it is helpful.
 

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

Top