mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
9 lines
142 B
Systemverilog
9 lines
142 B
Systemverilog
function integer log2;
|
|
input integer x;
|
|
begin
|
|
x = x-1;
|
|
for (log2 = 0; x > 0; log2 = log2 + 1)
|
|
x = x >> 1;
|
|
end
|
|
endfunction
|