0% found this document useful (0 votes)
34 views12 pages

Encoder

The document discusses encoders, priority encoders, and decoders. It explains what encoders and decoders are, how they differ from multiplexers, and how to design binary encoders and decoders of various sizes through truth tables and logic gates. Priority encoders are a type of encoder that can improve upon the design of simple encoders.

Uploaded by

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

Encoder

The document discusses encoders, priority encoders, and decoders. It explains what encoders and decoders are, how they differ from multiplexers, and how to design binary encoders and decoders of various sizes through truth tables and logic gates. Priority encoders are a type of encoder that can improve upon the design of simple encoders.

Uploaded by

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

10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

View Course Path

Priority Encoders, Encoders and Decoders – Simple


explanation & designing
Umair Hussaini   |   Published October 10, 2018   |   Updated February 5, 2020

An n-bit binary number can have 2^n variations. For example, a


2-bit number can have 2^2 variations. 00,01,10 and 11.  This
means that we can use an n bit number to store 2 to the power n
worth of data. This is essentially the concept of encoding.

To perform this operation, we design a circuit known as an


encoder. The circuit’s name is a derivation from its purpose.

A priority encoder is a type of encoder that improves upon the


design of a simple encoder.

A decoder is a circuit that undoes the work of an encoder. It’s the


opposite of an encoder.

Use the table below to navigate.

Ad
Improve agility.
Workflows increase agility which helps teams stay connected.

ServiceNow

FIND OUT MORE

Contents 
1. What is an encoder?
2. How is an encoder different from a multiplexer?
3. How to design a 4:2 Encoder?

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 1/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

3.1. Truth table of 4:2 encoder


4. How to design an 8:3 Encoder?
4.1. Truth table of an 8:3 encoder
View Course Path
5. What is a Priority Encoder? What is the difference between priority
encoders vs encoders?
6. How to design a 4:2 priority encoder?
6.1. Truth table of a 4:2 priority encoder
7. What are the advantages and differences of using a priority
encoder rather than a binary encoder?
8. What are Decoders?
9. How to design a 2:4 Decoder?
9.1. Truth table for a 2:4 decoder
10. How to design a 3:8 Decoder?
10.1. Truth table for a 3:8 decoder
11. How to design 4:16 Decoders?
12. How to design a 5:32 Decoder?

What is an encoder?
An encoder is a combinational logic circuit that can be used to
convert 2^n lines of digital input into n bits of coded binary
output. However, in a simple encoder, only one of the inputs is
considered to be high out of all the 2^n inputs. In simple terms,
an encoder takes in 2^n binary inputs, one at a time, and codes
them into n bits of one output code.

Ad
Make hybrid working work.
Wherever your hybrid employees work
from, digital workflows help them
work.

ServiceNow

LEARN MORE

How is an encoder different from a


multiplexer?
A multiplexer takes in one of the several inputs and sends it to
the output. However, an encoder takes in all the 1s from every
input and codes them into an output. The output may be of 2-
bits, 3-bits, or 4-bits depending on the number of inputs.

Ad
Make hybrid working work.
Wherever your hybrid employees work
from, digital workflows help them
work.

ServiceNow

LEARN MORE

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 2/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

Hence a multiplexer is known as a data selector since it merely


selects the data and sends it to the output. An encoder codes
View Course Path
the data.

From a hardware perspective, a multiplexer has n inputs and one


output. Whereas an encoder has 2^n inputs and n outputs.
Multiplexers and encoders have separate applications too.
Multiplexers find applications in communication channels.
Encoders find applications in compression of information for
transmission or storage and for encryption.

How to design a 4:2 Encoder?


A 4:2 encoder has four inputs and two outputs. By definition, an
encoder takes in the high value of every input and gives an n bit
output. Essentially, the output that the encoder outputs is the
physical address of the line.

What does that mean?

The first input line has a physical address of 1. The first output is
00 (binary) = 0 (decimal). 2^0 = 1, which is the physical address
of the first input line. The combination of all the first inputs is
0001 (=1 in decimal).

Similarly, the second output is 01 (binary) = 1 (decimal). 2^1 =2.


The combination of all the second inputs is 0010 (=2 in decimal).

Hence in this way, the output of an encoder gives the physical


address of the inputs.

Truth table of 4:2 encoder


A B C D Y0 Y1

0 0 0 1 0 0

0 0 1 0 0 1

0 1 0 0 1 0

1 0 0 0 1 1

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 3/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

From the truth table of the 4:2 encoder above we have, Y0 = 1 at


0100 or 1000, so,
View Course Path
Y0 = A’BC’D’ + AB’C’D’ = C’D'( )

Similarly, Y1 = 1 at 0010 or 1000, so,

Y1 = A’B’CD’ + AB’C’D’ = B’D'( )

