Module 5 - Combinational Logic Digital Arithmetic Circuits

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Digital Electronics 1 1

The addition of two numbers is the most important arithmetical operation in


a digital system since it becomes the basis of other arithmetical operations such as
multiplication and subtraction. When more than two numbers are to be manipulated,
the operation is broken down into many steps, each of which works with only two
numbers at a time. The addition of numbers in the binary system involves similar
steps to those used in a normal decimal system. When two digits are added, there
is a sum digit as well as a carry digit. For example, in the sum of 7 and 8, we get 15
in which the 1 represents the carry digit and 5 the sum digit.

A logic circuit with two inputs X and Y (the digits to be added) and two
outputs C (for carry) and S (for sum) can be designed by viewing the latter
table shown below as two truth tables, one for carry and the other for sum.
Such a circuit is known as a half adder.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 2

The simplified Boolean functions for the two outputs can be obtained directly
from the truth table. The simplified sum of the products expressions is:

Sum = x' y + xy' = x  y


Carry = xy

A full adder is a combinational circuit that forms the arithmetic sum of three
input bits.
It consists of three inputs and two outputs.
Two of the input variables, denoted by X and Y, represent the two
significant bits to be added. The third input, Cin, represents the carry from
the previous lower significant position.
Two outputs are necessary because the arithmetic sum of three binary
digits ranges in value from 0 to 3, and binary 2 or 3 needs two digits.

=
=
=

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 3

=
=
=

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 4

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 5

Subtractors
The subtraction of two binary numbers may be accomplished by taking the
complement of the subtrahend and adding it to the minuend.
By this method, the subtraction operation becomes an addition operation
requiring full adders for its machine implementation.
It is possible to implement subtraction with logic circuits in a direct manner,
as done with paper and pencil.
By this method, each subtrahend bit of the number is subtracted from its
corresponding significant minuend bit to form a difference bit.
Just as there are half- and full-adders, there are half- and full-subtractors.

Half-subtractor
It is a combinational circuit that subtracts two bits and produces their
difference.
It also has an output to specify if a 1 has been borrowed.
The truth table for the input-output relationship of a half-subtractor can now
be derived as follows:

Inputs Outputs
x y Diff Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

The Boolean functions for the two outputs of the half-subtractor are
derived directly form the truth table
Diff = x' y + xy' = x  y
Borrow = x' y

Note: It is interesting to note that the logic for Diff is exactly the same as logic for
output Sum in the half-adder.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 6

Full-Subtractor
It is a combinational circuit that performs a subtraction between two bits,
taking into account that a 1 may have been borrowed by a lower significant
stage.
This circuit has three inputs and two outputs.
The truth table for the circuit is as follows:
Inputs Outputs
Previous
x y Borrow(Bin) Diff Borrow
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
The Boolean functions for the two outputs of the full-subtractor are derived
directly form the truth table
For Difference
Diff = x' yBin + xy' Bin'+ x' y' Bin + xyBin
Diff = ( x' y + xy' ) Bin'+ ( x' y'+ xy ) Bin
Diff = ( x  y ) Bin'+ ( x  y )' Bin
Diff = ( x  y )  Bin
For Borrow
Borrow = x' y' Bin + xyBin + x' yBin + x' yBin'
Borrow = ( x' y'+ xy ) Bin + x' y( Bin + Bin' )
Borrow = ( x  y )' Bin + x' y

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 7

Again, we note that the logic function for output Diff in the full-subtractor is
exactly the same as output Sum in the full-adder.
Moreover, the output Borrow resembles the function for C in the full-adder,
except that the input variable x is complemented.
Because of these similarities, it is possible to convert a full-adder into a full-
subtractor by merely complementing input x prior to its application to the
gates that form the carry output.

Code Conversion
The availability of a large variety of codes for the same discrete elements of
information results in the use of different codes by different digital systems.
It is sometimes necessary to use the output of one system as the input to
another.
A conversion circuit must be inserted bet two systems if each uses different
codes for the same information.
Thus, a code converter is a circuit that makes the two systems compatible
even though each uses a different binary code.
A combinational circuit performs this transformation by means of logic gates.

