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

Subversion Repositories cdc_ufifo

[/] [cdc_ufifo/] [trunk/] [StdUtils.vh] - Rev 2

Compare with Previous | Blame | View Log

/*
    standart utils verilog include
*/
 
function integer clog2 (input integer num); // this function calculates ceil(log2(num))
begin    
    num = num - 1;                          // without this statement clog2(32) will be 6 but must be 5    
    for (clog2 = 0; num > 0; clog2 = clog2 + 1)        
        num = num >> 1;
end
endfunction
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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