signal <= (others => '0')

Discussion in 'VHDL' started by Pasacco, Apr 18, 2005.

  1. Pasacco

    Pasacco Guest


    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
    Pasacco, Apr 18, 2005
    1. Advertisements

  2. 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.

    Engineering Guy, Apr 18, 2005
    1. Advertisements

  3. Pasacco

    Pasacco Guest


    Pasacco, Apr 18, 2005
  4. Pasacco

    aaaaaa Guest

    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.
    aaaaaa, Apr 19, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.