1
0
This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
SEm-ExamMidterm2024/VHD/hdl/utils_pkg_body.vhd
2024-03-22 13:16:48 +01:00

16 lines
329 B
VHDL

PACKAGE BODY utils IS
function requiredBitNb (val : integer) return integer is
variable powerOfTwo, bitNb : integer;
begin
powerOfTwo := 1;
bitNb := 0;
while powerOfTwo <= val loop
powerOfTwo := 2 * powerOfTwo;
bitNb := bitNb + 1;
end loop;
return bitNb;
end requiredBitNb;
END utils;