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

Subversion Repositories light8080

[/] [light8080/] [trunk/] [vhdl/] [soc/] [l80pkg.vhdl] - Diff between revs 70 and 80

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

Rev 70 Rev 80
Line 37... Line 37...
-- size: Size of the target memory.
-- size: Size of the target memory.
-- Returns ram_t value size-bytes long, suitable for synth-time initialization 
-- Returns ram_t value size-bytes long, suitable for synth-time initialization 
-- of a BRAM.
-- of a BRAM.
function objcode_to_bram(oC : obj_code_t; size : integer) return ram_t;
function objcode_to_bram(oC : obj_code_t; size : integer) return ram_t;
 
 
 
-- Compute log2(A), rounding up. 
 
-- Use this to get the minimum width of the address bus necessary to
 
-- address A locations.
 
function log2(A : natural) return natural;
 
 
end package;
end package;
 
 
package body l80pkg is
package body l80pkg is
 
 
Line 68... Line 72...
    br(obj_size to size-1) := (others => x"00");
    br(obj_size to size-1) := (others => x"00");
 
 
    return br;
    return br;
end function objcode_to_bram;
end function objcode_to_bram;
 
 
 
 
 
function log2(A : natural) return natural is
 
begin
 
    for I in 1 to 30 loop -- Works for up to 32 bit integers
 
        if(2**I >= A) then
 
            return(I);
 
        end if;
 
    end loop;
 
    return(30);
 
end function log2;
 
 
end package body;
end package body;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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