Professional Documents
Culture Documents
ECEG-3201-DLD-Lec - 07 - Adders Comparators Decoders Encoders
ECEG-3201-DLD-Lec - 07 - Adders Comparators Decoders Encoders
AAIT, Department of
Electrical and Computer 2 Nebyu Yonas Sutri
Engineering
Adders
Addition is an important process in digital
systems, especially computers.
There are two types of basic adders:
Half Adder
Simple Binary Addition
Full Adder
0+0= 0
0+1= 1
1+0= 1
1 + 1 = 10
AAIT, Department of
Electrical and Computer 3 Nebyu Yonas Sutri
Engineering
Half Adders
Half adder: Is a circuit that add two binary digits
and produce a sum bit and a carry bit.
A A B
+ B
Half Adder
Co S Circuit
Carry Sum CO S
AAIT, Department of
Electrical and Computer 4 Nebyu Yonas Sutri
Engineering
Half Adders
Truth table: Equation:
A B CO S
S A B
0 0 0 0
0 1 0 1 CO A B
1 0 0 1
1 1 1 0
A
S
B
Logic Circuit:
CO
AAIT, Department of
Electrical and Computer 5 Nebyu Yonas Sutri
Engineering
Full Adders
Since half adder cannot handle crisis when there
is an input carry from previous bit, we need to use
a full adder.
Full adder: circuit that adds two binary numbers
with the existence of a carry in bit. It produces a
sum and a carry out. A B
Cin
A Full Adder
+ B Circuit Cin
Co S
Carry Sum CO S
AAIT, Department of
Electrical and Computer 6 Nebyu Yonas Sutri
Engineering
Full Adders
Truth table: Equation:
A B Cin CO S
0 0 0 0 0 S ABCin ABCin ABCin ABCin
A B C
0 0 1 0 1 Co ABCin ABCin ABCin ABCin
0 1 0 0 1 AB C in ( A B )
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
AAIT, Department of
Electrical and Computer 7 Nebyu Yonas Sutri
Engineering
Full Adders
Full adder circuit can also be implemented using 2
half adders.
AAIT, Department of
Electrical and Computer 8 Nebyu Yonas Sutri
Engineering
Full Adders
AAIT, Department of
Electrical and Computer 9 Nebyu Yonas Sutri
Engineering
Parallel Binary Adder
Two bit adder
AAIT, Department of
Electrical and Computer 10 Nebyu Yonas Sutri
Engineering
Parallel Binary Adder
A group of 4 bits is called a Nibble.
Four bit parallel adder.
AAIT, Department of
Electrical and Computer 11 Nebyu Yonas Sutri
Engineering
Parallel Binary Adder
AAIT, Department of
Electrical and Computer 12 Nebyu Yonas Sutri
Engineering
Parallel Binary Adder
Parallel adders can be placed in to two categories
based on the way in which the internal carries
from stage to stage are handled.
Ripple carry adder
Look-ahead carry adder
Externally, both types of adders are the same in
terms of inputs and outputs.
The difference is the speed at which they can add
numbers. The look-ahead carry adder is much
faster than ripple carry adder.
AAIT, Department of
Electrical and Computer 13 Nebyu Yonas Sutri
Engineering
Ripple Carry Adder
In ripple carry adder, the second full adder (FA2) needs to
wait for the input carry (Cin), coming from the output carry
(Cout) from first adder (FA1).
Assume one adder has a delay of 8 ns. 4 adders will
contribute to 32 ns delay in adding up the 4 bits number .
AAIT, Department of
Electrical and Computer 14 Nebyu Yonas Sutri
Engineering
Look-Ahead Carry Adder
The objective of the adder is to reduce the adder’s delay in
performing the addition. This is because, the input carry
and output carry is dependent on the input’s value of the
adder itself.
No propagation delay from one adder to the other.
AAIT, Department of
Electrical and Computer 15 Nebyu Yonas Sutri
Engineering
4 Bit 2’s Complementer Circuit
AAIT, Department of
Electrical and Computer 16 Nebyu Yonas Sutri
Engineering
4 Bit Adder Subtractor
AAIT, Department of
Electrical and Computer 17 Nebyu Yonas Sutri
Engineering
Comparator
Comparator is a device that compares two digital
quantities to determine the relationship of those
quantities.
Comparison is made in terms of:
Equal to ‘=’
Less than ‘<’
Greater than ‘>’
The function of a comparator is to compare either
the input bit is the same as the reference bit or
not.
It can be a 1-bit, 2-bit or 4-bit comparator.
AAIT, Department of
Electrical and Computer 18 Nebyu Yonas Sutri
Engineering
Comparator
1 bit comparator
A B X
0 0 1
0 1 0 Equals to X-NOR
1 0 0
1 1 1
AAIT, Department of
Electrical and Computer 19 Nebyu Yonas Sutri
Engineering
Comparator
2 bit comparator
The output is 1 when A0 = B0 AND A1 = B1.
AAIT, Department of
Electrical and Computer 20 Nebyu Yonas Sutri
Engineering
Comparator
4 bit comparator.
AAIT, Department of
Electrical and Computer 21 Nebyu Yonas Sutri
Engineering
Decoder
Circuit that:
Accepts a set of inputs (binary number /code) and
Activates the only output that corresponds to that
particular input.
Types of decoders:
Binary decoder
3-bit decoder
4-bit decoder
BCD-to-decimal decoder
BCD-to-7-segment decoder
AAIT, Department of
Electrical and Computer 22 Nebyu Yonas Sutri
Engineering
Binary Decoder
Is used to determine if a specific binary number
occurs or not in a digital circuitry.
AAIT, Department of
Electrical and Computer 23 Nebyu Yonas Sutri
Engineering
3-Bit/Binary to Octal Decoder
The decoder converts standard 3-bit binary into one octal
high output at a time.
Enable Data input Active high data outputs
EN2 EN1 C B A X0 X1 X2 X3 X4 X5 X6 X7
1 1 0 0 0 1 0 0 0 0 0 0 0
1 1 0 0 1 0 1 0 0 0 0 0 0
1 1 0 1 0 0 0 1 0 0 0 0 0
1 1 0 1 1 0 0 0 1 0 0 0 0
1 1 1 0 0 0 0 0 0 1 0 0 0
1 1 1 0 1 0 0 0 0 0 1 0 0
1 1 1 1 0 0 0 0 0 0 0 1 0
1 1 1 1 1 0 0 0 0 0 0 0 1
0 X X X X 0 0 0 0 0 0 0 0
X 0 X X X 0 0 0 0 0 0 0 0
AAIT, Department of
Electrical and Computer 24 Nebyu Yonas Sutri
Engineering
3-Bit/Binary to Octal Decoder
AAIT, Department of
Electrical and Computer 25 Nebyu Yonas Sutri
Engineering
3-Bit Active-Low Decoder
Enable Data input Active high data outputs
EN2 EN1 C B A X0 X1 X2 X3 X4 X5 X6 X7
0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 1 1 0 1 1 1 1 1 1
0 0 0 1 0 1 1 0 1 1 1 1 1
0 0 0 1 1 1 1 1 0 1 1 1 1
0 0 1 0 0 1 1 1 1 0 1 1 1
0 0 1 0 1 1 1 1 1 1 0 1 1
0 0 1 1 0 1 1 1 1 1 1 0 1
0 0 1 1 1 1 1 1 1 1 1 1 0
1 X X X X 1 1 1 1 1 1 1 1
X 1 X X X 1 1 1 1 1 1 1 1
AAIT, Department of
Electrical and Computer 26 Nebyu Yonas Sutri
Engineering
3-Bit Active-Low Decoder
AAIT, Department of
Electrical and Computer 27 Nebyu Yonas Sutri
Engineering
4-Bit Decoder
Input Output
D C B A X
0 0 0 0 X0
0 0 0 1 X1
Also called 0 0 1 0 X2
0 0 1 1 X3
binary to
0 1 0 0 X4
hexadecimal 0 1 0 1 X5
decoder. 0 1 1 0 X6
0 1 1 1 X7
1 0 0 0 X8
1 0 0 1 X9
1 0 1 0 X10
1 0 1 1 X11
1 1 0 0 X12
1 1 0 1 X13
1 1 1 0 X14
1 1 1 1 X15
AAIT, Department of
Electrical and Computer 28 Nebyu Yonas Sutri
Engineering
BCD to Decimal Decoder
Act the same as a 4-bit decoder but limited to 10 decimal
digits only
Input Output
D C B A X0 X1 X2 X3 X4 X5 X6 X7 X8 X9
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
AAIT, Department of
Electrical and Computer 29 Nebyu Yonas Sutri
Engineering
BCD-to-7 Segment Decoder
Output of the decoder is active Low, therefore, common
anode 7-segment display is used.
AAIT, Department of
Electrical and Computer 30 Nebyu Yonas Sutri
Engineering
BCD-to-7 Segment Decoder
If Active High;
AAIT, Department of
Electrical and Computer 31 Nebyu Yonas Sutri
Engineering
Encoder
It works opposite ways from decoders.
Circuit that allows only one input to be activated,
and produces an N-bit output code, depending on
which input is activated.
Common encoders:
8-line-to-3-line encoder
Decimal-to-BCD encoder
AAIT, Department of
Electrical and Computer 32 Nebyu Yonas Sutri
Engineering
8-Line-to-3-Line Encoder
Octal to binary converter: Octal input is applied by pressing
one of the push buttons at a time. Circuit converts the applied
input to a binary at the output, X.
AAIT, Department of
Electrical and Computer 33 Nebyu Yonas Sutri
Engineering
Decimal-to-BCD Encoder
Also called 10-Line-to-4-Line converter.
AAIT, Department of
Electrical and Computer 34 Nebyu Yonas Sutri
Engineering
What to do this week?
AAIT, Department of
Electrical and Computer 35 Nebyu Yonas Sutri
Engineering