ECEG-3201 Digital Logic Design - WordPress.com · Encoder It works opposite ways from decoders....
Transcript of ECEG-3201 Digital Logic Design - WordPress.com · Encoder It works opposite ways from decoders....
Addis Ababa Institute of Technology (AAIT) Department of Electrical and
Computer Engineering
ECEG-3201 Digital Logic Design
AAIT, Department of Electrical and Computer
Engineering
Nebyu Yonas Sutri 2
Learning Outcomes
At the end of the lecture, students should get
familiarized with;
Adders/Subtractors.
Comparators.
Decoders.
Encoders.
3 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Addition is an important process in digital
systems, especially computers.
There are two types of basic adders:
Half Adder
Full Adder
Adders
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10
Simple Binary Addition
4 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Half Adders
Half adder: Is a circuit that add two binary digits
and produce a sum bit and a carry bit.
A
+ B
Co S
Carry Sum
Half Adder
Circuit
B A
S CO
5 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Half Adders
Truth table: Equation:
A B CO S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
BAC
BAS
O
A
BS
CO
Logic Circuit:
6 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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.
Full Adder
Circuit
B A
S CO
Cin
Cin
A
+ B
Co S Carry Sum
7 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Full Adders
Truth table: Equation:
A B Cin CO S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
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
in in in in
o in in in in
S ABC ABC ABC ABC
C ABC ABC ABC ABC
( )in
A B C
AB C A B
8 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Full Adders
Full adder circuit can also be implemented using 2
half adders.
9 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Full Adders
10 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Parallel Binary Adder
Two bit adder
11 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Parallel Binary Adder
A group of 4 bits is called a Nibble.
Four bit parallel adder.
12 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Parallel Binary Adder
13 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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.
Parallel Binary Adder
14 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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 .
15 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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.
16 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
4 Bit 2’s Complementer Circuit
17 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
4 Bit Adder Subtractor
18 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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.
19 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Comparator
1 bit comparator
The output is 1 when the inputs are equal.
A B X
0 0 1
0 1 0
1 0 0
1 1 1
Equals to X-NOR
20 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Comparator
2 bit comparator
The output is 1 when A0 = B0 AND A1 = B1.
21 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Comparator
4 bit comparator.
22 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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
23 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Binary Decoder
Is used to determine if a specific binary number
occurs or not in a digital circuitry.
The output is 1 only when:
A0 = 1
A1 = 0
A2 = 0
A3 = 1
24 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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
25 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
3-Bit/Binary to Octal Decoder
26 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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
27 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
3-Bit Active-Low Decoder
28 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
4-Bit Decoder
Also called
binary to
hexadecimal
decoder.
Input Output
D C B A X
0 0 0 0 X0
0 0 0 1 X1
0 0 1 0 X2
0 0 1 1 X3
0 1 0 0 X4
0 1 0 1 X5
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
29 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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
30 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
BCD-to-7 Segment Decoder Output of the decoder is active Low, therefore, common
anode 7-segment display is used.
31 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
BCD-to-7 Segment Decoder If Active High;
32 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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
33 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
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.
34 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Decimal-to-BCD Encoder Also called 10-Line-to-4-Line converter.
35 AAIT, Department of
Electrical and Computer Engineering
Nebyu Yonas Sutri
Read about Multiplexers, Demultiplexers and
Code Converters.
Digital Fundamentals, Thomas L. Floyd, Chapter 6,
Pages 329 – 342.
What to do this week?