Example: Conversion of codes from BCD to the excess-3 code.

Step 1: Build truth table to show the relationship between input and output.

Input Output
BCD Excess-3 code
A B C D w x y z
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 8

Step 2: Derive (simplified) Boolean expression.


Using K-Map
CD CD
AB 00 01 11 10 AB 00 01 11 10
00 1 1 00 1 1
01 1 1 01 1 1
11 x x x x 11 x x x x
10 1 x x 10 1 x x

z = D' y = CD + C' D' = CD + (C + D)'

CD CD
AB 00 01 11 10 AB 00 01 11 10
00 1 1 1 00
01 1 01 1 1 1
11 x x x x 11 x x x x
10 1 x x 10 1 1 x x

x = B' C + B' D + BC ' D' w = A + BC + BD


x = B' (C + D) + B(C + D)' w = A + B (C + D )
Step 3: Transform Boolean expression into logic circuit.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 9

Introduction
Medium Scale Integration (MSI) devices perform specific digital functions
commonly employed in the design of digital computer systems.
The selection of MSI components in preference to Small Scale Integration
(SSI) gates is extremely important, since it would invariably result in a
considerable reduction of IC packages and interconnecting wires.
Familiarity with available MSI functions is very important not only in design
of combinational circuits, but also in the design of more complicated digital
computer systems.
Occasionally one finds MSI and Large Scale Integration (LSI) circuits that
can be applied directly to design and implementation of any combinational
circuit.
The use of logic packages speeds up the design procedure and also
minimizes the physical sizes of the networks.
Some examples of the logic packages are decoders, encoders,
demultiplexer, multiplexer, ROMs, RAMs, and programmable logic arrays.

Binary Parallel Adder


It is a digital function that produces the arithmetic sum of two binary numbers
in parallel.
It consists of full-adders connected in cascade, with the output carry from
one full adder connected to the input carry of the next full-adder.
Two binary numbers of n bits each can be added by means of this circuit.
To demonstrate with a specific example, consider two binary numbers;
A = 1011
B = 0011
Sum = 1110
4 3 2 1
Input Carry (Cin) 0 1 1 0
Augend (A) 1 0 1 1
Addend (B) 0 0 1 1
Sum 1 1 1 0
Output Carry (Cout) 0 0 1 1

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 10

The interconnection of four full-adder circuits to provide a 4-bit binary


parallel adder.
B4 A4 B3 A3 B2 A2 B1 A1

Cin4 = Cout3 Cin3 = Cout2 Cin2 = Cout1


Cout4 Cin1
FA FA FA FA

S4 S3 S2 S1

The 4-bit parallel adder is a typical example of an MSI function. It can be


used in many applications involving arithmetic operations.

An example of a 4-bit full-adder is the TTL type 74283 or 7483 IC.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 11

Example: Design a BCD-to-Excess-3 code converter (Using MSI devices)


Step 1: Build truth table to show the relationship between input and output.
Input Output
BCD Excess-3 code
A4 A3 A2 A1 S4 S3 S2 S1
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
Step 2: Inspection of the truth table immediately reveals that excess-3 equivalent
code can be obtained from the BCD code by the addition of binary of 0011.
Recall:
Excess-3 Code
This is an unweighted code and its code assignment is obtained from the
corresponding value of BCD after the addition of 3.
Excess-3 Code = BCD + 3
Example:
BCD: 0000 0001 0010 …… 1001
+3 : 0011 0011 0011 …… 0011
Sum: 0011 0100 0101 …… 1100

Step 3: The addition of 3 to BCD can be implemented by means of a 4-bit full-adder


MSI circuit. The BCD digit is applied to inputs A. Inputs B are set to a constant 0011.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 12

