CSE 311 Foundations of Computing I

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.
1 CK Cheng CSE Dept. UC San Diego CS 140, Lecture 2 Combinational Logic.
ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE 301 – Digital Electronics Minterm and Maxterm Expansions and Incompletely Specified Functions (Lecture #6) The slides included herein were taken from.
1 CK Cheng CSE Dept. UC San Diego CS 140, Lecture 2 Combinational Logic.
CK Cheng Tuesday 10/2/02 CS 140 Lecture 2. Part I. Combinational Logic I) Specification –a. Language –b. Truth Table –c. Boolean Algebra –d. Incompletely.
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
1 CSE 20: Lecture 7 Boolean Algebra CK Cheng 4/21/2011.
Propositional Calculus Math Foundations of Computer Science.
Chapter 2: Boolean Algebra and Logic Functions
Lecture 4 Logic gates and truth tables Implementing logic functions
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
ECE 331 – Digital System Design
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.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
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.
Logic Gates Shashidhara H S Dept. of ISE MSRIT. Basic Logic Design and Boolean Algebra GATES = basic digital building blocks which correspond to and perform.
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
Logic Functions: XOR, XNOR
CSE 311 Foundations of Computing I
Discrete Mathematics CS 2610 September Equal Boolean Functions Two Boolean functions F and G of degree n are equal iff for all (x 1,..x n )  B.
Computer Systems 1 Fundamentals of Computing Simplifying Boolean Expressions.
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.
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,
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 9 Boolean Algebras and Combinatorial Circuits.
CSE 311 Foundations of Computing I Lecture 4, Boolean Logic Autumn 2011 CSE 3111.
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,
Boolean Algebra & Logic Gates
ECE 301 – Digital Electronics
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
© Copyright 2004, Gaetano Borriello and Randy H. Katz
De Morgan’s Theorem,.
Chapter 2: Boolean Algebra and Logic Functions
CS 105 Digital Logic Design
Princess Sumaya University
Jeremy R. Johnson Wed. Sept. 29, 1999
ECE 331 – Digital System Design
Lecture 3: Boolean Algebra
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
Boolean Algebra.
Boolean Algebra.
Lecture 14: Boolean Algebra
Chapter 2 Boolean Algebra and Logic Gate
CSE 370 – Winter Combinational Logic - 1
Combinatorial Logic Circuit
January 19 W’05 Yutao He 4532B Boelter Hall CSM51A/EEM16-Sec.1 W’05
February 7, 2002 John Wawrzynek
Boolean Algebra Introduction CSCI 240
CSE 311 Foundations of Computing I
Chapter 2 Introduction to Logic Circuits
Spring Combinational Logic - 1
Lecture 5 Logistics Last lecture Today’s lecture
COMS 361 Computer Organization
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 Algebra and Circuits Spring 2013

Administrative Course web: http://www.cs.washington.edu/311 Homework: Homework, Lecture slides, Office Hours, ... Worksheets from Section, too Homework: Due Wednesday at the start of class

Announcements Reading assignments Boolean Algebra 12.1 – 12.3 7th Edition 11.1 – 11.3 6th Edition For next time: Predicates and Quantifiers 1.4 7th Edition 1.3 6th Edition

Highlights from last lecture Calendar: Number of Days in a Month Encoding: how many bits for each input/output? binary number for month four wires for 28, 29, 30, and 31 month leap d28 d29 d30 d31 0000 – – – – – 0001 – 0 0 0 1 0010 0 1 0 0 0 0010 1 0 1 0 0 0011 – 0 0 0 1 0100 – 0 0 1 0 0101 – 0 0 0 1 0110 – 0 0 1 0 0111 – 0 0 0 1 1000 – 0 0 0 1 1001 – 0 0 1 0 1010 – 0 0 0 1 1011 – 0 0 1 0 1100 – 0 0 0 1 1101 – – – – – 1110 – – – – – 1111 – – – – – leap month d28 d29 d30 d31

Highlights from last lecture Calendar: Number of Days in a Month d28 = m8'•m4'•m2•m1'•leap’ d29 = m8'•m4'•m2•m1'•leap d30 = (m8'•m4•m2'•m1') + (m8'•m4•m2•m1') + (m8•m4'•m2'•m1) + (m8•m4'•m2•m1) = (m8'•m4•m1') + (m8•m4'•m1) d31 = (m8'•m4'•m2'•m1) + (m8'•m4'•m2•m1) + (m8'•m4•m2'•m1) + (m8'•m4•m2•m1) + (m8•m4'•m2'•m1') + (m8•m4'•m2•m1') + (m8•m4•m2'•m1')

