4-to-1 multiplexer: module instantiation discussion d2.2 example 5
TRANSCRIPT
![Page 1: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/1.jpg)
4-to-1 Multiplexer:Module Instantiation
Discussion D2.2
Example 5
![Page 2: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/2.jpg)
4-to-1 Multiplexer
• Module Instantiation
• Logic Equation for a 4-to-1 MUX
![Page 3: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/3.jpg)
2 x 1 MUX
y = a*~s + b*s
2 x 1
MUX
a
b
y
s
s y
0 a
1 b
0
1
![Page 4: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/4.jpg)
4-to-1 Multiplexer
z 4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
![Page 5: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/5.jpg)
Multiplexers
z
4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
0 0
A multiplexer is adigital switch
![Page 6: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/6.jpg)
Multiplexers
z
4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
0 1
![Page 7: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/7.jpg)
Multiplexers
z
4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
1 0
![Page 8: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/8.jpg)
Multiplexers
z
4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
1 1
![Page 9: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/9.jpg)
Creating a 4 x 1 MUX from 2 x 1 MUXs
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
4 x 1
MUX
c0
c3
z
s1
s1 s0 z
0 0 c0 0 1 c1 1 0 c2 1 1 c3
s0
c1
c2
0
1
2
3
![Page 10: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/10.jpg)
-- Example 5a: 4-to-1 MUX using module instantiationlibrary IEEE;use IEEE.STD_LOGIC_1164.all;entity mux41 is
port( c : in STD_LOGIC_VECTOR(3 downto 0); s : in STD_LOGIC_VECTOR(1 downto 0); z : out STD_LOGIC
);end mux41;architecture mux41 of mux41 is
component mux21aport(
a : in std_logic;b : in std_logic;s : in std_logic;y : out std_logic);
end component;signal v, w: STD_LOGIC;begin
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
![Page 11: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/11.jpg)
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
beginM1 : mux21a
port map(a => c(0),b => c(1),s => s(0),y => v
);M2 : mux21a
port map(a => c(2),b => c(3),s => s(0),y => w
);M3 : mux21a
port map(a => v,b => w,s => s(1),y => z
);end mux41;
![Page 12: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/12.jpg)
--Example 4a: --2-to-1 MUX using logic equationslibrary IEEE;use IEEE.STD_LOGIC_1164.all;entity mux21a is
port( a : in STD_LOGIC; b : in STD_LOGIC; s : in STD_LOGIC; y : out STD_LOGIC
);end mux21a;
architecture mux21a of mux21a isbegin
y <= (not s and a) or (s and b);end mux21a;
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
M1 : mux21aport map(
a => c(0),b => c(1),s => s(0),y => v
);
![Page 13: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/13.jpg)
--Example 4a: --2-to-1 MUX using logic equationslibrary IEEE;use IEEE.STD_LOGIC_1164.all;entity mux21a is
port( a : in STD_LOGIC; b : in STD_LOGIC; s : in STD_LOGIC; y : out STD_LOGIC
);end mux21a;
architecture mux21a of mux21a isbegin
y <= (not s and a) or (s and b);end mux21a;
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
M2 : mux21aport map(
a => c(2),b => c(3),s => s(0),y => w
);
![Page 14: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/14.jpg)
--Example 4a: --2-to-1 MUX using logic equationslibrary IEEE;use IEEE.STD_LOGIC_1164.all;entity mux21a is
port( a : in STD_LOGIC; b : in STD_LOGIC; s : in STD_LOGIC; y : out STD_LOGIC
);end mux21a;
architecture mux21a of mux21a isbegin
y <= (not s and a) or (s and b);end mux21a;
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
M3 : mux21aport map(
a => v,b => w,s => s(1),y => z
);
![Page 15: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/15.jpg)
Label1 : mux21aport map(
a => a,b => b,s => s,y => y
);
![Page 16: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/16.jpg)
Aldec Active-HDL Simulation
![Page 17: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/17.jpg)
4-to-1 Multiplexer
• Module Instantiation
• Logic Equation for a 4-to-1 MUX
![Page 18: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/18.jpg)
2 x 1 MUX
y = a*~s + b*s
2 x 1
MUX
a
b
y
s
s y
0 a
1 b
0
1
![Page 19: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/19.jpg)
2 x 1
MUX
v
w
z
s1
s0
2 x 1
MUX
2 x 1
MUX
s0
c0
c1
c2
c3
0
0
0
1
1
1
M1
M2
M3
v = ~s0*c0 + s0*c1 w = ~s0*c2 + s0*c3 z = ~s1*v + s1*w
z = ~s1*(~s0*c0 + s0*c1) + s1*(~s0*c2 + s0*c3)
z = ~s1*~s0*c0 + ~s1*s0*c1 + s1*~s0*c2 + s1*s0*c3
![Page 20: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/20.jpg)
4-to-1 Multiplexer
z 4 x 1 MUX
s0s1
c0
c1
c2
c3
z s1 s0
0 0 c00 1 c11 0 c21 1 c3
z = ~s1*~s0*c0 + ~s1*s0*c1 + s1*~s0*c2 + s1*s0*c3
![Page 21: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/21.jpg)
-- Example 5b: 4-to-1 MUX using logic equationlibrary IEEE;use IEEE.STD_LOGIC_1164.all;entity mux41b is
port( c : in STD_LOGIC_VECTOR(3 downto 0); s : in STD_LOGIC_VECTOR(1 downto 0); z : out STD_LOGIC
);end mux41b;architecture mux41b of mux41b isbegin
z <= (not s(1) and not s(0) and c(0))or (not s(1) and s(0) and c(1))or (s(1) and not s(0) and c(2))or (s(1) and s(0) and c(3));
end mux41b;
![Page 22: 4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5](https://reader036.vdocuments.us/reader036/viewer/2022062805/5697bfed1a28abf838cb92cc/html5/thumbnails/22.jpg)
Aldec Active-HDL Simulation