BDC Adder
It is a circuit that adds two BCD digits in parallel and produces a sum digit
also in BCD.
A BCD Adder must include the correction logic in its internal construction.
➢ In examining the contents of the table below, it is apparent that when the binary sum is equal
to or less than 1001, the corresponding BCD number is identical, and therefore no
conversion is needed.
➢ When the binary sum is greater than 1001, we obtain a nonvalid BCD representation.
➢ The addition of binary 6 (0110) to binary sum converts it to the correct BCD representation
and also produces an output carry as required.
➢ The logic circuit that detects that detects the necessary correction can be derived from the
table entries (use tabulation method to derive the equation).
➢ The condition for a correction and an output carry can be expressed by Boolean function:
C = K + Z8 Z4 + Z8 Z 2
➢ When C=1, it is necessary to add 0110 to the binary sum and provide an output carry for the
next stage.
The two decimal digits, together with the input carry, are first added in the
top 4-bit binary adder to produce the binary sum.
Truth Table
Binary Sum BDC sum Decimal
K Z8 Z4 Z2 Z1 C S8 S4 S2 S1
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 2
0 0 0 1 1 0 0 0 1 1 3
0 0 1 0 0 0 0 1 0 0 4
0 0 1 0 1 0 0 1 0 1 5
0 0 1 1 0 0 0 1 1 0 6
0 0 1 1 1 0 0 1 1 1 7
0 1 0 0 0 0 1 0 0 0 8
0 1 0 0 1 0 1 0 0 1 9
0 1 0 1 0 1 0 0 0 0 10
0 1 0 1 1 1 0 0 0 1 11
0 1 1 0 0 1 0 0 1 0 12
0 1 1 0 1 1 0 0 1 1 13
0 1 1 1 0 1 0 1 0 0 14
0 1 1 1 1 1 0 1 0 1 15
1 0 0 0 0 1 0 1 1 0 16
1 0 0 0 1 1 0 1 1 1 17
1 0 0 1 0 1 1 0 0 0 18
1 0 0 1 1 1 1 0 0 1 19

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 13

The Block diagram of a BCD adder:

A decimal parallel adder that adds n decimal digits needs n BCD adder
stages. The output carry from one stage must be connected to the input
carry of the next higher-order stage.

Note: TTL IC type 82S83 is a BCD Adder.

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 14

MAGNITUDE COMPARATOR

It is a combinational circuit that compares two numbers, A and B, and


determines their relative magnitudes.
The outcome of the comparison is specified by three binary variables that
indicate whether A > B, A = B, or A < B.
Consider two numbers, A and B, with four digits each.
A = A3 A2 A1 A0
B = B3 B2 B1 B0
(A = B)
Two numbers are equal if all pairs of significant digits are equal.
When the numbers are binary, the digits are either 1 or 0 and the equality
relation of each pair of bits can be expressed logically with an equivalence
function:

xi = Ai Bi + Ai ' Bi ' = ( Ai ' Bi + Ai Bi ' )' i = 0,1,2,3

where xi = 1 only if the pair of bits in position i are equal, i.e., if both are 1’s
or both are 0’s.

For the equality condition to exist, all xi variables must be equal to


This dictates an AND operation of all variables:

( A = B) = x3 x2 x1 x0

(A > B) and (A < B)


To determine if A is greater than or less than B, we inspect the relative
magnitudes of pairs of significant digits starting from the most significant
position.
If the two digits are equal, we compare the next lower significant pair of
digits.
This comparison continues until a pair of unequal digits is reached.
The sequential comparison can be expressed logically by the following
two Boolean functions:

( A  B ) = A3 B3 '+ x 3 A2 B2 '+ x 3 x 2 A1 B1 '+ x 3 x 2 x1 A0 B0 '


( A  B ) = A3 ' B3 + x 3 A2 ' B2 + x3 x2 A1 ' B1 + x 3 x2 x1 A0 ' B0

Prepared By: Engr. Mark Anthony C. Aseoche


Digital Electronics 1 15

The logic diagram of the 4-bit magnitude comparator:

Note: TTL type 7485 is a 4-bit magnitude comparator. It has more inputs for
connecting comparators in cascade.

Prepared By: Engr. Mark Anthony C. Aseoche

You might also like