Logic and Boolean algebra

Similar documents
Boolean Algebra, Gates and Circuits

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Chapter 5. Digital systems. 5.1 Boolean algebra Negation, conjunction and disjunction

CHAPTER1: Digital Logic Circuits Combination Circuits

CS61c: Representations of Combinational Logic Circuits

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

Digital Logic (2) Boolean Algebra

Week-I. Combinational Logic & Circuits

UNIVERSITI TENAGA NASIONAL. College of Information Technology

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

Logic Design. Chapter 2: Introduction to Logic Circuits

ELCT201: DIGITAL LOGIC DESIGN

MC9211 Computer Organization

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

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

Lecture 2 Review on Digital Logic (Part 1)

Boolean Algebra and Digital Logic

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

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

Chapter 7 Logic Circuits

Systems I: Computer Organization and Architecture

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Chapter 2: Switching Algebra and Logic Circuits

Ex: Boolean expression for majority function F = A'BC + AB'C + ABC ' + ABC.

DIGITAL CIRCUIT LOGIC BOOLEAN ALGEBRA (CONT.)

Combinational Logic. Review of Combinational Logic 1

Prove that if not fat and not triangle necessarily means not green then green must be fat or triangle (or both).

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

LOGIC GATES. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

211: Computer Architecture Summer 2016

Combinational Logic Design Principles

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

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

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics

Chapter 2. Boolean Algebra and Logic Gates

Review for Test 1 : Ch1 5

Boolean Algebra. Philipp Koehn. 9 September 2016

Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Part 1: Digital Logic and Gates. Analog vs. Digital waveforms. The digital advantage. In real life...

Design of Sequential Circuits

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Boolean Algebra & Logic Gates. By : Ali Mustafa

Chapter 2. Digital Logic Basics

ENG2410 Digital Design Combinational Logic Circuits

Chapter 2: Princess Sumaya Univ. Computer Engineering Dept.

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

Lecture A: Logic Design and Gates

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

1. Name the person who developed Boolean algebra

Switches: basic element of physical implementations

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

Digital Logic Appendix A

Boolean Algebra CHAPTER 15

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Unit 2 Session - 6 Combinational Logic Circuits

Combinational Logic. By : Ali Mustafa

CS 226: Digital Logic Design

CHAPTER III BOOLEAN ALGEBRA

Possible logic functions of two variables

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

CHAPTER 12 Boolean Algebra

CS/COE0447: Computer Organization and Assembly Language

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

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks

Philadelphia University Student Name: Student Number:

Logic Gate Level. Part 2

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev

Computer Organization: Boolean Logic

Logic Design I (17.341) Fall Lecture Outline

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

CHAPTER III BOOLEAN ALGEBRA

KUMARAGURU COLLEGE OF TECHNOLOGY COIMBATORE

Lecture 22 Chapters 3 Logic Circuits Part 1

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Discrete Mathematics. CS204: Spring, Jong C. Park Computer Science Department KAIST

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

Gate-Level Minimization

Philadelphia University Student Name: Student Number:

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

Contents. Chapter 3 Combinational Circuits Page 1 of 36

CS1800: Hex & Logic. Professor Kevin Gold

CHAPTER 2 BOOLEAN ALGEBRA

Electronics. Overview. Introducction to Synthetic Biology

WEEK 2.1 BOOLEAN ALGEBRA

SAMPLE ANSWERS MARKER COPY

Lecture 6: Gate Level Minimization Syed M. Mahmud, Ph.D ECE Department Wayne State University

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

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

Unit 8A Computer Organization. Boolean Logic and Gates

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

CSC9R6 Computer Design. Practical Digital Logic

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Chapter 2 Combinational Logic Circuits

ELCT201: DIGITAL LOGIC DESIGN

EECS Variable Logic Functions

Transcription:

Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University

last week coding theory channel coding information theory concept Hamming distance error detection motivation parity cyclic redundancy checks Central Processing Unit IR increment PC CU operation select PSR Mouse DR PC registers ALU Universal Serial Bus AR Input / Output Controller address bus Random Access Memory PCI Bus Keyboard HDD GPU Audio SSD Net 0 4 8 6 20 24 28 data bus error correction motivation block parity Hamming codes 2

this week the mathematics of logic circuits the foundation of all digital design Boolean logic when 0 and represent true and false Boolean algebra Boolean functions canonical forms Central Processing Unit IR increment PC CU operation select PSR Mouse DR PC registers ALU Universal Serial Bus AR Input / Output Controller address bus Random Access Memory PCI Bus Keyboard HDD GPU Audio SSD Net 0 4 8 6 20 24 28 data bus simplification of Boolean expressions de Morgan s laws 3

