0% found this document useful (0 votes)
32 views64 pages

EEE303-Week06 - Mux Demux

This document discusses multiplexers (MUX) and demultiplexers (DEMUX). It explains that a MUX has multiple data inputs, select inputs, and one output that passes one of the data inputs based on the select inputs. A DEMUX is the opposite, taking a single input and routing it to multiple outputs based on the select inputs. Various MUX and DEMUX circuits including 2-to-1, 4-to-1, and 16-to-1 are presented. Implementing logic functions like XOR using MUX is also covered. The document concludes by discussing tasks, functions, and the difference between them in Verilog.

Uploaded by

Saif Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views64 pages

EEE303-Week06 - Mux Demux

This document discusses multiplexers (MUX) and demultiplexers (DEMUX). It explains that a MUX has multiple data inputs, select inputs, and one output that passes one of the data inputs based on the select inputs. A DEMUX is the opposite, taking a single input and routing it to multiple outputs based on the select inputs. Various MUX and DEMUX circuits including 2-to-1, 4-to-1, and 16-to-1 are presented. Implementing logic functions like XOR using MUX is also covered. The document concludes by discussing tasks, functions, and the difference between them in Verilog.

Uploaded by

Saif Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 64

EEE 303 – Digital Electronics

EEE Multiplexer (MUX) and


Demultiplexer (DEMUX)
303
Lecture 06.1
Dr. Sajid Muhaimin Choudhury, Assistant Professor
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
Combinational Circuits
• Output is dependent on the combination of inputs
• n inputs, m outputs, n × m combinations

n m

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 2


Department of EEE, BUET
Multiplexer
Multiplexer circuit has a number of data inputs, one or more select
inputs, and one output.
It passes the signal value on one of the data inputs to the output.
The data input is selected by the values of the select inputs.

n-to-1 multiplexer
n 1

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 3


Department of EEE, BUET
2-to-1 Multiplexer

f =s w 0 +s w1

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 4


Department of EEE, BUET
4-to-1 Multiplexer

𝑓 =𝑠 1 𝑠0 𝑤0 + 𝑠1 𝑠 0 𝑤1+ 𝑠 1 𝑠0 𝑤2 + 𝑠1 𝑠 0 𝑤 3

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 5


Department of EEE, BUET
4-to-1 Mux using 2-to-1 Mux

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 6


Department of EEE, BUET
16-to-1 Mux using 4-to-1 Mux

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 7


Department of EEE, BUET
Crossbar Switch

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 8


Department of EEE, BUET
Demultiplexer
Opposite function of a multiplexer - placing the value of a single data input onto multiple data
outputs

In this case the En input serves as the data input for the demultiplexer, and the y0 to y3 outputs are
the data outputs. The valuation of w1 w0 determines which of the outputs is set to the value of En.

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 9


Department of EEE, BUET
Communication Line

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 10


Department of EEE, BUET
Implementing Logic Functions with MUX: Simple Way
Choose all the inputs of the given function as the select pins
of the mux
Choose the outputs of the given function as the inputs of the
mux- simple as that

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 11


Department of EEE, BUET
Basic Gates Using MUX: Simple Way

XOR

x y f x y f
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1

xy xy

0 0
0 f 1 f
0 1
1 1
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 12
Department of EEE, BUET
Implementing Logic Functions with MUX: Smart Way

Choose some of the inputs (usually starting from the MSB) of


the given function as the select pins of the mux
Derive the expression of the functions for those select pins –
also not that difficult

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 13


Department of EEE, BUET
Basic Gates Using Smart Way

XOR

x y f x y f
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1

x x

0 y
f f
y 1

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 14


Department of EEE, BUET
Majority function

• In Boolean logic, the majority function (also called


the median operator) is the Boolean function that
evaluates to false when half or more arguments are
false and true otherwise, i.e. the value of the function
equals the value of the majority of the inputs. 

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 15


Department of EEE, BUET
3-Input Majority Function using 2-to-1 Mux

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 16


Department of EEE, BUET
3-Input Majority Function using 4-to-1 Mux

f=0

f = w3

f = w3
f=1

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 17


Department of EEE, BUET
3-Input XOR using 2-to-1 Mux

w1
w2
w3 f

f = w2 ⊕   w3
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 18
Department of EEE, BUET
3-Input XOR using 4-to-1 Mux

f = w3

f=

f=
f = w3

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 19


Department of EEE, BUET
Shannon's Expansion Theorem - 1
Any Boolean expression can be written through multiplexing

𝐹 =𝑥 . 𝐹 𝑥 + 𝑥 𝐹 𝑥
¿

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 20


Department of EEE, BUET
Shannon's Expansion Theorem - 2

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 21


Department of EEE, BUET
Shannon's Expansion Theorem - 3

