F
Frank Buss
Guest
I'm using this function for calculating the number of bits needed to encode
a natural number:
function num_bits(n: natural) return natural is
begin
if n > 0 then
return 1 + num_bits(n / 2);
else
return 1;
end if;
end num_bits;
I wonder if there is already such a function in the IEEE.* libraries or
some special VHDL operator.
--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
a natural number:
function num_bits(n: natural) return natural is
begin
if n > 0 then
return 1 + num_bits(n / 2);
else
return 1;
end if;
end num_bits;
I wonder if there is already such a function in the IEEE.* libraries or
some special VHDL operator.
--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de