CSE 311 Foundations of Computing I Lecture 4, Boolean Logic Autumn 2011 CSE 3111.

Slides:



Advertisements
Similar presentations
L14: Boolean Logic and Basic Gates
Advertisements

CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
Chapter 2 Logic Circuits.
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Combinational logic Basic logic  Boolean algebra, proofs by re-writing,
ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE 331 – Digital System Design Boolean Algebra (Lecture #3) The slides included herein were taken from the materials accompanying Fundamentals of Logic.
ECE 301 – Digital Electronics Minterm and Maxterm Expansions and Incompletely Specified Functions (Lecture #6) The slides included herein were taken from.
EECS Components and Design Techniques for Digital Systems Lec 05 – Boolean Logic 9/4-04 David Culler Electrical Engineering and Computer Sciences.
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Propositional Calculus Math Foundations of Computer Science.
Boolean Algebra and Logic Simplification. Boolean Addition & Multiplication Boolean Addition performed by OR gate Sum Term describes Boolean Addition.
Chapter 2: Boolean Algebra and Logic Functions
Lecture 4 Logic gates and truth tables Implementing logic functions
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
Switching functions The postulates and sets of Boolean logic are presented in generic terms without the elements of K being specified In EE we need to.
 Seattle Pacific University EE Logic System DesignSOP-POS-1 The Connection: Truth Tables to Functions abcF abcF
CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1.
F = ∑m(1,4,5,6,7) F = A’B’C+ (AB’C’+AB’C) + (ABC’+ABC) Use X’ + X = 1.
Foundations of Computing I CSE 311 Fall bit Binary Adder Inputs: A, B, Carry-in Outputs: Sum, Carry-out A B Cin Cout S
CSE 311 Foundations of Computing I Lecture 5, Boolean Logic and Predicates Autumn 2012 CSE 3111.
Chapter 2 Two- Level Combinational Logic. Chapter Overview Logic Functions and Switches Not, AND, OR, NAND, NOR, XOR, XNOR Gate Logic Laws and Theorems.
LOGIC GATES & BOOLEAN ALGEBRA
1 Chapter 2 Combinational logic. 2 Combinational logic Basic logic  Boolean algebra, proofs by re-writing, proofs by perfect induction  logic functions,
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
Logic Functions: XOR, XNOR
Test Slide SAT MCAT GRE. CSE 370 Spring 2006 Introduction to Digital Design Lecture 5: Canonical Forms Last Lecture Logic Gates Different Implementations.
CSE 311 Foundations of Computing I
1 Boolean Algebra  Digital circuits Digital circuits  Boolean Algebra Boolean Algebra  Two-Valued Boolean Algebra Two-Valued Boolean Algebra  Boolean.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
1 CSE370, Lecture 3 Lecture 3: Boolean Algebra u Logistics u Last lecture --- Numbers n Binary numbers n Base conversion n Number systems for negative.
1 Lect # 2 Boolean Algebra and Logic Gates Boolean algebra defines rules for manipulating symbolic binary logic expressions. –a symbolic binary logic expression.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2002 Topic2: DeMorgan Laws José Nelson Amaral.
Module 5.  In Module 3, you have learned the concept of Boolean Algebra which consists of binary variables and binary operator.  A binary variable x,
Boolean Algebra and Logic Gates
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 9 Boolean Algebras and Combinatorial Circuits.
Lecture 18: Boolean Algebra Boolean Functions. w = Chris is allowed to watch television x = Chris's homework is finished y = it is a school night z =
1 An algebraic structure consists of –a set of elements B –binary operators {+,.} –and a unary operator { ‘ } Such that following holds –Membership: B.
ECE 171 Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 2/1/2016 Copied with Permission from prof. Mark PSU ECE.
CSE 461. Binary Logic Binary logic consists of binary variables and logical operations. Variables are designated by letters such as A, B, C, x, y, z etc.
1 CSE370, Lecture 4 Lecture 4 u Logistics n HW1 due now n HW2 posted now and is due one week from today n Lab1 going on this week n Feedback on lectures,
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Chapter 2: Boolean Algebra and Logic Functions
CS 105 Digital Logic Design
ECE 331 – Digital System Design
Lecture 3: Boolean Algebra
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
CSE 311 Foundations of Computing I
Boolean Algebra.
Boolean Algebra.
Lecture 14: Boolean Algebra
CSE 370 – Winter Combinational Logic - 1
Combinatorial Logic Circuit
January 19 W’05 Yutao He 4532B Boelter Hall CSM51A/EEM16-Sec.1 W’05
CSE 311 Foundations of Computing I
Chapter 2 Introduction to Logic Circuits
Spring Combinational Logic - 1
Chapter #2: Two-Level Combinational Logic
Logic Circuits I Lecture 3.
Lecture 3: Boolean Algebra
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
Boolean Algebra Rayat Shikshan Sanstha’s
Boolean Algebra Rayat Shikshan Sanstha’s
CSE 311: Foundations of Computing
Lecture 3: Boolean Algebra
CSE 370 – Winter Number syst.; Logic functions- 1
Presentation transcript:

CSE 311 Foundations of Computing I Lecture 4, Boolean Logic Autumn 2011 CSE 3111

Announcements Homework 2 – Available for download Reading assignments – Boolean Algebra 12.1 – th Edition 11.1 – th Edition 10.1 – th Edition – Predicates and Quantifiers th Edition th and 6 th Edition Autumn 2011CSE 3112

Ugrad Autumn Career Events We strongly urge all CSE undergrads to attend our first two CSE Autumn Career Events. These events feature vital employment information for all future CSE job seekers. (Note: for CSE majors only.) Event 1: Employer Panel Date/Time: Wednesday, October 5, :30-6:30pm Place: EE125 Our first career event of autumn will provide an overview of the job search process from both the CSE student and employer perspective. Event 2: Resume Review Roundtable Workshop Date/Time: Tuesday, October 11, 3:00-6:00 pm Place: CSE Atrium In this workshop, HR reps, recruiters and engineers sit with small groups of CSE students to critique resumes, offer suggestions, and help refine the way you present yourself on paper. Message from our sponsor Autumn 2011CSE 3113

Boolean logic Combinational logic – output t = F(input t ) Sequential logic – output t = F(output t-1, input t ) output dependent on history concept of a time step (clock) An algebraic structure consists of – a set of elements B = {0, 1} – binary operations { +, } (OR, AND) – and a unary operation { ’ } (NOT ) Autumn 2011CSE 311 4

A quick combinational logic example Calendar subsystem: number of days in a month (to control watch display) – used in controlling the display of a wrist-watch LCD screen – inputs: month, leap year flag – outputs: number of days Autumn 2011CSE 311 5

Implementation in software integer number_of_days ( month, leap_year_flag) { switch (month) { case 1: return (31); case 2: if (leap_year_flag == 1) then return (29) else return (28); case 3: return (31);... case 12: return (31); default: return (0); } Autumn 2011CSE 311 6

Implementation as a combinational digital system Encoding: – how many bits for each input/output? – binary number for month – four wires for 28, 29, 30, and 31 Autumn 2011CSE leap month d28d29d30d31 monthleapd28d29d30d ––––– 0001– – – – – – – – – – – ––––– 1110––––– 1111–––––

Combinational example (cont’d) Truth-table to logic to switches to gates – d28 = “1 when month=0010 and leap=0” – d28 = m8'm4'm2m1'leap' – d31 = “1 when month=0001 or month=0011 or... month=1100” – d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) +... (m8m4m2'm1') – d31 = can we simplify more? Autumn 2011CSE monthleapd28d29d30d ––––– 0001– – – – ––––– 111––––––

Combinational example (cont’d) d28 = m8'm4'm2m1'leap’ d29 = m8'm4'm2m1'leap d30 = (m8'm4m2'm1') + (m8'm4m2m1') + (m8m4'm2'm1) + (m8m4'm2m1) = (m8'm4m1') + (m8m4'm1) d31 = (m8'm4'm2'm1) + (m8'm4'm2m1) + (m8'm4m2'm1) + (m8'm4m2m1) + (m8m4'm2'm1') + (m8m4'm2m1') + (m8m4m2'm1') Autumn 2011CSE 311 9

Combinational logic Switches Basic logic and truth tables Logic functions Boolean algebra Proofs by re-writing and by perfect induction Autumn 2011CSE

Switches: basic element of physical implementations Implementing a simple circuit (arrow shows action if wire changes to “1”): Autumn 2011CSE close switch (if A is “1” or asserted) and turn on light bulb (Z) AZ open switch (if A is “0” or unasserted) and turn off light bulb (Z) Z  A A Z

Switches (cont’d) Compose switches into more complex ones (Boolean functions): Autumn 2011CSE AND OR Z  A and B Z  A or B A B A B

Transistor networks Modern digital systems are designed in CMOS technology – MOS stands for Metal-Oxide on Semiconductor – C is for complementary because there are both normally-open and normally-closed switches MOS transistors act as voltage-controlled switches – similar, though easier to work with than relays. Autumn 2011CSE

Multi-input logic gates CMOS logic gates are inverting – Easy to implement NAND, NOR, NOT while AND, OR, and Buffer are harder Autumn 2011CSE XYZ XYZ Z X 1.8V 0V Y 1.8V XY X Z 0V Y 1.8V XY X Y Z Claude Shannon – 1938

Possible logic functions of two variables There are 16 possible functions of 2 input variables: – in general, there are 2**(2**n) functions of n inputs Autumn 2011 CSE XY16 possible functions (F 0 –F 15 ) X and Y X Y X or Y not Y not X 1 X Y F X xor Y X nor Y not (X or Y) X = Y X nand Y not (X and Y)

Boolean algebra An algebraic structure consists of – a set of elements B – binary operations { +, } – and a unary operation { ’ } – such that the following axioms hold: 1. the set B contains at least two elements: a, b 2. closure:a + b is in Ba b is in B 3. commutativity:a + b = b + aa b = b a 4. associativity:a + (b + c) = (a + b) + ca (b c) = (a b) c 5. identity:a + 0 = aa 1 = a 6. distributivity:a + (b c) = (a + b) (a + c)a (b + c) = (a b) + (a c) 7. complementarity:a + a’ = 1a a’ = 0 Autumn 2011CSE George Boole – 1854

Logic functions and Boolean algebra Any logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators: ’, +, and Autumn 2011CSE X, Y are Boolean algebra variables XYX Y XYX’Y’X YX’ Y’( X Y ) + ( X’ Y’ ) ( X Y ) + ( X’ Y’ )  X = Y XYX’X’ Y Boolean expression that is true when the variables X and Y have the same value and false, otherwise

Axioms and theorems of Boolean algebra identity 1. X + 0 = X1D. X 1 = X null 2. X + 1 = 12D. X 0 = 0 idempotency: 3. X + X = X3D. X X = X involution: 4. (X’)’ = X complementarity: 5. X + X’ = 15D. X X’ = 0 commutatively: 6. X + Y = Y + X6D. X Y = Y X associativity: 7. (X + Y) + Z = X + (Y + Z)7D. (X Y) Z = X (Y Z) distributivity: 8. X (Y + Z) = (X Y) + (X Z)8D. X + (Y Z) = (X + Y) (X + Z) Autumn 2011CSE

Axioms and theorems of Boolean algebra (cont’d) uniting: 9. X Y + X Y’ = X9D. (X + Y) (X + Y’) = X absorption: 10. X + X Y = X10D. X (X + Y) = X 11. (X + Y’) Y = X Y11D. (X Y’) + Y = X + Y factoring: 12. (X + Y) (X’ + Z) =12D. X Y + X’ Z = X Z + X’ Y (X + Z) (X’ + Y) consensus: 13. (X Y) + (Y Z) + (X’ Z) =13D. (X + Y) (Y + Z) (X’ + Z) = X Y + X’ Z (X + Y) (X’ + Z) de Morgan’s: 14. (X + Y +...)’ = X’ Y’...14D. (X Y...)’ = X’ + Y’ +... generalized de Morgan’s: 15. f ’(X 1,X 2,...,X n,0,1,+,) = f(X 1 ’,X 2 ’,...,X n ’,1,0,,+) Autumn 2011CSE

Proving theorems (rewriting) Using the laws of Boolean algebra: – e.g., prove the theorem: X Y + X Y’ = X e.g., prove the theorem: X + X Y = X Autumn 2011CSE distributivity (8) complementarity (5) identity (1D) distributivity (8) identity (2) identity (1D) X Y + X Y’ = X (Y + Y’) = X (1) = X X + X Y = X 1 + X Y = X (1 + Y) = X (1) = X

Proving theorems (perfect induction) Using perfect induction (complete truth table): – e.g., de Morgan’s: Autumn 2011CSE (X + Y)’ = X’ Y’ NOR is equivalent to AND with inputs complemented (X Y)’ = X’ + Y’ NAND is equivalent to OR with inputs complemented XYX’Y’(X + Y)’X’ Y’ XYX’Y’(X Y)’X’ + Y’

A simple example: 1-bit binary adder Inputs: A, B, Carry-in Outputs: Sum, Carry-out Autumn 2011 CSE A B Cin Cout S ABCinCoutS Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin S = A’ B’ Cin + A’ B Cin’ + A B’ Cin’ + A B Cin AAAAAAAAAA BBBBBBBBBB SSSSSSSSSS Cin Cout

Apply the theorems to simplify expressions The theorems of Boolean algebra can simplify expressions – e.g., full adder’s carry-out function Autumn 2011CSE Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin + A B Cin = A’ B Cin + A B Cin + A B’ Cin + A B Cin’ + A B Cin = (A’ + A) B Cin + A B’ Cin + A B Cin’ + A B Cin = (1) B Cin + A B’ Cin + A B Cin’ + A B Cin = B Cin + A B’ Cin + A B Cin’ + A B Cin + A B Cin = B Cin + A B’ Cin + A B Cin + A B Cin’ + A B Cin = B Cin + A (B’ + B) Cin + A B Cin’ + A B Cin = B Cin + A (1) Cin + A B Cin’ + A B Cin = B Cin + A Cin + A B (Cin’ + Cin) = B Cin + A Cin + A B (1) = B Cin + A Cin + A B adding extra terms creates new factoring opportunities

A simple example: 1-bit binary adder Inputs: A, B, Carry-in Outputs: Sum, Carry-out Autumn 2011CSE A B Cin Cout S ABCinCoutS Cout = B Cin + A Cin + A B S = A’ B’ Cin + A’ B Cin’ + A B’ Cin’ + A B Cin = A’ (B’ Cin + B Cin’ ) + A (B’ Cin’ + B Cin ) = A’ Z + A Z’ = A xor Z = A xor (B xor Cin) AAAAAAAAAA BBBBBBBBBB SSSSSSSSSS Cin Cout

From Boolean expressions to logic gates NOTX’X~X X/ ANDX YXYX  Y ORX + YX  Y Autumn 2011CSE XYZ XYZ XY0110XY0110 XYZ XYZ X Y X X Y Y Z Z

From Boolean expressions to logic gates (cont’d) NAND NOR XOR X  Y XNOR X = Y Autumn 2011CSE X Y Z XYZ XYZ XYZ XYZ Z X Y X Y Z XYZ XYZ XYZ XYZ Z X Y X xor Y = X Y’ + X’ Y X or Y but not both ("inequality", "difference") X xnor Y = X Y + X’ Y’ X and Y are the same ("equality", "coincidence")

Before Boolean minimization Cout = A'BCin + AB'Cin + ABCin' + ABCin After Boolean minimization Cout = BCin + ACin + AB Full adder: Carry-out Autumn 2011CSE 31127

Full adder: Sum Autumn 2011CSE Before Boolean minimization Sum = A'B'Cin + A'BCin' + AB'Cin' + ABCin After Boolean minimization Sum = (A  B)  Cin

Preview: A 2-bit ripple-carry adder Autumn 2011CSE A1A1 B1B1 C out C in Sum 1 A Sum C out C in B 1-Bit Adder A2A2 B2B2 Sum 2 C out C in 0

Mapping truth tables to logic gates Given a truth table: 1.Write the Boolean expression 2.Minimize the Boolean expression 3.Draw as gates 4.Map to available gates Autumn 2011CSE ABC F F = A’BC’+A’BC+AB’C+ABC = A’B(C’+C)+AC(B’+B) = A’B+AC

Canonical forms Truth table is the unique signature of a Boolean function The same truth table can have many gate realizations – we’ve seen this already – depends on how good we are at Boolean simplification Canonical forms – standard forms for a Boolean expression – we all come up with the same expression Autumn 2011CSE

Sum-of-products canonical forms Also known as disjunctive normal form Also known as minterm expansion Autumn 2011CSE ABCFF’ F = F’ = A’B’C’ + A’BC’ + AB’C’ F = A’BC+ AB’C+ ABC’ + ABC A’B’C

Sum-of-products canonical form (cont’d) Product term (or minterm) – ANDed product of literals – input combination for which output is true – each variable appears exactly once, true or inverted (but not both) Autumn 2011CSE short-hand notation for minterms of 3 variables ABCminterms 000A’B’C’m0 001A’B’Cm1 010A’BC’m2 011A’BCm3 100AB’C’m4 101AB’Cm5 110ABC’m6 111ABCm7 F in canonical form: F(A, B, C)=  m(1,3,5,6,7) = m1 + m3 + m5 + m6 + m7 = A’B’C + A’BC + AB’C + ABC’ + ABC canonical form  minimal form F(A, B, C)= A’B’C + A’BC + AB’C + ABC + ABC’ = (A’B’ + A’B + AB’ + AB)C + ABC’ = ((A’ + A)(B’ + B))C + ABC’ = C + ABC’ = ABC’ + C = AB + C

Product-of-sums canonical form Also known as conjunctive normal form Also known as maxterm expansion Autumn 2011CSE ABCFF’ F = F = F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’) (A + B + C)(A + B’ + C) (A’ + B + C)

Product-of-sums canonical form (cont’d) Sum term (or maxterm) – ORed sum of literals – input combination for which output is false – each variable appears exactly once, true or inverted (but not both) Autumn 2011CSE ABCmaxterms 000A+B+CM0 001A+B+C’M1 010A+B’+CM2 011A+B’+C’M3 100A’+B+CM4 101A’+B+C’M5 110A’+B’+CM6 111A’+B’+C’M7 short-hand notation for maxterms of 3 variables F in canonical form: F(A, B, C)=  M(0,2,4) = M0 M2 M4 = (A + B + C) (A + B’ + C) (A’ + B + C) canonical form  minimal form F(A, B, C)= (A + B + C) (A + B’ + C) (A’ + B + C) = (A + B + C) (A + B’ + C) (A + B + C) (A’ + B + C) = (A + C) (B + C)

S-o-P, P-o-S, and de Morgan’s theorem Complement of function in sum-of-products form – F’ = A’B’C’ + A’BC’ + AB’C’ Complement again and apply de Morgan’s and get the product-of-sums form – (F’)’ = (A’B’C’ + A’BC’ + AB’C’)’ – F = (A + B + C) (A + B’ + C) (A’ + B + C) Complement of function in product-of-sums form – F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’) Complement again and apply de Morgan’s and get the sum-of-product form – (F’)’ = ( (A + B + C’)(A + B’ + C’)(A’ + B + C’)(A’ + B’ + C)(A’ + B’ + C’) )’ – F = A’B’C + A’BC + AB’C + ABC’ + ABC Autumn 2011CSE