Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.

Similar presentations


Presentation on theme: "Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic."— Presentation transcript:

1 Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic

2 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.

3 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.

4 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.

5 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.

6 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

7 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

8 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.

9 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

10 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

11 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.

12 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

13 There is one other graphical convention The NOT gate is sometimes reduced to a small circle attached to some other gate, so

14 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

15 Combinational Circuit Example

16 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

17 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

18 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

19 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.

20 This is what a 4-to-1 multiplexer looks like on the inside. 4-to-1 multiplexer

21 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.

22 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

23 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

24 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.

25 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).

26 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

27 Building a circuit from a truth table (7) The final circuit:

28 An Adder for 2 bits A single column could be done by a circuit like this 

29 An Adder for 2 bits (2) Here is its truth table EXERCISE: fill in the missing data in the table below

30 An Adder for 2 bits (3) Now Let’s complete the circuit

31 Wiring up a 4-bit Adder

32 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

33 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?

34 Simple 32 bit ALU

35 Addition (unsigned)

36 Bitwise AND Note, carryIn and carry out don’t contribute anything

37 Bitwise OR We can also use Bitwise OR Note: carryIn and carry out don’t contribute anything

38 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

39 Q A &


Download ppt "Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic."

Similar presentations


Ads by Google