CS1022 Computer Programming & Principles

Slides:



Advertisements
Similar presentations
CS1022 Computer Programming & Principles Lecture 9.2 Boolean Algebra (2)
Advertisements

CS1022 Computer Programming & Principles
Chapter 9: Boolean Algebra
Propositional Calculus Math Foundations of Computer Science.
Computer Organization and Assembly Language: Chapter 7 The Karnaugh Maps September 30, 2013 By Engineer. Bilal Ahmad.
PHY 201 (Blum)1 Karnaugh Maps References: Chapters 4 and 5 in Digital Principles (Tokheim) Chapter 3 in Introduction to Digital Systems (Palmer and Perlman)
Boolean Algebra and Logic Simplification
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
Chapter 3.5 Logic Circuits. How does Boolean algebra relate to computer circuits? Data is stored and manipulated in a computer as a binary number. Individual.
CS1Q Computer Systems Lecture 8
Discrete Mathematics CS 2610 February 19, Logic Gates: the basic elements of circuits Electronic circuits consist of so-called gates connected.
1 Digital Logic Design Week 5 Simplifying logic expressions.
Apr. 3, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 3: Review of Digital Circuits and Logic Design Jeremy R. Johnson Mon. Apr.
Karnaugh Maps References:
Discrete Mathematics and Its Applications.  The English mathematician George Boole ( ) sought to give symbolic form to Aristotle's system of.
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CS1Q Computer Systems Lecture 7
February 2, 2004CS 2311 Karnaugh maps Last time we saw applications of Boolean logic to circuit design. – The basic Boolean operations are AND, OR and.
Computer Systems 1 Fundamentals of Computing Simplifying Boolean Expressions.
CS231 Boolean Algebra1 Summary so far So far: – A bunch of Boolean algebra trickery for simplifying expressions and circuits – The algebra guarantees us.
Karnaugh Mapping Digital Electronics. Karnaugh Mapping or K-Mapping This presentation will demonstrate how to Create and label two, three, & four variable.
June 12, 2002© Howard Huang1 Karnaugh maps Last time we saw applications of Boolean logic to circuit design. – The basic Boolean operations are.
BOOLEAN ALGEBRA LOGIC GATES. Introduction British mathematician George Boole( ) was successful in finding the link between logic and mathematics.
Karnaugh Maps The minimization method using Boolean Algebra, apart from being laborious and requiring the remembering all the laws, can lead to solutions.
K-maps and Decoders Prof. Sin-Min Lee Department of Computer Science.
Mu.com.lec 9. Overview Gates, latches, memories and other logic components are used to design computer systems and their subsystems Good understanding.
Chapter 12. Chapter Summary Boolean Functions Representing Boolean Functions Logic Gates Minimization of Circuits (not currently included in overheads)
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Digital Logic.
CHAPTER 3 Simplification of Boolean Functions
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
Minimization of Circuits
ECE 2110: Introduction to Digital Systems
ECE 3110: Introduction to Digital Systems
CS 352 Introduction to Logic Design
Dr. Clincy Professor of CS
Digital Logic.
CHAPTER 3 SETS AND BOOLEAN ALGEBRA
Karnaugh Map Method.
Lecture 3 Gunjeet Kaur Dronacharya Group of Institutions
Jeremy R. Johnson Wed. Sept. 29, 1999
Computer Science 210 Computer Organization
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
Propositional Calculus: Boolean Algebra and Simplification
Dr. Clincy Professor of CS
BASIC & COMBINATIONAL LOGIC CIRCUIT
Karnaugh Mapping Karnaugh Mapping Digital Electronics
SYEN 3330 Digital Systems Chapter 2 – Part 4 SYEN 3330 Digital Systems.
Karnaugh Mapping Digital Electronics
Karnaugh Mapping Karnaugh Mapping Digital Electronics
Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: We can represent.
Karnaugh Mapping Digital Electronics
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Chapter 10.3 and 10.4: Combinatorial Circuits
CS Chapter 3 (3A and ) – Part 3 of 5
Dr. Clincy Professor of CS
From now on: Combinatorial Circuits:
3-Variable K-map AB/C AB/C A’B’ A’B AB AB’
Karnaugh Maps (K maps).
Karnaugh maps Last time we saw applications of Boolean logic to circuit design. The basic Boolean operations are AND, OR and NOT. These operations can.
Analysis of Logic Circuits Example 1
Basic circuit analysis and design
Copyright © Cengage Learning. All rights reserved.
Chapter 11 (Part 2): Boolean Algebra
Circuit Simplification and
Computer Architecture
Presentation transcript:

CS1022 Computer Programming & Principles Lecture 2 Boolean Algebra

Plan of lecture Simplifying Boolean expressions Karnaugh maps Logic circuits CS1022

Simplifying Boolean expressions (1) Given a Boolean expression, can we find a “simpler” equivalent expression? “Simpler” = “fewer symbols” Technique applied to disjunctive normal form (DNF) Even though it might be more complex than original Process: original expr.  DNF  simplified expr. Technique restricted to at most 3 Boolean variables Extension to more variables is possible CS1022

