blob: 2f7b64d4dfdf0717255da8559f156b8762ff74ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
|
function integer clog2;
input integer value;
integer result;
begin
value = value - 1;
for (result = 0; value > 0; result = result + 1)
value = value >> 1;
clog2 = result;
end
endfunction
|