02 the cpu

26
The CPU Central Processing Unit

Upload: jim-finn

Post on 27-Jul-2015

139 views

Category:

Education


0 download

TRANSCRIPT

Page 1: 02 the cpu

The CPUCentral Processing Unit

Page 2: 02 the cpu

Switches, Bits and Bytes

•A Computer chip is essentially a huge collection of switches that can be turned on and off

•A switch that is on is given the number 1•A switch that is off is given the number 0•This is binary•In computer terminology one of these

numbers is called a bit.

Page 3: 02 the cpu

•1 Bit – a 1 or a 0•8 Bits = 1 Byte•1024 Bytes = 1Kilobyte (Kb)•1024 Kb = 1 Megabyte (Mb)•1024 Mb = 1 Gigabyte (Gb)•1024 Gb = 1 Terabyte (Tb)•1024 Tb = 1 Pentabyte (Pb)

Page 4: 02 the cpu

Central Processing Unit• the CPU is the device that performs the

calculations that make computing possible• Although there are several CPU

manufacturers, Intel and Advanced Micro Devices (AMD) make the vast majority of processors used in Windows-based PCs

• One other processor family worth mentioning is the very inexpensive VIA C3 family from VIA Technologies (via.com.tw), which has started to show up in some similarly inexpensive systems.

Page 5: 02 the cpu

Clock Speed• Clock Cycle

▫The Computer and microprocessor has a clock that controls the timing of functions of the computer. Old Computers took multiple clock cycles to perform a single calculation. Modern processors can perform multiple calculations in a single cycle

• There are a number of clocks in a PC▫CPU Clock – Controls the speed of the CPU▫System Clock – Controls the speed of the system

bus. Different to the CPU clock. Memory runs at this speed

Page 6: 02 the cpu

CPU Terminology

•BUS▫The Bus is a data pathway in the computer.▫The wires on the motherboard that allows

the CPU to communicate with the other devices in the computer

▫The system bus is central to how the CPU and the Computer works

Page 7: 02 the cpu

Buses

•There are lots of buses such as the internal bus, the external bus, expansion bus, data bus, memory bus, PCI bus, ISA bus, address bus, control bus,

•We will be looking at some of these in this course and how they work.

Page 8: 02 the cpu

System bus

•Made up of 3 different buses/Controls▫Data Bus▫Address Bus▫Control Bus

•To understand how the bus works you must look at how data is transmitted.

Page 9: 02 the cpu

Data transmission•Data is broken up into 3 parts to be

transmitted along a bus

•The Data being transmitted•The Address that tells the data where to go•The Control that ensures the data arrives

complete

DataControl

Address

Control

Page 10: 02 the cpu

•The Address bus controls where the data goes.▫Each component has a unique address. The

address bus ensures that the data goes to the correct device

•Control Bus ensures that the data arrives correctly to the device▫It contains a check that makes sure that

the data is complete when it arrives•Data bus Carries the data

▫The data being sent by the CPU

Page 11: 02 the cpu

BUS Size•Is your computer a 16Bit, 32Bit or 64Bit

computer•This is the size of the bus.•A 32Bit bus can send 32 Bits of data at

the same time.•It allows it to access a maximum amount

of memory at one time.▫32 Bit can access 4Gb at 1 time▫64 Bit can access 16Eb (Exabytes = 1024

Pentabytes)

Page 12: 02 the cpu

Example

•http://computer.howstuffworks.com/computer-memory3.htm

Page 13: 02 the cpu

• Front Side Bus (FSB): ▫ Measured in megahertz (MHz), the FSB is the

channel that connects the processor with main memory. The faster this is, the better the performance will be.

• Sockets and slots: ▫ processors either fit in a socket or slot,

depending on their construction. There are quite a few different socket and slot types.

• Pins: ▫ Within the categories of sockets and slots,

there are different types of each. The types vary by size, and number and configuration of pins.

Page 14: 02 the cpu

Cache (pronounced “cash”): • All new CPUs have cache memory. Cache,

as it pertains to CPUs, is expensive high-speed memory used for storing frequently used instructions. The less expensive CPU lines, Intel, Celeron, and AMD Duron, have less cache than their otherwise equivalent Pentium and Athlon cousins.

• Different types of cache memory▫ L1 – This is cache memory that sits on the

CPU and runs at the CPU Clock speed▫ L2 – This sits between CPU and Main Memory

and runs at system clock speed

Page 15: 02 the cpu

