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

Subversion Repositories avs_aes

[/] [avs_aes/] [trunk/] [rtl/] [VHDL/] [mux3.vhd] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ruschi
--------------------------------------------------------------------------------
2 10 ruschi
-- This file is part of the project  avs_aes
3
-- see: http://opencores.org/project,avs_aes
4 2 ruschi
--
5
-- description: Mux2, 3-Port-N-Bit Bit Mulitplexer
6
--
7
-------------------------------------------------------------------------------
8
--
9
-- Author(s):
10
--         Thomas Ruschival -- ruschi@opencores.org (www.ruschival.de)
11
--
12
--------------------------------------------------------------------------------
13
-- Copyright (c) 2009, Authors and opencores.org
14
-- All rights reserved.
15
--
16
-- Redistribution and use in source and binary forms, with or without modification,
17
-- are permitted provided that the following conditions are met:
18
--    * Redistributions of source code must retain the above copyright notice,
19
--    this list of conditions and the following disclaimer.
20
--    * Redistributions in binary form must reproduce the above copyright notice,
21
--    this list of conditions and the following disclaimer in the documentation
22
--    and/or other materials provided with the distribution.
23
--    * Neither the name of the organization nor the names of its contributors
24
--    may be used to endorse or promote products derived from this software without
25
--    specific prior written permission.
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
36
-- THE POSSIBILITY OF SUCH DAMAGE
37
-------------------------------------------------------------------------------
38
-- version management:
39 20 ruschi
-- $Author::                                         $
40
-- $Date::                                           $
41
-- $Revision::                                       $
42 2 ruschi
-------------------------------------------------------------------------------
43
 
44
library ieee;
45
use ieee.std_logic_1164.all;
46
 
47
entity mux3 is
48
        generic (
49
                IOwidth : POSITIVE := 1                 -- width of I/O ports
50
                );
51
        port (
52
                inport_a : in  STD_LOGIC_VECTOR (IOwidth-1 downto 0);  -- port 1
53
                inport_b : in  STD_LOGIC_VECTOR (IOwidth-1 downto 0);  -- port 2
54
                inport_c : in  STD_LOGIC_VECTOR (IOwidth-1 downto 0);  -- port 3
55
                selector : in  STD_LOGIC_VECTOR (1 downto 0);-- switch to select ports
56
                outport  : out STD_LOGIC_VECTOR (IOwidth-1 downto 0)   -- output
57
                );
58
end mux3;
59
 
60
 
61
architecture arch1 of mux3 is
62
 
63
begin  -- arch1
64
 
65
        -- purpose: switch the ports
66
        -- type   : combinational
67
        -- inputs : selector,inport_a,inport_b
68
        -- outputs: outport
69
        muxing : process (inport_a, inport_b, inport_c, selector)
70
        begin  -- PROCESS selector
71
                case selector is
72
                        when "00" =>
73
                                outport <= inport_a;
74
                        when "01" =>
75
                                outport <= inport_b;
76
                        when "10" =>
77
                                outport <= inport_c;
78
                        when others =>
79
                                outport <= (others => 'X');
80
                                --pragma synthesis_off
81
                                report "!! selector in arch1 of mux3 has strange value !!" severity warning;
82
                                --pragma synthesis_on
83
                end case;
84
        end process muxing;
85
 
86
end arch1;

powered by: WebSVN 2.1.0

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