Plotting the circuit from the above equations we get the


following combinational logic circuit for the 4:2 encoder.

4:2 encoder using gates

How to design an 8:3 Encoder?


An 8:3 encoder has eight input lines and three output lines. Let’s
write the truth table for the encoder using the information that
the encoder gives outputs that are physical addresses of the
inputs. For a random example, for an 8-bit input 00001000 (=8
decimal), the 3-bit output should be 011 (=3, 2^3 = 8).

Truth table of an 8:3 encoder


A B C D E F G H Y2 Y1 Y0

0 0 0 0 0 0 0 1 0 0 0

0 0 0 0 0 0 1 0 0 0 1

0 0 0 0 0 1 0 0 0 1 0

0 0 0 0 1 0 0 0 0 1 1

0 0 0 1 0 0 0 0 1 0 0

0 0 1 0 0 0 0 0 1 0 1

0 1 0 0 0 0 0 0 1 1 0

1 0 0 0 0 0 0 0 1 1 1

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 4/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

From the above truth table, we have

Y0 = G + E + C + A
View Course Path
Y1 = F + E + B + A

Y2 = A + B + C + D

What is a Priority Encoder? What is


the difference between priority
encoders vs encoders?
The encoders we saw above are known as digital or binary
encoders. If you observe their truth tables, you will notice that
the inputs are a bit peculiar. All the outputs are possible at inputs
that have only one high bit. That is, the outputs are present only
when exactly one of the input bits is 1. This limits the scope of
the data that we can encode. Because if any of the inputs have
more than one bit high, the binary encoder gives us an error.

A priority encoder overcomes this disadvantage of the binary


encoder. It gives a coded output by assigning a priority to the
bits of input. The lower priority bits’ values don’t matter. If the
higher priority bit is high, then the priority encoder will generate
the output depending on the high bit’s position. The outputs are
the same as an encoder, but the range of inputs is higher since
the output depends only on the high priority bit. Check out the
truth table below to get a clearer picture.

How to design a 4:2 priority


encoder?
A 4:2 priority encoder has four inputs and two outputs like a
normal binary encoder. The difference lies in the truth table. For
a priority encoder, the output is dependant on the highest
priority bit. For example, if I7, I6, and I0 bits of an 8-bit input are
high, then the output (111) will be for I7. Let’s write the truth
table for a 4:2 priority encoder.

Truth table of a 4:2 priority encoder Back to course page 

Digital Electronics Course


I3 I2 I1 I0 A B
Course Path
0 0 0 1 0 0
Digital Number Systems And
Base Conversions
0 0 1 x 0 1
Boolean Algebra – All the Laws,
0 1 x x 1 0 Rules, Properties and Operations

Binary Arithmetic – All rules and


1 x x x 1 1 operations

Sequential and Combinational


logic circuits – Types of logic
Here x stands for don’t care condition. It does not matter
circuits
whether that bit is 0 or 1.
Logic Gates using NAND and
https://technobyte.org/priority-encoders-decoders-binary-encoders/ 5/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

A is high when I2 and I3 are high. Regardless of what the lower NOR universal gates

bits are. So this means that A is one for Half Adder, Full Adder, Half
View Course Path
Subtractor & Full Subtractor
A =1
Comparator – Designing 1-bit, 2-
for 01xx, which when we expand becomes 0100, 0101, 0110, bit and 4-bit comparators using
logic gates
0111. Thus A is high for all four of these values.
Multiplier – Designing of 2-bit
for 1xxx, which when we expand becomes 1000, 1001, 1010, and 3-bit binary multiplier circuits

1011, 1100, 1101, 1110, 1111. Thus A is high for all eight of 4-bit parallel adder and 4-bit
parallel subtractor – designing &
these values too.
logic diagram
Plotting the K-map for these values, we get for output A Carry Look-Ahead Adder –
Working, Circuit and Truth Table

Multiplexer and Demultiplexer –


The ultimate guide

Code Converters – Binary to


Share and Support

A = I2 + I3

and for B

B = I3 + I1I2′

From the above equations for A and B, we get the following logic
circuit for a 4:2 priority encoder.

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 6/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

4:2 Priority encoder using Gates

What are the advantages and View Course Path

differences of using a priority


encoder rather than a binary
encoder?
Binary encoders are good at compressing data. However, the
problem with binary encoders is that if more than one of the
input bits is high, then it produces an error at the output.
Whereas priority encoders were made to overcome this issue. It
gives an output by considering only the highest priority bit. Due
to this fact and feature, priority encoders are great at handling
interrupt requests for a microprocessor.

What are Decoders?


A decoder is a combinational logic circuit that performs the
opposite function of an encoder. Basically, it takes n inputs and
gives out 2^n outputs. A decoder is similar to a demultiplexer.
However, it has no select inputs.

