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

Subversion Repositories opencpu32

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

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
           sel : in  STD_LOGIC_VECTOR (1 downto 0);      --! Select inputs (1, 2, 3, 4)
22 10 leonardoar
           S   : out  STD_LOGIC_VECTOR (n downto 0));    --! Mux Output
23 18 leonardoar
end Multiplexer4_1;
24 5 leonardoar
 
25
--! @brief Architure definition of the MUX
26 6 leonardoar
--! @details On this case we're going to use VHDL combinational description
27 18 leonardoar
architecture Behavioral of Multiplexer4_1 is
28 5 leonardoar
 
29
begin
30 10 leonardoar
        with sel select
31 18 leonardoar
                S <= A when "00",
32
                          B when "01",
33
                          C when "10",
34
                          D when "11",
35 10 leonardoar
                          (others => 'Z') when others;
36 5 leonardoar
 
37
end Behavioral;
38
 

powered by: WebSVN 2.1.0

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