You are on page 1of 28

Digital Logic Design

Functions of Combinational
Logic

CHAPTER 6
Content

Adders
Comparators
The Half-Adder

The half-adder accepts two binary digits on its


inputs and produces two binary digits as its
output (a sum bit and a carry bit)
Inputs Outputs
A B Cout S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
half-adder logic symbol
The Full-Adder
The full-adder accepts two inputs bits and a carry at the
input and generates two outputs (a sum and a carry)

Inputs Outputs
A B Cin Cout 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
The full adder with three binary inputs (A, B, and Carry in)
and two binary outputs (Carry out and Sum).

full-adder logic symbol


Full-adder from half-adder
Example
S S 0 Sum
S 1 S
For the given inputs, 1 A A

determine the intermediate 0 B Cout 0 B Cout 1


and final outputs of the full 1 Cout
adder. 1

The first half-adder has inputs of 1 and 0; therefore


the Sum =1 and the Carry out = 0.
The second half-adder has inputs of 1 and 1;
therefore the Sum = 0 and the Carry out = 1.
The OR gate has inputs of 1 and 0, therefore the
final carry out = 1.
Notice

The result from the previous example can be read


directly on the truth table for a full adder.
S 1 S 0 Sum
Inputs Outputs 1 A S A S

A B Cin Cout S
0 1
0 0 0 0 0 0 B Cout B Cout
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0 1
Cout
1 0 0 0 1
1 0 1 1 0 1
1 1 0 1 0
1 1 1 1 1
Position Value : 2 1
Parallel Carry : 1 0 Ci

Binary Number A : 1 1 Ai

Adder Number B : 1 1 Bi
--------------------------------------
Sum : 1 1 0 Si
i = positional value

FA-2 FA-1
Example 3-bit parallel adder

101 + 011
Parallel Adders
Full adders are combined into parallel adders that can
add binary numbers with multiple bits.
A 4-bit adder is shown.
A4 B4 A3 B3 A2 B 2 A1 B1

C0

A B Cin A B Cin A B Cin A B Cin

Cout S Cout S Cout S Cout S

C4
C3 C2 C1
S4 S3 S2 S1
The output carry (C4) is not ready until it propagates
through all of the full adders. This is called ripple carry,
delaying the addition process.
Truth table
Parallel Adders

The logic symbol for a 4-bit parallel adder is shown.


This 4-bit adder includes a carry in (labeled (C0) and a
Carry out (labeled C4). S
1 1
Binary 2 2 4-bit
number A 3 3 sum
4 4
1
Binary 2
number B 3
4
Input Output
C0 C4
carry carry

The 74LS283 is an example. It features look-ahead carry, which


adds logic to minimize the output carry delay. For the 74LS283,
the maximum delay to the output carry is 17 ns.
4-bit parallel adder in IC form
Example

8-bit parallel adder 1011 1001


1001 1110 +
using 4-bit parallel
adder -------------------
- A to A
5 8
1 0101 0111
A 1 to A 4

B 1 to B 4 B 5 to B 8
Reminder

Level of Integration

Small-scale integration (SSI): contains fewer than 10 gates


in one IC.

Medium-scale integration (MSI): contains approximately 10


to 1,000 gates in a single IC. Such as decoders, adders and
multiplexers, etc.

Large Scale Integration (LSI): contains thousands of gates in


a single IC. Such as processors, memory chips and
programmable logic devices, etc.

Very Large Scale Integration (VLSI): contains hundred of


thousands of gates within a single packages. Large memory
arrays and complex microcomputer chips, etc.
Comparators

Equality/inequality can be tested by XOR


2-bit comparator
The function of a comparator is to compare the
magnitudes of two binary numbers to determine the
relationship between them.
In the simplest form, a comparator can test for
equality using XNOR gates.
Example
Example

To test two 4-bit numbers for equality?


We can AND the outputs of four XNOR gates.

A1
B1

A2
B2
Output
A3
B3

A4
B4
IC comparators
They provide outputs to indicate which of the numbers is larger or
if they are equal. The bits are numbered starting at 0, rather than 1
as in the case of adders. Cascading inputs are provided to expand
the comparator to larger numbers.

COMP
A0 0
A1 A
A2
A3 3
A>B A>B
Cascading
A=B A=B Outputs
inputs
A<B A<B
B0 0
B1 A The IC shown is the
B2 4-bit 74LS85.
B3 3
Example

Outputs
1

0
The 74HC85 4-bit magnitude comparator

[74HC85]
Example : 8-bit comparator using 74HC85
Logic diagram (FYI)

You might also like