Forum Discussion
Altera_Forum
Honored Contributor
14 years agoUnfortunately, important parts are still missing from the code, e.g. definition of all involved signals and generics. So the exact solution can't be given.
The said error message about requiring constant range for bit vector slices is simply reflecting VHDL syntax rules. As mentioned by Tricky, a for loop with a bitwise copy is the usual way to implement assignments of dynamical varying size. A problem you probably stumbled upon is, that the for loop range also must be constant. So you need to do the iteration over the maximal range and decide with an if statement about the actual used range. I'm sure you can figure it out when thinking about it a little bit. P.S.: I fear, that the construct for i in 0 to r_by_2-1 loop doesn't work for the said reasons. You'll probably needfor i in 0 to msize-1 loop
if i < r_by_2 then
end if;
end loop;