330 likes | 441 Views
Module 5 Central Processing Unit. 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction set 4. Important features of CPUs. Data representation.
E N D
Module 5Central Processing Unit 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction set 4. Important features of CPUs
Data representation • All modern digital equipment work on binary digits, 0, 1, based on the two measurable/recogniable states: such as circuitry voltage, high voltage (ON): 1 Low voltage (Off) : 0 • Why? Simple, reliable, and available technology • The fundamental component made of silicon: Transister • Logic gates AND, OR, NOT can be constructed from transistor
Data representation • All modern digital equipment work on binary digits, i.e., 0, 1, based on the two states of a circuitry, e.g.High voltage (ON): 1 Low voltage (Off) : 0 • Why? Simple, reliable, and available technology • CPU can only understand 0 and 1 • Data must be represented in binary form before it is processed by a CPU • How to representation number? • Binary (base 2) number, containing only two digits, 0 and 1 • How to represent characters? • English text for example
Binary number • In decimal (base 10) we indicate place values by the order of digits • 135 = (1*102) + (3*101) + (5*100) • In binary only 0’s and 1’s exist we do the same thing but since we use only two digits the place values change. • 10011 = (1*24)+(0*23)+(0*22)+(1*21)+(1*20) = 16 + 0 + 0 + 2 + 1 = 19
19 5 9 1 1 Read up Read up 4 2 1 1 1 2 0 0 0 1 0 0 1 1 11 Conversion between binary and decimal 10112 = (1x20)+(1x21)+(0x22)+(1x23) = 1+2+0+8 = 11 Decimal to binary: repeatedly divide the quote by 2, read the remainder backward 1110=10112 1910 = 100112
Fixed length binary representation One binary digit can represents two numbers, 0, 1 Two binary digits can represent four numbers 00, 01, 10, 11 0 1 2 3 Three binary digits can represent ___numbers
Binary number facts It takes more digits to represent a number in binary than it does in decimal
Binary number operations Add, subtract, multiply, divisionExample of add1101 + 1001 1101 1001 +_____ 10110
Binary representation for characters • Coding schemes provide a common way of representing a character of data • Common Schemes • ASCII, 7 bits • Stands for American Standard Code for Information Interchange • Most widely used standard • Used on virtually all personal computers
ASCII coding scheme 065 1000001 A 066 1000010 B 067 1000011 C 068 1000100 D 069 1000101 E 070 1000110 F 071 1000111 G 072 1001000 H 073 1001001 I 074 1001010 J 075 1001011 K 076 1001100 L 077 1001101 M 078 1001110 N 079 1001111 O 080 1010000 P 081 1010001 Q 082 1010010 R 083 1010011 S 084 1010100 T 085 1010101 U 086 1010110 V 087 1010111 W 088 1011000 X 089 1011001 Y 090 1011010 Z • 7 bits, 127 different symbols • Examples Dec Binary Symbols 048 0110000 0 049 0110001 1 050 0110010 2 051 0110011 3 052 0110100 4 053 0110101 5 054 0110110 6 055 0110111 7 056 0111000 8 057 0111001 9 058 0111010 : (colon) 059 0111011 ; (semi-colon) 060 0111100 < (less than) 061 0111101 = (equal sign) 062 0111110 > (greater than) 063 0111111 ? (question mark) 064 1000000 @ (AT symbol)
Unicode • Designed to accommodate alphabets of more than 256 characters • Uses 16 bits to represent one character • 65,536 possible values • Requires twice as much space to store data
Word • Word is the number of bits the CPU processes as a unit. • A word usually consists of several bytes. It is CPU dependent. The larger the word, the more powerful the computer. • We say a 32 bits processor. Here 32 is the size of the word. It is equal to the size of a register. in length
The units for information storage sizes • One kilobyte (1 KB) = 1024 (210) bytes = 213 bits • Memory capacity of older personal computers • One Megabyte (1 MB) = 220 bytes ≈ 106 bytes (one million bytes) • Personal computer memory • Portable storage devices (diskette, CD-ROM) • One gigabyte (1 GB) = 230 bytes ≈ 109 bytes (one billion bytes) • Storage devices (hard drives) • Mainframe and network server memory • One terabyte (1 TB) = 240 bytes ≈ 1012 bytes (one trillion bytes) • Storage devices on very large systems
Memory Control Unit Registers ALU CPU Central Processing Unit (CPU) • Consists of complex set of electronic circuitry • Executes stored program instructions • Three components • Registers • Control unit • Arithmetic/Logic Unit (ALU)
Registers • Registers: temporary place for instructions and data. All instructions and data must be placed in registers before being executed and processed • High-speed temporary storage areas • Storage locations located within the CPU • Work under direction of control unit • Accept, hold, and transfer instructions or data • Keep track of where the next instruction to be executed or needed data is stored
Control unit • Control unit: directs the computer system to execute stored program instructions • Must communicate with memory and ALU • Storage operations • Moving data/instructions from/to register to/from registers • Sends data and instructions from secondary storage to memory as needed
ALU • Executes all arithmetic and logical operations • Arithmetic operations • Addition, subtraction, multiplication, division • Logical operations • Compare numbers, letters, or special characters • Tests for one of three conditions • Equal-to condition, Less-than condition, Greater-than condition • Branch to different instructions
Memory • Also known as primary storage and main memory • Often expressed as random-access memory (RAM) • Not part of the CPU • Holds data and instructions for processing • Stores information only as long as the program is in operation
The CPU and memory • CPU cannot process data from disk or input device • It must first reside in memory • Control unit retrieves data from disk and moves it into memory • Items sent to ALU for processing • Control unit sends items to ALU, then sends back to memory after processing • Data and instructions held in memory until sent to an output or storage device or program is shut down
Data storage and the CPU • Two types of storage: • Primary storage (memory) • Stores data temporarily • CPU refers to it for both program instructions and data • Secondary storage • Long-term storage • Stored on external medium, such as a disk
How the CPU executes instructions • Four steps performed for each instruction • Machine cycle: the amount of time needed to execute an instruction • Personal computers execute in less than one millionth of a second • Supercomputers execute in less than one trillionth of a second • Each CPU has its own instruction set • those instructions that CPU can understand and execute
The machine cycle • The time required to retrieve, execute, and store an operation • Components • Instruction time • Execution time • System clock synchronizes operations
Instruction time • Also called I-time • Control unit gets instruction from memory and puts it into a register • Control unit decodes instruction and determines the memory location of needed data
Execution time • Control unit moves data from memory to registers in ALU • ALU executes instruction on the data • Control unit stores result of operation in memory or in a register
Microprocessor • Central processing unit etched on silicon chip • Contain hundreds of millions of tiny transistors • Key components: • ALU • Registers • Control unit • System clock
Transistors • Electronic switches that may or may not allow electric current to pass through • If current passes through, switch is on, representing a 1 bit • Otherwise, switch is off, representing a 0 bit • The size of a transistor • New technology makes the size of a transistor smaller and smaller! • Current: 0.13 micro meter or 130 nano meterMoving to 0.09 micro meter 90 nano meterNext a few years: 60 nano meters
Types of chips • Intel makes a family of processors • Pentium III and Pentium4 processors in most PCs • Celeron processor sold for low-cost PCs • Xeon and Itanium for high-end workstations and network servers • Other processors • Cyrix and AMD make Intel-compatible microprocessors • PowerPC chips used primarily in Macintosh computers • Compaq’s Alpha microprocessor used in high-end servers
Computer processing speeds • Instruction speeds measured in fractions of seconds • Millisecond: one thousandth of a second • Microsecond: one millionth of a second • Nanosecond: one billionth of a second • Modern computers have reached this speed • Picoseconds: one trillionth of a second
Microprocessor speeds • Measure of system clock speed • How many electronic pulses the clock produces per second (clock frequency) • Usually expressed in frequency • Gigahertz (GHz), Megahertz (MHz), Kilohertz (KHz) • Or how much time for each cycle: clock cycle time clock cycle time = 1 / clock frequency • Second, millisecond, microsecond, nanosecond, picoseconds • Comparison of clock speed only meaningful between identical microprocessors
Other performance measures • Millions of Instructions per Second (MIPS) • High-speed personal computers can perform over 500 MIPS • Typically a more accurate measure of performance than clock speed • Megaflop: one million floating-point operations • Measures ability of computer to perform complex mathematical operations
Cache Memory • A temporary storage area • Speeds up data transfer within computer • Processor cache Cache L2 Cache L1 Control Unit Registers ALU CPU
Processor cache • A small block of high-speed memory • Stores most frequently and most recently used data and instructions • Microprocessor looks for what it needs in cache first • Transferred from cache much faster than from memory • If not in cache, control unit retrieves from memory • The more cache “hits” the faster the system performance • Internal (Level 1) cache built into microprocessor • Fastest access, but highest cost • External (Level 2) cache on separate chip • Incorporated into processor on some current microprocessors