3 – Boolean Logic and Logic Gates 4 – Binary Numbers

Slides:



Advertisements
Similar presentations
1 Chapter 2 The Digital World. 2 Digital Data Representation.
Advertisements

Data Storage – Part 1 CS 1 Introduction to Computers and Computer Technology Rick Graziani Fall 2013.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, Java Version, Third Edition.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Main Memory Lecture 2 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
Chapter 1 Data Storage. 2 Chapter 1: Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Fourth Edition.
Data Representation (in computer system) Computer Fundamental CIM2460 Bavy LI.
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
CISC1400: Binary Numbers & Computer Fall 2011, Dr. Zhang 1.
Bits and Data Storage. Basic Hardware Units of a Computer.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
CSC 101 Introduction to Computing Lecture 9 Dr. Iftikhar Azim Niaz 1.
Computers Organization & Assembly Language
CSCI-235 Micro-Computers in Science Hardware Design Part I.
Computer Terminology Chapter 2 CIT History of Computers First known device used to compute was the Abacus 3000 BC 1617 John Napier created a crude.
Chapter 2 Computer Hardware
Digital Information  digits are symbols chapter 8 BITS & THE “WHY” OF BYTES.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Chapter 1: Digital Computers and Information Illustration at beginning of each Chapter Base 10 Binary Base 2 Octal Base 8 Hex bas
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Islamic University Of Gaza, Nael Aburas Data Storage Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
CSCI-100 Introduction to Computing Hardware Design Part I.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Binary System Presented by Mr. Wilhelmi Internal Representation of Data Input Input  Data that is put into the computer for processing Data Data  The.
Data Representation (in computer system). Data Representation How do computers represent data? b The computers are digital Recognize.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Logic Design EE-2121 Manesh T. Digital Systems  Introduction  Binary Quantities and Variables  Logic Gates  Boolean Algebra  Combinational Logic.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Millions of electronic pulses move through your computer every second. Computers are capable of processing thousands of functions in the time it takes.
Understanding Computers
Understanding Binary Understanding Computers. Understanding Computers L3 – Understanding Binary Learning Objectives All will Understand why all data is.
Binary Representation in Text
Binary Representation in Text
Binary and Hard Disk PEOPLE Program
Understanding binary Understanding Computers.
Computer basics.
Invitation to Computer Science, C++ Version, Fourth Edition
Chapter 3 - Binary Numbering System
Computer Code.
Computer Science 210 Computer Organization
INFS 211: Introduction to Information Technology
3.1 Denary, Binary and Hexadecimal Number Systems
Introduction to Computers
Information Support and Services
CSCI-100 Introduction to Computing
BITS & BYTES.
Fundamentals & Ethics of Information Systems IS 201
University of Gujrat Department of Computer Science
Invitation to Computer Science, Java Version, Third Edition
An Introduction to Microprocessors
Invitation to Computer Science, C++ Version, Third Edition
Chapter 1 Data Storage.
CS105 Introduction to Computer Concepts GATES and CIRCUITS
The Building Blocks: Binary Numbers, Boolean Logic, and Gates
BITS & BYTES.
Information Representation
Chapter Four Data Representation in Computers By Bezawit E.
CMSC250 Fall 2018 Circuits 1 1.
Abstraction – Number Systems and Data Representation
Information Technology Department
Digital Circuits and Logic
WJEC GCSE Computer Science
UNIT – 3 & 4. Data Representation and Internal
An Introduction to Microprocessors
COMPUTER ORGANIZATION
Presentation transcript:

3 – Boolean Logic and Logic Gates 4 – Binary Numbers CS 1 Introduction to Computers and Computer Technology Rick Graziani Fall 2017

BIT – BInary digiT ON OFF Bit (Binary Digit) = Basic unit of information, representing one of two discrete states. The smallest unit of information within the computer. The only thing a computer understands. Abbreviation: b Bit has one of two values: 0 (off) or 1 (on) 0 (False) or 1 (True) ON OFF Rick Graziani graziani@cabrillo.edu

Bits The boxes illustrate a position where magnetism may be set and sensed; pluses (red) indicate magnetism of positive polarity (1 bit), interpreted as “present” and minuses (blue) (0 bit). 1 1 1 1 1 1 1 1 Two patterns are known as the state of the bit. For example, magnetic encoding of information on tapes, floppy disks, and hard disks are done with positive or negative polarity. Rick Graziani graziani@cabrillo.edu

Bits Bits are really only symbols. Used to display the one of two different, discrete states. Bits are used as: Storing data Numbers Text characters Images Sound Etc. Processing data Rick Graziani graziani@cabrillo.edu