combinational logic (this week, next week) similar to mathematical functions output depends only on current inputs logic circuits no memory of past inputs or outputs (stateless) used to implement arithmetic and logical functions e.g., the ALU, instruction decoding, etc. sequential logic (week after next) memory of past inputs and/or outputs (stateful) output depends on current inputs and/or past inputs synchronous logic (week after next) sequential logic with a clock change to sequential state occurs whenever the clock ticks used to implement control and iterative functions e.g., the control unit, multiply/divide instructions, registers, etc. 4

Boolean algebra only two values: false and true, usually written 0 and respectively three fundamental operations or: x + y is true if either x or y is true and: x y is true if both x and y are true not: x is true if x is not true OR 0 + 0 = 0 0 + = + 0 = + = AND 0 0 = 0 0 = 0 0 = 0 = NOT 0 = = 0 notation or x + y x y x y logical sum, union, or disjunction and x y x y x y logical product, intersection, or conjunction not x x x logical complement, or negation x y can be written xy (like implicit multiplication in normal arithmetic) + and have the same precedence as addition and multiplication, respectively the unary negation operator x has highest precedence 5

truth tables truth tables list the input(s) and corresponding output of a Boolean operation OR x y x + y 0 0 0 0 0 AND x y x y 0 0 0 0 0 0 0 NOT x x 0 0 or of a Boolean expression, e.g., x + y z x y z yz x + yz 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6

proof by truth table (perfect induction) to demonstrate the equivalence of two expressions, e.g., x (y + z) = x y + x z (distributivity) a truth table can be constructed x y z y + z x(y + z) xy xz xy + xz 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 all of the basic properties of Boolean algebra can be proved easily this way 7

Boolean algebra basic properties x + x = x, x x = x x + 0 = x, x = x x + =, x 0 = 0 x + y = y + x, x y = y x (x + y) + z = x + (y + z), (x y) z = x (y z) x + x =, x x = 0 x (y + z) = x y + x z, x + y z = (x + y) (x + z) (idempotency) (identity) (domination) (commutativity) (associativity) (complementation) (distributivity) 8

algebraic manipulation of Boolean expressions the basic properties can be used to rewrite Boolean functions e.g., to demonstrate the property x + (x y) = x (absorption) x + (x y) = x + xy (identity) = x( + y) (distributivity) = x (domination) = x (identity) note that Boolean algebra has no inverse operations unlike normal algebra, cancellations are not allowed x + y = x + z = y = z 9

duality and De Morgan s laws notice what happens if you invert the meaning of true and false normal inverted logic logic x y x + y x y x y (x y ) 0 0 0 0 0 0 0 0 0 0 0 0 0 or is identical to and when using inverted logic principle of duality: replace 0 and by and 0, respectively swap the OR and AND operation the truth table is the same this leads to De Morgan s laws (x + y) = x y (x y) = x + y 0

a function is a mapping Boolean functions from each possible combination of input value(s) to a unique output value a Boolean function maps one or more Boolean input values to a Boolean output value for n Boolean input values, there are 2 n possible combinations a 3-input function f can be completely specified with an 8-row truth table x y z f(x, y, z) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

canonical forms the truth table for a function f is its canonical form it completely describes the behaviour of the function previously we have used truth tables to visualise the behaviour of expressions if we know the behaviour of a function (its canonical form) we can go the other way a truth table lets us reconstruct the expression corresponding to a Boolean function every row in the table corresponds to a unique combination of inputs it is one term in the expression: a product of the inputs on which the output depends if an input is specified as, it appears uncomplemented in the product if an input is specified as 0, it appears complemented in the product the sum of all the terms for which f = is the expression for the function x y f(x, y) term 0 0 0 0 x y 0 x y 0 f(x, y) = x y + xy 2

simplification of Boolean expressions algebraically, by applying the properties described above e.g., simplify x + x y x + x y = (x + x )(x + y) (distributivity, complementation) = (x + y) (complementation) = x + y (identity) visually, using a two-dimensional truth table to find a function s minimal expression A B F 0 0 0 0 0 F A 0 B 0 0 A 0 B 0 0 P Q A 0 B 0 0 P = A Q = B F = A + B a details... 3

Karnaugh maps a Karnaugh map is a two-dimensinal truth table input variables are arranged along the axes the minimal expression for the map is constructed term-by-term pick any which has not been previously considered group it with the maximum possible number of adjacent s, to form a rectangle the sides of the rectangle must be a power-of-2 long:, 2, 4, 8,... write a term for this rectangle any input variable completely covered (0 and ) by the rectangle is irrelevant the remaining inputs form the term an input that must be appears uncomplemented an input that must be 0 appears complemented A B F 0 0 0 0 0 F A 0 B 0 0 A 0 B 0 0 P Q A 0 B 0 0 P = A Q = B F = A + B the sum of the resulting terms is the minimal expression for the function 4

