1 4. Computer Maths and Logic 4.2 Boolean Logic. 4.2.1 Boolean Operators.

Slides:



Advertisements
Similar presentations
Logic Gates.
Advertisements

Digital logic gates.
CT455: Computer Organization Logic gate
Programmable Logic Controllers.
Computer Systems – Logic Gates Introduce the basic logic gates Introduce truth tables Introduce Boolean algebra (dont panic!) Examples of combining gates.
Universal Gates Sum of Products Products of Sum
Boolean Algebra and Logic Gate
Basic Logical Operations (Fascinating)
James Tam AND OR NOT NAND NOR XOR Basic logic operations (fascinating)
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.
Simple One and Two Input Logic Gates Truth Tables and Function Tables Based Upon TTL Levels.
Logic Circuits In today’s lesson we will look at: the symbols for NOT, AND, OR and EOR using truth tables to represent logic circuits two new operators.
22C:19 Discrete Math Boolean Algebra & Digital Logic Fall 2010 Sukumar Ghosh.
Logical Circuit Design Week 5: Combinational Logic Circuits Mentor Hamiti, MSc Office ,
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
Logic gates & Boolean Algebra. Introduction Certain components (called logic elements) of the computer combine electric pulses using a set of rules. Electric.
TODAY YOU ARE LEARNING to explain why data is represented in computer systems in binary form 2. to understand and produce simple logic diagrams.
CS1502 Formal Methods in Computer Science
 In studying digital integrated circuits, one must start with the simplest group of circuit, the SSIs or Small Scale Integrated Circuits. Since these.
Logic Disjunction A disjunction is a compound statement formed by combining two simple sentences using the word “OR”. A disjunction is true when at.
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.
Week 6: Gates and Circuits: PART I READING: Chapter 4.
Sneha.  Gates Gates  Characteristics of gates Characteristics of gates  Basic Gates Basic Gates  AND Gate AND Gate  OR gate OR gate  NOT gate NOT.
A-Level Computing#BristolMet Session Objectives#6 MUST understand and produce simple logic diagrams using the operations NOT, AND and OR SHOULD explain.
Linear Algebra. Circuits The circuits in computers and other input devices have inputs, each of which is either a 0 or 1, the output is also 0s and 1s.
1 2. Program Construction in Java. 2.4 Selection (decisions)
4. Computer Maths and Logic 4.2 Boolean Logic Simplifying Boolean Expressions.
COMPUTER ARCHITECTURE TRUTH TABLES AND LOGIC GATES.
Logic Gates. A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs and one output. At any given moment,
Boolean and Sequential Logic Last week – Basic Gates AND OR NOT NOR XOR NAND.
Appendix B: Digital Logic
Basic Logic Gates By : Ashima Wadhwa Assistant Professor (giBS)
MECH 1500 Chapter 4. MECH 1500 The Binary Concept 4.1.
NAND, NOR, and EXOR (more primitive logical gates) CS Computer Architecture David Mayer.
Logic Gates and Boolean Algebra Introduction to Logic II.
Boolean Algebra. LO:  Understand why Boolean algebra is used  Understand basic Boolean algebra notation  Understand why Boolean algebra is used  Understand.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Logic Gates Review. Logic Gates OR gate – 1 if either input is 1 – 0 if they both are 0.
CS 111 – Aug. 27 Section 1.1 –Binary data and operations –Logic gates –Flip-flop –A binary shorthand: hexadecimal Commitment for next day: –Please read.
Logic Gates Learning Objectives Learn that there is a one-to-one relationship between logic gates and Boolean expressions Learn how logic gates are combined.
Digital Logic. December 0s and 1s As we have already considered, a computer operates on 0’s and 1’s Why? Because the power on a line.
Logic gates.
CPS120 Introduction to Computer Science
Basics of Logic gates - Part 1
Logic Gates and Boolean Algebra
Logic Gates.
Logic Gates Benchmark Companies Inc PO Box Aurora CO
EI205 Lecture 5 Dianguang Ma Fall 2008.
Basic Logical Operations (Fascinating)
Digital Signals Digital Signals have two basic states:
Practice #Digital Logic Mr. Burleson
Logic – Bell Ringer.
Conditional Statements
Agenda – 2/12/18 Questions? Readings: CSI 4, P
Boolean Operations 1 and 1 = 1.
3.4 Computer systems Boolean logic Lesson 2.
King Fahd University of Petroleum and Minerals
Logic Gates.
Boolean Logic Boolean Logic is considered to be the basic of digital electronics. We know that a computer’s most basic operation is based on digital electronics.
GCSE Computer Science – Logic Gates & Boolean Expressions
Today You are Learning simple logic diagrams using the operations AND, OR and NOT truth tables combining Boolean operators using AND, OR and NOT.
Chapter 4 Gates and Circuits.
XOR Function Logic Symbol  Description  Truth Table 
Truth tables Mrs. Palmer.
Department of Electronics
Digital Logic Design Basics Combinational Circuits Sequential Circuits.
Introduction to Logic diagrams and truth tables
What are Logic Gates?.
Agenda Lecture Content: Combinatorial Circuits Boolean Algebras
Presentation transcript:

