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

Subversion Repositories ion

[/] [ion/] [trunk/] [vhdl/] [mips_pkg.vhdl] - Diff between revs 81 and 85

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 81 Rev 85
Line 122... Line 122...
package body mips_pkg is
package body mips_pkg is
 
 
function log2(A : natural) return natural is
function log2(A : natural) return natural is
begin
begin
    for I in 1 to 30 loop -- Works for up to 32 bit integers
    for I in 1 to 30 loop -- Works for up to 32 bit integers
        if(2**I > A) then
        if(2**I >= A) then
            return(I-1);
            return(I);
        end if;
        end if;
    end loop;
    end loop;
    return(30);
    return(30);
end function log2;
end function log2;
 
 

powered by: WebSVN 2.1.0

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