Boolean Operations Integrated Circuits (microchips) are used to store and manipulate (process) bits. This is done using Boolean operations (in honor of mathematician George Boole, 1815-1864). Boolean Operation: An operation that manipulates one or more true/false values Specific operations AND OR XOR (exclusive or) NOT Using Truth Tables we can uses different sets of logic operations to store, add, subtract, and more complicated operations with bit. Rick Graziani graziani@cabrillo.edu

Boolean Algebra and logical expressions (Addendum) Boolean algebra (due to George Boole) - The mathematics of digital logic Useful in dealing with binary system of numbers. Used in the analysis and synthesis of logical expressions. Logical expressions – Expressions constructed using logical-variables and operators. Result is: True or False Boolean algebra – In mathematics a variable uses one of the two possible values: 1 or 0 May also be represented as: Truth or Falsehood of a statement On or Off states of a switch High (5V) or low (0V) of a voltage level Rick Graziani graziani@cabrillo.edu

Used in electronics (Addendum) Electrical circuits are designed to represent logical expressions Known as logic circuits. Used to make important logical decisions in household appliances, computers, communication devices, traffic signals and microprocessors. Three basic logic operations as listed below: OR operation AND operation NOT operation Rick Graziani graziani@cabrillo.edu

Logic gates A logic gate is an electronic circuit/device which makes the logical decisions based on these operations. Logic gates have: one or more inputs only one output The output is active only for certain input combinations. Logic gates are the building blocks of any digital circuit. Rick Graziani graziani@cabrillo.edu

Boolean Operations - AND TRUE TRUE AND = TRUE Truth tables (simple ones) AND operation Both input values must be TRUE for output to be TRUE Kermit is a frog AND Miss Piggy is an actress Inputs to AND operation represent truth of falseness of the compound statement. Rick Graziani graziani@cabrillo.edu

Boolean Operations Gate: A device that computes a Boolean operation A device that produces the output of a Boolean operation when given the operation’s input values. Gates can be: Gears Relays Optic devices Electronic circuits (microchips) Rick Graziani graziani@cabrillo.edu

Boolean Operations – AND Gate Truth Table Inputs Output 0 0 0 1 1 0 1 1 1 1 1 0 = FALSE 1 = TRUE AND operation Both input values must be TRUE for output to be TRUE 1 1 1 Rick Graziani graziani@cabrillo.edu

Off (False) Off (False) On (True) To build an AND gate: Two transistors connected together Two inputs (transistors A and B) and one output Transistor A: Off (False) Transistor B: On (True) Output: Off (False) Rick Graziani graziani@cabrillo.edu

On (True) On (True) On (True) Transistor A: On (True) Transistor B: On (True) Output: On (True) Rick Graziani graziani@cabrillo.edu

Boolean Operations - OR TRUE OR True = TRUE Truth tables (simple ones) OR operation Only one input values must be TRUE for output to be TRUE In Rick likes to surf OR Rick likes to go dancing. Taking both courses will also TRUE. Rick Graziani graziani@cabrillo.edu

Boolean Operations – OR Gate Truth Table Inputs Output 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 = FALSE 1 = TRUE OR operation At least one input value must be TRUE for output to be TRUE 1 1 1 1 Rick Graziani graziani@cabrillo.edu

Two inputs (transistors A and B) and one output Transistor A: Off (False) Transistor B: Off (False) Output: Off (False) Rick Graziani graziani@cabrillo.edu

Two inputs (transistors A and B) and one output Transistor A: Off (False) Transistor B: On (True) Output: On (True) Rick Graziani graziani@cabrillo.edu

Two inputs (transistors A and B) and one output Transistor A: On (True) Transistor B: On (True) Output: On (True) Rick Graziani graziani@cabrillo.edu

Boolean Operations - XOR TRUE XOR False = TRUE Truth tables (simple ones) XOR operation One and ONLY one input value can be TRUE for output to be TRUE At noon Rick is going to surf the Hook XOR surf Liquor Stores (this is a surf spot) Both cannot be true, as I cannot surf both spots at the same time. Rick Graziani graziani@cabrillo.edu

Boolean Operations – XOR Gate Truth Table Inputs Output 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 = FALSE 1 = TRUE XOR operation Only one input value is TRUE for output to be TRUE 1 1 Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Boolean Operations – NOT Gate Truth Table 1 Inputs Output 1 1 1 0 = FALSE 1 = TRUE NOT operation Only one input Opposite of input NOT FALSE = TRUE NOT TRUE = FALSE Rick Graziani graziani@cabrillo.edu

