Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

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 n inputs Enable
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-1 Electrical & Computer Engineering

ECE380 Digital Logic


Combinatorial Circuit Building Blocks: Decoders, Demultiplexers, Encoders and Code Converters

w0 wn-1 En

y0 y2n-1

2n outputs

Dr. D. J. Jackson Lecture 22-2

2-to-4 decoder circuit


w0 w1 Enable En y0 y1 y2 y3 w 0 w 1 0 0 0 1 0 En

3-to-8 decoder
w0 w1 w2 w0 w1 En y0 y1 y2 y3 y0 y1 y2 y3

y 0 y 1 y 2 y 3

En w1 w0 y0 y1 y2 y3 1 1 1 1 0 0 0 1 1 X 0 1 0 1 X 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0

En

w0 w1 En

y0 y1 y2 y3

y4 y5 y6 y7

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

74138 3-to-8 decoder

Decoder application
A common decoder application is the decoding of address lines for memory chips m-to-2m decoder
Sel0 Sel1 0/1 0/1 0/1 0/1 .. .. . . . 0/1 0/1 .. 0/1 0/1 0/1 a0 a1

Address

. . .

am-1

. . . .
Sel2m-1 read

Note the active low outputs


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

Dr. D. J. Jackson Lecture 22-6

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 select inputs Acts as the data input
Electrical & Computer Engineering

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

w0 w1 Enable En

y0 y1 y2 y3

Encoders reduce the number of bits needed to represent given information Practical use: transmitting information in a digital system

Dr. D. J. Jackson Lecture 22-7

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 22-8

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

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
y 0 y 1
Dr. D. J. Jackson Lecture 22-9 Electrical & Computer Engineering Dr. D. J. Jackson Lecture 22-10

A 2n-to-n binary encoder w3 w2 w1 w0 y1 y0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 w 0 w 1 w 2 w 3

When an input with a high priority is asserted, the other lower priority inputs are ignored

Electrical & Computer Engineering

Priority encoders
Assume that w0 has the lowest priority and w3 has the highest The output z indicates when none of the inputs are 1 Letting
i0=w3w2w1w0 i1=w3w2w1 i2=w3w2 i3=w3

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

w3 w2 w1 w0 y1 y0 z 0 0 0 0 1 0 0 0 1 X 0 0 1 X X 0 1 D 0 D 0 1 0 1 0 1 1 1 1

X 0 X 1 X 1

y0 =i1+i3, y1=i2+i3 z = i1+i2 +i3+i4


Electrical & Computer Engineering

4-to-2 priority encoder truth table

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

Dr. D. J. Jackson Lecture 22-11

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

BCD-to-7-segment decoder
w w0 w1 w2 3 a b c d e f g a f e g d b c w3 w2 w1 w0 a b c d e f 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 g 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1
Dr. D. J. Jackson Lecture 22-14

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

Electrical & Computer Engineering

BCD-to-7-segment decoder
a f e g d a f e g d
Electrical & Computer Engineering

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

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

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

a b g d a b g d
Dr. D. J. Jackson Lecture 22-15

You might also like