Computer Organization: Boolean Logic

Similar documents
Unit 8A Computer Organization. Boolean Logic and Gates

Chapter 2: Switching Algebra and Logic Circuits

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

Computer Science. 20. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section

Switches: basic element of physical implementations

Implementation of Boolean Logic by Digital Circuits

UNIT 8A Computer Circuitry: Layers of Abstraction. Boolean Logic & Truth Tables

Digital Circuit And Logic Design I. Lecture 3

Applications. Smartphone, tablet, game controller, antilock brakes, microprocessor, Wires

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

Logic Design. Chapter 2: Introduction to Logic Circuits

CS61c: Representations of Combinational Logic Circuits

CS 226: Digital Logic Design

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

20. Combinational Circuits

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

Boolean Algebra, Gates and Circuits

Chapter 2 Combinational Logic Circuits

Boolean Algebra. Philipp Koehn. 9 September 2016

2009 Spring CS211 Digital Systems & Lab CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS

EEE130 Digital Electronics I Lecture #4

Boolean Algebra & Digital Logic

Digital Logic (2) Boolean Algebra

Logic Gates and Boolean Algebra

Combinational Logic Design Principles

WEEK 2.1 BOOLEAN ALGEBRA

Chapter 2 Combinational Logic Circuits

Boolean Algebra. The Building Blocks of Digital Logic Design. Section. Section Overview. Binary Operations and Their Representation.

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1.

Week-I. Combinational Logic & Circuits

control in out in out Figure 1. Binary switch: (a) opened or off; (b) closed or on.

2. Associative Law: A binary operator * on a set S is said to be associated whenever (A*B)*C = A*(B*C) for all A,B,C S.

Digital Logic. Lecture 5 - Chapter 2. Outline. Other Logic Gates and their uses. Other Logic Operations. CS 2420 Husain Gholoom - lecturer Page 1

Chapter 2: Boolean Algebra and Logic Gates

EECS Variable Logic Functions

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Circuits & Boolean algebra.

Additional Gates COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Every time has a value associated with it, not just some times. A variable can take on any value within a range

Computer organization

Note: The area of logic that deals with propositions is called the propositional calculus or propositional logic.

CSC9R6 Computer Design. Practical Digital Logic

COS 140: Foundations of Computer Science

CHAPTER1: Digital Logic Circuits Combination Circuits

Contents. Chapter 2 Digital Circuits Page 1 of 30

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

Floating Point Representation and Digital Logic. Lecture 11 CS301

Logic Gate Level. Part 2

MC9211 Computer Organization

Chapter 2 Boolean Algebra and Logic Gates

1 Boolean Algebra Simplification

Total Time = 90 Minutes, Total Marks = 50. Total /50 /10 /18

Digital Electronics H H

DIGITAL CIRCUIT LOGIC BOOLEAN ALGEBRA

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

Unit 4: Computer as a logic machine

Unit 2 Boolean Algebra

Boolean Algebra and Logic Gates

Combinational logic. Possible logic functions of two variables. Minimal set of functions. Cost of different logic functions.

Boolean Algebra CHAPTER 15

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication

Chapter 2. Boolean Algebra and Logic Gates

Chapter 2 Combinational Logic Circuits

Intro To Digital Logic

Logic and Boolean algebra

Chapter 2. Digital Logic Basics

Cs302 Quiz for MID TERM Exam Solved

More Propositional Logic Algebra: Expressive Completeness and Completeness of Equivalences. Computability and Logic

Review: Additional Boolean operations

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Why digital? Overview. Number Systems. Binary to Decimal conversion

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Learning Objectives 10/7/2010. CE 411 Digital System Design. Fundamental of Logic Design. Review the basic concepts of logic circuits. Dr.

Lecture 22 Chapters 3 Logic Circuits Part 1

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

CSC Discrete Math I, Spring Propositional Logic

CS 121 Digital Logic Design. Chapter 2. Teacher Assistant. Hanin Abdulrahman

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

2 Application of Boolean Algebra Theorems (15 Points - graded for completion only)

Lecture 1. Notes. Notes. Notes. Introduction. Introduction digital logic February Bern University of Applied Sciences

In Module 3, we have learned about Exclusive OR (XOR) gate. Boolean Expression AB + A B = Y also A B = Y. Logic Gate. Truth table

CS 173 Lecture 2: Propositional Logic

Number System conversions

