Download presentation
Presentation is loading. Please wait.
Published byJosephine Armstrong Modified over 9 years ago
1
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Fourth Edition
2
Invitation to Computer Science, C++ Version, Fourth Edition 2 Objectives In this chapter, you will learn about The binary numbering system Boolean logic and gates Building computer circuits
3
Invitation to Computer Science, C++ Version, Fourth Edition 3
4
Learn 3 basic circuit symbols to design simple circuits. http://library.thinkquest.org/10784/circuit_sym bols.html http://library.thinkquest.org/10784/circuit_sym bols.html Invitation to Computer Science, C++ Version, Fourth Edition 4
5
You should be able to design this. Invitation to Computer Science, C++ Version, Fourth Edition 5
6
We will learn binary numbering system. Why does the computer use binary digit (0 and 1)? Homework assignment: Read the book to find out why (Section 4.2.3). Invitation to Computer Science, C++ Version, Fourth Edition 6
7
7 How to convert a decimal to a binary number? 5 10 = 101 2 7 10 = 111 2
8
Invitation to Computer Science, C++ Version, Fourth Edition 8 Quiz 9 10 = ______ 2 11 10 = _____ 2 15 10 = _____ 2
9
Invitation to Computer Science, C++ Version, Fourth Edition 9 How to convert a binary to a decimal number? 1010 2 = 10 10 ans: 1* 23 + 0* 22 + 1 * 21 + 0 * 20 = 8 + 0 + 2 + 0 = 10
10
Invitation to Computer Science, C++ Version, Fourth Edition 10 1110 2 = 14 10 ans: 1* 23 + 1* 22 + 1 * 21 + 0 * 20 = 8 + 4 + 2 + 0 = 14
11
Invitation to Computer Science, C++ Version, Fourth Edition 11 Quiz 1010 2 = _______________ 10 10101 2 = ___________ 10 10111 2 = ___________ 10
12
Invitation to Computer Science, C++ Version, Fourth Edition 12 Binary Addition 1 1 0 1 0 1 0 1 + 0 1 1 0 0 0 1 1 ----------------------------
13
Invitation to Computer Science, C++ Version, Fourth Edition 13 ASCII Table: 8-bit Decimal Octal Hex Binary Value ------- ----- --- ------ ----- 065 101 041 01000001 A 066 102 042 01000010 B 067 103 043 01000011 C 068 104 044 01000100 D 069 105 045 01000101 E 070 106 046 01000110 F 071 107 047 01000111 G 072 110 048 01001000 H 073 111 049 01001001 I What is the binary representation of the character string “BAD”? 01000010 01000001 01000100
14
Book Exercises P. 184. Do 3a 3b. 4a. 4b. 7. 9a Invitation to Computer Science, C++ Version, Fourth Edition 14
15
Invitation to Computer Science, C++ Version, Fourth Edition 15 AND Truth Table T AND T is T T AND F is F F AND F is F F AND T is F _____(T/F) Assume that a=1, b=2, and c=3. The value of the following Boolean expression is TRUE. (a > 1) AND ( b > c)
16
Invitation to Computer Science, C++ Version, Fourth Edition 16 Quiz _____(T/F) Assume that a=1, b=2, and c=3. The value of the following Boolean expression is TRUE. (a c) _____(T/F) Assume that a=1, b=2, and c=3. The value of the following Boolean expression is TRUE. (a > 1) AND ( b < c)
17
Invitation to Computer Science, C++ Version, Fourth Edition 17 Circuit Symbol AND gate. If A is True and B is False, then what is output? ________
18
Invitation to Computer Science, C++ Version, Fourth Edition 18 If A is False and B is False, then what is output of C? ________
19
Invitation to Computer Science, C++ Version, Fourth Edition 19 OR truth table T OR T is T T OR F is T F OR F is F F OR T is T Assume that a=2, b=3, and c=5. What is the value of each of the following Boolean expressions?______ (a> 1) OR (b = 3)
20
Invitation to Computer Science, C++ Version, Fourth Edition 20 Circuit Symbol OR gate. Apply the OR truth table What is the output of C if A is True and B is false? _____
21
Invitation to Computer Science, C++ Version, Fourth Edition 21 What is the output of C if A is True and B is false? _____
22
Invitation to Computer Science, C++ Version, Fourth Edition 22 NOT truth table NOT T is F NOT F is T 1. Assume that a=2, b=3, and c=5. What is the value of each of the following Boolean expressions? 2. NOT (a > 1)
23
Invitation to Computer Science, C++ Version, Fourth Edition 23 1. Assume that a=2, b=3, and c=5. What is the value of each of the following Boolean expressions? 2. NOT [(a > 1) AND (b < 3)] 3. (a > 1) AND [NOT (b < 3)]
24
Invitation to Computer Science, C++ Version, Fourth Edition 24 What is the output of C if A is False and B is False?______
25
Book Exercises. P.184. Do 15a, 15b, 15c, 15d 17. Invitation to Computer Science, C++ Version, Fourth Edition 25
26
Invitation to Computer Science, C++ Version, Fourth Edition 26 How to use sum-of-product algorithm to design a combinational circuit for a given truth table? Step 1. Given Mysterious Truth Table: AB Output 110 000 101 011 Step 2. Write a sum-of-product Boolean Expression _ _ A.B + A. B _ Note: The ‘.’ of the expression A. B means A and B. _ The bar A means A is fed to a gate with a false value, The ‘+’ of the expression X + Y means X and Y are fed to the OR Gate
27
Invitation to Computer Science, C++ Version, Fourth Edition 27 step 3: Draw a combinational circuit.
28
Invitation to Computer Science, C++ Version, Fourth Edition 28 Quiz: Given Mysterious Truth Table: AB Output 110 001 101 010 Write the sum-of-product Boolean expression: Draw the combinational circuit diagram:
29
Invitation to Computer Science, C++ Version, Fourth Edition 29 Characters are mapped onto binary numbers ASCII code set 8 bits per character; 256 character codes UNICODE code set 16 bits per character; 65,536 character codes Text strings are sequences of characters in some encoding Binary Representation of Numeric and Textual Information (continued)
30
Invitation to Computer Science, C++ Version, Fourth Edition 30 Binary Representation of Sound and Images Multimedia data is sampled to store a digital form with or without detectable differences Representing sound data Sound data must be digitized for storage in a computer Digitizing means periodic sampling of amplitude values
31
Invitation to Computer Science, C++ Version, Fourth Edition 31 Binary Representation of Sound and Images (continued) From samples, original sound can be approximated To improve the approximation Sample more frequently Use more bits for each sample value
32
Invitation to Computer Science, C++ Version, Fourth Edition 32 Figure 4.5 Digitization of an Analog Signal (a) Sampling the Original Signal (b) Recreating the Signal from the Sampled Values
33
Invitation to Computer Science, C++ Version, Fourth Edition 33 Representing image data Images are sampled by reading color and intensity values at even intervals across the image Each sampled point is a pixel Image quality depends on number of bits at each pixel Binary Representation of Sound and Images (continued)
34
Invitation to Computer Science, C++ Version, Fourth Edition 34 The Reliability of Binary Representation Electronic devices are most reliable in a bistable environment Bistable environment Distinguishing only two electronic states Current flowing or not Direction of flow Computers are bistable: binary representations
35
Invitation to Computer Science, C++ Version, Fourth Edition 35 Magnetic core Historic device for computer memory Tiny magnetized rings; flow of current sets the direction of magnetic field Binary values 0 and 1 are represented using the direction of the magnetic field Binary Storage Devices
36
Invitation to Computer Science, C++ Version, Fourth Edition 36 Figure 4.9 Using Magnetic Cores to Represent Binary Values
37
Invitation to Computer Science, C++ Version, Fourth Edition 37 Transistors Solid-state switches; either permit or block current flow A control input causes state change Constructed from semiconductors Binary Storage Devices (continued)
38
Invitation to Computer Science, C++ Version, Fourth Edition 38 Figure 4.11 Simplified Model of a Transistor
39
Invitation to Computer Science, C++ Version, Fourth Edition 39 Boolean Logic and Gates: Boolean Logic Boolean logic describes operations on true/false values True/false maps easily onto bistable environment Boolean logic operations on electronic signals can be built out of transistors and other electronic devices
40
Invitation to Computer Science, C++ Version, Fourth Edition 40 Boolean Logic (continued) Boolean operations a AND b True only when a is true and b is true a OR b True when a is true, b is true, or both are true NOT a True when a is false and vice versa
41
Invitation to Computer Science, C++ Version, Fourth Edition 41 Boolean expressions Constructed by combining together Boolean operations Example: (a AND b) OR ((NOT b) AND (NOT a)) Truth tables capture the output/value of a Boolean expression A column for each input plus the output A row for each combination of input values Boolean Logic (continued)
42
Invitation to Computer Science, C++ Version, Fourth Edition 42 abValue 001 010 100 111 Example: (a AND b) OR ((NOT b) and (NOT a)) Boolean Logic (continued)
43
Invitation to Computer Science, C++ Version, Fourth Edition 43 Gates Hardware devices built from transistors to mimic Boolean logic AND gate Two input lines, one output line Outputs a 1 when both inputs are 1
44
Invitation to Computer Science, C++ Version, Fourth Edition 44 Gates (continued) OR gate Two input lines, one output line Outputs a 1 when either input is 1 NOT gate One input line, one output line Outputs a 1 when input is 0 and vice versa
45
Invitation to Computer Science, C++ Version, Fourth Edition 45 Figure 4.15 The Three Basic Gates and Their Symbols
46
Invitation to Computer Science, C++ Version, Fourth Edition 46 Abstraction in hardware design Map hardware devices to Boolean logic Design more complex devices in terms of logic, not electronics Conversion from logic to hardware design can be automated Gates (continued)
47
Invitation to Computer Science, C++ Version, Fourth Edition 47 Building Computer Circuits: Introduction A circuit is a collection of logic gates Transforms a set of binary inputs into a set of binary outputs Values of the outputs depend only on the current values of the inputs Combinational circuits have no cycles in them (no outputs feed back into their own inputs)
48
Invitation to Computer Science, C++ Version, Fourth Edition 48 Figure 4.19 Diagram of a Typical Computer Circuit
49
Invitation to Computer Science, C++ Version, Fourth Edition 49 A Circuit Construction Algorithm Sum-of-products algorithm is one way to design circuits Truth table to Boolean expression to gate layout
50
Invitation to Computer Science, C++ Version, Fourth Edition 50 Figure 4.21 The Sum-of-Products Circuit Construction Algorithm
51
Invitation to Computer Science, C++ Version, Fourth Edition 51 Sum-of-products algorithm Truth table captures every input/output possible for circuit Repeat process for each output line Build a Boolean expression using AND and NOT for each 1 of the output line Combine together all the expressions with ORs Build circuit from whole Boolean expression A Circuit Construction Algorithm (continued)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.