Line 3... |
Line 3... |
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
|
|
package mips_pkg is
|
package mips_pkg is
|
|
|
|
-- FIXME this stuff belongs in the cache module where address decoding is made
|
subtype t_addr_decode is std_logic_vector(31 downto 16);
|
-- (besides, they should be module generics, not package constants)
|
constant ADDR_BOOT : t_addr_decode := X"0000";
|
subtype t_addr_decode is std_logic_vector(31 downto 24);
|
constant ADDR_XRAM : t_addr_decode := X"8000";
|
constant ADDR_BOOT : t_addr_decode := X"00";
|
constant ADDR_IO : t_addr_decode := X"2000";
|
constant ADDR_XRAM : t_addr_decode := X"80";
|
|
constant ADDR_IO : t_addr_decode := X"20";
|
|
|
|
|
subtype t_addr is std_logic_vector(31 downto 0);
|
subtype t_addr is std_logic_vector(31 downto 0);
|
subtype t_word is std_logic_vector(31 downto 0);
|
subtype t_word is std_logic_vector(31 downto 0);
|
subtype t_dword is std_logic_vector(63 downto 0);
|
subtype t_dword is std_logic_vector(63 downto 0);
|
Line 56... |
Line 57... |
|
|
-- Computes ceil(log2(A)), e.g. address width of memory block
|
-- Computes ceil(log2(A)), e.g. address width of memory block
|
-- CAN BE USED IN SYNTHESIZABLE CODE as long as called with constant arguments
|
-- CAN BE USED IN SYNTHESIZABLE CODE as long as called with constant arguments
|
function log2(A : natural) return natural;
|
function log2(A : natural) return natural;
|
|
|
-- Return '1' if address A is within a given memory area
|
|
-- CAN BE USED IN SYNTHESIZABLE CODE as long as called with constant arguments
|
|
function addr_decode(A : std_logic_vector; mask : t_addr_decode) return std_logic;
|
|
|
|
end package;
|
end package;
|
|
|
package body mips_pkg is
|
package body mips_pkg is
|
|
|
Line 74... |
Line 72... |
end if;
|
end if;
|
end loop;
|
end loop;
|
return(30);
|
return(30);
|
end function log2;
|
end function log2;
|
|
|
function addr_decode(A : std_logic_vector; mask : t_addr_decode) return std_logic is
|
|
begin
|
|
if A(mask'high downto mask'low) = mask then
|
|
return '1';
|
|
else
|
|
return '0';
|
|
end if;
|
|
end function addr_decode;
|
|
|
|
end package body;
|
end package body;
|
|
|
No newline at end of file
|
No newline at end of file
|