summing of array elements in for loop

Joined
Feb 12, 2012
Messages
1
Reaction score
0
How can I sum an array of vectors in a for loop? If e.g. I would have a type

type tab is array(my_size downto 0) of STD_LOGIC_VECTOR(3 DOWNTO 0);
signal s : tab;


and I want to do a sum that would be equivalent to this:

dout <= s(0) + s(1) + s(2) + s(3) ....

but how can I do that in a for loop? Of course I could use a variable:

for N in my_size-1 downto 0 loop
temp_var := temp_var + s(N);
end loop;


but how is it possible without using a variable?
 

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

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top