Forum Discussion
Altera_Forum
Honored Contributor
14 years agoAddition Sum of Array
Hey @ all, i'm new here and i have some questions about the Sum of an array (VHDL), that contains a lot of 8 bit value's of std_logic_vector. For example i have declared the array as fol...
Altera_Forum
Honored Contributor
14 years agoThank's for the fast answer. My VHDL experience are not the best. This is a new section for me.
Yes, that's right. I have to convert std_logic_vector in unsigned / signed. Can i use integer too? So, my idea for the implementation:
type table is Array (natural range <>) of std_logic_vector (7 downto 0);
constant vec_value: table := ("00000000","00000001","00000010","00000010","00000010","00000110","00010010");
begin
signal tmp : unsigned := "00000000" ;
process(CLK)
begin
if clk'event and clk = '1' then
for i in 0 to 6 loop
tmp <= tmp + unsigned(vec_value(i));
end loop;
SUM <= (tmp,8);
end if;
end process;
Is it the right way? But do i need a clk? --- Quote Start --- The question is, will vec_value always be a constant, or is it some kind of memory? --- Quote End --- For the first time to lean about arithmetic operations i use constant's but later it will be elements of memory which are frequently change Thank's a lot regards phot