4% (423/10570) logic elements @ 81.59MHz, klingt schon mal besser :)
package body gen_pkg is
function find_msb(a : csigned) return natural is
variable r : natural := 0;
- variable count : boolean := true;
begin
for i in (CBITS-1) downto 0 loop
- if count then
- if a(i) = '1' then
- count := false;
- else
- r := r+1;
- end if;
- else
- null;
- end if;
+ exit when a(i) = '1';
+ r := r+1;
end loop;
return (CBITS - r);
end function find_msb;