Chapter 4: the Building Blocks: Binary Numbers, Boolean Logic, and Gates

Chapter 4: the Building Blocks: Binary Numbers, Boolean Logic, and Gates

Objectives Chapter 4: The Building In this chapter, you will learn about: Blocks: Binary Numbers, The binary numbering system Boolean Logic, and Gates Boolean logic and gates Invitation to Computer Science, Building computer circuits C++ Version, Third Edition Control circuits Invitation to Computer Science, C++ Version, Third Edition 1 Invitation to Computer Science, C++ Version, Third Edition 2 Introduction The Binary Numbering System Chapter 4 focuses on hardware design (also A computer’s internal storage techniques are called logic design) different from the way people represent information in daily lives How to represent and store information inside a computer How to use the principles of symbolic logic to Information inside a digital computer is stored as design gates a collection of binary data How to use gates to construct circuits that perform operations such as adding and comparing numbers, and fetching instructions Invitation to Computer Science, C++ Version, Third Edition 3 Invitation to Computer Science, C++ Version, Third Edition 4 Binary Representation of Numeric and Textual Information Figure 4.2 Binary-to-Decimal Binary numbering system Conversion Table Base-2 Built from ones and zeros Each position is a power of 2 1101 = 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0 Decimal numbering system Base-10 Each position is a power of 10 3052 = 3 x 10 3 + 0 x 10 2 + 5 x 10 1 + 2 x 10 0 Invitation to Computer Science, C++ Version, Third Edition 5 Invitation to Computer Science, C++ Version, Third Edition 6 Binary Representation of Numeric and Binary Representation of Numeric and Textual Information (continued) Textual Information (continued) Representing integers Representing real numbers Decimal integers are converted to binary integers Real numbers may be put into binary scientific notation: a x 2 b Given k bits, the largest unsigned integer is Example: 101.11 x 2 0 2k - 1 Number then normalized so that first significant Given 4 bits, the largest is 2 4-1 = 15 digit is immediately to the right of the binary point 3 Signed integers must also represent the sign Example: .10111 x 2 (positive or negative) Mantissa and exponent then stored Invitation to Computer Science, C++ Version, Third Edition 7 Invitation to Computer Science, C++ Version, Third Edition 8 Binary Representation of Numeric and Binary Representation of Sound and Textual Information (continued) Images Characters are mapped onto binary numbers Multimedia data is sampled to store a digital form, with or without detectable differences ASCII code set 8 bits per character; 256 character codes Representing sound data UNICODE code set Sound data must be digitized for storage in a 16 bits per character; 65,536 character codes computer Text strings are sequences of characters in Digitizing means periodic sampling of amplitude some encoding values Invitation to Computer Science, C++ Version, Third Edition 9 Invitation to Computer Science, C++ Version, Third Edition 10 Binary Representation of Sound and Images (continued) Figure 4.5 Digitization of an Analog Signal From samples, original sound may be approximated (a) Sampling the Original Signal To improve the approximation: Sample more frequently (b) Recreating the Signal from the Sampled Use more bits for each sample value Values Invitation to Computer Science, C++ Version, Third Edition 11 Invitation to Computer Science, C++ Version, Third Edition 12 Binary Representation of Sound and The Reliability of Binary Images (continued) Representation Representing image data Electronic devices are most reliable in a bistable environment Images are sampled by reading color and Bistable environment intensity values at even intervals across the image Distinguishing only two electronic states Current flowing or not Each sampled point is a pixel Direction of flow Image quality depends on number of bits at each Computers are bistable: hence binary pixel representations Invitation to Computer Science, C++ Version, Third Edition 13 Invitation to Computer Science, C++ Version, Third Edition 14 Binary Storage Devices 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 Figure 4.9 direction of the magnetic field Using Magnetic Cores to Represent Binary Values Invitation to Computer Science, C++ Version, Third Edition 15 Invitation to Computer Science, C++ Version, Third Edition 16 Binary Storage Devices (continued) Transistors Solid-state switches : either permits or blocks current flow A control input causes state change Figure 4.11 Constructed from semiconductors Simplified Model of a Transistor Invitation to Computer Science, C++ Version, Third Edition 17 Invitation to Computer Science, C++ Version, Third Edition 18 Boolean Logic and Gates: Boolean Boolean Logic (continued) Logic Boolean operations Boolean logic describes operations on true/false values a AND b True only when a is true and b is true True/false maps easily onto bistable a OR b environment True when either a is true or b is true, or both are true Boolean logic operations on electronic signals may be built out of transistors and other NOT a electronic devices True when a is false, and vice versa Invitation to Computer Science, C++ Version, Third Edition 19 Invitation to Computer Science, C++ Version, Third Edition 20 Boolean Logic (continued) Boolean Logic (continued) Boolean expressions Example: Constructed by combining together Boolean (a AND b) OR ((NOT b) and (NOT a)) operations Example: (a AND b) OR ((NOT b) AND (NOT a)) a b Value Truth tables capture the output/value of a 0 0 1 Boolean expression 0 1 0 A column for each input plus the output 1 0 0 1 1 1 A row for each combination of input values Invitation to Computer Science, C++ Version, Third Edition 21 Invitation to Computer Science, C++ Version, Third Edition 22 Gates Gates (continued) Gates OR gate Hardware devices built from transistors to mimic Two input lines, one output line Boolean logic Outputs a 1 when either input is 1 AND gate NOT gate Two input lines, one output line One input line, one output line Outputs a 1 when both inputs are 1 Outputs a 1 when input is 0 and vice versa Invitation to Computer Science, C++ Version, Third Edition 23 Invitation to Computer Science, C++ Version, Third Edition 24 Gates (continued) Abstraction in hardware design Map hardware devices to Boolean logic Design more complex devices in terms of logic, not electronics Figure 4.15 Conversion from logic to hardware design may be The Three Basic Gates and Their Symbols automated Invitation to Computer Science, C++ Version, Third Edition 25 Invitation to Computer Science, C++ Version, Third Edition 26 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 Figure 4.19 (no outputs feed back into their own inputs) Diagram of a Typical Computer Circuit Invitation to Computer Science, C++ Version, Third Edition 27 Invitation to Computer Science, C++ Version, Third Edition 28 A Circuit Construction Algorithm Sum-of-products algorithm is one way to design circuits: Truth table to Boolean expression to gate layout Figure 4.21 The Sum-of-Products Circuit Construction Algorithm Invitation to Computer Science, C++ Version, Third Edition 29 Invitation to Computer Science, C++ Version, Third Edition 30 A Circuit Construction Algorithm Examples Of Circuit Design And (continued) Construction Sum-of-products algorithm Compare-for-equality circuit Truth table captures every input/output possible for circuit Addition circuit Repeat process for each output line Build a Boolean expression using AND and NOT for each 1 of the output line Both circuits can be built using the sum-of- Combine together all the expressions with ORs products algorithm Build circuit from whole Boolean expression Invitation to Computer Science, C++ Version, Third Edition 31 Invitation to Computer Science, C++ Version, Third Edition 32 A Compare-for-equality Circuit A Compare-for-equality Circuit (continued) Compare-for-equality circuit 1-CE circuit truth table CE compares two unsigned binary integers for equality a b Output 0 0 1 Built by combining together 1-bit comparison circuits (1-CE) 0 1 0 1 0 0 Integers are equal if corresponding bits are equal 1 1 1 (AND together 1-CD circuits for each pair of bits) Invitation to Computer Science, C++ Version, Third Edition 33 Invitation to Computer Science, C++ Version, Third Edition 34 A Compare-for-equality Circuit (continued) 1-CE Boolean expression First case : (NOT a) AND (NOT b) Second case : a AND b Combined : Figure 4.22 ((NOT a) AND (NOT b)) OR (a AND b) One-Bit Compare for Equality Circuit Invitation to Computer Science, C++ Version, Third Edition 35 Invitation to Computer Science, C++ Version, Third Edition 36 An Addition Circuit An Addition Circuit (continued) Addition circuit 1-ADD truth table Adds two unsigned binary integers, setting output Input bits and an overflow One bit from each input integer Built from 1-bit adders (1-ADD) One carry bit (always zero for rightmost bit) Starting with rightmost bits, each pair produces Output A value for that order One bit for output place value A carry bit for next place to the left One “carry” bit Invitation to Computer

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us