Topic 2_1 Digital Logic

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

CSC401

p
Fundamentals of Computer Science

Topic 2: Digital Logic


1
Objectives
y Understand the relationship between Boolean
logic and digital computer circuits.
y Learn how to design
g simple
p logic
g circuits.
y Understand how digital circuits work together to
form complex computer systems
systems.
Outline
y Transistors
y Boolean Algebra
y Logic Gates
y Digital Components
y Combinational Circuits
2.1 Transistors

y Integrated Circuits (IC) is the building blocks of computers


y Designed for specialized functions
y Examples: the CPU, bus interface, memory management unit
y Transistors: primary components off ICs
y Motorola MPC 7400 PowerPC modules: 6.5 million transistors
in less than ½ in2
2.1 Transistors

y Microprocessors contain millions of transistors


y IIntel
t l Pentium
P ti 4 (2000):
(2000) 48 million
illi
y IBM PowerPC 750FX (2002): 38 million
y IBM/Apple PowerPC G5 (2003): 58 million

y Logically, each transistor acts as a switch


y Combined to implement logic functions
y AND, OR, NOT
y Combined to build higher-level structures
y Adder, multiplexer, decoder, register, …
y Combined to build processor
y LC
LC-33

3-5
2.1 Transistors

y Boolean algebra:
g basis for computer
p logic
g
design
y Transistors: means for implementing Boolean
algebra
y Switches: on/off to represent the 0’s and 1’s
of binary digital circuits
y Combined to form logic gates
2.2 Boolean Algebra

y George
g Boole developed
p ‘Boolean Algebra’
g
(details later) Æ it’s applied in the design and
analysis of digital systems.
y Boolean algebra is a mathematical system for the
manipulation of variables that can have one of
two values.
y In formal logic,
logic these values
alues are “true”
true and “false
false.”
y In digital systems, these values are “on” and “off,” 1 and 0, or
“high” and “low.”
y Boolean expressions are created by performing
operations on Boolean variables.
y Common Boolean operators include AND, OR, and NOT.

7
2.2 Boolean Algebra

y A Boolean operator can be completely


described using a truth table
table.
y The truth table for the Boolean operators
AND and OR are shown at the right.
y The AND operator is also known as a
Boolean product. The OR operator is the
Boolean sum.
y AND
y Result TRUE if and only if both input operands
are true
y INCLUSIVE OR
y Result TRUE if any input operands are true

8
2.2 Boolean Algebra

y The truth table for the


Boolean NOT operator is
shown at the right.
y NOT
y Result TRUE if single input
value is FALSE
y The
Th NOT operation
ti iis mostt
often designated by an
overbar. It is sometimes
indicated by a prime mark ( ‘ )
or an “elbow” (¬).

9
Boolean Operators
y EXCLUSIVE-OR
A B C
y Result TRUE if either A or B is
TRUE but not both 0 0 0

y C =A ⊕ B 0 1 1

y Can be derived from 1 0 1


INCLUSIVE-OR,, AND and NOT 1 1 0
y
A ⊕ B = (A + B) z ( A z B )
A xor B equals A or B but not both A and B
y
A ⊕ B = (A z B ) + ( B z A )
A xor B = either A and not B or B and not A
2.2 Boolean Algebra

y A Boolean function has:


• At least one Boolean variable,
• At least one Boolean operator, and
• At least one input from the set {0,1}.
y It produces an output that is also a member of
the set {0,1}.

Now you k
N know why
h ththe bi
binary numbering
b i
system is so handy in digital systems.

11
2.2 Boolean Algebra

y The truth table for the


Boolean function:

is shown at the right.


y To make evaluation of the
Boolean function easier,
the truth table contains
extra ((shaded)) columns to
hold evaluations of
subparts of the function.

12
2.2 Boolean Algebra

y As with common
arithmetic, Boolean
operations have rules of
precedence.
precedence
y The NOT operator has
highest priority,
priority followed
by AND and then OR.
y This is how we chose the
(shaded) function
subparts in our table.

13
2.2 Boolean Algebra

y Digital computers contain circuits that implement


Boolean functions.
y The simpler that we can make a Boolean function,
the smaller the circuit that will result.
y Simpler circuits are cheaper to build, consume less power, and
run faster than complex circuits.
circuits
y With this in mind, we always want to reduce our
Boolean functions to their simplest
p form.
y There are a number of Boolean identities that help
us to do this.

14
2.2 Boolean Algebra

y Most Boolean identities have an AND (p


(product)) form as
well as an OR (sum) form. We give our identities using
both forms. Our first group is rather intuitive:

15
2.2 Boolean Algebra

y Our second group of Boolean identities should be


familiar to you from your study of algebra:

16
2.2 Boolean Algebra

y Our last group of Boolean identities are perhaps the


most useful.
y If you have studied set theory or formal logic, these
laws are also familiar to you.

17
2.2 Boolean Algebra

y We can use Boolean identities to simplify the


function:
as follows:
f ll

18
2.2 Boolean Algebra

y Sometimes it is more economical to build a circuit


using the complement of a function (and
complementing its result) than it is to implement
th function
the f ti directly.
di tl
y DeMorgan’s law provides an easy way of finding
th complement
the l t off a Boolean
B l function.
f ti
y Recall DeMorgan’s law states:

19
2.2 Boolean Algebra

y DeMorgan’s
g law can be extended to any
y number of
variables.
y Replace each variable by its complement and
change all ANDs to ORs and all ORs to ANDs.
y Thus, we find the the complement of:

