IB Computer Science Computer Organization

Slides:



Advertisements
Similar presentations
Digital Circuits.
Advertisements

Boolean Algebra and Reduction Techniques
Boolean Algebra and Combinational Logic
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Propositional Calculus Math Foundations of Computer Science.
In this module you will learn: What the various logic gates do. How to represent logic gates on a circuit diagram. The truth tables for the logic gates.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals with PLD Programming.
Digital Logic ENEL 111. Digital systems A digital system is a system whose inputs and outputs fall within a discrete, finite set of values Two main types.
1 Fundamentals of Computer Science Propositional Logic (Boolean Algebra)
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
1 The Chinese University of Hong Kong Faculty of Education Diploma in Education (Part-Time) Winter 1997 Educational Communications and Technology Assignment.
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.
Lecture 22: 11/19/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
LOGIC GATES AND CIRCUITS Digital systems are said to be constructed by using logic gates. These gates are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates.
IT253: Computer Organization Lecture 7: Logic and Gates: Digital Design Tonga Institute of Higher Education.
LOGIC GATES & BOOLEAN ALGEBRA
ECE 301 – Digital Electronics Basic Logic Operations, Boolean Expressions, and Boolean Algebra (Lecture #3)
Floyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd Chapter 5 © 2008 Pearson Education.
Boolean Algebra and Reduction Techniques
1 EENG 2710 Chapter 2 Algebraic Methods For The Analysis and Synthesis of Logic circuits.
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
BOOLEAN ALGEBRA LOGIC GATES. Introduction British mathematician George Boole( ) was successful in finding the link between logic and mathematics.
EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Boolean Algebra & Logic Gates
Basics of Logic gates - Part 2
Combinational Circuits Part 1
Morgan Kaufmann Publishers
Department of Preparatory Year, Umm Al Qura University
Logic Gates and Boolean Algebra
Chapter 3 Notes – Part II Review Questions
De Morgan’s Theorem,.
Digital Fundamentals Floyd Chapter 5 Tenth Edition
DeMorgan’s Theorem DeMorgan’s 2nd Theorem
ECE 2110: Introduction to Digital Systems
Unit 2 Boolean Algebra.
ECE 20B, Winter 2003 Introduction to Electrical Engineering, II LECTURE NOTES #2 Instructor: Andrew B. Kahng (lecture)
Boolean Algebra & De Morgan's Theorems
Logic Gates and Boolean Algebra
CHAPTER 1 : INTRODUCTION
Digital Logic.
Boolean Algebra and Combinational Logic
Boolean Algebra.
Princess Sumaya University
Boolean Algebra – Part 1 ECEn 224.
SLIDES FOR CHAPTER 2 BOOLEAN ALGEBRA
Reading: Hambley Chapters
Digital Fundamentals Floyd Chapter 5 Tenth Edition
Propositional Calculus: Boolean Algebra and Simplification
BASIC & COMBINATIONAL LOGIC CIRCUIT
Combinatorial Logic Circuit
Boolean Algebra.
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION Part (a)
Digital Fundamentals Floyd Chapter 5 Tenth Edition
GCSE Computer Science – Logic Gates & Boolean Expressions
Logic Gates By Dr.Mazin Alzewary
From now on: Combinatorial Circuits:
Digital Fundamentals Floyd Chapter 4 Tenth Edition
ECE 352 Digital System Fundamentals
Digital Fundamentals Floyd Chapter 5 Tenth Edition
Digital Fundamentals Floyd Chapter 5 Tenth Edition
Digital Fundamentals Floyd Chapter 5 Tenth Edition
Design of Digital Circuits Lab 1 Supplement: Drawing Basic Circuits
Chapter 5 Combinational Logic Analysis
Digital Fundamentals Floyd Chapter 5 Tenth Edition
Combinational Logic Circuit
Laws & Rules of Boolean Algebra
Chapter 3 – Describing Logic Circuits
Presentation transcript:

IB Computer Science Computer Organization Part 4 – Digital Logic, Logic Gates, and Boolean Expressions

What the IB curriculum says…

Boolean Algebra

Boolean Algebra A variant of algebra where values can only be TRUE (1) or FALSE (0) Core operators are not addition, multiplication, etc. Instead we use AND, OR, and NOT. Others covered are NAND, NOR, and XOR. Others exist, but aren’t covered on the IB test.

Boolean Notation Variables are what you’re used to: X, Y, A, B, etc. Values can only be 0 or 1 (or True/False) Core functions notation: NOT = A’ (A prime) – sometimes shown as 𝐴 AND looks like multiplication: AB, or A·B, or sometimes A˄B OR looks like addition: A+B, or sometimes A˅B Let’s look at the details for each one…

NOT operator NOT just means the opposite Notation reminder: A’ Since the only values are 0 and 1: 0’ = 1 1’ = 0 So if A = 0, A’ = 1, and if B = 1, B’ = 0 A TRUTH TABLE for NOT is here: In circuit design, we use a NOT gate, also called and inverter (the circle means flip or invert): So this means we can trace through a circuit… A A’ 1

AND operator AB AND usually has multiple inputs Notation reminder: AB, or A·B, or A˄B Output is TRUE (1) only if both inputs are TRUE (1) AB = 1 only if A=1 and B=1 The TRUTH TABLE is: The circuit symbol is: A B A B AB 1 AB

OR operator A+B OR usually has multiple inputs Notation reminder: A + B, or sometimes A˅B Output is TRUE (1) if either or both inputs are TRUE (1) AB = 1 if A=1 OR B=1 (or both =1) The TRUTH TABLE is: The circuit symbol is: A B A B A+B 1 A+B

IB Test Specifics On the IB Test, you don’t have to remember the symbols for these, but you should learn them anyways for college Just remember the types of logic AND OR NOT Coming later… NAND NOR XOR And draw them as: AND

Boolean Expressions

Boolean Expressions …like algebraic expressions in some ways. We use them to define the result of processing inputs with logic gates Parenthesis can be used to define precedence The priority for precedence is: Work expressions inside parenthesis first NOT AND OR

Boolean expression examples Example 1: If I did my homework (A) AND didn't play video games(B represents playing video games), then I get ice cream for dessert. AB' represents whether I get ice cream AB’ take the opposite of B first, then AND with A Example 2: If I did my homework (B) AND fed the dog (C), OR I babysat my sister (A), then I can watch Daredevil on Netflix. A + BC represents whether I can watch Netflix A+BC take AND of BC first, then OR with A

More practice, the other way Write on paper, the equations of: Y=?? X=?? Draw a diagram using all three types of symbols, and have your partner solve it by writing the equation

Example 1: Solving an equation for a specific set of inputs For the equation: (A+B)’ + CD(E+FG’) Solve where A=1, B=0, C=1, D=1, E=0, F=1, and G=0 What does the above expression result in? Note you can show the result in: Words A TRUTH TABLE A Boolean Expression as above A Circuit diagram These are all equivalent solutions, just different ways to look at it Let’s create a TRUTH TABLE, and a Circuit for the above We’ll work this one together on the Whiteboard… TURN OFF YOUR MONITORS, DON’T LOOK AHEAD IN THE SLIDES

Whiteboard:(A+B)’ + CD(E+FG’) Solve where A=1, B=0, C=1, D=1, E=0, F=1, and G=0 Truth Table (add columns for the expression parts) Circuit diagram (work from inside out, and down) A B C D E F G G' FG' etc 1

Example 1 solution for review (A+B)’ + CD(E+FG’) A TRUTH TABLE if A=1, B=0, C=1, D=1, E=0, F=1, and G=0 Circuit Diagram A B C D E F G A+B (A+B)’ G’ FG’ (E+FG’) CD CD(E+FG’) (A+B)’ + CD(E+FG’) 1 You can fill out all of the other combinations too, but that’s a lot of work!

Example 2 A car has 3 sensors Create: K is TRUE if the key is in the ignition D is TRUE if the door is open L is TRUE if the lights are on Output Buzzer B should be true if: The lights are on when the key is not in the ignition, or when the door is open and the key is in the ignition Create: A Boolean expression A FULL truth table showing all 8 combinations of inputs (0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0), etc. A circuit diagram using logic gates TURN OFF YOUR MONITORS AGAIN. DON’T LOOK AT THE NEXT SLIDE. IT’S THERE FOR REVIEW WHEN YOU'RE RESTUDYING THIS Work with a partner or two

Example 2 solution for review LK’ + DK = B L K D B 1

Practice tools for logic gates In the Unit 2 folder on the Google drive, open the Logic Circuit folder and install Cedar Logic Simulator (CedarLSSetup.exe) Use it to drag and drop gates, connect them, and test out how they work. Focus on the top 3 categories of gates: Basic Gates (AND, OR, and later NAND, NOR, XOR) Invert and Connect (INVERTER = NOT, From and To with the Oscilloscope feature) Input and Output (On/Off Switches, Square Wave, LED for output) Use View, OScope to use the Oscilloscope feature with square waves Requires Using the To block to measure something on the scope Double click the To block to relabel it Double click the Square Wave block to change its frequency

Cedar Logic Sim (AND gate) We’ll build this together so you can become familiar with the tool

Exercise: Build Ex 2 in Cedar 3 Inputs: Lights, Key, Door (Connect to on/off switches) One Output: B for Buzzer (Connect to an LED) Add in and connect up the gates Test it out by flipping the switches to see if the LED comes on when appropriate (simulates the buzzer going off)

Example 3 Convert this circuit diagram to a Boolean expression Create and analyze this in Cedar Create a full TRUTH TABLE showing X for all 8 input combos Also, if A=1, B=1 and C = 0, what is X? TURN OFF YOUR MONITORS AGAIN. DON’T LOOK AT THE NEXT SLIDE. IT’S THERE FOR LATER REVIEW

Example 3 solution for review If A=1, B=1 and C = 0, what is X? Working through: AB=1 B’C = 0 (B’C)’=1 AB+(B’C)’ = 1 (AB+(B’C)’)’ = 0 A B C X 1

Simplifying Expressions If Q = (A’ + B)’C + AC’ Then we have this TRUTH TABLE Looking at the table, we see that Q is 1 when A is 1, except if B AND C are both 1 Thus, we can simplify to: Q=A(BC)’ What do the circuits look like? Which is simpler? Which would cost less to implement using gates? A B C Q 1

Other ways to simplify The following are the basic Boolean theorems. They are used to simplify boolean expressions. You'll cover these in detail in college. Idempotent Law A * A = A A + A = A Associative Law (A * B) * C = A * (B * C) (A + B) + C = A + (B + C) Commutative Law A * B = B * A A + B = B + A Distributive Law A * (B + C) = A * B + A * C A + (B * C) = (A + B) * (A + C) Identity Law A * 0 = 0     A * 1 = A A + 1 = 1     A + 0 = A Complement Law A * A' = 0 A + A' = 1 Involution Law (A')' = A DeMorgan's Law (A * B)' = A' + B' (A + B)' = A' * B'