In a system, if data is encoded using an encoder, it needs a


decoder at the other end to decode it. A binary decoder gives
output at only one of the output lines depending on the physical
address pointed by the inputs.

For example, for the input 10 (n=2 decimal), 2^n = 2^2 = 4


(=0100 binary). Hence the output for 10 will be 0100; that is, the
I2 line will be high. Let’s design a 2:4 decoder and understand its
truth table.

How to design a 2:4 Decoder?


A 2:4 decoder has two inputs and four outputs.

Truth table for a 2:4 decoder


A B Y3 Y2 Y1 Y0

0 0 0 0 0 1

0 1 0 0 1 0

1 0 0 1 0 0

1 1 1 0 0 0

From the truth table of the 2:4 decoder above we have, Y0 = 1 at


A=0 and B=0, so,

Y0 = A’B’

Similarly, Y1 = 1 at A = 0 and B = 1, thus,


https://technobyte.org/priority-encoders-decoders-binary-encoders/ 7/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

Y1 = A’B

Similarly,
View Course Path
Y2 = AB’

and

Y3 = AB

Plotting the circuit from the above equations, we get the


following combinational logic circuit for the 2:4 decoder

2:4 Decoder

How to design a 3:8 Decoder?


A 3:8 decoder has three inputs and eight outputs. Let’s design
its truth table and circuit using the logic we saw in the designing
of the 2:4 decoder.

Truth table for a 3:8 decoder


A B C Y7 Y6 Y5 Y4 Y3 Y2 Y1

0 0 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 0 1

0 1 0 0 0 0 0 0 1 0

0 1 1 0 0 0 0 1 0 0

1 0 0 0 0 0 1 0 0 0

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 8/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

1 0 1 0 0 1 0 0 0 0

1 1 0 0 1 0 0 0 0 0 View Course Path

1 1 1 1 0 0 0 0 0 0

From the above truth table

Y0 = A’B’C’

Y1 = A’B’C

Y2 = A’BC’

Y3 = A’BC

Y4 = AB’C’

Y5 = AB’C

Y6 = ABC’

Y7 = ABC

The resulting logic circuit for the 3:8 decoder is as follows.

3:8 Decoder

We can add an enable pin to the chip by just adding it to the


AND gates, since AND logic requires all inputs to be high to get
a high output. By just adding an enable pin to all the outer AND
logic gates, if we want to switch off the decoder,  we can do by
grounding the enable pin.

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 9/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

View Course Path

3:8 decoder with an Enable Pin

How to design 4:16 Decoders?


By joining two 3:8 decoders together, we can obtain a 4:16
decoder. We need 16 outputs, which we can easily have as we
are using two 3:8 decoders. However, on the input side, we need
only four inputs. We have six. So we add the enable pin and
make it four inputs on each 3:8 decoder. Joining the eight input
pins together, we can get the four inputs we need.

However, one of the pins is an enable pin. And both the 3:8
decoders cannot be active at the same time. Hence, the enable
pin to the second decoder is connected with an inverter. So at a
time, only one of the decoders is working.

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 10/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

View Course Path

4:16 Decoder using two 3:8 decoders

How to design a 5:32 Decoder?


By joining four 3:8 decoders. And a 2:4 decoder controlling the
enable pins of all the 3:8 decoders.

About the author

Umair Hussaini
Umair has a Bachelor’s Degree in Electronics and Telecommunication Engineering. He
also holds a Post-Graduate Diploma in Embedded System Design from the Centre of
Development of Advanced Computing (Pune, India). Currently, Umair is pursuing his
MS in Electronics Engineering from the University of Hertfordshire (Hatfield, UK).

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 11/12
10/17/21, 4:58 PM Priority Encoders, Encoders and Decoders - Simple explanation & designing

Related courses to Priority Encoders, Encoders and Decoders – Simple explanation &
designing

View Course Path


8085 Microprocessors VHDL Course CMOS - IC Design
Course Course
A free and complete
A free course on VHDL course for A free course as part of
Microprocessors. Start students. Learn our VLSI track that
from the basic everything from teaches everything
concepts related to the scratch including CMOS. Right from the
working of general syntax, different physics of CMOS to
microprocessors and modeling styles with designing of logic
work upto coding the examples of basic circuits using the
8085 and 8086. circuits. CMOS inverter.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Join our mailing list to get notified about new courses and features

Email address Subscribe

Content Navigation
Engineering Courses Articles Interesting Facts Contribute

Helpful Links

Contact About Us Advertise Blog

TECHNOBYTE
© 2016 - 2020
All rights reserved. Read our privacy policy and terms of use .

https://technobyte.org/priority-encoders-decoders-binary-encoders/ 12/12

You might also like