Highlights from last lecture Boolean algebra to circuit design Boolean algebra a set of elements B = {0, 1} 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 B a • b is in B 3. commutativity: a + b = b + a a • b = b • a 4. associativity: a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c 5. identity: a + 0 = a a • 1 = a 6. distributivity: a + (b • c) = (a + b) • (a + c) a • (b + c) = (a • b) + (a • c) 7. complementarity: a + a’ = 1 a • a’ = 0 George Boole – 1854

Axioms and theorems of Boolean algebra identity 1. X + 0 = X 1D. X • 1 = X null 2. X + 1 = 1 2D. X • 0 = 0 idempotency: 3. X + X = X 3D. X • X = X involution: 4. (X’)’ = X complementarity: 5. X + X’ = 1 5D. X • X’ = 0 commutatively: 6. X + Y = Y + X 6D. 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)

Axioms and theorems of Boolean algebra (cont.) uniting: 9. X • Y + X • Y’ = X 9D. (X + Y) • (X + Y’) = X absorption: 10. X + X • Y = X 10D. X • (X + Y) = X 11. (X + Y’) • Y = X • Y 11D. (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’ + ...

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 distributivity (8) complementarity (5) identity (1D) X • Y + X • Y’ = X • (Y + Y’) = X • (1) = X identity (1D) distributivity (8) uniting (2) X + X • Y = X • 1 + X • Y = X • (1 + Y) = X • (1) = X

Proving theorems (truth table) Using complete truth table: e.g., de Morgan’s: X Y X’ Y’ (X + Y)’ X’ • Y’ 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 (X + Y)’ = X’ • Y’ NOR is equivalent to AND with inputs complemented X Y X’ Y’ (X • Y)’ X’ + Y’ 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 (X • Y)’ = X’ + Y’ NAND is equivalent to OR with inputs complemented

A simple example: 1-bit binary adder A A A A A B B B B B S S S S S Cin Cout Inputs: A, B, Carry-in Outputs: Sum, Carry-out A B Cin Cout S A B Cin Cout S 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 S = A’ B’ Cin + A’ B Cin’ + A B’ Cin’ + A B Cin Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin

Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin

Apply the theorems to simplify expressions The theorems of Boolean algebra can simplify expressions e.g., full adder’s carry-out function 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

S = A’ B’ Cin + A’ B Cin’ + A B’ Cin’ + A B Cin

A simple example: 1-bit binary adder A A A A A B B B B B S S S S S Cin Cout Inputs: A, B, Carry-in Outputs: Sum, Carry-out A B Cin Cout S A B Cin Cout S 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 Cout = B Cin + A Cin + A B S = A xor (B xor Cin)

Recall Gates NOT X’ X X AND X • Y XY X  Y OR X + Y X  Y X Y 0 1 1 0 X Y Z 0 0 0 0 1 0 1 0 0 1 1 1 X Y Z X Y Z X Y Z 0 0 0 0 1 1 1 0 1 1 1 1

Recall gates (cont) NAND NOR XOR X Y XNOR X ↔ Y, X = Y Z X Y Z 0 0 1 0 1 1 1 0 1 1 1 0 X Y Z 0 0 1 0 1 0 1 0 0 1 1 1 X Y Z 0 0 0 0 1 1 1 0 1 NAND NOR XOR X Y XNOR X ↔ Y, X = Y

A 2-bit ripple-carry adder 1-Bit Adder Cin Cout Cin Cout Cin Cout Sum1 Sum2 Sum

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

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

Sum-of-products canonical form Also known as Disjunctive Normal Form (DNF) Also known as minterm expansion F = 001 011 101 110 111 + ABC’ + ABC A’B’C + AB’C + A’BC F = A B C F F’ 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 F’ = A’B’C’ + A’BC’ + AB’C’

Sum-of-products canonical form (cont) 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) A B C minterms 0 0 0 A’B’C’ m0 0 0 1 A’B’C m1 0 1 0 A’BC’ m2 0 1 1 A’BC m3 1 0 0 AB’C’ m4 1 0 1 AB’C m5 1 1 0 ABC’ m6 1 1 1 ABC m7 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 short-hand notation for minterms of 3 variables

Product-of-sums canonical form Also known as Conjunctive Normal Form (CNF) Also known as maxterm expansion F = 000 010 100 F = (A + B’ + C) (A’ + B + C) (A + B + C) A B C F F’ 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)

Product-of-sums canonical form (cont) 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) A B C maxterms 0 0 0 A+B+C M0 0 0 1 A+B+C’ M1 0 1 0 A+B’+C M2 0 1 1 A+B’+C’ M3 1 0 0 A’+B+C M4 1 0 1 A’+B+C’ M5 1 1 0 A’+B’+C M6 1 1 1 A’+B’+C’ M7 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) short-hand notation for maxterms of 3 variables