Initial commit
This commit is contained in:
15
VHD/hdl/utils_pkg_body.vhd
Normal file
15
VHD/hdl/utils_pkg_body.vhd
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user