Vous êtes sur la page 1sur 50

DIGITAL LOGIC DESIGN

(DLD)

Lecture # 10

BASIC COMBINATIONAL LOGIC CIRCUITS

AND-OR logic
AND-OR

logic
SOP

produces an
expression.
In general, an ANDOR circuit can have
any number of AND
gates each with any
number of inputs.

A
B
C
D

AB

SOP
X=AB+CD

CD

inputs

A
B
C
D

AB
X=AB+CD
CD

AB

CD

o/p

AND-OR-Invert
A

logic
AB

B
X=AB+CD
C
D

AB+CD
CD

POS
X ( A B )(C D )

Exclusive-OR
Inputs

logic

X A B

X A B AB
or

X AB A B

A
X AB A B

XOR

BASIC COMBINATIONAL LOGIC CIRCUITS

Exclusive-NOR

logic

X ( AB )( A B ) ( A B )( A B ) A B AB

X AB A B

XOR

A
X
B

X A B

AB

B
X
AB

IMPLEMENTING COMBINATIONAL LOGIC

Boolean expression
logic circuit

For
every
Boolean
expression there is a logic
circuit, and for every logic
circuit there is a Boolean
expression

X AB CDE
X AB(CD EF )

Truth

If

expression, you can write the SOP

expression from the truth table and
then implement the logic circuit.
Remember?

SOP

implementation.

AND-OR

IMPLEMENTATION

UNIVERSAL GATES

UNIVERSAL GATES

We

Lets

There

0 + 0 =0
0+1=1
1+0=1
1 + 1 = 10

PROBLEM ANALYSIS

Notice that one of the combinations of two single

digit additions is a double digit number, created
by
1 + 1 = 10

carry:

STANDARDIZED OUTPUT
Well

use leading zeros in order to produce a standard

output:
0

00

(0

plus

equals

0)

01

(0

plus

equals

1)

01

(1

plus

equals

1)

1 + 1 = 10 (1 + 1 equals 10)
Notice

the output in standardized form, we can stipulate the

behavior of both outputs given any combination of two
inputs with the following truth table

TWO 1-BIT NUMBERS
INPUTS

OUTPUTS

INPUTS

OUTPUTS

Notice

the

from

Its

Q=AB

the
an

truth
AND!:

INPUTS
A

OUTPUTS
Q

What

the R column?
R

TABLE

high.

What expression can we use to prove this

statement?
R = (~A B) + (A ~B)

CIRCUIT DIAGRAM
Q = (~A B) + (A ~B)

A
Q
B

A SHORT CUT
The

so common in circuit design that it has a special

name. It is called an Exclusive Or. It is usually
labeled XOR or drawn as a plus sign with a circle
around it.
From

statement: Our adding circuit should consist of an

XOR gate (for R output, the Sum line) and an AND
gate (for Q output, the Carry line).

MORE ON XOR
We

AND and OR.
Although

derived gate.
We

However, engineers use the XOR so often theyve

given XOR its own symbol

XOR SYMBOL
The

A
Q
B

Q = A+ B

INPUTS
A

OUTPUTS
Q

AB

A+ B

The XOR circuit delivers the

Sum Line (R) of adding two
single digits.

Carry Line (Q).

Weve

just

created

single bit numbers.

A

RSUM

QCARRY

BUILDING BLOCK
The

might think. It operates as the key component in a

divide-and-conquer approach to adding n digits.
How

in realizing that three single digit numbers could

be added two at a time:

Then, add the result of this sum to the third number using another

Lets

We need 3 input lines, one for each number.

Two input lines feed into the first half adder; the third input
line functions as a carry-in line.

The second half-adder has two input lines: the output sum
from the first half-adder, plus the third, carry-in input line.

The

INPUTS

OUTPUTS

CIN

QCARRY

RSUM

RSUM

B
QCARRY
CIN

The full adder is usually drawn in a shorthand

notation:

A
B
C

IN

QCARRY

FULL

RSUM

Do you see any patterns between the output lines and the input
lines?

If you look at the truth table, you can see that the QCARRY
output line is true if and only if exactly two or three input lines
are high.

Also, the RSUM output line is high when the XOR of A and (the
sum of Input B and CIN) is high? In other words, add the Input
B and CIN values together, as though you were putting them
through a half adder. Take the result, and XOR it with the
value of the A input line. The result is the value for the RSUM
output line

By connecting two half-adders together, we can

add 3 single digit binary numbers

It shouldnt come as a surprise to learn that by

stringing even more half-adders together, we can
add even more single digit numbers

The

First,

be N + 1 bits
This

its

Here

the sum
The

The

At

GETTING REAL
The

arithmetic logic unit uses Adder circuitry to

perform fundamental arithmetic operations.
By

connecting half adders to make a full

now can work our way to simple addition.
Other

operations are a variation on this

fundamental capability

HOW TO SUBTRACT

What other arithmetic operations do we need to be able to

perform with circuits?

We could come up with a separate subtraction circuit,

and some clever scheme of knowing which circuit to
activate based on what kind of math problem we
encountered

It turns out that the solution is more elegant -- it uses

the approach we have seen repeatedly: turn a new
problem into a problem we have already solved

What

numbers
Lets

3,

or,

put

another

way:

5 + (-2) = 3
Now,

we

have

an

problem,

of

subtraction. This means our existing circuit will work we

could unlock how to represent negative numbers, like -2.

TWOS COMPLEMENT
Remember

numbers

using

scheme

called

Twos

Complement.
In

number,

you

take

its

positive

value,

The

complement form.

1.

Convert each number from Base-10 to its

Base-10 format (well use four-bit numbers);
for negative values, convert their absolute
value:
510 = 01012
|-210| = 00102

2.

Complement the negative value, changing all

1s to 0s and all 0s to 1s. The result is called a
Ones
00102 11012

Complement:

3.

Add 1 to the Ones Complement. The result is

your original negative number in Twos
Complement
-210 00102 11012 + 12 = 11102

form:

PROBLEM SOLUTION

Then, we add the first number of our problem (510

or 01012) to this twos complemented number:
01012 + 11102 = 100112

is

correct:

00112 = 310

Is that legal? Why or why not? We are restricting

ourselves here to 2, 4-bit numbers. We can choose to
simply ignore the carry line (the 5 th bit).

Can

Lets

The

We

took the ones complement, then added

one to get the final twos complement.

COMPLEMENT
How

would we take ones complement?

A NOT gate would work here. Any number you put in, the
NOT gate would reverse

The

Now

PRETTY CLOSE
This

is pretty close to how subtraction is actually

performed in a computer.
There

circuit design
The

second step of twos complement requires you

However, do you remember how we built our multibit adder by stringing together multiple adders?

SUMMARY OF SUBTRACTORS
Represent

We

Complement.
Once

we have converted the subtraction problem

from a half-adder consisting of an And and an
XOR gate.

By

the following rule applies for performing

the arithmetic operation of subtraction:
X Y can be computed by adding the
negative of Y to X using addition circuitry
designed

for

positive

numbers,

and