Current To build an NOT gate: One transistor One input and one output Transistor A: On (True) Current flows to ground wire and none to output, so output is Off (False) Rick Graziani graziani@cabrillo.edu

Current Transistor A: Off (False) Current flows to ground wire and none to output, so output is Off (False) Rick Graziani graziani@cabrillo.edu

http://www.neuroproductions.be/logic-lab/ Rick Graziani graziani@cabrillo.edu

Another way to write it… 0 = FALSE; 1 = TRUE Rick Graziani graziani@cabrillo.edu

Binary Numbers

Binary = Of two states Rick Graziani graziani@cabrillo.edu

Binary Math Rick Graziani graziani@cabrillo.edu

Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s 1,000’s 100’s 10’s 1’s 1 2 3 9 1 0 9 9 1 0 0 Rick Graziani graziani@cabrillo.edu

Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s 1,000’s 100’s 10’s 1’s 4 1 0 8 3 8 2 1 0 0 0 9 1 0 0 1 0 Rick Graziani graziani@cabrillo.edu

Rick’s Number System Rules All digits start with 0 A Base-n number system has n number of digits: Decimal: Base-10 has 10 digits Binary: Base-2 has 2 digits Hexadecimal: Base-16 has 16 digits The first column is always the number of 1’s Each of the following columns is n times the previous column (n = Base-n) Base 10: 10,000 1,000 100 10 1 Base 2: 16 8 4 2 1 Base 16: 65,536 4,096 256 16 1 Rick Graziani graziani@cabrillo.edu

Counting in Decimal (0,1,2,3,4,5,6,7,8,9) 1,000’s 100’s 10’s 1’s 1 2 3 1 2 3 ... 9 1 0 1 1 1 8 1 9 2 0 2 1 2 2 1,000’s 100’s 10’s 1’s . . . 2 9 3 0 3 1 ... 9 9 1 0 0 1 0 1 9 9 9 1 0 0 0 Rick Graziani graziani@cabrillo.edu

Counting in Binary (0, 1) 8’s 4’s 2’s 1’s 1 1 0 1 1 1 0 0 1 0 1 Dec 8’s 4’s 2’s 1’s Dec 9 1 0 0 1 1 10 1 0 1 0 2 3 1 0 1 1 11 4 12 1 1 0 0 5 1 1 0 6 1 1 0 1 13 1 1 1 7 1 1 1 0 14 1 0 0 0 8 1 1 1 1 15 Rick Graziani graziani@cabrillo.edu

Binary Math (more later) 0 0 1 10 11 100 101 +0 +1 +1 +1 +1 + 1 + 1 0 1 10 11 100 101 110 111 00000000 11111110 + 1 + 0 -> + 1 1000 …… 00000000 11111111 Rick Graziani graziani@cabrillo.edu

Base 2 (Binary) Number System Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s 64’s 32’s 16’s 8’s 4’s 2’s 1’s Dec. 2 1 0 10 1 0 1 0 17 70 130 255 Rick Graziani graziani@cabrillo.edu

Base 2 (Binary) Number System Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s 64’s 32’s 16’s 8’s 4’s 2’s 1’s Dec. 2 1 0 10 1 0 1 0 17 1 0 0 0 1 70 1 0 0 0 1 1 0 130 1 0 0 0 0 0 1 0 255 1 1 1 1 1 1 1 1 Rick Graziani graziani@cabrillo.edu

Converting between Decimal and Binary Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s 64’s 32’s 16’s 8’s 4’s 2’s 1’s Dec. 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 172 192 Rick Graziani graziani@cabrillo.edu

Converting between Decimal and Binary Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s 64’s 32’s 16’s 8’s 4’s 2’s 1’s Dec. 70 1 0 0 0 1 1 0 40 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 128 1 0 0 0 0 0 0 0 172 1 0 1 0 1 1 0 0 192 1 1 0 0 0 0 0 0 Rick Graziani graziani@cabrillo.edu

0 1 Computers do Binary Bits have two values: OFF and ON 0 1 Bits have two values: OFF and ON The Binary number system (Base-2) can represent OFF and ON very well since it has two values, 0 and 1 0 = OFF 1 = ON Understanding Binary to Decimal conversion is critical in computer science, computer networking, digital media, etc. Rick Graziani graziani@cabrillo.edu

Rick’s Program Rick Graziani graziani@cabrillo.edu

Rick’s Program Rick Graziani graziani@cabrillo.edu

Rick’s Program Rick Graziani graziani@cabrillo.edu

