Decoder and Encoder
Aarti Solanki
Department of Information and Communication Technology
Pandit Deendayal Energy University, Gandhinagar
Decoders
Digital information represented
in some binary form must be
converted into some alternate
binary form.
𝑛 to 2^𝑛-line decoder.
Only one of the 2^𝑛 output
lines responds, with a logic-1,
to a given input combination of
values on its 𝑛-input lines.
Decoders
Definition:
A decoder is a combinational circuit that converts binary
information from n input lines to a maximum of unique output
lines.
If n-bit decoded information has unused or don’t-care combinations,
the decoder output will have less than outputs.
The decoders presented here are called n-to-m line decoders
where 𝑚≤. Their purpose is to generate the (or less) minterms of n
input variables.
Decoders
Application:
Code Conversion: Decoders are greatly used in applications where the particular output or
group of outputs to be activated only on the occurrence of a specific combination of input
levels. Some important application of decoder circuit is given below.
Address Decoders: Amongst its many uses, a decoder is widely used to decode the particular
memory location in the computer memory system. Decoders accept the address code
generated by the CPU which is a combination of address bits for a specific location in the
memory.
Instruction Decoder: Another application of the decoder can be found in the control unit of
the central processing unit. This decoder is used to decode the program instructions in order to
activate the specific control lines such that different operations in the ALU of the CPU are
carried out.
Generating Control Signals
Logic Circuit Implementation
Decoders are also utilized to turn on and off digital devices at a specific time.
2 X 4 Decoder
2 to 4 decoder is one that has 2 input lines and 4 () output
lines. Operation
The operation of logic circuit of the 2 to 4 decoder is
described as follows −
When enable input (E) is inactive, i.e. set to 0, none of the
AND gates will function.
When enable input (E) is made active by setting it to 1, then
the circuit works as explained below.
When A = 0 and B = 0, the AND gate 1 becomes active and
produces output Y0.
When A = 0 and B = 1, the AND gate 2 becomes active and
produces output Y1.
When A = 1 and B = 0, the AND gate 3 becomes active and
produces output Y2.
When A = 1 and B = 1, the AND gate 4 becomes active and
produces output Y3.
3 X 8 Decoder
The 3 to 8 decoder is one that has 3 input lines and 8 () output lines.
The operation of logic circuit of the 3 to 8 decoder is described as follows −
When enable input (E) is inactive, i.e. set to 0, none of the AND gates will
function.
When enable input (E) is made active by setting it to 1, then the circuit
works as described below.
When A = 0, B = 0, and C = 0, the AND gate 1 becomes active and produces
output Y0.
When A = 0, B = 0, and C = 1, the AND gate 2 becomes active and produces
output Y1.
When A = 0, B = 1, and C = 0, the AND gate 3 becomes active and produces
output Y2.
When A = 0, B = 1, and C = 1, the AND gate 4 becomes active and produces
output Y3.
When A = 1, B = 0, and C = 0, the AND gate 5 becomes active and produces
output Y4.
When A = 1, B = 0, and C = 1, the AND gate 6 becomes active and produces
output Y5.
When A = 1, B = 1, and C = 0, the AND gate 7 becomes active and produces
output Y6.
When A = 1, B = 1, and C = 1, the AND gate 8 becomes active and produces
output Y7.
From the truth table it is observed that the output variables are mutually exclusive because only one output can be equal to 1 at any one
time. The output line whose value is equal to 1 represents the minterm equivalent of the binary number presently available in the input
lines.
4 X 16 Decoder
The 4 to 16 decoder is the type of decoder which has 4 input lines and 16
(214) output lines.
3 to 8 decoder using 2 to 4 decoder
4 to 16 decoder using 3 to 8 decoder
4 to 16 decoder using 2 to 4 decoder
Encoders
• An encoder is a digital combinational circuit that converts a human friendly information
into a compact coded format for processing using machines.
• An encoder converts a piece of information normal form to coded form. This process is
called encoding.
• An encoder has a number of input lines, only one of which input is activated at a given time
and produces an N-bit output code, depending on which input is activated.
• Encoder is a combinational circuit that performs the reverse operation of a Decoder. It has a
maximum of 2^n input lines and ‘n’ output lines, hence it encodes the information from 2^n
inputs into an n-bit code. It will produce a binary code equivalent to the input, which is
active High.
4 to 2 Encoder
• 4 to 2 Encoder is one that has 4 () input lines and 2 output lines. Operation
• It produces an output code (i.e., convert input information in a 2-bit format) depending on the combination of
input lines.
8 to 3 Encoder
• 8 to 3 Encoder is one that has 8 () input lines and 3 output lines. Operation
• It produces an output code (i.e., convert input information in a 3-bit format) depending on the combination of
input lines.
Decimal to BCD Encoder
• convert a decimal number or information represented using decimal number into its equivalent binary-coded
decimal (BCD) format is known as a decimal to BCD encoder.
Priority Encoders
A priority encoder is an encoder that includes the priority function
If two or more inputs are equal to 1 at the same time, the input having
the highest priority will take precedence.
Implementing Boolean Function using
Decoder
Example: Minterms using OR
Gates
f1(x, y, z) = ∑ (1, 2, 4, 5)
f2(x, y, z) = ∑ (1,5,7)
Implementing Full Adder using Decoders
Example: Implement a full adder circuit with a decoder and two OR gates.
S(x, y, z) = ∑ (1, 2, 4, 7)
C(x, y, z) = ∑ (3, 5, 6, 7)
Full adder with decoder