"Target of signal assignment is not a signal"

Discussion in 'VHDL' started by Nicolas Moreau, Jul 24, 2007.

  1. Hey everyone, I'm kinda a newbie in VHDL programming. And I don't know
    what this error means in my case, here is what I have :

    type tab_aud_samp is array (NATURAL range <>) of std_logic_vector(31
    downto 0);


    function clear_table(h : tab_aud_samp) return std_logic_vector is
    variable aux : std_logic_vector (31 downto 0);
    begin
    aux := X"00000000";
    for i in 0 to h'length-1 loop
    h(i) <= aux;
    end loop;
    return aux;
    end clear_table;


    I didn't know how to clear this table in only one clock some other
    way. And it tells me that when I do

    h(i) <= aux;

    "Target of signal assignment is not a signal"

    Do you know what it means ? What I should do ?

    Thanks a lot.
    Nicolas
     
    Nicolas Moreau, Jul 24, 2007
    #1
    1. Advertising

  2. Nicolas Moreau schrieb:

    > h(i) <= aux;
    >
    > "Target of signal assignment is not a signal"


    h(i) := aux;

    Variables have the ":=" assign operator, signals have the "<=" Operator.

    Ralf
     
    Ralf Hildebrandt, Jul 24, 2007
    #2
    1. Advertising

  3. Nicolas Moreau

    Tim McBrayer Guest

    "Nicolas Moreau" <> wrote in message
    news:...
    > Hey everyone, I'm kinda a newbie in VHDL programming. And I don't know
    > what this error means in my case, here is what I have :
    >
    > type tab_aud_samp is array (NATURAL range <>) of std_logic_vector(31
    > downto 0);
    >
    >
    > function clear_table(h : tab_aud_samp) return std_logic_vector is
    > variable aux : std_logic_vector (31 downto 0);
    > begin
    > aux := X"00000000";
    > for i in 0 to h'length-1 loop
    > h(i) <= aux;
    > end loop;
    > return aux;
    > end clear_table;


    The function parameter is a constant, not a signal, inside the function. It
    is passed by value, so you cannot use a signal assignment. You could
    rewrite this as a procedure with h being an inout signal parameter, but the
    simplest way to do this the following, instead of calling clear_table:

    h <= (others => (others => '0'));

    This will initialize each element of your 2-D array of std_logic to '0'.
    Alternatively you could use:

    h <= (others => X"00000000");

    if you find the double-others use is confusing.
     
    Tim McBrayer, Jul 24, 2007
    #3
  4. Nicolas Moreau

    KJ Guest

    On Jul 24, 2:10 pm, Nicolas Moreau <> wrote:
    > Hey everyone, I'm kinda a newbie in VHDL programming. And I don't know
    > what this error means in my case, here is what I have :
    >
    > type tab_aud_samp is array (NATURAL range <>) of std_logic_vector(31
    > downto 0);
    >
    > function clear_table(h : tab_aud_samp) return std_logic_vector is
    > variable aux : std_logic_vector (31 downto 0);
    > begin
    > aux := X"00000000";
    > for i in 0 to h'length-1 loop
    > h(i) <= aux;
    > end loop;
    > return aux;
    > end clear_table;
    >
    > I didn't know how to clear this table in only one clock some other
    > way. And it tells me that when I do
    >
    > h(i) <= aux;
    >
    > "Target of signal assignment is not a signal"
    >
    > Do you know what it means ? What I should do ?
    >
    > Thanks a lot.
    > Nicolas


    "Target of signal assignment is not a signal" means that you've got an
    assignment (in your case "h(i) <= aux;") where the target of the
    assignment (in your case "h(i)") is not a signal. Your function
    defines 'h' to be of type 'tab_aud_samp' and is an input (all function
    parameters are inputs).

    If you really want to assign to 'h' then you'll have to make it a
    procedure instead of a function. If 'h' is supposed to be an input,
    then don't assign to it.

    But I'm guessing that what you really wanted to do was
    aux := h(i);
    instead of
    h(i) <= aux;

    KJ

    KJ
     
    KJ, Jul 24, 2007
    #4
  5. Nicolas Moreau

    KJ Guest

    On Jul 24, 2:25 pm, Ralf Hildebrandt <> wrote:
    > Nicolas Moreau schrieb:
    >
    > > h(i) <= aux;

    >
    > > "Target of signal assignment is not a signal"

    >
    > h(i) := aux;
    >
    > Variables have the ":=" assign operator, signals have the "<=" Operator.
    >
    > Ralf


    Flip it around to "aux := h(i);" since 'h' is the function input and
    'aux' is the local variable.

    KJ
     
    KJ, Jul 24, 2007
    #5
  6. Nicolas Moreau

    Andy Guest

    On Jul 24, 1:10 pm, Nicolas Moreau <> wrote:
    > Hey everyone, I'm kinda a newbie in VHDL programming. And I don't know
    > what this error means in my case, here is what I have :
    >
    > type tab_aud_samp is array (NATURAL range <>) of std_logic_vector(31
    > downto 0);
    >
    > function clear_table(h : tab_aud_samp) return std_logic_vector is
    > variable aux : std_logic_vector (31 downto 0);
    > begin
    > aux := X"00000000";
    > for i in 0 to h'length-1 loop
    > h(i) <= aux;
    > end loop;
    > return aux;
    > end clear_table;
    >
    > I didn't know how to clear this table in only one clock some other
    > way. And it tells me that when I do
    >
    > h(i) <= aux;
    >
    > "Target of signal assignment is not a signal"
    >
    > Do you know what it means ? What I should do ?
    >
    > Thanks a lot.
    > Nicolas


    Parameters passed into functions are read only inside the function.
    You need to either return a cleared copy of H or use a procedure with
    H declared as inout.

    Andy
     
    Andy, Jul 24, 2007
    #6
  7. In fact, h is an output of my big picture, the only thing I wanted to
    do is put 0s everywhere in it on the reset and I thought it ws the
    best way to do it. A function that would on one clock only put 0s in
    every one of the 16 std_logic_vector. Every advice is welcome and
    already thank you to everyone of you ! So maybe I need a procedure
    ( never did one, only functions, I'm gonna take a look at it ) but I
    don't think it would be := Am I right ?

    Nicolas
     
    Nicolas Moreau, Jul 24, 2007
    #7
  8. Tim, your thing apparently worked.
    I have to admit I don't completely understand how it works. Does
    others in some way mean "everything it can be" ?
    Or do you have any link to give me so I can better understand how it
    works ?
    Thanks again.

    Nicolas
     
    Nicolas Moreau, Jul 24, 2007
    #8
  9. Nicolas Moreau a écrit :
    > Tim, your thing apparently worked.
    > I have to admit I don't completely understand how it works. Does
    > others in some way mean "everything it can be" ?


    Not exactly. It means "everything that has not been specified before".
    One can write
    vect <= (0 => '1', others => '0');
    for example.

    In your case you have an array of arrays so you end up with "cascaded"
    others.

    Nicolas (another one)
     
    Nicolas Matringe, Jul 25, 2007
    #9
  10. Nicolas Moreau

    Andy Guest

    On Jul 25, 1:38 am, Nicolas Matringe <> wrote:
    > Nicolas Moreau a écrit :
    >
    > > Tim, your thing apparently worked.
    > > I have to admit I don't completely understand how it works. Does
    > > others in some way mean "everything it can be" ?

    >
    > Not exactly. It means "everything that has not been specified before".
    > One can write
    > vect <= (0 => '1', others => '0');
    > for example.
    >
    > In your case you have an array of arrays so you end up with "cascaded"
    > others.
    >
    > Nicolas (another one)


    And, the result of "others" must be locally staticly determinable,
    unless it is the only choice. Thus you cannot say, (i => '1', others
    => '0'), unless i is a constant declared locally, or declared in a
    package (and not deferred in a package body). Also, you cannot use it
    in a comparison of vectors, since the comparison is valid for vectors
    of different length, and thus the compile cannot determine how long
    others might be in such a case. In an assignment, the compiler knows
    that the others expression must be the same length as the vector being
    assigned.

    I really wish they'd relax the locally static / only choice
    requirement, since it really does not break any rules they don't break
    elsewhere ("i" can be locally non-static if used by itself), and in
    every other application of others, it is allowed to be the null set,
    so duplication of indices need not be an issue.

    Andy
     
    Andy, Jul 25, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page