Title: Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates
1Chapter 4 The Building Blocks Binary Numbers,
Boolean Logic, and Gates
- Invitation to Computer Science,
- C Version, Third Edition
- Spring 2005 Additions by S. Steinfadt
2Objectives
- In this chapter, you will learn about
- The binary numbering system
- Boolean logic and gates
- Building computer circuits
- Control circuits
3Introduction
- Chapter 4 focuses on hardware design (also called
logic design) - How to represent and store information inside a
computer - How to use the principles of symbolic logic to
design gates - How to use gates to construct circuits that
perform operations such as adding and comparing
numbers, and fetching instructions
4The Binary Numbering System
- A computers internal storage techniques are
different from the way people represent
information in daily lives - Information inside a digital computer is stored
as a collection of binary data
5Binary Representation of Numeric and Textual
Information
- Binary numbering system
- Base-2
- Built from ones and zeros
- Each position is a power of 2
- 1101 1 x 23 1 x 22 0 x 21 1 x 20
- Decimal numbering system
- Base-10
- Each position is a power of 10
- 3052 3 x 103 0 x 102 5 x 101 2 x 100
6- Figure 4.2
- Binary-to-Decimal
- Conversion Table
7Binary Representation of Numeric and Textual
Information (continued)
- Representing integers
- Decimal integers are converted to binary integers
- Given k bits, the largest unsigned integer is 2k
- 1 - Given 4 bits, the largest is 24-1 15
- Signed integers must also represent the sign
(positive or negative) - Sign/Magnitude notation
8Binary Representation of Numeric and Textual
Information (continued)
- Representing real numbers
- Real numbers may be put into binary scientific
notation a x 2b (or M x BE) - Example 101.11 x 20
- Number then normalized so that first significant
digit is immediately to the right of the binary
point - Example .10111 x 23
- Mantissa and exponent then stored
9Binary Representation of Numeric and Textual
Information (continued)
- 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
10Binary Representation of Textual Information
(contd)
Decimal Binary Val.
48 00110000 0
49 00110001 1
50 00110010 2
51 00110011 3
52 00110100 4
53 00110101 5
54 00110110 6
55 00110111 7
56 00111000 8
57 00111001 9
58 00111010
59 00111011
60 00111100 lt
61 00111101
62 00111110 gt
63 00111111 ?
64 01000000 _at_
65 01000001 A
66 01000010 B
Dec. Unicode Charac.
0x30 0x0030 0
0x31 0x0031 1
0x32 0x0032 2
0x33 0x0033 3
0x34 0x0034 4
0x35 0x0035 5
0x36 0x0036 6
0x37 0x0037 7
0x38 0x0038 8
0x39 0x0039 9
0x3A 0x003A
0x3B 0x003B
0x3C 0x003C lt
0x3D 0x003D
0x3E 0x003E gt
0x3F 0x003F ?
0x40 0x0040 _at_
0x41 0x0041 A
0x42 0x0042 B
Unicode 16 bits long
ASCII 8 bits long
Partial listings only!
11Binary 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
12Binary Representation of Sound and Images
(continued)
- From samples, original sound may be approximated
- To improve the approximation
- Sample more frequently (increase sampling rate)
- Use more bits for each sample value (? bit depth)
13- Figure 4.5
- Digitization of an Analog Signal
- (a) Sampling the Original
- Signal
- (b) Recreating the
- Signal from the Sampled
- Values
14Binary Representation of Sound (contd)
- MP3 format discussed in text, AAC format here
- AAC (Advanced Audio Coding) advantages over MP3
- Improved compression provides higher-quality
results with smaller file sizes - Higher resolution audio, yielding sampling rates
up to 96 kHz - Improved decoding efficiency, requiring less
processing power for decode - http//www.apple.com/mpeg4/aac/
- http//www.aac-audio.com/
15Binary Representation of Sound and Images
(continued)
- 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
16Binary Representation of Images (contd)
- 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 - More image information http//cat.xula.edu/tutori
als/imaging/grayscale.php
17The 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 hence binary
representations
18Binary 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
direction of the magnetic field
19- Figure 4.9
- Using Magnetic Cores to Represent Binary Values
20Binary Storage Devices (continued)
- Transistors
- Solid-state switches either permits or blocks
current flow - A control input causes state change
- Constructed from semiconductors
21- Figure 4.11
- Simplified Model of a Transistor