OpenCores
URL https://opencores.org/ocsvn/opencpu32/opencpu32/trunk

Subversion Repositories opencpu32

[/] [opencpu32/] [trunk/] [hdl/] [opencpu32/] [Multiplexer4_1.vhd] - Blame information for rev 21

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 leonardoar
--! @file
2 18 leonardoar
--! @brief 4:1 Mux using with-select
3 5 leonardoar
 
4
--! Use standard library
5
library IEEE;
6
use IEEE.STD_LOGIC_1164.ALL;
7
 
8 6 leonardoar
--! Use CPU Definitions package
9 10 leonardoar
use work.pkgOpenCPU32.all;
10 6 leonardoar
 
11
--! Mux 2->1 circuit can select one of the 2 inputs into one output with some selection signal
12 5 leonardoar
 
13
--! Detailed description of this 
14
--! mux design element.
15 18 leonardoar
entity Multiplexer4_1 is
16 10 leonardoar
    generic (n : integer := nBits - 1);                                 --! Generic value (Used to easily change the size of the Alu on the package)
17
         Port ( A   : in  STD_LOGIC_VECTOR (n downto 0); --! First Input
18
           B   : in  STD_LOGIC_VECTOR (n downto 0);      --! Second Input
19 18 leonardoar
                          C   : in  STD_LOGIC_VECTOR (n downto 0);       --! Third Input
20
                          D   : in  STD_LOGIC_VECTOR (n downto 0);       --! Forth Input
21 19 leonardoar
                          E   : in  STD_LOGIC_VECTOR (n downto 0);       --! Fifth Input
22
           sel : in  STD_LOGIC_VECTOR (2 downto 0);      --! Select inputs (1, 2, 3, 4, 5)
23 10 leonardoar
           S   : out  STD_LOGIC_VECTOR (n downto 0));    --! Mux Output
24 18 leonardoar
end Multiplexer4_1;
25 5 leonardoar
 
26
--! @brief Architure definition of the MUX
27 6 leonardoar
--! @details On this case we're going to use VHDL combinational description
28 18 leonardoar
architecture Behavioral of Multiplexer4_1 is
29 5 leonardoar
 
30
begin
31 10 leonardoar
        with sel select
32 19 leonardoar
                S <= A when "000",
33
                          B when "001",
34
                          C when "010",
35
                          D when "011",
36
                          E when "100",
37 10 leonardoar
                          (others => 'Z') when others;
38 5 leonardoar
 
39
end Behavioral;
40
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.