----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
-- Company:
|
-- Engineer: Joao Carlos Nunes Bittencourt
|
-- Engineer:
|
----------------------------------------------------------------------------------
|
--
|
-- Create Date: 13:18:18 03/06/2012
|
-- Create Date: 22:26:49 04/18/2012
|
----------------------------------------------------------------------------------
|
-- Design Name:
|
-- Design Name: 2x1 Multiplexer
|
-- Module Name: mux2x1 - Behavioral
|
-- Module Name: mux2x1 - behavioral
|
-- Project Name:
|
----------------------------------------------------------------------------------
|
-- Target Devices:
|
-- Project Name: 16-bit uRISC Processor
|
-- Tool versions:
|
----------------------------------------------------------------------------------
|
-- Description:
|
|
--
|
|
-- Dependencies:
|
|
--
|
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- 1.0 - File Created
|
-- Additional Comments:
|
-- 2.0 - Project refactoring
|
--
|
--
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
entity mux2x1 is
|
entity mux2x1 is
|
generic ( WIDTH : integer := 16 );
|
generic ( WIDTH : integer := 16 );
|
port ( sink_a : in std_logic_vector (WIDTH-1 downto 0);
|
port ( sink_a : in std_logic_vector (WIDTH-1 downto 0);
|
sink_b : in std_logic_vector (WIDTH-1 downto 0);
|
sink_b : in std_logic_vector (WIDTH-1 downto 0);
|
sink_sel : in std_logic_vector (0 downto 0); -- FIXME
|
sink_sel : in std_logic_vector (0 downto 0); -- FIXME
|
src_data : out std_logic_vector (WIDTH-1 downto 0)
|
src_data : out std_logic_vector (WIDTH-1 downto 0)
|
);
|
);
|
end mux2x1;
|
end mux2x1;
|
|
|
architecture Primitive of mux2x1 is
|
architecture Primitive of mux2x1 is
|
begin
|
begin
|
process(sink_sel, sink_a, sink_b)
|
process(sink_sel, sink_a, sink_b)
|
begin
|
begin
|
case sink_sel is
|
case sink_sel is
|
when "0" => src_data <= sink_a;
|
when "0" => src_data <= sink_a;
|
when "1" => src_data <= sink_b;
|
when "1" => src_data <= sink_b;
|
when others => src_data <= (others => '0');
|
when others => src_data <= (others => '0');
|
end case;
|
end case;
|
|
|
end process;
|
end process;
|
end Primitive;
|
end Primitive;
|
|
|
|
|