Intel Processor History The date is the year that the processor was first introduced.

Many processors are re-introduced at higher clock speeds for many years after the original release date.

Transistors is the number of transistors on the chip. Microns is the width, in microns, of the smallest wire on the

chip. For comparison, a human hair is 100 microns thick. As the feature size on the chip goes down, the number of transistors rises.

Clock speed is the maximum rate that the chip can be clocked at. Clock speed will make more sense in the next section.

Data Width is the width of the ALU. An 8-bit ALU can add/subtract/multiply/etc

MIPS stands for "millions of instructions per second" and is a rough measure of the performance of a CPU. Modern CPUs can do so many different things that MIPS ratings lose a lot of their meaning, but you can get a general sense of the relative power of the CPUs from this column.

Page 16: 02 the cpu
Page 17: 02 the cpu

How does the CPU Work? A microprocessor executes a collection of

machine instructions that tell the processor what to do. Based on the instructions, a microprocessor does three basic things:

Using its ALU (Arithmetic/Logic Unit), a microprocessor can perform mathematical operations like addition, subtraction, multiplication and division. Modern microprocessors contain complete floating point processors that can perform extremely sophisticated operations on large floating point numbers.

A microprocessor can move data from one memory location to another.

A microprocessor can make decisions and jump to a new set of instructions based on those decisions.

Page 18: 02 the cpu
Page 19: 02 the cpu

This is about as simple as a microprocessor gets. This microprocessor has: An address bus (that may be 8, 16 or 32 bits

wide) that sends an address to memory A data bus (that may be 8, 16 or 32 bits wide) that

can send data to memory or receive data from memory

An RD (read) and WR (write) line to tell the memory whether it wants to set or get the addressed location

A clock line that lets a clock pulse sequence the processor

A reset line that resets the program counter to zero (or whatever) and restarts execution

Page 20: 02 the cpu

We’ve talked about the address and data buses, as well as the RD and WR lines. These buses and lines connect either to RAM or ROM

ROM stands for read-only memory. A ROM chip is programmed with a permanent collection of pre-set bytes. The address bus tells the ROM chip which byte to get and place on the data bus

Page 21: 02 the cpu

Using the CPU Even a simple processor can have a large

library of instructions that it uses for it’s operation

The collection of instructions is implemented as bit patterns, each one of which has a different meaning when loaded into the instruction register.

We are not good at remembering bit patterns so a set of instructions were created to represent what each bit pattern did in the processor.

This collection of words is called the assembly language of the processor

An Assembler converts this code into the bit patterns that the processor will recognise

Page 22: 02 the cpu

Microprocessor Performance The number of transistors that a processor has a

direct effect on the performance of the Processor a typical instruction in an old processor like an

8088 took 15 clock cycles to execute. With more transistors, much more powerful

multipliers capable of single-cycle speeds become possible.

More transistors also allow for a technology called pipelining.

In a pipelined architecture, instruction execution overlaps. So even though it might take five clock cycles to execute each instruction, there can be five instructions in various stages of execution simultaneously.

Page 23: 02 the cpu

Pipelineing

•Each instruction takes 5 cycles to execute•Normally CPU has to wait for one to finish

before starting the next

•Pipelining allows staggered execution1 2

1

2

3

4

5

Page 24: 02 the cpu

•Many modern processors have multiple instruction decoders, each with its own pipeline.

•This allows for multiple instruction streams, which means that more than one instruction can complete during each clock cycle.

Page 25: 02 the cpu

The Future For the last number of years the trend has been

towards full 32bit ALU’s and fast Floating Point Units and pipelined execution with multiple instruction streams.

For a time the next step was logically jump to a 64bit processor. Particularly used in servers.

Also used has been the inclusion of special code on the processor to preform specific tasks (MMX)

A new development in recent times is towards multiple core processors.

All of these cause the transistor count to rise and modern processors can have multiple million transistors on them.

Modern processors can execute up to 1 Billion (1,000,000,000) instructions per second.

Page 26: 02 the cpu

The 64bit processor was developed in 1992. Both Intel and AMD have introduced 64-bit

chips Why Use 64Bit? Thirty-two-bit chips are often constrained to

a maximum of 2 GB or 4 GB of RAM access. A 64-bit chip has none of these constraints

because a 64-bit RAM address space is essentially infinite for the foreseeable future -- 2^64 bytes of RAM is something on the order of a billion gigabytes of RAM.

A 64 System also has faster data buses which means faster Input and output.