𝑓=𝑤 1.𝑓 𝑤 +𝑤 1.𝑓 𝑤 1 1


EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 22
Department of EEE, BUET
Shannon's Expansion Theorem - 4

=
=

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 23


Department of EEE, BUET
Using only 2-to-1 Mux - 1

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 24


Department of EEE, BUET
Using only 2-to-1 Mux - 2

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 25


Department of EEE, BUET
Using Few Gates

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 26


Department of EEE, BUET
74HC153 dual four-input MUX

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 27


Department of EEE, BUET
74HC151 eight-input MUX

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 28


Department of EEE, BUET
Conditional Operator ?:
The question mark is known in Verilog as a conditional
operator though in other programming languages it also is
referred to as a ternary operator, an inline if, or a ternary if.
It is used as a short-hand way to write a conditional
expression in Verilog (rather than using if/else statements).
Usage:
condition ? value_if_true : value_if_false

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 29


Department of EEE, BUET
Mux Using Conditional Operator

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 30


Department of EEE, BUET
Mux Using if-else

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 31


Department of EEE, BUET
16-to-1 Mux using 4-to-1 Mux

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 32


Department of EEE, BUET
Mux Using case

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 33


Department of EEE, BUET
Task
 Must be included in the module that calls it

 May have i/p and o/p ports which are used to make external connections to the
module (these are not the i/p and o/p ports of the module)

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 34


Department of EEE, BUET
Function
 Returns only a single value that is placed where the function is invoked

 compiler essentially inserts the body of the function at each place where it is called

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 35


Department of EEE, BUET
Difference Between Task and Function

 Function has only one output


 function can invoke another function but it cannot call a task. A task
may call another task and it may invoke a function.
 task after the always block that calls it. function before the always
block that invokes it. both tasks and functions. functions to be
defined before the statements that invoke them.
 Functions cannot include timing delays, like posedge, negedge, etc.
Task can.

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 36


Department of EEE, BUET
EEE 303 – Digital Electronics
EEE Encoder and Decoder

303
Lecture 06.2
Dr. Sajid Muhaimin Choudhury, Assistant Professor
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
Decoder
 Decoder circuits are used to decode encoded information.
 A binary decoder is a logic circuit with n inputs and 2𝑛 outputs.
 An n-bit binary code in which exactly one of the bits is set to 1 at a
time is referred to as one-hot encoded
 The outputs of a binary decoder are one-hot encoded.

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 38


Department of EEE, BUET
2-to-4 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 39


Department of EEE, BUET
2 to 4 Line Decoder with Enable

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 40


Department of EEE, BUET
3 to 8 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 41


Department of EEE, BUET
3-to-8 Decoder using 2-to-4 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 42


Department of EEE, BUET
4 to 16 Decoder Truth Table

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 43


Department of EEE, BUET
4-to-16 Decoder using 4-to-2 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 44


Department of EEE, BUET
Verilog for Decoders

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 45


Department of EEE, BUET
Code for 4-to-16 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 46


Department of EEE, BUET
Mux from Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 47


Department of EEE, BUET
Mux from Decoder with Verilog

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 48


Department of EEE, BUET
Synthesis using Decoder - SOP

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 49


Department of EEE, BUET
Synthesis using Decoder - POS

¿ ∏ 𝑀(2,5)

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 50


Department of EEE, BUET
Memory Block

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 51


Department of EEE, BUET
74HC154 Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 52


Department of EEE, BUET
5 Bit Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 53


Department of EEE, BUET
BCD to Binary Decoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 54


Department of EEE, BUET
EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 55
Department of EEE, BUET
EEE 303 – Digital Electronics

Encoder

56

Dr. Sajid Muhaimin Choudhury, Assistant Professor


02/03/2023
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
Encoder

 An encoder performs the opposite function of a decoder. It encodes


given information into a more compact form
 A binary encoder encodes information from 2𝑛 inputs into an n-bit code
 Inputs are one hot encoded for binary encoder
 Are used to reduce the number of bits/wires in a digital system

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 57


Department of EEE, BUET
4-to-2 Binary Encoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 58


Department of EEE, BUET
4-to-2 Binary Encoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 59


Department of EEE, BUET
8-to-3 Binary Encoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 60


Department of EEE, BUET
Priority Encoder - 1
 In a priority encoder each input has a priority level
associated with it
 The encoder outputs indicate the active input that
has the highest priority
 When an input with a high priority is asserted, the
other inputs with lower priority are ignored.

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 61


Department of EEE, BUET
Priority Encoder - 2

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 62


Department of EEE, BUET
Four-input priority encoder

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 63


Department of EEE, BUET
Priority Encoder with Verilog

EEE 303 – Digital Electronics Dr. Sajid Muhaimin Choudhury 64


Department of EEE, BUET

You might also like