Decimal Math - Addition 10,000’s 1,000’s 100’s 10’s 1’s 1 6 5 1 0 + 1 6 5 9 5 ----------------------------- 1 1 1 3 3 1 5 Rick Graziani graziani@cabrillo.edu

Binary Math - Addition 1 1 1 1 1 1 1 1 Double check using Decimal. 64’s 32’s 16’s 8’s 4’s 2’s 1’s 1 1 1 0 1 0 + 1 1 0 1 1 ----------------------------- Dec 1 1 1 1 58 + 27 ----- 1 1 1 1 85 Double check using Decimal. Rick Graziani graziani@cabrillo.edu

Half Adder Gate – Adding two bits XOR Inputs: A, B S = Sum C = Carry AND A + B = 2’s 1’s Rick Graziani graziani@cabrillo.edu

Half Adder Gate – Adding two bits XOR Inputs: A, B S = Sum C = Carry AND C S + 0 ---- A + B = 2’s 1’s 0 0 = Rick Graziani graziani@cabrillo.edu

Half Adder Gate – Adding two bits XOR Inputs: A, B S = Sum C = Carry 1 1 AND C S + 1 ---- A + B = 2’s 1’s 0 1 = 1 1 Rick Graziani graziani@cabrillo.edu

Half Adder Gate – Adding two bits XOR 1 Inputs: A, B S = Sum C = Carry 1 AND C S 1 + 0 ---- A + B = 2’s 1’s 1 0 = 1 1 Rick Graziani graziani@cabrillo.edu

Half Adder Gate – Adding two bits XOR 1 Inputs: A, B S = Sum C = Carry 1 1 AND C S 1 + 1 ---- A + B = 2’s 1’s 1 1 = 1 1 0 Rick Graziani graziani@cabrillo.edu

Marble Adding Machine http://www.youtube.com/watch?v=GcDshWmhF4A&NR=1&feature=fvwp Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Rick Graziani graziani@cabrillo.edu

Text

Digitizing Text Earliest uses of PandA (Presence and Absence) was to digitize text (keyboard characters). We will look at digitizing images and video later. Assigning Symbols in United States: 26 upper case letters 26 lower case letters 10 numerals 20 punctuation characters 10 typical arithmetic characters 3 non-printable characters (enter, tab, backspace) 95 symbols needed Rick Graziani graziani@cabrillo.edu

ASCII-7 In the early days, a 7 bit code was used, with 128 combinations of 0’s and 1’s, enough for a typical keyboard. The standard was developed by ASCII (American Standard Code for Information Interchange) Each group of 7 bits was mapped to a single keyboard character. 0 = 0000000 1 = 0000001 2 = 0000010 3 = 0000011 … 127 = 1111111 Rick Graziani graziani@cabrillo.edu

Byte Byte = A collection of bits (usually 7 or 8 bits) which represents a character, a number, or other information. More common: 8 bits = 1 byte Abbreviation: B Rick Graziani graziani@cabrillo.edu

Bytes 1 byte (B) Kilobyte (KB) = 1,024 bytes (210) “one thousand bytes” 1,024 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 Megabyte (MB) = 1,048,576 bytes (220) “one million bytes” Gigabyte (GB) = 1,073,741,824 bytes (230) “one billion bytes” Rick Graziani graziani@cabrillo.edu

Wikipedia Rick Graziani graziani@cabrillo.edu

ASCII-8 IBM later extended the standard, using 8 bits per byte. This was known as Extended ASCII or ASCII-8 This gave 256 unique combinations of 0’s and 1’s. 0 = 00000000 1 = 00000001 2 = 00000010 3 = 00000011 … 255 = 11111111 1 Rick Graziani graziani@cabrillo.edu

ASCII-8 Rick Graziani graziani@cabrillo.edu

Try it! 1 Write out Cabrillo College (Upper and Lower case) in bits (binary) using the chart above. 0100 0011 0110 0001 … C a Rick Graziani graziani@cabrillo.edu

The answer! 1 0100 0011 0110 0001 0110 0010 0111 0010 0110 1001 0110 1100 C a b r i l 0110 1100 0110 1111 0010 0000 0100 0011 0110 1111 0110 1100 l o space C o l 0110 1100 0110 0101 0110 0111 0110 0101 l e g e Rick Graziani graziani@cabrillo.edu

Unicode Although ASCII works fine for English, many other languages need more than 256 characters, including numbers and punctuation. Unicode uses a 16 bit representation, with 65,536 possible symbols. Unicode can handle all languages. www.unicode.org Rick Graziani graziani@cabrillo.edu

3 – Boolean Logic and Logic Gates 4 – Binary Numbers CS 1 Introduction to Computers and Computer Technology Rick Graziani