OpenCores
URL https://opencores.org/ocsvn/cdc_ufifo/cdc_ufifo/trunk

Subversion Repositories cdc_ufifo

[/] [cdc_ufifo/] [trunk/] [StdUtils.vh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 AlexRayne
/*
2
    standart utils verilog include
3
*/
4
 
5
function integer clog2 (input integer num); // this function calculates ceil(log2(num))
6
begin
7
    num = num - 1;                          // without this statement clog2(32) will be 6 but must be 5    
8
    for (clog2 = 0; num > 0; clog2 = clog2 + 1)
9
        num = num >> 1;
10
end
11
endfunction

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.