Digital Logic ยท Unit 5
Decoders and Encoders
Exam-focused notes for Decoders and Encoders (Digital Logic, BIT103): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.
Decoders and Encoders in short
Decoders and encoders convert information from one code to another. A decoder turns a binary code into a single active output line. An encoder does the opposite. Both are used in memory addressing, displays and code conversion.
What this unit covers
- Decoder design and operation
- BCD to decimal decoder
- BCD to seven-segment decoder
- BCD to excess-3 code converter
- Encoder circuits
BCD to excess-3 code converter
2080 ยท 10 marks
Define BCD code. Design BCD to Excess-3 Code converter with truth table and logic diagram.[10]
Show solved answerHide answer
BCD to Excess-3 Code Converter
Definition of BCD Code
BCD (Binary Coded Decimal) is a binary encoding of decimal digits where each decimal digit (0-9) is represented by its 4-bit binary equivalent. Only 10 out of 16 possible 4-bit combinations (0000 to 1001) are valid; the remaining six (1010 to 1111) are invalid/don't-care states.
| Decimal | BCD (8-4-2-1) |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| ... | ... |
| 9 | 1001 |
Definition of Excess-3 Code
Excess-3 (XS-3) is a non-weighted, self-complementing code obtained by adding 3 (0011) to each BCD digit.
Truth Table: BCD to Excess-3
Let BCD inputs be A, B, C, D (A = MSB, D = LSB) Let Excess-3 outputs be W, X, Y, Z (W = MSB, Z = LSB)
| Decimal | A | B | C | D | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
| 3 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
| 4 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
| 6 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 7 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
| 9 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
| 10-15 | - | - | - | - | X | X | X | X |
(X = don't care)
K-Map Simplification
Output W (minterms: 5,6,7,8,9 + don't cares 10-15)
CD
AB 00 01 11 10
00 | 0 | 0 | 0 | 0 |
01 | 0 | 1 | 1 | 1 |
11 | X | X | X | X |
10 | 1 | 1 | X | X |
W = A + BC + BD
Output X (minterms: 1,2,3,4,9 + don't cares 10-15)
CD
AB 00 01 11 10
00 | 0 | 1 | 1 | 1 |
01 | 1 | 0 | 0 | 0 |
11 | X | X | X | X |
10 | 0 | 1 | X | X |
X = B'C + B'D + BC'D'
(Simplified: X = BC'D' + B'C + B'D)
Output Y (minterms: 0,3,4,7,8 + don't cares 10-15)
CD
AB 00 01 11 10
00 | 1 | 0 | 1 | 0 |
01 | 1 | 0 | 1 | 0 |
11 | X | X | X | X |
10 | 1 | 0 | X | X |
Y = 1 at minterms 0, 3, 4, 7 and 8. On the map those cells fill the columns CD = 00 and CD = 11 for every value of AB, so the two groups are C'D' and CD, and the don't-care row AB = 11 is absorbed into them.
Y = CD + C'D'
(Y = C XNOR D = CD + C'D')
Output Z (minterms: 0,2,4,6,8 + don't cares 10-15)
CD
AB 00 01 11 10
00 | 1 | 0 | 0 | 1 |
01 | 1 | 0 | 0 | 1 |
11 | X | X | X | X |
10 | 1 | 0 | X | X |
Z = D'
Simplified Boolean Expressions
| Output | Expression |
|---|---|
| W | A + BC + BD |
| X | B'C + B'D + BC'D' |
| Y | CD + C'D' |
| Z | D' |
Logic Diagram
Inputs: A, B, C, D, with inverters supplying B', C' and D'
W = A + BC + BD
B ---+--[AND]--- BC ---+
C ---+ |
B ---+--[AND]--- BD ---+--[OR]--- W
D ---+ |
A ---------------------+
X = B'C + B'D + BC'D'
B' --+--[AND]--- B'C ---+
C ---+ |
B' --+--[AND]--- B'D ---+--[OR]--- X
D ---+ |
B ---+ |
C' --+--[AND]-- BC'D' --+
D' --+
Y = CD + C'D'
C ---+--[AND]--- CD ----+
D ---+ +--[OR]--- Y
C' --+--[AND]--- C'D' --+
D' --+
Z = D'
D -------[NOT]--------- Z
Only two-level AND-OR logic is needed for each output, and the inverters that produce B', C' and D' are shared across all four output networks. Y is the XNOR of C and D, so a single XNOR gate can replace its two AND gates and the OR gate.
2081.2 ยท 10 marks
Design a combinational circuit that generates 9โs complement of a BCD number.[10]
BCD to seven-segment decoder
2079 ยท 10 marks
Design a BCD-to Seven-segment decoder to display decimal numbers 1, 2 and 4.[10]
Decoder design and operation
2078 ยท 5 marks
Implement the following function: F = ฮฃ\Sigmaฮฃ(0,1,3,4,5,8,9,10,15) using i) Decoder ii) Multiplexer iii) PLA[5]
Show solved answerHide answer
Implementation of F = ฮฃ(0,1,3,4,5,8,9,10,15)
Given
- Function: $F(A,B,C,D) = \Sigma m(0,1,3,4,5,8,9,10,15)$
- 4 variables: A (MSB), B, C, D (LSB)
- Minterms where F = 1: {0, 1, 3, 4, 5, 8, 9, 10, 15}
- Minterms where F = 0: {2, 6, 7, 11, 12, 13, 14}
Truth Table
| m | A | B | C | D | F |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 2 | 0 | 0 | 1 | 0 | 0 |
| 3 | 0 | 0 | 1 | 1 | 1 |
| 4 | 0 | 1 | 0 | 0 | 1 |
| 5 | 0 | 1 | 0 | 1 | 1 |
| 6 | 0 | 1 | 1 | 0 | 0 |
| 7 | 0 | 1 | 1 | 1 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 |
| 9 | 1 | 0 | 0 | 1 | 1 |
| 10 | 1 | 0 | 1 | 0 | 1 |
| 11 | 1 | 0 | 1 | 1 | 0 |
| 12 | 1 | 1 | 0 | 0 | 0 |
| 13 | 1 | 1 | 0 | 1 | 0 |
| 14 | 1 | 1 | 1 | 0 | 0 |
| 15 | 1 | 1 | 1 | 1 | 1 |
Solution
i) Using Decoder (4-to-16 Decoder)
A 4-to-16 decoder produces all 16 minterms on its outputs $D_0 \ldots D_{15}$. Feed the minterm outputs where F = 1 into an OR gate.
$$F = D_0 + D_1 + D_3 + D_4 + D_5 + D_8 + D_9 + D_{10} + D_{15}$$
A,B,C,D --> [4-to-16 Decoder]
outputs D0,D1,D3,D4,D5,D8,D9,D10,D15
--> [9-input OR gate] --> F
(If active-low decoder outputs are used, a 9-input NAND gate is used instead.)
ii) Using Multiplexer (8-to-1 MUX)
Use A, B, C as select lines ($S_2=A,,S_1=B,,S_0=C$) and D as data variable.
| A B C | m(D=0) / m(D=1) | F,F | Input |
|---|---|---|---|
| 000 | m0=1, m1=1 | 1,1 | 1 |
| 001 | m2=0, m3=1 | 0,1 | D |
| 010 | m4=1, m5=1 | 1,1 | 1 |
| 011 | m6=0, m7=0 | 0,0 | 0 |
| 100 | m8=1, m9=1 | 1,1 | 1 |
| 101 | m10=1, m11=0 | 1,0 | D' |
| 110 | m12=0,m13=0 | 0,0 | 0 |
| 111 | m14=0,m15=1 | 0,1 | D |
MUX input connections:
$$I_0=1,; I_1=D,; I_2=1,; I_3=0,; I_4=1,; I_5=D',; I_6=0,; I_7=D$$
iii) Using PLA
Minimize using K-map.
CD
AB 00 01 11 10
00 | 1 1 1 0
01 | 1 1 0 0
11 | 0 0 1 0
10 | 1 1 0 1
Grouping SOP terms:
- P1: $A'C'$ โ cells 00-00,00-01,01-00,01-01 = m0,m1,m4,m5 โ
- P2: $B'C'$ โ m0,m1,m8,m9 (00-00,00-01,10-00,10-01) โ
- P3: $A'B'D$ โ m1,m3 (00-01,00-11) โ
- P4: $B'C D'$ โ m10 (10-10); pair with m8? m8=10-00 no. Use $A B' C D'$... check m10 alone. Pair m10 with m2(=0) not allowed. So $m10 = AB'CD'$ (single cell).
- P5: $ABCD$ โ m15 (single cell)
Verify coverage:
- P1 covers 0,1,4,5
- P2 covers 0,1,8,9
- P3 covers 1,3
- P4 covers 10
- P5 covers 15
Union = {0,1,3,4,5,8,9,10,15} โ all minterms covered, no extra.
$$\boxed{F = A'C' + B'C' + A'B'D + AB'CD' + ABCD}$$
PLA Programming Table (5 product terms, inputs A,B,C,D, one output F):
| Product | A | B | C | D | F |
|---|---|---|---|---|---|
| $A'C'$ | 0 | - | 0 | - | 1 |
| $B'C'$ | - | 0 | 0 | - | 1 |
| $A'B'D$ | 0 | 0 | - | 1 | 1 |
| $AB'CD'$ | 1 | 0 | 1 | 0 | 1 |
| $ABCD$ | 1 | 1 | 1 | 1 | 1 |
(AND array programs the 5 product terms; OR array connects all 5 to output F.)
Common mistake: grouping the PLA K-map carelessly, for example placing $m_{10}$ in an $AB'$ pair that covers 10. The minimized expression above is the correct grouping. The MUX and decoder parts are straightforward by comparison.
2081.2 ยท 5 marks
Explain the concept of decoder with an example. [5]
0
Design of Full Adder Circuit Using 3-to-8 Decoder
A Full Adder is a combinational circuit that adds three input bits (A, B, Cin) and produces two outputs: Sum (S) and Carry (Cout). It can be implemented using a 3-to-8 decoder and OR gates.
0 ยท 5 marks
Design a decoder with three input lines but with only six output lines. If the value of the input corresponds to 6 or 7, then all output line should be asserted to signal an error. [5]
BCD to decimal decoder
2077 ยท 10 marks
What is Decoder? Design BCD to Decimal Decoder with Truth Table and Logic Diagram [10]
Make Unit 5 stick
Practice BIT103 with flashcards & quizzes