Decoders and Encoders
Decoders and Encoders
KEC302
Unit-2
Combinational Circuits
Deepak Sigroha
Electronics Engineering Department
Rajkiya Engineering College Sonbhadra
deepak.sigroha@recsonbhadra.ac.in
+91-9478856526
Outline
Looping
• Combinational Circuits
o Analysis & Design
• Arithmetic Circuits
o Adder, Subtractor, & Multiplier
• Non-arithmetic Circuits
o Magnitude Comparator, Code Convertors & Parity Generator/Checker
• Encoder & Decoder
• Multiplexer & De-Multiplexer
• ALU
• Barrel Shifter
Combinational Circuit
(Decoders & Encoders)
Decoders
Discrete quantities of information are represented in digital systems by binary codes. A binary
code of n bits is capable of representing up to distinct elements of coded information.
A decoder is a logic circuit that accepts a set of inputs which represents a binary number and
activates the only output that corresponds to the input number.
A decoder is a combinational circuit that converts binary information from n input lines to a
maximum of 2n unique output lines. If the n -bit coded information has unused combinations, the
decoder may have fewer than 2n outputs (i.e. .
In other words, a decoder circuit looks at its inputs, determines which binary number is present
there, and activates the specific output which corresponds to that number; all other outputs remain
inactive.
Unit 2 – Combinational Circuits 4
Decoders
The general diagram shown in Figure with n inputs and m outputs. Because each of the n inputs
can be 0 or 1, there are possible input combinations or codes. For each of these input
combinations, only one of the m outputs will be active (HIGH); all the other outputs are
inactive (LOW).
Many decoders are designed to produce active-LOW outputs, where only the selected output is
LOW while all others are HIGH. This situation is indicated by the presence of small circles on
the output lines in the decoder diagram.
I0 O0
I1 O1
I2 O2
n inputs
.
. Decoder
.
.
m outputs m=2n
. .
In-2 Om-2
In-1 Om-1
D 7=ABC
D 6= ABC′
• 3 to 8 line decoder can be
D 5= AB ′ C implemented using AND
gates to achieve active-
D 4= AB ′ C ′ HIGH output.
• For active-LOW outputs,
NAND gates are used.
D 3=A ′ BC
D 2= A ′ BC ′
D 1= A ′ B ′ C
D 0= A ′ B ′ C ′
Unit 2 – Combinational Circuits 9
3-Line-to-8-Line (Binary to Octal) Decoder
The three inputs are decoded into eight outputs, each representing one of the minterms of the
three input variables.
The three inverters provide the complement of the inputs, and each one of the eight AND gates
generates one of the minterms.
Also called 1-of-8 decoder only 1 of the 8 outputs is activated at one time.
It uses all AND gates, and therefore, the outputs are active-HIGH. For active-LOW outputs,
NAND gates are used.
However, a three-to-eight-line decoder can be used for decoding any three-bit code to provide
eight outputs, one for each element of the code.
Furthermore, decoders include one or more enable inputs to control the circuit operation.
For example, in the 3-line to 8-line decoder, if a common ENABLE line is connected to the
fourth input of each gate.
A particular output as determined by the input code will go HIGH only when the ENABLE line
is held HIGH. When the ENABLE is held LOW, however, all the outputs will be forced to the
LOW state regardless of the levels at the and inputs.
E A B C
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0 0 0
1 0 0 1 0 1 0 0 0 0 0 0
1 0 1 0 0 0 1 0 0 0 0 0
1 0 1 1 0 0 0 1 0 0 0 0
1 1 0 0 0 0 0 0 1 0 0 0
1 1 0 1 0 0 0 0 0 1 0 0
1 1 1 0 0 0 0 0 0 0 1 0
1 1 1 1 0 0 0 0 0 0 0 1
D 7=E ABC
D 6=E ABC ′
D 5= E AB ′ C
D 4= E AB ′ C ′
D 3=E A′ BC
D 2= E A ′ BC ′
D 1=E A ′ B′ C
D 0=E A′ B′ C ′
Unit 2 – Combinational Circuits 14
2-Line-to-4-Line Decoder with NAND Gates & Enable Input
A two-to-four-line decoder with an enable input constructed with NAND gates is shown in Fig. The circuit
operates with complemented outputs and a complement enable input.
Inputs Outputs
From Truth Table
1 1 1 1 1
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 0 1 1 1 0
The output whose value is equal to 0 represents the minterm selected by inputs A and B.
The circuit is disabled when E is equal to 1, regardless of the values of the other two inputs.
When the circuit is disabled, none of the outputs are equal to 0 and none of the minterms are selected.
ENABLE
inputs
7442
BCD-to-decimal
decoder.
an enable input.
Inputs Outputs
A B C D
0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0 0 0 0 0 0 0
0 0 1 1 0 0 0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0 0 1 0 0 0 0
0 1 1 0 0 0 0 0 0 0 1 0 0 0
0 1 1 1 0 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0 0 0 0 0 1 0
1 0 0 1 0 0 0 0 0 0 0 0 0 1
Unit 2 – Combinational Circuits 21
Design: BCD-to-Decimal Decoder
AB
00 01 11 10
CD
0 4 12 8
00
1 5 13 9
01
3 7 15 11
11
2 6 14 10
10
The most significant input bit is connected through an inverter to on the upper decoder (for
through ) and directly to E on the lower decoder (for through ).
When is LOW, the upper decoder is enabled and the lower decoder is disabled. The bottom
decoder outputs all 0s, and top 8 outputs generate minterms.
When A3 is HIGH, the lower decoder is enabled and the upper decoder is disabled. The bottom
decoder outputs generate minterms 1000 to 1111 while the outputs of the top decoder are all 0s.
In general, enable inputs are a convenient feature for interconnecting two or more standard
components for the purpose of expanding the component into a similar function with more
inputs and outputs.
0 X X 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
Since any Boolean function can be expressed in sum-of-minterms form, a decoder that generates the
minterms of the function, together with an external OR gate that forms their logical sum, provides a
hardware implementation of the function. In this way, any combinational circuit with n inputs and m
outputs can be implemented with an n-to-2n-line decoder and m OR gate.
The procedure for implementing a combinational circuit by means of a decoder and OR gates requires
that the Boolean function for the circuit be expressed as a sum of minterms.
A decoder is then chosen that generates all the minterms of the input variables. The inputs to each OR gate
are selected from the decoder outputs according to the list of minterms of each function.
Since there are three inputs and a total of eight minterms, we need a three-to-eight-line decoder. The implementation is shown
in Figure.
If NAND gates are used for the decoder, then the external gates must be NAND gates instead of OR
gates.
This is because a two-level NAND gate circuit implements a sum-of-minterms function and is
equivalent to a two-level AND–OR circuit.
A function with a long list of minterms requires an OR gate with a large number of inputs.
A function having a list of k minterms can be expressed in its complemented form with minterms.
If the number of minterms in the function is greater than , then can be expressed with fewer minterms.
In such a case, it is advantageous to use a NOR gate to sum the minterms of . The output of the NOR gate
complements this sum and generates the normal output F .
Implement the circuit with a decoder constructed with NAND gates and NAND or AND gates connected to the
decoder outputs. Use a block diagram for the decoder. Minimize the number of inputs in the external gates.
Solution
When the LED anode is more positive than the cathode by approximately 2 V, the LED
By controlling current through each LED, some segments are turned on & emit light, while others are turned off, which generates the desired character
pattern.
In the common-anode type, a low voltage applied to an LED cathode allows current to flow
through the diode, which causes it to emit light.
In the common-cathode type, a high voltage applied to an LED anode causes the current to flow
and produces the resulting light emission.
Unit 2 – Combinational Circuits 41
BCD-to-Seven Segment Decoder/Driver
A BCD-to-7-segment decoder/driver is used to take a four-bit BCD input and provide the
outputs that will pass current through the appropriate segments to display the decimal digit.
The logic for this decoder is more complicated than the logic of decoders that we have looked
at previously because each output is activated for more than one combination of inputs.
For example, the segment must be activated for any of the digits and , which means whenever any
of the codes or occurs.
Since LEDs require considerable power, decoders often contain output drivers capable of supplying sufficient
power
Unit 2 – Combinational Circuits 45
BCD-to-Seven Segment Decoder/Driver
After using K-map, the simplified minimum Boolean expression are given by
The output of display has AND-OR logic, so it can be implemented by “24” NAND gates
The 7446/47 decoder/drivers are designed to activate specific segments even for non-BCD input
codes (greater than 1001). Figure shows the activated segment patterns for all possible input
codes from 0000 to 1111. Note that an input code of 1111 (15) will blank out all the segments.
It has (or fewer) input lines and N-output lines. Out of input lines only one is activated at a
given time and produces an output code, depending upon which input is activated.
where,
• To resolve this ambiguity, encoder circuits must establish an input priority to ensure that only one input is encoded.
• If we establish a higher priority for inputs with higher subscript numbers, and if both D 3 and D6 are 1 at the same time,
the output will be 110 because D6 has higher priority than D3.
In some practical applications, priority encoders may have several inputs that are routinely
HIGH at the same time, and the principal function of the encoder in those cases is to select the
input with the highest priority. This function is called arbitration. A common example is found
in computer systems, where there are numerous input devices and several of which may attempt
to supply data to the computer at the same time.
A priority encoder is used to enable that input device which has the highest priority among
those competing for access to the computer at the same time.
If all inputs are 0, there is no valid input and V is equal to 0. The other two outputs are not inspected when V
equals 0 and are specified as don’t-care conditions.
Note that whereas in output columns represent don’t-care conditions, the in the input columns
are useful for representing a truth table in condensed form. Instead of listing all 16 minterms of
four variables, the truth table uses an to represent either 1 or 0. For example, represents the two
minterms and .
𝐷0 𝐷1 𝐷0 𝐷1
00 01 11 10 00 01 11 10
𝐷2 𝐷3 0 4 12 8 𝐷2 𝐷3 0 4 12 8
00 X 00 X 1 1
1 5 13 9 1 5 13 9
01 1 1 1 1 01 1 1 1 1
3 7 15 11 3 7 15 11
11 1 1 1 1 11 1
1 1 1
2 6 14 10 2 6 14 10
10 1 1 1 1 10
A=D 3+ D 2 B= D 3 + D ′2 D 1
Unit 2 – Combinational Circuits 60
Priority Encoder
V =∑ (1 , 2 , 3 , 4 ,5 ,6 ,7 , 8 , 9 ,10 ,11 , 12 ,13 , 14 ,15)
m
D0 D100 01 11 10 D3 B= D3 + D ′2 D1
D2 D3 0 4 12 8 D2
00 0 1 1 1 D1
1 5 13 9
01 1 1 1 1
A=D 3+D 2
3 7 15 11
11 1 1 1 1
D0
2 6 14 10
10 1 1 1 1 V = D 3+D 2+D 1+D 0
V = D 3+D 2+ D 1+ D 0
Unit 2 – Combinational Circuits 61
References
1. T. L. Floyd, “Digital Fundamental”, 11th Ed., USA : Prentice-Hall.
2. R.J. Tocci, N. S. Widmer and G. L. Moss “Digital Systems: Principles and Applications”,
11th Ed., USA : Prentice-Hall.,
3. M. Morris Mano, M. D. Ciletti, “Digital Design” 6th Ed., USA : Prentice-Hall.
4. A. Anand Kumar, “Fundamentals of Digital Circuits” 4th Ed., PHI.