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

16 lines
329 B
VHDL
Raw Normal View History

2024-03-22 12:16:48 +00:00
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;