Simplifying Boolean expressions (2) To simplify, let’s suppress “” Just like “” in algebra can be dropped (e.g., 2y = 2  y) For instance, the expression in disjunctive normal form (p q r)  (p q  r)  (p  q r) Will be represented as pqr  pqr  pqr We can simplify the above expression as follows: pqr  pqr  pqr  (prq  prq)  pqr Comm.& assoc. Laws pr(q q)  pqr Distr. Law pr  pqr Since q q = 1 CS1022

Simplifying Boolean expressions (3) Compare pr  pqr and pqr  pqr  pqr They are equivalent – all changes done via a “law” It is much simpler than original expression Very important: simplification can be automated Each step in the process is an operation Sequence of steps terminates at some point Notice: First step puts together two minterms which differed by one symbol Second step reduced two terms to one CS1022

Karnaugh maps (1) Simplification done via a Karnaugh map “Device” invented in the 1950s to help circuit design Uses a visual display to indicate which pairs of minterms can be merged as a simpler expression For Boolean expressions with 3 variables (p, q and r) Karnaugh map is a table with 2 rows and 4 columns Columns labelled with all possible disjunctions of p and q and their negations Rows labelled with r and r pq pq pq pq r r CS1022

Karnaugh maps (2) pq pq pq pq r 1 r As we move from column to column precisely one change occurs in the column label Cells correspond to 8 different minterms stemming from 3 Boolean variables For a given Boolean expression, we write “1” in each cell whose row/column expression appears For instance, pqr  pqr  pqr has map pq pq pq pq r 1 r CS1022

Karnaugh maps (3) pq pq pq pq r 1 r Required simplification suggested by “clusters” of 1s Shaded in green here There is only one such cluster in the example Corresponds to terms we combined using the laws pq pq pq pq r 1 r CS1022

Karnaugh maps (3) Relabelling columns preserves adjacency Some clusters may be “hidden” NB relabelling must be consistent with requirement that adjacent columns differ by one symbol only Example: Karnaugh map of pqr  pqr  pqr Relabelling columns produces an alternative Karnaugh map and reveals a pair of adjacent minterms pq pq pq pq r 1 r pq pq pq pq r 1 r CS1022

Karnaugh maps (4) pq pq pq pq r 1 r Hence, pqr  pqr  pqr  pqr  pr(q q) pqr  pr pq pq pq pq r 1 r CS1022

Karnaugh maps (5) Let’s simplify pqr  pqr  pqr  pqr  pqr It contains a cluster of 4 (A) and a pair (B) There are no hidden pairs We must try relabelling exhaustively pq pq pq pq r 1 r CS1022

Karnaugh maps (6) Cluster (A) corresponds to pq pq pq pq r 1 r pqr  pqr  pqr  pqr  (p  p)qr  (p  p)qr qr  qr q(r  r) q CS1022

Karnaugh maps (7) Cluster (B) corresponds to So, simplified expression is q  pr pq pq pq pq r 1 r pqr  pqr  pr(q  q) pr CS1022

Logic circuits (1) One of the main application of Boolean algebra is the design of binary devices They accept a (finite) number of inputs They produce a (finite) number of outputs Binary: only two possible values for each input & output Circuits as “black boxes”: ? p1 q1 p2 q2 p3 q3 ... ... pn qm CS1022

Logic circuits (2) Devices are built of logic gates which perform basic Boolean operations (, , and ) a b a  b OR gate a b a  b AND gate a a NOT gate a b (a  b) NAND gate CS1022

Logic circuits (3) Interconnecting gates produces a logical circuit A logical circuit evaluates a Boolean expression Example: What is the final output of this circuit? 4 3 2 1 p q r 5 6 7 CS1022

Logic circuits (4) Example: What is the final output of this circuit? pq pq pqr pqr pqr pqr  pqr 4 3 2 1 p q r 5 6 7 4 3 2 1 p q r 5 6 7 4 3 2 1 p q r 5 6 7 4 3 2 1 p q r 5 6 7 pqr  pqr  pqr CS1022

Logic circuits (5) Solution: pqr  pqr  pqr Gate Inputs Output 1 2 p, q pq 3 pq, r pqr 4 pq, r pqr 5 pq, r pqr 6 pqr, pqr pqr  pqr 7 pqr  pqr, pqr pqr  pqr  pqr CS1022

Logic circuits (6) Logic circuits can be simplified if we allow AND and OR gates to have more than 2 inputs More dramatic simplifications w/ Karnaugh maps 2 clusters (one hidden) We can simplify things: pqr  pqr  pq(r  r)  pq pqr  pqr  (q  q)pr  pr That is, pqr  pqr  pqr  pq  pr We can further simplify this as p(q  r) pq pq pq pq r 1 r CS1022

Logic circuits (7) With p(q  r), we simplify previous circuit to obtain p q r CS1022

Further reading R. Haggarty. “Discrete Mathematics for Computing”. Pearson Education Ltd. 2002. (Chapter 9) Wikipedia’s entry on Boolean algebra Wikibooks entry on Boolean algebra CS1022