0 UNIT 2 PPT File 04092024
0 UNIT 2 PPT File 04092024
any.
• So we required three bits adder because there
were a carry from the previous addition.
A B Cin SUM Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
• Table : truth table for a 4-bit adder.
Truth tables may be called function tables
or functional truth tables.
• The subscript n represents the adder bits and
can be 1, 2, 3, or 4 for the 4-bit adder.
• Cn-1 is the carry from the previous adder.
• Carries C1, C2, and C3 are generated
internally. C0 is an external carry input and C4
is an output.
The Look-Ahead Carry Adder
• The speed of an addition operation is limited by the
time required for the carries to propagate,
(or ripple, through all the stages of a parallel
adder.)
• look-ahead carry addition is one method to speeding
up the addition process by eliminating this ripple carry
delay.
• The look-ahead carry adder anticipates the output
carry of each stage.
• based on the inputs, produces the output carry by
either carry generation (Cg) or carry propagation (Cp).
• Carry generation occurs when an output carry
is produced (generated) internally by the full-
adder.
• A carry is generated only when both input bits
are 1s.
• The generated carry, Cg, is expressed as the
AND function of the two input bits, A and B.
• Cg= A.B
• The conditions for
• carry generation and
• carry propagation
are illustrated in Figure 6–15.
• The three arrowheads symbolize ripple
(propagation).
FIGURE Illustration of conditions for carry generation and carry
propagation
• The output carry of a full-adder can be expressed in
terms of both the generated carry (Cg) and the
propagated carry (Cp).
• The output carry (Cout) is a 1 if the generated carry is
a 1 OR if the propagated carry is a 1 AND the input
carry (Cin) is 1.
• That is we get an output carry of 1 if it is generated
by the full-adder (A = 1 AND B = 1) or if the adder
propagates the input carry (A = 1 OR B = 1) AND Cin =
1.
• Cout = 1 if Cg =1 {A = 1 AND B = 1 } or Cp = 1
This relationship is expressed as
• Cout = Cg.Cp.Cin Equation 6–7
• For each full-adder, the output carry is
dependent on the generated carry (Cg), the
propagated carry (Cp), and its input carry
(Cin).
• Now let’s see how this concept can be applied
to a parallel adder.
• Individual stages are shown in Figure for a 4-
bit example.
• The input carry to each stage is the output
carry of the previous stage.
• The Cg and Cp functions for each stage.
• And are immediately available as soon as the
input bits A and B and the input carry to the
LSB adder are applied.
• Because they are dependent only on these
bits.
FIGURE Carry generation and carry propagation in terms of the
input bits to a 4-bit adder.
Example: 4-bit full-adder stage.
Full-adder 1:
• Cout1 = Cg1 + Cp1.Cin1
Full-adder 2:
Cin2 = Cout1
• Cout2 = Cg2 + Cp2Cin2
• = Cg2 + Cp2Cout1
• = Cg2 + Cp2(Cg1 + Cp1.Cin1)
• = Cg2 + Cp2Cg1 + Cp2.Cp1.Cin1
Full-adder 3:
Cin3 = Cout2
• Cout3 = Cg3 + Cp3.Cin3
• = Cg3 + Cp3Cout2
• = Cg3 + Cp3(Cg2 + Cp2.Cg1 + Cp2.Cp1.Cin1)
• = Cg3 + Cp3.Cg2 + Cp3.Cp2.Cg1 + Cp3.Cp2.Cp1.Cin1
Full-adder 4:
Cin4 = Cout3
• Cout4 = Cg4 + Cp4.Cin4
= Cg4 + Cp4.Cout3
= Cg4 + Cp4(Cg3 + Cp3.Cg2 + Cp3.Cp2.Cg1 +
Cp3.Cp2.Cp1.Cin1)
= Cg4 + Cp4.Cg3 + Cp4.Cp3.Cg2 +
Cp4.Cp3.Cp2.Cg1
+ Cp4Cp3.Cp2.Cp1.Cin1
Note
• In each of these expressions, the output carry for
each full-adder stage is dependent only on the initial
input carry (Cin1),
• the Cg and Cp functions of that stage, and the Cg and
Cp functions of the preceding stages.
• Since each of the Cg and Cp functions can be
expressed in terms of the A and B inputs to the full-
adders, all the output carries are immediately
available (except for gate delays),
• and you do not have to wait for a carry to ripple
through all the stages before a final result is achieved.
• Thus, the look-ahead carry technique speeds
up the addition process.
• The Cout equations are implemented with
logic gates and connected to the full-adders
to create a 4-bit look-ahead carry adder, as
shown in Figure 6–17.
BCD Adder
• A BCD adder is used to perform the addition of
BCD numbers.
• four-bit binary represents a BCD digit.
• Ie., 0000, 0001, …… , 1001, the equivalent of
decimal numbers 0, 1, ….. , 9.
• When we add two BCD digits and we assume
that there is an input carry .
• The highest binary number we can get is the
equivalent of decimal number 19 (9+9+1).
• This binary number is going to be (10011)2.
• If we do BCD addition, we would expect the
answer to be (0001 1001)BCD.
• And if we restrict the output bits to the
minimum required, the answer in BCD would be
(11001)BCD.
• Table 7.1 lists the possible results in binary and
the expected results in BCD for a four-bit binary
adder to perform the addition of two BCD digits.
• The sum of the two BCD digits remains equal to
or less than 9, the four-bit adder produces the
correct BCD output.
• The binary sum and the BCD sum are the same up
to sum value 9 or less than 9.
• When the sum is greater than 9 that the two
results are different.
• It can also be seen from the table that, for a
decimal sum greater than 9 (or the equivalent
binary sum greater than 1001),
• if we add 0110 to the binary sum, we can get the
correct BCD sum and the desired carry output
• The Boolean expression that can apply the
necessary correction is written as
• C = K+Z3Z2+Z3Z1 ---------2.2
• Equation (2.2 )shows that the following
correction needs to be applied whenever
K = 1.
• This takes care of the last four entries.
• Also, a correction needs to be applied
whenever both Z3 and Z2 are ‘1’.
• This takes care of the next four entries from
the bottom, corresponding to a decimal sum
equal to 12, 13, 14 and 15.
• For the remaining two entries corresponding
to a decimal sum equal to 10 and 11, a
correction is applied for both Z3 and Z1, being
‘1’.
• While hardware-implementing, 0110 can be
added to the binary sum output with the help
of a second four-bit binary adder.
• The correction logic as dictated by the
Boolean expression (2.2) should ensure that
(0110) gets added only when the above
expression is satisfied.
• Otherwise, the sum output of the first binary
adder should be passed on as such to the final
output, which can be accomplished by adding
(0000) in the second adder.
• Figure 7.21 shows the logic arrangement of a
BCD adder capable of adding two BCD digits
with the help of two four-bit binary adders
and some additional combinational logic.
• This BCD adder can be used to add two single-
digit BCD numbers only.
• However, a cascade arrangement of single-
digit BCD adder can be used to perform the
addition of multiple-digit BCD numbers.
Example :
• For n-digit BCD adder would require n such
stages in cascade.
• As an illustration, Fig. 7.22 shows the block
diagram of a circuit for the addition of two
three-digit BCD numbers.
Three-digit BCD numbers
• The first BCD adder, labelled LSD (Least Significant Digit),
handles the least significant BCD digits.
• It produces the sum output (S3 S2 S1 S0), which is the BCD
code for the least significant digit of the sum.
• It also produces an output carry that is fed as an input
carry to the next higher adjacent BCD adder.
• This BCD adder produces the sum output (S7 S6 S5 S4),
which is the BCD code for the second digit of the sum, and
a carry output.
• This output carry serves as an input carry for the BCD
adder representing the most significant digits.
• The sum outputs (S11 S10 S9 S8) represent the BCD code for
the MSD of the sum.
Multiplexers (Data Selectors)
Example :
•octal-to-binary encoder.
•It have eight input lines, each representing
an octal digit, and
•three output lines representing the three-
bit binary equivalent.
The truth table for encoder is shown
In the truth table,
• D0 to D7 represent octal digits 0 to 7.
• A, B and C represent the binary digits.
Table 8.8 Truth table of an
encoder
INPUTS OUTPUTS
D0 D1 D2 D3 D4 D5 D6 D7 A B C
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
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 1 0
0 0 0 0 0 0 0 1 1 1 1
Encoders Hardware
Implementation
•Figure below shows the hardware
implementation of the octal-to-binary encoder
described by the truth table in above Table 8.8.
INPUTS OUTPUTS
D0 D1 D2 D3 D4 D5 D6 D7 A B C
1 0 0 0 0 0 0 0 0 0 0
X 1 0 0 0 0 0 0 0 0 1
X X 1 0 0 0 0 0 0 1 0
X X X 1 0 0 0 0 0 1 1
X X X X 1 0 0 0 1 0 0
X X X X X 1 0 0 1 0 1
X X X X X X 1 0 1 1 0
X X X X X X X 1 1 1 1
Figure 10-line decimal to four-line
BCD priority encoder
output : low level input : low
level
10-line decimal to four-line BCD priority
encoder
INPUTS OUTPUTS
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D C B A
X X X X X X X X X 0 0 1 1 0
X X X X X X X X 0 1 0 1 1 1
X X X X X X X 0 1 1 1 0 0 0
X X X X X X 0 1 1 1 1 0 0 1
X X X X X 0 1 1 1 1 0 1 1 0
X X X X 0 1 1 1 1 1 1 0 1 1
X X X 0 1 1 1 1 1 1 1 1 0 0
X X 0 1 1 1 1 1 1 1 1 1 0 1
X 0 1 1 1 1 1 1 1 1 1 1 1 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1
Decoders
Seven segment
Truth Table for a 7-segment display
× × × × × × 0
× × 1
× × × × × 2
× × × × × 3
× × × × 4
× × × × × 5
× × × × × × 6
× × × 7
Individual Segments
Display
a b c d e f g
× × × × × × × 8
× × × × × × 9
× × × × × × A
× × × × × b
× × × × C
× × × × × d
× × × × × E
× × × × F
Seven segment
Seven segment
• Note –
• For Common Anode type seven segment LED display, we
only have to interchange all ‘0s’ and ‘1s’ in the output
side i.e., (for a, b, c, d, e, f, and g replace all ‘1’ by ‘0’ and
vice versa) and solve using K-map.
• Output for first combination of inputs (A, B, C and D) in
Truth Table corresponds to ‘0’ and last combination
corresponds to ‘9’. Similarly rest corresponds from 2 to 8
from top to bottom.
• BCD numbers only range from 0 to 9,thus rest inputs
from 10-F are invalid inputs.
• Common Cathode and Common Anode Format
Seven segment K-Maps:
#for a:
Seven segment
• #for b:
• #for c:
• #for d:
• #for e:
• #for f:
• #for g:
• Display Decoder Example
Parity Generator And Parity Checker Circuits
• From the above parity checker truth table, the simplified expression of the parity bit can be written as
From the above parity checker truth table, the simplified expression of the parity bit
can be written as
Parity Generator And Parity Checker Circuits
• To generate the even parity bit for a 4-bit data, three
Ex-OR gates are required to add the 4-bits and their
sum will be the parity bit.
Parity Generator And Parity Checker Circuits