----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
-- Company:
|
-- Company:
|
-- Engineer:
|
-- Engineer:
|
--
|
--
|
-- Create Date: 21:30:09 11/08/2009
|
-- Create Date: 21:30:09 11/08/2009
|
-- Design Name:
|
-- Design Name:
|
-- Module Name: bus_register_x16 - Behavioral
|
-- Module Name: bus_register_x16 - Behavioral
|
-- Project Name:
|
-- Project Name:
|
-- Target Devices:
|
-- Target Devices:
|
-- Tool versions:
|
-- Tool versions:
|
-- Description:
|
-- Description:
|
--
|
--
|
-- Dependencies:
|
-- Dependencies:
|
--
|
--
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- Revision 0.01 - File Created
|
-- Additional Comments:
|
-- Additional Comments:
|
--
|
--
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|
|
---- Uncomment the following library declaration if instantiating
|
---- Uncomment the following library declaration if instantiating
|
---- any Xilinx primitives in this code.
|
---- any Xilinx primitives in this code.
|
--library UNISIM;
|
--library UNISIM;
|
--use UNISIM.VComponents.all;
|
--use UNISIM.VComponents.all;
|
|
|
entity bus_register_x16 is
|
entity bus_register_x16 is
|
Port ( clk : in STD_LOGIC;
|
Port ( clk : in STD_LOGIC;
|
reset : in STD_LOGIC;
|
reset : in STD_LOGIC;
|
re : in STD_LOGIC;
|
re : in STD_LOGIC;
|
we : in STD_LOGIC;
|
we : in STD_LOGIC;
|
dataIn : in STD_LOGIC_VECTOR (15 downto 0);
|
dataIn : in STD_LOGIC_VECTOR (15 downto 0);
|
dataOut : out STD_LOGIC_VECTOR (15 downto 0));
|
dataOut : out STD_LOGIC_VECTOR (15 downto 0));
|
end bus_register_x16;
|
end bus_register_x16;
|
|
|
architecture Behavioral of bus_register_x16 is
|
architecture Behavioral of bus_register_x16 is
|
signal data: std_logic_vector(15 downto 0);
|
signal data: std_logic_vector(15 downto 0);
|
|
|
component bus_access_x16
|
|
Port ( en : in STD_LOGIC;
|
|
dataRead : in STD_LOGIC_VECTOR (15 downto 0);
|
|
dataWrite : out STD_LOGIC_VECTOR (15 downto 0));
|
|
end component;
|
|
begin
|
begin
|
|
|
ba: bus_access_x16
|
tristate: process(we, data) is
|
port map( en => we,
|
begin
|
dataRead=>data,
|
if we = '1' then
|
dataWrite=>dataOut);
|
dataOut <= data;
|
|
else
|
|
dataOut <= (others=>'Z');
|
|
end if;
|
|
end process;
|
|
|
readData: process(clk) is
|
readData: process(clk) is
|
begin
|
begin
|
if clk'event and clk = '1' then
|
if clk'event and clk = '1' then
|
if re = '1' then
|
if re = '1' then
|
data <= dataIn;
|
data <= dataIn;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
end Behavioral;
|
end Behavioral;
|
|
|
|
|