Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
-
Upload
clinton-henry -
Category
Documents
-
view
221 -
download
1
Transcript of Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Objectives
• Understand the relationship between Boolean logic and digital computer circuits.
• Learn how to design simple logic circuits.• Understand how digital circuits work
together to form complex computer systems.
Introduction
• In the latter part of the nineteenth century, George Boole incensed philosophers and mathematicians alike when he suggested that logical thought could be represented through mathematical equations.—How dare anyone suggest that human thought
could be encapsulated and manipulated like an algebraic formula?
• Computers, as we know them today, are implementations of Boole’s Laws of Thought.—John Atanasoff and Claude Shannon were
among the first to see this connection.
Introduction
• In the middle of the twentieth century, computers were commonly known as “thinking machines” and “electronic brains.”—Many people were fearful of them.
• Nowadays, we rarely ponder the relationship between electronic digital computers and human logic. Computers are accepted as part of our lives.—Many people, however, are still fearful of them.
• In this chapter, you will learn the simplicity that constitutes the essence of the machine.
Boolean Algebra
• Boolean algebra is a mathematical system for the manipulation of variables that can have one of two values.—In formal logic, these values are “true” and
“false.”—In digital systems, these values are “on” and
“off,” 1 and 0, or “high” and “low.”
• Boolean expressions are created by performing operations on Boolean variables.—Common Boolean operators include AND, OR,
and NOT.
• A Boolean operator can be completely described using a truth table.
• The truth table for the Boolean operators AND and OR are shown at the right.
• The AND operator is also known as a Boolean product. The OR operator is the Boolean sum.
Boolean Algebra
• The truth table for the Boolean NOT operator is shown at the right.
• The NOT operation is most often designated by an overbar. It is sometimes indicated by a prime mark ( ‘ ) or an “elbow” ().
Boolean Algebra
Boolean Algebra
• A Boolean function has:—At least one Boolean variable, —At least one Boolean operator, and —At least one input from the set {0,1}.
• It produces an output that is also a member of the set {0,1}.
Now you know why the binary numbering system is so handy in digital systems.
• The truth table for the Boolean function:
is shown at the right.
• To make evaluation of the Boolean function easier, the truth table contains extra (shaded) columns to hold evaluations of subparts of the function.
Boolean Algebra
• As with common arithmetic, Boolean operations have rules of precedence.
• The NOT operator has highest priority, followed by AND and then OR.
• This is how we chose the (shaded) function subparts in our table.
Boolean Algebra
Boolean Algebra
• Digital computers contain circuits that implement Boolean functions.
• The simpler that we can make a Boolean function, the smaller the circuit that will result.—Simpler circuits are cheaper to build, consume
less power, and run faster than complex circuits.
• For the purposes of this course, we will deal only with And, Or, and Not gates—While there are more interesting gates, such as
XOR, NOR, and NAND gates.
• The three simplest gates are the AND, OR, and NOT gates.
• They correspond directly to their respective Boolean operations, as you can see by their truth tables.
Logic Gates
Logic Gates
• There is one other graphical convention
• The NOT gate is sometimes reduced to a small circle attached to some other gate, so
Combinational Circuit
• A Combinational Circuit has no memory.
• Its outputs depend only on its inputs—not on a value stored inside the circuit—Each input (and each output) is either 1 or 0.
• To specify its behavior, we use a truth table
• Example—Imagine a circuit with 3 inputs and 2 outputs. —The outputs form a binary number = number
of incoming 1's
• Combinational logic circuits give us many useful devices.
• One of the simplest is the half adder, which finds the sum of two bits.
• We can gain some insight as to the construction of a half adder by looking at its truth table, shown at the right.
Half Adder
• We can change our half adder into to a full adder by including gates for processing the carry bit.
• The truth table for a full adder is shown at the right.
Full Adder
Multiplexor
• A Multiplexor that allows us to choose one of two incoming bits.—S selects either A or B and sends its value on
to C.
—Left: A two input multiplexor—Right: implementation with gates
Multiplexor Exercise
• If A,B,S are 0,1,0, —what are the AND gate outputs? —the OR gate output?
• Now change S to 1 and update the outputs accordingly.
Building a circuit from a truth table
• Example:• A circuit with 3 inputs (A,B,C) and 3
outputs (D,E,F).• Output D is turned on
—when at least one input is on.
• Output E is turned on—when exactly two inputs are on.
• Output F is turned on—when all three inputs are on.
Building a circuit from a truth table (2)
• Truth Table
—D=1, when one input is on—E=1, when only two inputs are on—F=1, when all three inputs are on
Building a circuit from a truth table (3)
• To make a circuit that will compute these 3 outputs correctly, we start by creating an AND for each line of the truth table:
• This AND gate is turned on only when A is 0 (note the inverter), b is 1 and c is 1—Which corresponds to line 4 of the truth table
Building a circuit from a truth table (4)
• Now we need an OR gate for each output
• Now we connect some of the input AND's to some of the output OR's.
Building a circuit from a truth table (5)
Before continuing, let finish the diagram for Outputs D (at least one input set to 1) and F (all 3 set to 1).
Building a circuit from a truth table (6)
• Notice that one of the AND gates (line one of the truth table) never got used.• Also F's OR has only one input.
• We can eliminate these two gates to give
An Adder for 2 bits (2)
• Here is its truth table
• EXERCISE: fill in the missing data in the table below
Creating a simple ALU
• We start with a circuit that's similar to our adder.—3 data inputs
(a,b,CarryIn)—2 data outputs (Results,
CarryOut)—The box labeled + is
the full adder we did above.
• We also have 3 Control Signals: Ainvert, Binvert, Operation —We ignoring the less
Creating a simple ALU (2)
• Operation is a MUX—Allowing us to choose one of four inputs
• Exercise:—Ainvert and Binvert are 0, What happens—If Operation is 0?
—If operation is 1?
—If operation is 2?
Lastly
• It can also do subtraction —a31a30...a0 -
b31b30....b0—EXERCISE: How?
—Recall subtraction is done with 2's complement
– 2's complement, flip all the bits and add 1
• So that's an ALU that can do Add, Subtract, AND, OR