Ch6 Functions of Combinational Logic
Ch6 Functions of Combinational Logic
Chapter 6
The Half-Adder
Basic rules of binary addition are performed by a half adder, which has two
binary inputs (A and B) and two binary outputs (Carry out and Sum). The inputs
and outputs can be summarized on a truth table.
INPUTS OUTPUTS
A B ∑ Cout
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Where:
Observe that:
The sum output (∑) is a 1 only if the input variables, A and B, are not equal.
The sum can therefore be expressed as the exclusive–OR of the input
variables.
∑=A+B
The output carry (Cout) is a 1 only when both A and B are 1s. Thus Cout can
be expressed as the AND of the two input variables.
Cout = AB
Page 1
Logic Circuit and Switching Design
The Full-Adder
By contrast, a full adder has three binary inputs (A, B, and Carry in) and two
binary outputs (Carry out and Sum). The truth table summarizes the operation.
INPUTS OUTPUTS
A B Cin ∑ 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
Page 2
Logic Circuit and Switching Design
Notice that there are two half-adders connected with their output carries ORed.
The equation of the sum (∑) output of the full adder is:
∑ = (A + B) + Cin
The equation of the final output carry Cout of the full adder is:
Cout = AB + (A + B) Cin
Two or more full-adders are connected to form binary adders. To add two binary
numbers, a full-adder is required for each bit in the number. So for 2-bit
numbers, two adders are needed, for 4-bit numbers, four adders are used, and so
on.
The carry output of each adder is connected to the carry input of the next higher-
order adder as shown below:
Page 3
Logic Circuit and Switching Design
Notice that:
Either a half-adder can be used for the least significant position or the
carry input (Cin) of a full-adder can be made 0 (grounded) because there is
no carry input to the least significant bit (LSB) position.
The LSB of the two numbers are represented by A1 and B1. The next higher-
order bits are represented by A2 and B2.The three sum bits are ∑1, ∑2, and
∑3. The output carry from the left-most full-adder becomes the MSB in the
sum, ∑3.
Example: Determine the sum generated by the 3-bit parallel adder shown below.
Show the intermediate carries when the binary numbers A = 101 and B = 011 are
being added.
Page 4
Logic Circuit and Switching Design
Solution:
The LSBs of the two numbers are added in the right-most full-adder, and
the MSBs are added in the left-most full-adder.
The sum bits and the intermediate carries are indicated in the above figure.
A basic 4-bit parallel adder is implemented with four full-adder stages as shown
below:
The truth table for each stage for of a 4-bit parallel adder is shown below. The
subscript n represents the adder bits and can be 1, 2, 3, or 4. C n-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 external carry output.
Cn-1 An Bn ∑n Cn
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
Page 5
Logic Circuit and Switching Design
Example: Use the above truth table to find the sum and the output carry for the
addition of the following two 4-bit numbers if the input carry (cn -1) is 0:
A4A3A2A1 = 1100 and B4B3B2B1 = 1100
Solution: For n=1 : A1 = 0, B1 = 0, and cn -1= 0. From the 1st row of the table,
∑1 = 0 and C1 = 0
For n=2 : A2 = 0, B2 = 0, and cn -1= 0. From the 1st row of the table,
∑2 = 0 and C2 = 0
For n=3 : A3 = 1, B3 = 1, and cn -1= 0. From the 4th row of the table,
∑3 = 0 and C3 = 1
For n=4 : A4 = 1, B4 = 1, and cn -1= 1. From the last row of the table,
∑4 = 1 and C4 = 1
C4 becomes the output carry; the sum of 1100 and 1100 is 11000
Note:
The output carry (C4) is not ready until it propagates through all of the full adders.
This is called ripple carry, which results in delaying the addition process. The
74LS283 is an example of a 4-bit parallel adder that is available in IC form. It
features look-ahead carry, which adds logic to minimize the output carry delay.
Page 6
Logic Circuit and Switching Design
The carry propagation delay for each full-adder is the time from the application
of the input carry, until the output carry occurs. The input carry to the least
significant stage has to ripple through all adders before a final sum is produced.
The cumulative delay through all adder stages is a “worst-case” addition time. If
two numbers are added such that no carries (0) occur between stages, the
addition time is simply the propagation time through a single full-adder; however,
worst-case addition time must always assumed.
Page 7
Logic Circuit and Switching Design
Carry generation: occurs when an output carry is produces internally by the full-
adder. A carry generated only when both inputs are 1s.The generated carry, Cg, is
expressed as the AND function of the two input bits, A and B.
Cg= AB
Carry propagation: occurs when the input carry is rippled to become the output
carry. An output carry may be propagated by the full-adder when either or both
of the input bits are 1s.The propagated carry, Cp, is expressed as the OR function
of the input bits.
Cp = A + B
The conditions for carry generation and carry propagation are illustrated in the
figure below:
The output carry of a full-adder (Cout) can be expressed in terms of both (Cg) and
(Cp) as follows: Cout = Cg + Cp Cin
Page 8
Logic Circuit and Switching Design
For a 4-bit parallel adder, 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 Cg and Cp functions can be expressed in terms of the A and B inputs
to the full-adder, 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 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 below:
Page 9
Logic Circuit and Switching Design
Comparators
Equality
In the simplest form, a comparator can test for equality using XNOR gates.
Example: Apply each of the following sets of binary numbers to the comparator
inputs shown below, and determine the output by following the logic levels
through the circuit. (a) 10 and 10 (b) 11 and 10
Inequality
Page 10
Logic Circuit and Switching Design
3. If A3 = B3 , then you must examine the next lower bit position for an
inequality.
Example: Determine the A=B , A>B, and A<B outputs for the input numbers
shown on the comparator below:
Solution: The number on the A input is 0110 and the number on the B input is
0011. The A>B output is HIGH and the other outputs are LOW.
Page 11
Logic Circuit and Switching Design
Decoders
The logic equation for the decoder is developed, as illustrated in part (b). If a
NAND gate is used in place of the AND gate, an active LOW output will indicate
the presence of the proper binary code.
Example: Determine the logic required to decode the binary number 1011 by
producing a HIGH level on the output.
X = A 3 A 2’ A 1 A 0
Page 12
Logic Circuit and Switching Design
In order to decode all possible combinations of four bits, sixteen decoding gates
are required (24=16). A logic symbol for a 4-line-to-16-line (1-of-16) decoder with
active-LOW output is shown below:
The BIN/DEC label indicates that the binary input makes the corresponding
decimal output active. The input labels 8, 4, 2, and 1represent the binary weights
of the input bits (23 22 21 20). The integrated circuit 74HC154 is a good example of
(1-of-16) IC decoder.
The 74HC42 is a BCD-to-decimal decoder, in which only ten decoding gates are
required because the BCD code represents only the ten decimal digits from 0 to 9.
The logic symbol of the 74HC42 with four BCD inputs and ten active-LOW decimal
outputs (1-of-10) are shown below.
Page 13
Logic Circuit and Switching Design
The 74LS47 is a BCD-to-7-segment decoder that accepts the BCD code on its
inputs and provides outputs to drive 7-segment display devices to produce a
decimal readout. The logic symbol and the pin diagram are shown below:
In addition to its decoding and segment drive capability, the74LS47 has lamp test
and zero suppression capability. These features are indicated by LT’ (lamp test),
RBI’ (ripple blanking input), and BI’/RBO’ (blanking input/ripple blanking output)
functions.
Lamp test: is used to verify that no segments are burned out. By applying a LOW
to LT’ and a HIGH to BI’/RBO’, all of the seven segments in the display are turned
on.
Page 14
Logic Circuit and Switching Design
Encoders
Decimal-to-BCD Encoder
This type of encoder has ten inputs, one for each decimal digit, and four outputs
corresponding to the BCD code, this is a basic 10-lines-to-4-lines encoder, as
illustrated below:
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
Page 15
Logic Circuit and Switching Design
From this table you can determine the following logic expressions:
The encoder logic diagram resulting from these expressions is shown below:
The basic operation of this circuit is when a HIGH appears on one of the decimal
digit input lines, the appropriate levels occur on the four BCD output lines.
Page 16
Logic Circuit and Switching Design
The basic MUX has several data-input lines and a single output line. It also has
data-select inputs, which permit digital data on any one of the inputs to be
switched to the output line. A logic symbol for a 4-input MUX is shown below:
Notice that there are two data-select lines because with two select bits, any one
of the four data input lines can be selected, as indicted in the following table:
Data-Select
Inputs Selected Inputs
S1 S0
0 0 D0
Page 17
Logic Circuit and Switching Design
0 1 D1
1 0 D2
1 1 D3
The logic expression for the output in terms of the data and select inputs is as
follows:
The implementation of this equation requires four 3-input AND gates, one
4-input OR gate, and two inverters, as shown below:
Example: Use 74LS151s and any other logic necessary to multiplex 16 data-
input lines onto a single data-output line.
Solution:
Page 18
Logic Circuit and Switching Design
The Enable’ input is used as the select MSB bit. When Enable’ is active
(LOW), the left 74LS151 is enabled, and one of the data inputs (D0 through
D7) is selected by the other three data-select bits (S0 through S2). When
Enable’ is HIGH, the right 74LS151 is enabled, and one of the data inputs
(D8 through D15) is selected. The selected input data are then passed
through to the negative-OR gate and onto the single output line.
Demultiplexers (DEMUX)
A DEMUX basically reverses the MUX function. It takes digital information from
one line and distributes it to a given number of output lines. For this reason, the
DEMUX is also known as a data distributer.
The figure below shows a 1-line-to-4-line DEMUX. The data-input line goes to
“all” of the AND gates. The two data-selector lines enable only “one” gate at a
time, and the data appearing on the data-input line will pass through the
selected gate to the associated data-output line.
Page 19
Logic Circuit and Switching Design
Page 20
Logic Circuit and Switching Design
Page 21