4-to-1 MUX Truth Table ====================== S1 S0 Y --------- 0 0 D0 0 1 D1 1 0 D2 1 1 D3 --------- 4-to-1 MUX Boolean Expression ============================= Y = D0 (not S1) (not S0) + D1 (not S1) S0 + D2 S1 (not S0) + D3 S1 S0 4-to-1 MUX Symbol Showing Individual lines ==========================================In general, a multiplexer with n select inputs will have m = 2^n data inputs. The 8-to-1 (for 3 select inputs) and 16-to-1 (for 4 select inputs) are the other common multiplexers.![]()
Data inputs can also be multiple bits. Now let's look at the 4-to-1 4-bit Bus Multiplexer.
The Truth Table for a 4-to-1 4-bit Bus MUX
==========================================
S1 S0 Y3 Y2 Y1 Y0
-------------------------
0 0 D03 D02 D01 D00
0 1 D13 D12 D11 D10
1 0 D23 D22 D21 D20
1 1 D33 D32 D31 D30
-------------------------
Using vector notation:
----------------------
S = (S1 S0)
D = (D3 D2 D1 D0)
D0= (D03 D02 D01 D00)
D1= (D13 D12 D11 D10)
D2= (D23 D22 D21 D20)
D3= (D33 D32 D31 D30)
Y = (Y3 Y2 Y1 Y0)
4-to-1 MUX Symbol Showing 4-Bit Bus
==========================================
Note, in the above device symbol, the slash through a thick data line
and the number 4 above the line indicates that it represents four
related data signals. Similarly, an 8-to-1 or a 16-to-1 multiplexer
with multiple data bus can be defined.
__signal <= __expression;Using the Boolean expression that describes a 4-to-1 MUX in the previous section,
library IEEE; use IEEE.std_logic_1164.all; entity mux41v1 is port( d0 : in std_logic; d1 : in std_logic; d2 : in std_logic; d3 : in std_logic; s0 : in std_logic; s1 : in std_logic; y : out std_logic ); end mux41v1; architecture arch1 of mux41v1 is begin -- Your VHDL code defining the model goes here -- Using concurrent signal assignment statement y <= (D0 and (not S1) and (not S0)) or (D1 and (not S1) and S0) or (D2 and S1 and (not S0)) or (D3 and S1 and S0); end arch1;Although the concurrent signal assignment statement is not hard to derive, it can be very cumbersome for larger multiplexers, such as 8-to-1 MUX or greater. We may use a different statement in the architecture body.
__label: WITH __expression SELECT __signal <= __expression WHEN __constant_value, __expression WHEN __constant_value, __expression WHEN __constant_value, __expression WHEN __constant_value;The 4-to-1 MUX can be described in VHDL by using Selected Signal Assignment Statement as follows:
use IEEE.std_logic_1164.all;
library IEEE;
entity mux41v2 is
port(
d0 : in std_logic;
d1 : in std_logic;
d2 : in std_logic;
d3 : in std_logic;
s : in std_logic_vector(1 downto 0);
y : out std_logic
);
end mux41v2;
architecture arch1 of mux41v2 is
begin
-- Your VHDL code defining the model goes here
-- Using selected signal assignment statement
with s select
y <= d0 when "00",
d1 when "01",
d2 when "10",
d3 when "11";
end arch1;
The selected signal assignment statement evaluates the expression
in the WITH clause (the 2-bit vector, s) and depending on its value,
selects an expression to assign to y.
__process_label:
PROCESS (sensitivity list)
BEGIN
CASE __expression IS
WHEN __constant_value =>
__statement;
__statement;
WHEN __constant_value =>
__statement;
__statement;
WHEN OTHERS =>
__statement;
__statement;
END CASE;
END PROCESS __process_label;
Note: The use of label above is optional.
VHDL syntax requires a CASE statement to be obtained within a PROCESS. A PROCESS is a construct containing statements that are executed if a signal in the sensitivity list of the PROCESS changes. The general format of a PROCESS is:
[label:] PROCESS (sensitivity list)
BEGIN
statement;
END PROCESS;
Now let's look at the 4-to-1 MUX implementation with CASE statement:
library IEEE; use IEEE.std_logic_1164.all; -- define inputs and outputs entity mux41v3 is port( d0 : in std_logic; d1 : in std_logic; d2 : in std_logic; d3 : in std_logic; s : in std_logic_vector(1 downto 0); y : out std_logic ); end mux41v3; architecture arch1 of mux41v3 is begin -- Your VHDL code defining the model goes here -- Using CASE statement process(s) begin case s is when "00" => y <= d0; when "01" => y <= d1; when "10" => y <= d2; when "11" => y <= d3; when others => y <= '0'; end case; end process; end arch1;If the select inputs change, the PROCESS statements are executed. The CASE statement evaluates the select input vector, s, and chooses a signal assignment based on its value.
combo_Control_Outputs: process ( FSM_STATE)
begin
CASE FSM_STATE IS
WHEN S0 =>
Cntl_Shft <= '0';
Cntl_Write <= '0';
FSM_INC_3Bit <= '0';
WHEN S1 =>
Cntl_Shft <= '0' ;
Cntl_Write <= '1' ;
FSM_INC_3Bit <= '0' ;
WHEN S2 =>
Cntl_Shft <= '1' ;
Cntl_Write <= '0' ;
FSM_INC_3Bit <= '1' ;
WHEN S3 =>
Cntl_Shft <= '0' ;
Cntl_Write <= '0' ;
FSM_INC_3Bit <= '0' ;
WHEN others =>
Cntl_Shft <= '0' ;
Cntl_Write <= '0' ;
FSM_INC_3Bit <= '0' ;
END CASE;
end process combo_Control_Outputs;
Look at the following diagram, a 4-to-1 multiplexer is used to select which CD you want to play.
The following 4-to-1 multiplexer selects one of the 4-bit channels and directs a 4-bit output.![]()
For the quadruple 4-to-1 MUX indicated above, we can develop the following VHDL file:![]()
library IEEE;
use IEEE.std_logic_1164.all;
entity muxQ41 is
port(
s : in std_logic_vector(1 downto 0);
d0 : in std_logic_vector(3 downto 0);
d1 : in std_logic_vector(3 downto 0);
d2 : in std_logic_vector(3 downto 0);
d3 : in std_logic_vector(3 downto 0);
y : out std_logic_vector(3 downto 0)
);
end muxQ41;
architecture arch1 of muxQ41 is
begin
-- Your VHDL code defining the model goes here
-- Selected signal assignment
with s select y <= d0 when "00",
d1 when "01",
d2 when "10",
d3 when "11";
end arch1;
|
Monday, 01-Oct-2012 10:43:32 CST |
|