Altera_Forum
Honored Contributor
12 years agoHow to create a generic sum?
Hello folks,
I'm stuck at the idea how to optimize my code. Hope to get any help from you. My code is to make a generic sum y = a(1) + a(2) + a(3); I would like to make it like: n <= 3; process(y) begin ---for i in 1 to 3 loop ------y <= y + a(i); ---end loop; end process; Of course it will cause combinational loop :( I dont know how to do that sum without rewrite the program. I meant when I need to change the length of a. Need your help, Thanks