-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Title : mux
|
-- Title : mux
|
-- Project :
|
-- Project :
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File : mux.vhd
|
-- File : mux.vhd
|
-- Author :
|
-- Author :
|
-- Company :
|
-- Company :
|
-- Created : 2003-11-28
|
-- Created : 2003-11-28
|
-- Last update: 2003-12-05
|
-- Last update: 2003-12-05
|
-- Platform :
|
-- Platform :
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Description: Multiplixador de 2-1
|
-- Description: Multiplixador de 2-1
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Copyright (c) 2003
|
-- Copyright (c) 2003
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- Revisions :
|
-- Revisions :
|
-- Date Version Author Description
|
-- Date Version Author Description
|
-- 2003-11-28 1.0 tmsiqueira Created
|
-- 2003-11-28 1.0 tmsiqueira Created
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
entity mux is
|
entity mux is
|
|
|
generic (
|
generic (
|
width : natural);
|
width : natural);
|
|
|
port (
|
port (
|
inRa : in std_logic_vector(WIDTH-1 downto 0);
|
inRa : in std_logic_vector(WIDTH-1 downto 0);
|
inIa : in std_logic_vector(WIDTH-1 downto 0);
|
inIa : in std_logic_vector(WIDTH-1 downto 0);
|
inRb : in std_logic_vector(WIDTH-1 downto 0);
|
inRb : in std_logic_vector(WIDTH-1 downto 0);
|
inIb : in std_logic_vector(WIDTH-1 downto 0);
|
inIb : in std_logic_vector(WIDTH-1 downto 0);
|
outR : out std_logic_vector(WIDTH-1 downto 0);
|
outR : out std_logic_vector(WIDTH-1 downto 0);
|
outI : out std_logic_vector(WIDTH-1 downto 0);
|
outI : out std_logic_vector(WIDTH-1 downto 0);
|
clk : in std_logic;
|
clk : in std_logic;
|
sel : in std_logic);
|
sel : in std_logic);
|
|
|
end mux;
|
end mux;
|
|
|
architecture mux of mux is
|
architecture mux of mux is
|
|
|
begin -- mux
|
begin -- mux
|
|
|
-- outR <= inRa when (sel='0') else (others => 'Z');
|
-- outR <= inRa when (sel='0') else (others => 'Z');
|
-- outR <= inRb when (sel='1') else (others => 'Z');
|
-- outR <= inRb when (sel='1') else (others => 'Z');
|
-- outI <= inIa when (sel='0') else (others => 'Z');
|
-- outI <= inIa when (sel='0') else (others => 'Z');
|
-- outI <= inIb when (sel='1') else (others => 'Z');
|
-- outI <= inIb when (sel='1') else (others => 'Z');
|
|
|
-- with sel select
|
-- with sel select
|
-- outR <= inRa when '0',
|
-- outR <= inRa when '0',
|
-- inRb when others;
|
-- inRb when others;
|
|
|
-- with sel select
|
-- with sel select
|
-- outI <= inIa when '0',
|
-- outI <= inIa when '0',
|
-- inIb when others;
|
-- inIb when others;
|
|
|
process (clk)
|
process (clk)
|
begin
|
begin
|
if clk'event and clk='1' then
|
if clk'event and clk='1' then
|
case sel is
|
case sel is
|
when '0' =>
|
when '0' =>
|
outR <= inRa;
|
outR <= inRa;
|
outI <= inIa;
|
outI <= inIa;
|
when '1' =>
|
when '1' =>
|
outR <= inRb;
|
outR <= inRb;
|
outI <= inIb;
|
outI <= inIb;
|
when others =>
|
when others =>
|
null;
|
null;
|
end case;
|
end case;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
end mux;
|
end mux;
|
|
|