module 5 central processing unit

33
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

Upload: martina-nichols

Post on 30-Dec-2015

29 views

Category:

Documents


2 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Module 5 Central Processing Unit

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

Page 2: Module 5 Central Processing Unit

2

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

Page 3: Module 5 Central Processing Unit

3

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

Page 4: Module 5 Central Processing Unit

4

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

Page 5: Module 5 Central Processing Unit

5

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

115 12 11 00 1

1110=10112

Readup

199 14 12 01 0

1910 = 100112

Readup

0 1

Page 6: Module 5 Central Processing Unit

6

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

Fixed length binary representation

Page 7: Module 5 Central Processing Unit

7

Example of 4 binary digits numbers

Page 8: Module 5 Central Processing Unit

8

Binary number facts

Bits Range

8 0 to 28-1=255

16 0 to 216-1= 65 535

32 0 to 232-1= 4 294 967 295

64 0 to 264-1=18 446 744 073 709 551 615

It takes more digits to represent a number in binary than it does in decimal

Page 9: Module 5 Central Processing Unit

9

Binary number operations

Add, subtract, multiply, division

Example of add

1101 + 1001

1101

1001

+_____

10110

Page 10: Module 5 Central Processing Unit

10

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

Page 11: Module 5 Central Processing Unit

11

ASCII coding scheme• 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)

065 1000001 A065 1000001 A 066 1000010 B066 1000010 B 067 1000011 C067 1000011 C 068 1000100 D068 1000100 D 069 1000101 E069 1000101 E 070 1000110 F070 1000110 F 071 1000111 G071 1000111 G 072 1001000 H072 1001000 H 073 1001001 I073 1001001 I 074 1001010 J074 1001010 J 075 1001011 K075 1001011 K 076 1001100 L076 1001100 L 077 1001101 M077 1001101 M 078 1001110 N078 1001110 N 079 1001111 O079 1001111 O 080 1010000 P080 1010000 P 081 1010001 Q081 1010001 Q 082 1010010 R082 1010010 R 083 1010011 S083 1010011 S 084 1010100 T084 1010100 T 085 1010101 U085 1010101 U 086 1010110 V086 1010110 V 087 1010111 W087 1010111 W 088 1011000 X088 1011000 X 089 1011001 Y089 1011001 Y 090 1011010 Z090 1011010 Z

Page 12: Module 5 Central Processing Unit

12

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

Page 13: Module 5 Central Processing Unit

14

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

Page 14: Module 5 Central Processing Unit

15

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

Page 15: Module 5 Central Processing Unit

16

Central Processing Unit (CPU)

• Consists of complex set of electronic circuitry • Executes stored program instructions• Three components

– Registers– Control unit– Arithmetic/Logic Unit

(ALU) Control Unit

ALU

Registers

Memory

CPU

Page 16: Module 5 Central Processing Unit

17

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

Page 17: Module 5 Central Processing Unit

18

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

Page 18: Module 5 Central Processing Unit

19

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

Page 19: Module 5 Central Processing Unit

20

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

Page 20: Module 5 Central Processing Unit

21

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

Page 21: Module 5 Central Processing Unit

22

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

Page 22: Module 5 Central Processing Unit

23

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

Page 23: Module 5 Central Processing Unit

24

The machine cycle

• The time required to retrieve, execute, and store an operation

• Components– Instruction time– Execution time

• System clock synchronizes operations

Page 24: Module 5 Central Processing Unit

25

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

Page 25: Module 5 Central Processing Unit

26

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

Page 26: Module 5 Central Processing Unit

27

Microprocessor

• Central processing unit etched on silicon chip

• Contain hundreds of millions of tiny transistors

• Key components:– ALU– Registers– Control unit– System clock

Page 27: Module 5 Central Processing Unit

28

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 meter

Moving to 0.09 micro meter 90 nano meterNext a few years: 60 nano meters

Page 28: Module 5 Central Processing Unit

29

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

Page 29: Module 5 Central Processing Unit

30

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

Page 30: Module 5 Central Processing Unit

31

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

Page 31: Module 5 Central Processing Unit

32

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

Page 32: Module 5 Central Processing Unit

33

Cache

• A temporary storage area– Speeds up data

transfer within computer

• Processor cache

Control Unit

ALU

Registers

Memory

CPU

Cache L1

Cache L2

Page 33: Module 5 Central Processing Unit

34

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