1 4. Computer Maths and Logic 4.2 Boolean Logic

4.2.1 Boolean Operators

3 Boolean logic This is concerned only with the values true (1) and false (0). In the statement “if it is warm and not raining then we will go for a picnic” you can substitute all 3 parts with true or false, depending on the conditions.

4 Boolean operators True/false statements can be worked on using the following boolean operators: ‣ AND ‣ OR ‣ NOT ‣ XOR

5 Boolean operators Usually, you are combining 2 or more statements (the inputs) into one result (the output). Note the similarity with normal algebra, e.g. ‣ 3 x 4 = 12 ‣ where the x operator combines two inputs into one output.

6 AND Both inputs must be true for the output to be true. Symbol: e.g. A B = C So, 'if it is warm and sunny then we will go for a picnic' becomes ‣ 'If (it is warm it is sunny) = go for a picnic' ‣ A B = C where A = sunny, B = warm, C = picnic Note that it has got to be both.

7 AND in Java Use two ampersands (&&): ‣ boolean sunny, warm, goToBeach; if (sunny && warm) { goToBeach = true; } else { goToBeach = false; }

8 OR Only one input need be true for the output to be true. Symbol: + e.g. A + B = C So, ‘if it is warm or it is sunny then we’ll go for a picnic' becomes ‣ if (it is warm + it is sunny) = go for a picnic' ‣ A + B = C where A = sunny, B = warm, C = picnic This means we are not so fussy (warm and cloudy OK, cool and sunny OK, but not cool and cloudy).

9 OR in Java Use two break bars (||): ‣ boolean sunny, warm, goToBeach; if (sunny || warm) { goToBeach = true; } else { goToBeach = false; }

10 NOT This simply reverses the truth of the input. Symbol: o ̅̅ v ̅ e ̅ r ̅ l ̅ i ̅ n ̅ e ̅ e.g. A B ̅ = C So, ‘if it’s warm and it’s not raining then we’ll go for a picnic' becomes ‣ if (it’s warm it ̅ ’ ̅ s ̅ ̅ r ̅ a ̅ i ̅ n ̅ i ̅ n ̅ g ̅ ) = go for a picnic' ‣ A B ̅ = C where A = warm, B = rain, C = picnic This means it must be warm and it must NOT be raining.

11 NOT in Java Use the exclamation mark (!) boolean sunny, warm; if (!warm) { if (temp != 0) { output(“Good for mountain biking."); } }

12 XOR The exclusive OR - one or the other but not both. Symbol: ⊕ e.g A ⊕ B = C. So, ‘if it’s warm or sunny but not both, we’ll go for a picnic’ becomes ‣ ‘if (it’s warm ⊕ it’s sunny) = we’ll go for a picnic’ ‣ A ⊕ B = C where A = warm, B = sunny, C = picnic This means warm and cloudy OK, cool and sunny OK, but not cool and cloudy and not warm and sunny.

13 NAND and NOR The equivalent of doing AND / OR then reversing the result. Symbols: ̅ e.g. A ̅ B = C and + ̅ e.g. A + ̅ B = C. ‣ ‘If it is not (warm and sunny) then we are going for a picnic.’ ‣ ‘If it is not (warm or sunny) then we are going for a picnic.’ Can these be said another way?