Fundamentals of Computer Systems

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Building a Computer Adder

1.1 Statements and Compound Statements

CMSC 313 Lecture 16 Postulates & Theorems of Boolean Algebra Semiconductors CMOS Logic Gates

Set Theory Basics of Set Theory. mjarrar Watch this lecture and download the slides

Boolean Algebra & Logic Gates. By : Ali Mustafa

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

CprE 281: Digital Logic

Fundamentals of Computer Systems

CS/COE0447: Computer Organization and Assembly Language

Propositional Logic: Equivalence

University of Technology

Transcription:

Computer Organization: Boolean Logic

Representing and Manipulating Data Last Unit How to represent data as a sequence of bits How to interpret bit representations Use of levels of abstraction in representing more complex information (music, pictures) using simpler building blocks (numbers) This Unit How sequences of bits are implemented using electrical signals, and manipulated by circuits Use of levels of abstraction in designing more complex computer components from simpler components

3 Foundations Boolean logic is the logic of digital circuits

Implementing Bits Computers compute by manipulating electricity according to specific rules. We associate electrical signals inside the machine with bits. Any electrical device with two distinct states (e.g. on/off switch, two distinct voltage or current levels) could implement our bits. The rules are implemented by electrical circuits.

5 Conceptualizing bits and circuits ON or 1: true OFF or 0: false circuit behavior: expressed in Boolean logic or Boolean algebra

6 Boolean Logic (Algebra) Computer circuitry works based on Boolean Logic (Boolean Algebra) : operations on True (1) and False (0) values. A B A Λ B (A B) (conjunction) 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 A 0 1 1 0 A (NOT A) (negation) A and B in the table are Boolean variables, and are operations (also called functions).

Foundations of Digital Computing Boolean Algebra was invented by George Boole in 1854 (before digital computers) Variables and functions take on only one of two possible values: True (1) or False (0). The correspondence between Boolean Logic and circuits was not discovered until 1930s Shannon s thesis: A Symbolic Analysis of Relay and Switching Circuits argued that electrical applications of Boolean Algebra could construct any logical, numerical relationship. We forget about the logical (truth and falsehood) aspect of Boolean logic and just manipulate symbols. 7

8 Boolean Logic & Truth Tables Example: You can think of A Ù B below as 15110 is fun and 15110 is useful where A stands for the statement 15110 is fun, B stands for the statement 15110 is useful. A B A Λ B (A B) (conjunction) 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 A 0 1 1 0 A (NOT A) (negation)

9 Logic gates the basic elements of digital circuits

10 Logic Gates A gate is a physical device that implements a Boolean operator by performing basic operations on electrical signals. Nowadays, gates are built from transistors. Physical behavior of circuits is beyond the scope of our course. A B A Ù B A B A Ú B A NOT

A Mechanical Implementation Push-pull logic gate For an input pushed-in lever represents 1 For an output pushed-in lever represents 0 Source: randomwraith.com by Martin Howard

12 Combinational circuits combinations of logic gates

13 Combinational Circuits The logic states of inputs at any given time determine the state of the outputs. A Ù B B Ú C C Ù B (B Ú C) Ù (C Ù B) What is Q? (A Ù B) Ú ((B Ú C) Ù (C Ù B))

14 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 How do I know that there should be 8 rows in the truth table? Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

15 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

16 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

17 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

18 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

19 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

20 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

21 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

22 Truth Table of a Circuit Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 Describes the relationship between inputs and outputs of a device http://www.allaboutcircuits.com/vol_4/chpt_7/6.html

23 Describing Behavior of Circuits Boolean expressions Circuit diagrams Equivalent notations Truth tables

24 Manipulating circuits Boolean algebra and logical equivalence

25 Why manipulate circuits? The design process simplify a complex design for easier manufacturing, faster or cooler operation, Boolean algebra helps us find another design guaranteed to have same behavior

26 Logical Equivalence Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 Can we come up with a simpler circuit implementing the same truth table? Simpler circuits are typically cheaper to produce, consume less energy etc.

Logical Equivalence Q = (A Ù B) Ú ((B Ú C) Ù (C Ù B)) Q = B Ù (A Ú C) A B C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 This smaller circuit is logically equivalent to the one above: they have the same truth table. By using laws of Boolean Algebra we convert a circuit to another equivalent circuit. 27

