Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > "Target of signal assignment is not a signal"

Reply
Thread Tools

"Target of signal assignment is not a signal"

 
 
Nicolas Moreau
Guest
Posts: n/a
 
      07-24-2007
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

 
Reply With Quote
 
 
 
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      07-24-2007
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
 
Reply With Quote
 
 
 
 
Tim McBrayer
Guest
Posts: n/a
 
      07-24-2007

"Nicolas Moreau" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.


 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      07-24-2007
On Jul 24, 2:10 pm, Nicolas Moreau <(E-Mail Removed)> 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

 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      07-24-2007
On Jul 24, 2:25 pm, Ralf Hildebrandt <(E-Mail Removed)> 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

 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      07-24-2007
On Jul 24, 1:10 pm, Nicolas Moreau <(E-Mail Removed)> 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

 
Reply With Quote
 
Nicolas Moreau
Guest
Posts: n/a
 
      07-24-2007
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


 
Reply With Quote
 
Nicolas Moreau
Guest
Posts: n/a
 
      07-24-2007
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

 
Reply With Quote
 
Nicolas Matringe
Guest
Posts: n/a
 
      07-25-2007
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)
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      07-25-2007
On Jul 25, 1:38 am, Nicolas Matringe <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assignment to output signal from internal signal not istantaneous dibacco73 VHDL 1 02-12-2009 11:28 PM
Assignment operator self-assignment check Chris C++ 34 09-26-2006 04:26 AM
Augument assignment versus regular assignment nagy Python 36 07-20-2006 07:24 PM
Question: inout signal assignment John Potter VHDL 1 09-08-2003 10:51 AM
Comparison of Bit Vectors in a Conditional Signal Assignment Statement Anand P Paralkar VHDL 2 08-04-2003 08:40 PM



Advertisments