You are on page 1of 8

ECE380 Digital Logic

Combinatorial Circuit Building


Blocks:
Decoders, Demultiplexers,
Encoders and Code Converters

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-1

Decoders
• Decoder circuits: decode encoded information
• A binary decoder has n data inputs and 2n outputs
• Only one output is asserted at any time (one-hot
encoded) and each output corresponds to one
valuation of the inputs
• An enable input (En) is used to disable the outputs
– If En=0, none of the decoder outputs is asserted
– If En=1, one of the outputs is asserted according to the
valuation of the inputs

w0 y0
n
2n
inputs
wn-1 outputs
Enable En y2n-1

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-2

1
2-to-4 decoder circuit
w0 y0
w1 y1
y2 w
0 y
Enable En y3 0
w
1
En w1 w0 y0 y1 y2 y3 y
1
1 0 0 1 0 0 0
y
1 0 1 0 1 0 0 2
1 1 0 0 0 1 0
y
1 1 1 0 0 0 1 3
En
0 X X 0 0 0 0

Truth table
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-3

3-to-8 decoder

w0 w0 y0 y0
w1 w1 y1 y1
y2 y2
w2 y3 y3
En

En y0 y4
w0
w1 y1 y5
y2 y6
En y3 y7

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-4

2
74138 3-to-8 decoder

Note the ‘active low’ outputs


Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-5

Decoder application
• A common decoder application is the decoding of
address lines for memory chips
Sel0
m-to-2m decoder

0/1 0/1 ….. 0/1


a0 Sel1
Address

a1 0/1 0/1 ….. 0/1


. .
. . .
. . .
.
am-1 .
0/1 0/1 ….. 0/1
Sel2m-1

read
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-6

3
Demultiplexers
• A multiplexer multiplexed n data inputs to a single
output
• A circuit that performs the opposite, placing the
value of a single input onto one for multiple outputs
is called a demultiplexer
• An n-to-2n decoder implements a 1-to-n
demultiplexer

Act as the w0 y0
select inputs y1
w1
y2
Acts as the Enable En y3
data input

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-7

Encoders
• An encoder performs the opposite function of a
decoder
• A binary encoder encodes information (data) from
2n inputs into an n-bit code (output)
– Exactly one of the inputs should have a value of one
– The outputs represent the binary number that identifies
which input is equal to 1
• Encoders reduce the number of bits needed to
represent given information
• Practical use: transmitting information in a digital
system

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-8

4
Encoders

w0 y0
n
2n
outputs
inputs yn-1
w2n-1

A 2n-to-n binary encoder

w 3 w 2 w 1 w 0 y1 y0 w
0
0 0 0 1 0 0 w
1 y
0
0 0 1 0 0 1
w
2
0 1 0 0 1 0
w y
1 0 0 0 1 1 3 1

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-9

Priority encoders
• Another useful class of encoders is based on
the priority of the input signals
• 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 lower priority inputs are ignored

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-10

5
Priority encoders
• Assume that w0 has the
lowest priority and w3
has the highest
w 3 w 2 w 1 w 0 y1 y0 z
• The output z indicates
0 0 0 0 D D 0
when none of the inputs
are 1 0 0 0 1 0 0 1
• Letting 0 0 1 X 0 1 1
– i0=w3’w2’w1’w0
0 1 X X 1 0 1
– i1=w3’w2’w1
– i2=w3’w2 1 X X X 1 1 1
– i3=w3
4-to-2 priority encoder
truth table
y0 =i1+i3, y1=i2+i3
z = i1+i2 +i3+i4
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-11

Code converters
• The purpose of code converter circuits is to
convert from one type of input encoding to
another type of output encoding
• For example:
– A 3-to-8 decoder converts from a binary number
to a one-hot encoding at the output
– A 8-to-3 encoder performs the opposite
• Many different types of code converter
circuits can be constructed
– One common example a a BCD-to7-segment
decoder

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-12

6
BCD-to-7-segment decoder
• Converts one binary-coded decimal (BCD)
digit into information suitable for driving a
digit-oriented display
– A vending machine display is an example
• The circuit converts a BCD digit into 7 signals
that are used to drive (activate) the
segments in the display
– Each segment is a small light-emitting diode
(LED), which glows when driven by an electrical
signal

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-13

BCD-to-7-segment decoder
w3 w2 w1 w0 a b c d e f g
a
w b 0 0 0 0 1 1 1 1 1 1 0
w0 c 0 0 0 1 0 1 1 0 0 0 0
w1 d
w2 e 0 0 1 0 1 1 0 1 1 0 1
3 f
g 0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
a 0 1 0 1 1 0 1 1 0 1 1
f b 0 1 1 0 1 0 1 1 1 1 1

g 0 1 1 1 1 1 1 0 0 0 0
e c
1 0 0 0 1 1 1 1 1 1 1
d 1 0 0 1 1 1 1 1 0 1 1

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-14

7
BCD-to-7-segment decoder

a a a a a

f b f b f b f b f b
g g g g g
e c e c e c e c e c

d d d d d

a a a a a
f b f b f b f b f b
g g g g g
e c e c e c e c e c

d d d d d

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-15

You might also like