[an error occurred while processing this directive]
[an error occurred while processing this directive]
|
library ieee;
use ieee.std_logic_1164.all;
entity buses is
port( mem_data : inout std_logic_vector(7 downto 0);
rd : in std_logic;
wr : in std_logic;
wr_data : in std_logic_vector(7 downto 0);
rd_data : out std_logic_vector(7 downto 0)
);
end buses;
architecture buses_rtl of buses is
signal rd_reg : std_logic_vector(7 downto 0); -- DFF that stores value readed from memory.
signal wr_reg : std_logic_vector(7 downto 0); -- DFF that stores value for write to memory.
begin
process(rd)
begin
if(rd'event and rd = '1') then -- Creates the flipflop
rd_data <= rd_reg;
end if;
end process;
process(wr)
begin
if(wr'event and wr = '1') then -- Creates the flipflop
wr_reg <= wr_data;
end if;
end process;
process(wr, mem_data, wr_reg) -- Behavioral representation of tri-states.
begin
if(wr = '1') then
mem_data <= "ZZZZZZZZ";
rd_reg <= mem_data;
else
mem_data <= wr_reg;
rd_reg <= mem_data;
end if;
end process;
end buses_rtl;
E-mail: info@telesys.ru