One Simplification Example Simplify: C + (BC)': Expression Rule(s) Used C + (BC)' Original Expression C + (B' + C') DeMorgan's Law (BC)' = B' + C'. (C + C') + B' Commutative, Associative Laws. True + B' Complement Law. True Identity Law. Lots of examples online to see more: search for Boolean Expression Simplification

NAND and NOR gates

NAND and NOR are special NAND is just the inversion of AND NOR is just the inversion or OR The electronics (silicon chip design) is typically faster than AND and OR, and cheaper to build (less transistors) Interestingly, any circuit can be built using just NAND and NOR gates

NAND gates: X AND Y, Inverted XY (XY)’ 1 NAND = (XY)’ Symbol and TT: Where the dot means take the opposite of AND If the inputs are X and Y, then the output is (XY)’ Looking at the TT: the output is the same as: X’ + Y’ X Y X’ Y’ X’+Y’ (XY)’ 1

NOR gates: X or Y, inverted X+Y (X+Y)’ 1 NOR = (X+Y)’ Symbol and TT: Where the dot means take the opposite of OR If the inputs are X and Y, then the output is (X+Y)’ Looking at the TT: the output is the same as: X’Y’ X Y X’ Y’ X’Y’ (X+Y)’ 1

Alternative/equivalent gates As we saw above from the Truth Tables: NAND = (XY)’ = X’ + Y’ NOR = (X + Y)’ = X’Y’ AND = XY = (X’ + Y’)’ OR = X + Y = (X’Y’)’

AND/OR, NAND/NOR equivalency Many expressions are written like: AB+CD - a Sum of Products, or SOP (A+B)(C+D) - a Product of Sums, or POS Which yielded circuits using AND and OR gates We’ve said these gates are more expensive and slower than NAND and NOR gates

AND/OR, NAND/NOR equivalency But we can also use NAND and NOR gates For a Sum of Products (SOP), we can just use NAND gates Replace with Because: NAND = (XY)’ = X’ + Y’ The negatives (NOTs) cancel, Leaving AND / OR combo: =

AND/OR, NAND/NOR equivalency Similarly for Product of Sums, or POS, we can just use NOR gates Because: NOR= (X + Y)’ = X’Y’ Replace with The negatives (NOTs) cancel, Leaving OR / AND combo: =

AND/OR, NAND/NOR equivalency Summary If you have an SOP expression F = AB+A’C+B’D you can use AND / OR gates, or JUST NAND gates If you have a POS expression F = (A+B’)(C’+D) you can use OR / AND gates, or JUST NOR gates Also use inverters (NOTs) when needed

NAND Examples for SOP

NOR examples for POS

Exclusive OR (XOR)

XOR operator XOR is TRUE if either input is TRUE, but NOT BOTH INPUTS Notation: A B Output is TRUE (1) only if one input is TRUE (1) A B = 1 only if A=1 OR B=1 The TRUTH TABLE is: The circuit symbol is: A B XOR 1

XOR Example Create a truth table for A XOR (B OR C) Solution: Fill out the ABC values (000, 001, 010, 011, 100, 101, etc.) Do B OR C first – the stuff in parenthesis Now do column A XOR'd with column (B OR C) Answer is True(1) only if one or the other column is 1 (but not both) A B C (B OR C) A XOR (B OR C) 1

Summary of Gates Venn diagrams overlap with Math, Logic, Reason, TOK 𝐴 is same as A’ i.e., NOT

Boolean Algebra Theorems (for reference, not on tests) Idempotent Law A * A = A A + A = A Associative Law (A * B) * C = A * (B * C) (A + B) + C = A + (B + C) Commutative Law A * B = B * A A + B = B + A Distributive Law A * (B + C) = A * B + A * C A + (B * C) = (A + B) * (A + C) Identity Law A * 0 = 0     A * 1 = A A + 1 = 1     A + 0 = A Complement Law A * ~A = 0 A + ~A = 1 Involution Law ~(~A) = A DeMorgan's Law ~(A * B) = ~A + ~B ~(A + B) = ~A * ~B You can use these to simplify expressions manually. In college, you’ll do this, along with something called Karnaugh maps (K Maps)