28 Laws for the Logical Operators Ù and Ú (Similar to and +) Commutative: A Ù B = B Ù A A Ú B = B Ú A Associative: A Ù B Ù C = (A Ù B) Ù C = A Ù (B Ù C) A Ú B Ú C = (A Ú B) Ú C = A Ú (B Ú C) Distributive: A Ù (B Ú B) = (A Ù B) Ú (A Ù C) A Ú (B Ù C) = (A Ú B) Ù (A Ú C) Identity: A Ù 1 = A A Ú 0 = A Dominance: A Ù 0 = 0 A Ú 1 = 1 Idempotence: A Ù A = A A Ú A = A Complementation: A Ù A = 0 A Ú A = 1 Double Negation: A = A

Laws for the Logical Operators Ù and Ú (Similar to and +) Commutative: A Ù B = B Ù A A Ú B = B Ú A Associative: A Ù B Ù C = (A Ù B) Ù C = A Ù (B Ù C) A Ú B Ú C = (A Ú B) Ú C = A Ú (B Ú C) Distributive: A Ù (B Ú C) = (A Ù B) Ú (A Ù C) A Ú (B Ù C) = (A Ú B) Ù (A Ú C) Not true for + and Identity: A Ù 1 = A A Ú 0 = A The A s and B s here are schematic variables! You can instantiate them with any expression that has a Boolean value: (x Ú y) Ù z = z Ù (x Ú y) (by commutativity) A Ù B = B Ù A

Applying Properties for Ù and Ú Showing (x Ù y) Ú ((y Ú z) Ù (z Ù y)) = y Ù (x or z) Commutativity A Ù B = B Ù A (x Ù y) Ú ((z Ù y) Ù (y Ú z)) Distributivity A Ù (B Ú C) = (A Ù B) Ú (A Ù C) (x Ù y) Ú (z Ù y Ù y) Ú(z Ù y Ù z) Associativity, Commutativity, Idempotence (x Ù y) Ú ((z Ù y) Ú (y Ù z)) Commutativity, idempotence A Ù A = A ( y Ù x) Ú (y Ù z) Distributivity (backwards) (A Ù B) Ú (A Ù C) = A Ù (B Ú C) y Ù (x Ú z) Conclusion: (x Ù y) Ú ((y Ú z) Ù (z Ù y)) = y Ù (x Ú z)

31 Extending the system more gates and DeMorgan s laws

More gates (N, N, X) A B A nand B A nor B 0 0 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 0 0 0 nand ( not and ): A nand B = not (A and B) A xor B A B (A Ù B) nor ( not or ): A nor B = not (A or B) xor ( exclusive or ): A xor B = (A and not B) or (B and not A) A B A B (A Ú B) A Å B 32

A curious fact Functional Completeness of N and N Any logical circuit can be implemented using N gates only Same applies to N

34 DeMorgan s Law Nand: (A Ù B) = A Ú B Nor: (A Ú B) = A Ù B

35 DeMorgan s Law Nand: (A Ù B) = A Ú B if not (x > 15 and x < 110):... is logically equivalent to if (not x > 15) or (not x < 110):... Nor: (A Ú B) = A Ù B if not (x < 15 or x > 110):... is logically equivalent to if (not x < 15) and (not x > 110):...

36 A circuit for parity checking Boolean expressions and circuits

37 A Boolean expression that checks parity 3-bit odd parity checker F: an expression that should be true when the count of 1 bits is odd: when 1 or 3 of the bits are 1s. P = ( A Ù B Ù C) Ú ( A Ù B Ù C) Ú (A Ù BÙ C) Ú (A Ù B Ù C) A B C P 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 There are specific methods for obtaining canonical Boolean expressions from a truth table, such as writing it as a disjunction of conjunctions or as a conjunction of disjunctions. Note we have four subexpressions above each of them corresponding to exactly one row of the truth table where P is 1.

38 The circuit 3-bit odd parity checker P = ( A Ù BÙ C) Ú ( A Ù B Ù C) Ú (A Ù BÙ C) Ú (A Ù B Ù C) A B C P 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 A B P = (A Å B) Å C C P

39 Summary You should be able to: Identify basic gates Describe the behavior of a gate or circuit using Boolean expressions, truth tables, and logic diagrams Transform one Boolean expression into another given the laws of Boolean algebra

40 Next Time How circuits are combined to form a computer Von Neumann architecture revisited Fetch Decode - Execute Cycle