Forum Discussion
Altera_Forum
Honored Contributor
13 years agoIt isn't. As Tricky says you have to declare bit_location as a variable, local to the process:
process( bit_field , msbd , lsb )
variable bit_location : natural ;
begin
output <= (others => '0') ;
for i in 0 to 31 loop
bit_location := i + to_integer( unsigned(lsb) );
if (bit_location >= unsigned(lsb)) AND (bit_location <= unsigned(msbd)) then
output(i) <= bit_field(bit_location);
end if;
end loop;
end process ;
The RTL now is a lot bigger, but also very difficult to understand, if at all :) It uses 308 LCs. A solution using one or more barrel shifters will be smaller.