the cpu

21
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed

Upload: rimona

Post on 21-Feb-2016

28 views

Category:

Documents


0 download

DESCRIPTION

The CPU. The Central Presentation Unit Language Levels Fetch execute cycle Processor speed. Language G enerations: Evolution of Programming Languages . First Generation . The first generation of languages was very difficult to understand and also to code - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The CPU

The CPUThe Central Presentation Unit • Language Levels • Fetch execute cycle • Processor speed

Page 2: The CPU

Language Generations:

Evolution of Programming Languages

Page 3: The CPU

First Generation The first generation of languages was

very difficult to understand and also to code

This language was based on machine code language, hence the programmer would need to use binary to create a program

For this particular generation, punched tape was used, where a hole would represent a 1 and no-hole meant a 0.

Page 4: The CPU

1st Generation traits 1. This generation was very fast as the

computer would not need to translate the language but would understand it right away

2. It allows limited calculations such as simple arithmetic, logical operators, incrimination or decrementation and shift operations only

3. It cannot be run on another machine, unless it is identical

Page 5: The CPU

Second Generation / Assembly Language The second generation language, was also

based on machine code,

This language was much easier as it used mnemonics (opcodes and operands)

Programming was much easier because the programmer does not have to remember a list of binary digits

Since this code is not in machine code an assembler is used to convert the code to binary

Page 6: The CPU

Examples of OpcodesMachine Code

Assembly

Description

0000 END Stops the program0001 ADD Adds contents of memory location to accumulator0010 SUB Subtracts contents of memory location from

accumulator0011 MULT Multiplies contents of memory location to accumulator

0100 DIV Divides contents of memory location into accumulator

0101 LDA Copy contents of memory locations into the accumulator

0110 STO Copy contents of the accumulator into the memory location

0111 IN Input from Input Unit to memory location1000 OUT Output contents of memory location to Output Unit

1001 JMP Transfer Control to Instruction in Named Location

1010 JNZ Jump if contents of Accumulator is not Zero

Page 7: The CPU

Third Generation / High-level Language The third generation of languages

was a very big improvement from the second generation

This generation incorporated the use of English-like statements

Since this language is coded in English-like statements a compiler or an interpreter is needed to translate the language to binary

Page 8: The CPU

Compiler Vs. Interpreter The Compiler

Translates 3rd Generation languages

The code is translated all at once

Errors shown at the end of the translation

Fast translation

The Interpreter

Translates 3rd Generation languages

The code is translated line by line

Errors are shown after each line is translated

Much slower translation

Page 9: The CPU

Examples of the 3rd Generations FORTRAN - mathematics formulas, scientific

problems, engineering problems COBOL – business oriented BASIC – very easy to understand, ideal to learn

programming PASCAL – mostly used for teaching purposes C – used to write operating systems, database

management system, scientific applications LISP – artificial intelligence LOGO – teach children problem-solving and

programming skills C ++ - An improved C, very popular and powerful JAVA – Very popular and powerful, also cross-platform

Page 10: The CPU

Fourth Generation The fourth generation language is

much closer to the human language and is very fast to code

A typical example of the ease of use of 4th generation languages is the creation of a GUI.

To create a GUI in JAVA would be quite difficult because of the code required for each component, with 4GL creating it would be simply drag and drop

Page 11: The CPU

Fifth Generation Lastly we have the fifth

generation languages, which are the closest to the human language

This generation is used in artificial intelligence

Page 12: The CPU

Lang

uage

Ge

nera

tions

First Generation (1s and 0s)

Second Generation

(Mnemonics) Third Generation

(High-Level Language)

Fourth Generation (Drag

and Drop)Fifth Generation

(Artificial Intelligence)

Page 13: The CPU

The Fetch Execute Cycle

Actions that a (CPU) performs to execute

instruction

Page 14: The CPU

What is the Fetch Execute Cycle?The Fetch execute cycle is also

sometimes know as the Fetch-decode-execute cycle

This cycle explains what goes on within the CPU when an instruction is being processed

Page 15: The CPU

AbbreviationsCU = Control UnitPC = Program CounterIR = Instruction Register ALU = Arithmetic Logic Unit ACC = Accumilator

Page 16: The CPU

The Fetch Execute Cycle 1. The CPU sends the value of the PC on the

address bus. 2. The CPU fetches the instruction from main

memory along the data bus into the IR3. The data in the IR is decoded by the CU4. The decoded information is sent to the

relevant function units of the CPU (such as reading values from registers, passing them to the ALU, writing them to a certain register)

5. If there is another instruction the PC is incremented by 1and the cycle is repeated. If not the instruction set ends

Page 17: The CPU

Start

PC = Address of 1st Instruction

Fetch Instruction from location found at PC

Store a copy of fetched Instruction into IR

 PC = PC + 1

 Execute Instruction

End of Program? End

No

Yes

Note: When executing the instruction the following takes place: Get data required from main

memory Place it in Data Registers Activate correct circuits to work

out instruction Transfer results back to main

memory.

Abbreviation:PC – Program Counter

Page 18: The CPU

Assembly Code(Using the FEC) This allows the user to input 2

numbers and display their total Opcode Operan

dDescription

IN 100 Get input from keyboard and store it in location 100

IN 101 Get input from keyboard and store it in location 101

LDA 100 Copy contents of location 100 to the accumulator

ADD 101 Add the number found in location 101 to the accumulator

STO 102 Copy the number in the accumulator to location 102

OUT 102 Display the contents of 102 to an output device

Page 19: The CPU

STEP PC IR ACC 100 101 102 OUT1 1            2 1 IN 100          3 1 IN 100   5       4 2   5      5 2 IN 101   5      6 2 IN 101   5 10     7 3   5 10    8 3 LDA

100  5 10    

9 3 LDA 100

5  5 10    

10 4 5 5 10    11 4 ADD

1015 5 10    

12 4 ADD 101

15 5 10    

13 5 15 5 10    

14 5 STO 102

15 5 10    

15 5 STO 102

15 5 10 15   

16 6 STO 102

15 5 10 15  

17 6 15 5 10 15  

18 6 OUT 102

15 5 10 15  15

Page 20: The CPU

Processor SpeedThe clock rate measures the

number of instructions done by the CPU per second, this is measured in hertz.

When comparing the speeds of entire computers you need to look at ◦the clock rate of the RAM, ◦the width in bits of the CPU's buses◦the amount of cache

Page 21: The CPU

Clock Speed HistoryThe original IBM PC,(1981),had a

clock rate of 4.77 MHz (4,770,000 cycles/second)

In 1995, Intel's Pentium chip ran at 100 MHz (100 million cycles/second)

In 2002, an Intel Pentium 4 model has a clock rate of 3 GHz (three billion cycles/second)