2013-07-26 12:33:01 +02:00
|
|
|
-------------------------------------------------------
|
|
|
|
--! @file
|
|
|
|
--! @brief Maps memory devices to a given memory space
|
|
|
|
--! @author Dominik Meyer
|
2013-12-30 14:56:42 +01:00
|
|
|
--! @email dmeyer@federationhq.de
|
2013-07-26 12:33:01 +02:00
|
|
|
--! @date 2010-06-03
|
|
|
|
-------------------------------------------------------
|
|
|
|
library ieee;
|
2013-12-30 14:56:42 +01:00
|
|
|
use ieee.std_logic_1164.all;
|
|
|
|
use ieee.std_logic_unsigned.all;
|
2013-07-26 12:33:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
--! Maps memory devices to a given memory space
|
|
|
|
entity MemoryMapper is
|
2013-12-30 14:56:42 +01:00
|
|
|
port(
|
|
|
|
start : in std_logic_vector(15 downto 0); --! start of memory space
|
|
|
|
stop : in std_logic_vector(15 downto 0); --! end of mempry space
|
|
|
|
adr_in : in std_logic_vector(15 downto 0);
|
|
|
|
req_in : in std_logic; --! ram request type
|
|
|
|
req_out : out std_logic; --! ram request type
|
|
|
|
|
|
|
|
enable : out std_logic;
|
|
|
|
|
|
|
|
adr_out : out std_logic_vector(15 downto 0)
|
|
|
|
|
2013-07-26 12:33:01 +02:00
|
|
|
);
|
|
|
|
end MemoryMapper;
|
|
|
|
|
|
|
|
|
|
|
|
--! architecture to map memory devices to memory space
|
|
|
|
architecture arch of MemoryMapper is
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
process(adr_in, req_in, start, stop)
|
|
|
|
begin
|
2013-12-30 14:56:42 +01:00
|
|
|
|
2013-07-26 12:33:01 +02:00
|
|
|
if (adr_in >= start and adr_in <= stop) then
|
2013-12-30 14:56:42 +01:00
|
|
|
req_out <= req_in;
|
|
|
|
adr_out <= adr_in-start;
|
|
|
|
enable <= '1';
|
2013-07-26 12:33:01 +02:00
|
|
|
else
|
|
|
|
req_out <= '0';
|
2013-12-30 14:56:42 +01:00
|
|
|
enable <= '0';
|
2013-07-26 12:33:01 +02:00
|
|
|
adr_out <= (others => 'Z');
|
|
|
|
end if;
|
|
|
|
end process;
|
|
|
|
|
|
|
|
end arch;
|