Lecture 4
Lecture 4
Topics to be covered
• Adders (Half, Full, Parallel Adders)
• Subtractor (Half and Full)
• N-bit Comparator
• Encoder, Decoder and Priority Encoder
• Multiplexer and DeMultiplexer
Basic Rules for Binary
Addition
1011100
1
+100111
10
A ripple carry adder is
one in which the carry
output of each full-
adder is connected to
the carry input of the
next higher order
stage. The sum and
output carry of any
stage cannot be
produced until the
carry input occurs.
Thus causing a delay in
the overall addition
process.
A look ahead carry adder can
overcome the delay of a
ripple adder. It generates a
carry either by carry
generation or by carry
propagation.
From the conditions of carry,
we can see carry is
𝐂𝐠 = 𝐀𝐁
generated when both inputs
are 1.
𝐂𝐩 = 𝐀 + 𝐁
either of the inputs or both
the inputs are 1.
𝐂𝐨𝐮𝐭 = 𝐂𝐠 + 𝐂𝐩𝐂𝐢𝐧
The carry output is
dependent on the
generated carry,
propagation carry and
carry input(CIN). The
carry generation and
carry propagation for
each stage are
immediately available as
soon as the inputs are
available.
The Digital Comparator
Another common and very useful combinational logic circuit is that of the Digital Comparator circuit. Digital or
Binary Comparators are made up from standard AND, NOR and NOT gates that compare the digital signals
present at their input terminals and produce an output depending upon the condition of those inputs.
For example, along with being able to add and subtract binary numbers we need to be able to compare them and
determine whether the value of input A is greater than, smaller than or equal to the value at input B etc. The digital
comparator accomplishes this using several logic gates that operate on the principles of Boolean Algebra. There
are two main types of Digital Comparator available and these are.
1. Identity Comparator – an Identity Comparator is a digital comparator that has only one output terminal for
when A = B either “HIGH” A = B = 1 or “LOW” A = B = 0
2. Magnitude Comparator – a Magnitude Comparator is a type of digital comparator that has three output
terminals, one each for equality, A = B greater than, A > B and less than A < B
The purpose of a Digital Comparator is to compare a set of variables or unknown numbers, for example A (A1,
A2, A3, …. An, etc) against that of a constant or unknown value such as B (B1, B2, B3, …. Bn, etc) and produce
an output condition or flag depending upon the result of the comparison. For example, a magnitude comparator of
two 1-bits, (A and B) inputs would produce the following three output conditions when compared to each other.
Truth Table:
Logic Diagram:
Inputs Outputs
B A A>B A=B A<B
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
Logic Expression:
X0 = A0B0+A0’B0’
Block Diagram:
Logic Expression:
Xn= AnBn+An’Bn’
(A=B)=X2X1X0
(A<B)=A2’B2+X2A1’B1+X2X1A0’B0
(A>B)=A2B2’+X2A1B1’+X2X1A0B0’
Block Diagram:
5-bit Digital Magnitude Comparator:
Logic Expression:
Xn= AnBn+An’Bn’
(A=B)=X4X3X2X1 X0
(A<B)=A4’B4+X4A3’B3+X4X3A2’B2+X4X3X2A1’B1+X4X3X2X1A0’B0
(A>B)=A4B4’+X4A3B3’+X4X3A2B2’+X4X3X2A1B1’+X4X3X2X1A0B0’
DECODE
RS:
A decoder is a digital circuit that detects the presence of a specified combination of bits on its inputs
Determine the logic required to decode the Determine the logic required to decode the
binary number 1001 by producing a HIGH level on binary
the output. number 1101 and produce an active-LOW output.
Determine the logic required to decode the Determine the logic required to decode the
binary number 1011 by producing a HIGH level on binary number 1110 and produce an active-LOW
the output. output.
3-Line to 8-Line Decoding Function for Active-HIGH and Active-
LOW
Active-HIGH Active-LOW
output output
74HC154 Pin 7CHC154 Logic
Diagram Symbol
Design a 5- bit Decoder using
74HC154.
Solution:
Since the 74HC154 can handle
only 4- bits, two decoders must
Full-Adder Logical
Full-Adder Truth Circuit
Table with Decoder
Implement the following function a
3-bit Decoder and necessary Implement the following
gates. function a 4-bit Decoder and
𝐅=𝐀+ 𝐁 𝐂
necessary gates.
𝐅 = 𝐀𝐃 + 𝐁 𝐂
𝐅=𝐀+ 𝐁 𝐂 Implement the following
∴ 𝐅 = 𝐀𝐁𝐂 + 𝐀𝐁𝐂 + 𝐀𝐁 𝐂 + 𝐀𝐁
•function
Implementa the following
3-bit Decoder and
𝐂 + 𝐀 𝐁 𝐂
function a
necessary gates.
𝐅 = 𝐁and
• 3-bit Decoder + 𝐀 𝐂
necessary
gates.
•𝐅=𝐀 +𝐂 𝐁
• Implement
BCD
ENCODERS:
An encoder is a combinational circuit that detects the presence of an active level in its input and
converts it to a coded output. E.g. Decimal to Binary encoders, Decimal to BCD encoders, Octal to
Binary encoders, Priority Encoders, Irregular Sequence Encoder etc.
Follow Class
Lecture
Multiplexer: A multiplexer is a combinational circuit which selects binary information from one of many
input lines and directs it to a single output line.
Cascading Lower Input MUX to Design Higher Input MUX