[an error occurred while processing this directive]
|
function log2(x : natural) return integer is
variable i : integer := 0;
variable val : integer := 1;
begin
if x = 0 then
return 0;
else
for j in 0 to 29 loop
if val >= x then
null;
else
i := i+1;
val := val*2;
end if;
end loop;
return i;
end if;
end function log2;
E-mail: info@telesys.ru