is:

20
2.2 Boolean Algebra

y Through our exercises in simplifying Boolean


expressions, we see that there are numerous
ways of stating the same Boolean expression.
y These “synonymous” forms are logically equivalent.
y Logically equivalent expressions have identical truth tables.
y In order to eliminate as much confusion as
possible, designers express Boolean functions in
standardized or canonical form.

21
2.2 Boolean Algebra

y There are two canonical forms for Boolean


expressions: sum-of-products and product-of-sums.
y Recall the Boolean product is the AND operation and the Boolean
sum is
i th
the OR operation.
ti
y In the sum-of-products form, ANDed variables are
ORed together.
g
y For example:
y In the product-of-sums form, ORed variables are
AND d ttogether:
ANDed th
y For example:

22
2.2 Boolean Algebra

y It is easy
y to convert a function
to sum-of-products form using
its truth table.
y We are interested in the values
of the variables that make the
function true (=1).
( 1).
y Using the truth table, we list the
values of the variables that
result in a true function value.
y Each group of variables is then
ORed together.
together
23
2.2 Boolean Algebra

y The sum-of-products
p form
for our function is:

We note that this function is not


in simplest terms. Our aim is
only to rewrite our function in
canonical sum-of-products form.

24
2.3 Logic Gates

y We have looked at Boolean functions in abstract


terms.
y In this section, we see that Boolean functions are
i l
implemented t d iin di
digital
it l computer t circuits
i it called ll d gates.
t
y A gate is an electronic device that produces a result
based on two or more input values.
y In reality, gates consist of one to six transistors, but digital
designers think of them as a single unit.
y Integrated circuits contain collections of gates suited to a particular
purpose.

25
2.3 Logic Gates

y The three simplest


p g
gates are the AND,, O
OR,, and NOT
O
gates.

y They correspond directly to their respective Boolean


operations as you can see by their truth tables
operations, tables.
26
2.3 Logic Gates

y Another very useful gate is the exclusive OR (XOR)


gate.
y The output of the XOR operation is true only when
the values of the inputs differ.

Note the special symbol ⊕


for the XOR operation.
p

27
2.3 Logic Gates

y NAND and NOR


O
are two very
important gates.
Their symbols and
truth tables are
shown at the right.
g

28
2.3 Logic Gates

y NAND and NOR


O are
known as universal
gates because they
are inexpensive to
manufacture and
anyy Boolean
function can be
constructed using
only NAND or only
NOR gates.

29
2.3 Logic Gates

y Gates can have multiple


p inputs
p and more than
one output.
y A second output can be provided for the complement of the
operation
operation.
y We’ll see more of this later.

30
2.4 Digital Components

y The main thing to remember is that combinations


of gates implement Boolean functions.
y The circuit below implements the Boolean
function:

We simplify our Boolean expressions so


that we can create simpler circuits.
circuits
31
2.5 Combinational Circuits

y We have designed a circuit that implements the


Boolean function:

y This circuit is an example of a combinational logic


circuit.
y Combinational logic circuits produce a specified
output (almost) at the instant when input values are
applied.
applied
y In a later section, we will explore circuits where this is not the
case.

32
2.5 Combinational Circuits

y C
Combinational logic
g circuits
give us many useful devices.
y One of the simplest is the half
adder, which finds the sum of
two bits.
y We can gain some insight as
to the construction of a half
adder by looking at its truth
table, shown at the right.

33
2.5 Combinational Circuits

y As we see,, the sum can be


found using the XOR
operation and the carry using
the AND operation.
operation

34
2.5 Combinational Circuits

y We can change our half


adder into to a full adder
by including gates for
processing
i ththe carry bit
bit.
y The truth table for a full
adder
dd iis shown
h att th
the
right.

35
2.5 Combinational Circuits

y How can we change the


half adder shown below to
make it a full adder?

36
2.5 Combinational Circuits

y Here
Here’s
s our completed full adder.

37
2.5 Combinational Circuits

y Just as we combined half adders to make a full


adder, full adders can connected in series.
y The carry
y bit “ripples”
pp from one adder to the next;;
hence, this configuration is called a ripple-carry
adder.

Today’s systems employ more efficient adders.

38
2.5 Combinational Circuits

y Decoders are another important type of


combinational circuit.
y Among other things, they are useful in selecting a
memory location according a binary value placed on
the address lines of a memory bus.
y Address
Add d
decoders
d with
ith n inputs
i l t any off 2n
t can select
locations.
This is a block
diagram for a
decoder.

39
2.5 Combinational Circuits

y This is what a 2-to-4


2 to 4 decoder looks like on the
inside.

If x = 0 and y = 1,
which output
line is enabled?

40
2.5 Combinational Circuits

y A multiplexer
p does jjust the
opposite of a decoder.
y It selects a single output from
severall iinputs.
t
y The particular input chosen
for output is determined by
the value of the multiplexer’s
control lines.
This is a block
y To
T beb able
bl tto select
l t among n diagram for a
inputs, log2n control lines are multiplexer.
needed.
41
2.5 Combinational Circuits

y This is what a 4-to-1


4 to 1 multiplexer looks like on the
inside.

If S0 = 1 and S1 = 0,
which input is
transferred to the
output?
p

42
2.5 Combinational Circuits

y This shifter
moves the bits
of a nibble
one position
iti
to the left or
right.

If S = 0, in which
direction do the
i
input t bits
bit shift?
hift?
43

You might also like