Chapter Two Hardware Basics Inside the Box Chapter
Chapter Two Hardware Basics: Inside the Box
Chapter Outline • What Computers Do • A Bit About Bits • The Computer’s Core: CPU and Memory © 1999 Addison Wesley Longman 2
What Computers Do Four basic functions of computers include: – – Receive input Process information Produce output Store information © 1999 Addison Wesley Longman 3
Input Devices Computers accept information from the outside world. The keyboard is the most common input device. Pointing devices like the mouse also receive input. © 1999 Addison Wesley Longman 4
Process Information The processor, or central processing unit (CPU), processes information, and performs all the necessary arithmetic calculations. The CPU is like the “brain” of the computer. © 1999 Addison Wesley Longman 5
Output Devices Computers produce information and send it to the outside world. A video monitor is a common output device. Printers also produce output. © 1999 Addison Wesley Longman 6
Store Information Memory and storage devices are used to store information. Primary storage is the computer’s main memory. Secondary storage uses disks or other media. Primary storage © 1999 Addison Wesley Longman Secondary storage 7
A Bit About Bits A bit (binary digit) – is the smallest unit of information – can have two values - 1 and 0. Binary digits, or bits, can represent numbers, codes, or instructions. © 1999 Addison Wesley Longman On Off 8
Bits as Numbers Binary number system - a system that denotes all numbers and combinations of two digits. The binary system uses two digits to represent the numbers 0 and 1. © 1999 Addison Wesley Longman 9
Number System (I) • decimal system ( base 10 ) • octal system ( base 8 ) • binary system ( base 2 ) © 1999 Addison Wesley Longman 10
Number System (II) • decimal octal binary 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 10 11 12 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 © 1999 Addison Wesley Longman 11
To Represent Negative Numbers • • biased sign magnitude 1’s complement 2’s complement © 1999 Addison Wesley Longman 12
Biased Numbers • decimal 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 BCD biased -4 -3 -2 -1 0 1 2 3 © 1999 Addison Wesley Longman 13
Sign Magnitude Numbers • sign -3 -2 -1 -0 0 1 2 3 © 1999 Addison Wesley Longman 1 1 0 0 magnitude 11 10 01 00 00 01 10 11 14
1‘s Complement Numbers • -3 -2 -1 -0 0 1 2 3 100 101 110 111 000 001 010 011 © 1999 Addison Wesley Longman 15
2‘s Complement Numbers • -4 -3 -2 -1 0 1 2 3 100 101 110 111 000 001 010 011 © 1999 Addison Wesley Longman 16
1‘s Complement Addition • BCD addition • carry end around • result always correct when two operands have different sign • overflow when two positive operands add to a negative result • underflow when two negative operands add to a positive result © 1999 Addison Wesley Longman 17
2‘s complement Addition • BCD addition • carry dropped • result always correct when two operands have different sign • overflow when two positive operands add to a negative result • underflow when two negative operands add to a positive result © 1999 Addison Wesley Longman 18
Floating Point Representation • = 12345 * 10 -2 = 1234. 5 * 10 -1 = 123. 45 = 12. 345 * 101 = 1. 2345 * 102 = 0. 12345 * 103 — normalized form = 0. 012345 * 104 … • 21. 75 = 10101. 11 = 0. 1010111 * 25 © 1999 Addison Wesley Longman 19
PDP-11, VAX-11 Floating Point Representation sign mantissa 0 100001011100……. 0 8 bits 23 bits • precision 1/224 ~ 1/107 • range 2127 ~ 1038 © 1999 Addison Wesley Longman 20
IBM 360/370 Floating Point Representation • 21. 75 = 10101. 11 B = 15. CH =. 15 C * 162 0 1000010 0001 0101 1100 0000 4 2 1 5 C 0 0 0 • precision 1/221 ~ 1/106 • range 1663 = 2252 ~ 1078 © 1999 Addison Wesley Longman 21
Bits as Codes ASCII - American Standard Code for Information Interchange - most widely used code, represents each character as a unique 8 -bit code. © 1999 Addison Wesley Longman 22
Code & Character Sets • ASCII ( American Standard Code for Information Interchange ) — 7 bit 0 1 2 8 9 A 0| 1| 2| ! ` ( ) / 3| 0 1 7 8 9 4| @A B © 1999 Addison Wesley Longman H I J 3 B 4 C 5 D 6 E 7 F “ * # + $ - % , &. 2 3 4 5 6 C K D L E M F N G 23 O
Code & Character Sets (IV) • EBCDIC ( extended BCD for information exchange code ) — 8 bit 0 8 6 7 E F 8 | f g h 9 | o p q A | w x y © 1999 Addison Wesley Longman B | 1 9 2 A 3 B 4 C 5 D a i j r b c d e k l m n s t u v z 24
Chinese Characters • Big-5 2 byte ( 16 bit ) 13461字 • CNS 11643 3 byte ( 24 bit ) 48222 字 © 1999 Addison Wesley Longman 25
File & Record • files – program file – data file • Record – field – sub-field © 1999 Addison Wesley Longman 26
Type of Data • numerical – integer, real, double precision, complex, … • non-numerical – character string, boolean © 1999 Addison Wesley Longman 27
Bits as Instructions The computer stores programs as collections of bits. For instance, 01101010 might instruct the computer to add two numbers. (OP code) Other bit instructions might include where to find numbers stored in memory or where to store them. (operands) © 1999 Addison Wesley Longman 28
Bits, Bytes, and Buzzwords Common terms might describe file size or memory size: Bit: smallest unit of information Byte: a grouping of eight bits of information K: (kilobyte); about 1, 000 bytes of information - technically 1024 bytes equals 1 K of storage. © 1999 Addison Wesley Longman 29
Bits, Bytes, and Buzzwords MB: (megabyte); about 1 million bytes of information GB: (gigabyte); about 1 billion bytes of information TB: (terabyte); about 1 million megabytes of information © 1999 Addison Wesley Longman 30
The Computer’s Core: The CPU and Memory • The transformations are performed by the CPU - the central processing unit or processor. • The microprocessor, which is a silicon chip, is located on the motherboard. © 1999 Addison Wesley Longman 31
The Computer’s Core: The CPU and Memory When you purchase a computer, the selection of the CPU is a very important choice. There are two factors that are very important to computer users are: - Compatibility - Speed © 1999 Addison Wesley Longman 32
Compatibility Not all software is compatible with any given CPU. Each computer has a unique instruction set - a vocabulary of instructions the processor can execute. New microprocessors can usually run older software, but new software is not usually compatible with old microprocessors. © 1999 Addison Wesley Longman 33
Speed The computer’s speed is measured by the speed of its internal clock - a device to synchronize the electric pulses. Speed is measured in units called megahertz (m. Hz). © 1999 Addison Wesley Longman 34
Speed The architecture of a computer determines its speed. • CISC - complex computer instructions set computer • RISC - reduced instruction set computer © 1999 Addison Wesley Longman 35
CPU family • CISC – Intel X 86, Pentium – Motorola 680 x 0 • RISC – Power. PC, MIPS, SPARC, Alpha © 1999 Addison Wesley Longman 36
Primary Storage: The Computer’s Memory RAM (random access memory): – is the most common type of primary storage, or computer memory. – used to store program instructions and data temporarily – unique addresses and can store in any location – can quickly retrieve information – will not remain if power goes off (volatile). © 1999 Addison Wesley Longman 37
Primary Storage: The Computer’s Memory • ROM (read-only memory): – information is stored permanently on a chip. – contains startup instructions and other permanent data. © 1999 Addison Wesley Longman 38
Buses, Ports, and Peripherals Information travels between components through groups of wires called buses. © 1999 Addison Wesley Longman 39
Buses, Ports, and Peripherals: – are external devices for receiving input or producing output (keyboard, monitor, and mouse). – communicate with other parts of the system. © 1999 Addison Wesley Longman 40
Buses, Ports, and Peripherals – provide attachment and communication with external devices by means of: slots (for internal attachment) ports (for external attachments) © 1999 Addison Wesley Longman 41
- Slides: 41