Karnaugh maps Karnaugh maps are convenient for up to four inputs along a given axis, adjacent input patterns must differ by only one bit i.e., the axes are labelled with a minimum change code e.g., Gray code F ab 00 0 0 ab 00 0 0 P ab 00 0 0 Q ab 00 0 0 R 00 00 00 00 cd 0 cd 0 cd 0 cd 0 0 0 0 0 P = bc Q = ab R = ac d F = bc + ab + ac d 5

useful and strange Boolean functions the exclusive-or (or not equivalent ) function x y x y 0 0 0 0 0 0 f(x, y) = x y + xy x y x y x y x y is true if either x or y (but not both) is true i.e., if x and y are different represents addition, modulo-2 very useful in the ALU the implies function x y x y 0 0 0 0 0 f(x, y) = x + y x y the if x then y function note that if the predicate x is false, any consequent y satisfies the relation 6

next week combinational digital circuits signals and busses logic gates and, or, not nand, nor, xor gate-level logical operations bitwise: and, or, not Central Processing Unit IR increment PC CU operation select PSR Mouse DR PC registers ALU Universal Serial Bus AR Input / Output Controller address bus Random Access Memory PCI Bus Keyboard HDD GPU Audio SSD Net 0 4 8 6 20 24 28 data bus gate-level arithmetic operations addition, subtraction (unsigned, 2 s complement) -of-n selection multiplexers 7

homework practice drawing truth tables for useful functions what is the truth table for (three-input) binary sum? what is the truth table for (three-input) binary carry? practice converting truth tables into expressions what are the canonical expressions for sum and carry? practice algebraic simplification how simple can you make your sum and carry functions? practice finding minimal expressions using Karnaugh maps what are the minimal expressions for sum and carry? ask about anything you do not understand from any of the classes so far this semester (or the lecture notes) it will be too late for you to try to catch up later! I am always happy to explain things differently and practice examples with you 8

glossary and the logical operation in which x y is true iff x and y are simultaneously true. associativity a property of an operation that makes it independent of the order in which repeated applications of it are made. For example, addition is associative because in 2 + 3 + 4 the result is independent of the order of application of the two additions (2 + 7 vs. 5 + 4). canonical form a standard way of writing an expression or function in which every possible combination of inputs are accounted for and have a definite output value. commutativity a property of an operation that makes is independent of the order of its operands. For example, addition is commutative because in 3 + 4 the result is the same as for 4 + 3. complementation the behaviour of an operation when applied to a value and its complement. complement the logical opposite of a value. The complement of true is false, and the complement of false is true. conjunction when two or more things occur at the same point in time or space. covered an input to a function that has no influence on the result. De Morgan s laws logical rules arising from the duality of and and or when the logical interpretation of true and false is reversed. disjunction when two or more things are distinct (but not necessarily mutually-exclusive) alternatives. distributivity a property of two binary functions f and g that ensures f(x, g(y, z)) = g(f(x, y), f(x, z)). domination a combination of binary function and single operand that yields the same result when applied to any other operand value. exclusive-or the not equivalent function, true iff its inputs differ. false the logical value representing the opposite of true, typically written 0. idempotency a value that remains unchanged when operated on by itself. 9

identity a value that, when combined with any other value using a specified operation, leaves that value unchanged. implication a binary logical operation in which the right hand operand must be true whenever the left hand operand is true. inclusive-or the or operation, with an explicit indication that it remains true when both inputs are true. inverted logic the dual of normal logic, in which 0 represents true and represents false. If all occurences of and and or are swapped, the rules of inverted logic are identical to the rules of normal logic. Karnaugh map a two-dimensional truth table in which adjacent rows or columns differ in exaclt one input. Karnaugh maps immediately identify redundant inputs, facilitating the construction of minimal expressions for any given logical function. negation the conversion of a logical value into its complement. not the logical operation that negates, or complements, a value. or the logical operation + in which x + y is false iff x and y are simultaneously false. product the result of multiplication. In logic, the product of 0 with x is 0, and the product of with x is x. sum the result of addition. In logic, the sum of 0 with x is x, and the sum of with x is. term the expression represented by one line of a truth table, typically written as a product (logical and of input values, complemented as required). true the logical value representing the opposite of false, typically written. truth table a table listing all possible combinations of input values and their corresponding output value. xor the exclusive-or operation, which is true only if exactly one if the inputs is true. 20