1-2 – Central Processing Unit

Slides:



Advertisements
Similar presentations
The CPU The Central Presentation Unit What is the CPU?
Advertisements

Computer Architecture and the Fetch-Execute Cycle
GCSE Computing - The CPU
A-Level Computing#BristolMet Session Objectives#4 MUST describe the differences between the main types of primary memory SHOULD describe the function and.
The Computer Processor
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Computer Systems 1 Fundamentals of Computing The CPU & Von Neumann.
Internal hardware and external components of a computer Three-box Model  Processor The brain of the system Executes programs A big finite state machine.
Computing hardware CPU.
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
The Central Processing Unit
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
CENTRAL PROCESSING UNIT – a,b,c & d a - The Purpose of a CPU The CPU is the brain of the computer. The Purpose of the CPU is to process.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Chapter 2: CPU.
The Central Processing Unit (CPU) and the Machine Cycle.
Fetch-execute cycle.
Computer Studies/ICT SS2
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Assessment Covering… Von Neuman architecture Registers – purpose and use, the fetch execute cycle.
System Unit Working of CPU. The CPU CPU The CPU CPU stands for central processing unit. it is brain of computer It is most important component of the.
Dale & Lewis Chapter 5 Computing components
Computer operation is of how the different parts of a computer system work together to perform a task.
The Central Processing Unit (CPU)
1 3 Computing System Fundamentals 3.2 Computer Architecture.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
Software Design and Development Computer Architecture Computing Science.
What’s going on here? Can you think of a generic way to describe both of these?
3.1.4 Hardware a. describe the function and purpose of the control unit, memory unit and ALU (arithmetic logic unit) as individual parts of a computer;
Stored Program Concept Learning Objectives Learn the meaning of the stored program concept The processor and its components The fetch-decode-execute and.
CPU Central Processing Unit
Computer Hardware What is a CPU.
CPU Lesson 2.
OCR GCSE Computer Science Teaching and Learning Resources
GCSE Computing - The CPU
Systems Architecture Keywords Fetch Execute Cycle
GCSE OCR Computing A451 The CPU Computing hardware 1.
The CPU, RISC and CISC Component 1.
Von Neumann architecture
Chapter 10: Computer systems (1)
Chapter 2.1 CPU.
Starter: Stored Program Concept (von Neumann Architecture)
OCR GCSE Computer Science Teaching and Learning Resources
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Lecture 5: Computer systems architecture
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
3.3.3 Computer architectures
Lesson Objectives A note about notes: Aims
Assembly Language for Intel-Based Computers, 5th Edition
THE CPU i Bytes 1.1.
Hook – CPU Knowledge Check
Instructions at the Lowest Level
Computer Architecture 2
Teaching Computing to GCSE
System Architecture 1 Chapter 2.
CPU Key Revision Points.
Components of a CPU AS Computing - F451.
Unit 1.1 System Architecture Lesson 2
GCSE OCR 1 The CPU Computer Science J276 Unit 1
GCSE Computing - The CPU
WJEC GCSE Computer Science
Information Representation: Machine Instructions
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
OCR GCSE (9-1) Computer Science (J276)
Computer Architecture
Little work is accurate
Computer Science. The CPU The CPU is made up of 3 main parts : Cache ALU Control Unit.
Presentation transcript:

1-2 – Central Processing Unit

Central Processing Unit

Introduction (c) 2018

System architecture (c) 2018 How all the different hardware components connect together Central Processing Unit (CPU) consists of the following: Arithmetic Logic Unit (ALU) Control Unit (CU) Clock Bus Watch http://tiny.cc/systemarchitecture from BBC Bitesize for an overview of the system architecture (c) 2018

Von Neumann Architecture

Textbook reading Read pages 6-7 of Chapter 1 – Computer Systems from The Ultimate GCSE Computer Science Textbook (c) 2018

Von Neuman Architecture 1 John von Neumann Mathematician in the 1940s Identified that data and programs could be stored in the same memory Only one set of RAM required for both data and programs Other architectures also used in many smartphones eg Harvard architecture (c) 2018

Von Neumann Architecture 2 John von Neumann described system architecture as comprising: CPU Control Unit Input Output Arithmetic Logic Unit Memory (c) 2018

Arithmetic Logic Unit - ALU Part of CPU Carries out arithmetic calculations Addition Subtraction Shifts (multiplication and division) Carries out logical operations AND OR NOT Less Than < Greater Than > 5 + 6 = 11 if x > y (c) 2018

Control Unit - CU (c) 2018 Part of CPU Manages the execution of instructions Ensures all components perform tasks at the correct time Responsible for the fetch-execute cycle Analogy: a conductor for an orchestra (c) 2018

Clock (c) 2018 A signal to synchronise tasks Clock cycle is known as a tick Each cycle has high state Low state high one cycle (tick) Tick low Tick (c) 2018

Bus (c) 2018 System bus connects: Three buses: CPU Memory Input/Output control bus (control signals) address bus (memory addresses) data bus (instructions and data items) (c) 2018

Fetch-Execute cycle (c) 2018

Textbook reading Read page 8 of Chapter 1 – Computer Systems from The Ultimate GCSE Computer Science Textbook (c) 2018

Fetch-execute cycle (c) 2018 During one cycle: Fetch next instruction from memory Decode instruction Execute the instruction 01011101 STORE 13 (c) 2018

http://tiny.cc/fetchexecute (3:12 to 4:42) - Fetch-Execute Cycle

Registers used in Fetch-execute cycle Program counter - PC address of next instruction in memory (also known as instruction address register – IAR) Memory address register – MAR address of instruction during fetch phase OR address to retrieve data from during execute phase Memory data register – MDR current data that has been fetched from memory OR is about to be stored in memory (also known as the memory buffer register – MBR) Current instruction register – CIR instruction to be executed Accumulator – ACC result of the current calculation Registers areas of memory in the CPU hold data and memory addresses CPU   M A R P C C U M D R C I R It’s advisable to only cover the following slides with grade 6+ students and don’t be concerned if grade 6 students have difficulty understanding it. It’s only ever going to be a small number of marks on an exam paper that are targeted at the highest grade(s). A L U A C C (c) 2018

http://tiny.cc/fetchexecutefull - detailed explanation of Fetch-Execute Cycle

Fetch stage - 1 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The address in memory of the next instruction is already stored in the Program Counter (PC) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - Data Bus C U M D R - C I R - A L U Control Bus A C C - (c) 2018

Fetch stage - 2 CPU RAM (c) 2018 The address in the Program Counter (PC) is copied to the Memory Address Register (MAR) The Control Unit sends the contents of the Memory Address Register to RAM RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - Data Bus C U M D R - C I R - A L U Control Bus A C C - (c) 2018

Fetch stage - 3 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The instruction is now retrieved from memory and sent along the data bus to the Memory Data Register (MDR) The instruction is then copied from the Memory Data Register (MDR) to the Current Instruction Register (CIR) Finally the value of the Program Counter is increased by one ready for the next instruction after the fetch execute cycle RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - LOAD 4 Data Bus 1 C U M D R - C I R - LOAD 4 A L U Control Bus A C C - (c) 2018

Decode stage CPU RAM (c) 2018 The instruction in the Memory Data Register (MDR) is decoded by the Control Unit (CU) LOAD is recognised as the op-code (instruction) and 4 as the operand (memory location) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - Data Bus 1 C U M D R - C I R - LOAD 4 LOAD 4 LOAD 4 A L U Control Bus A C C - (c) 2018

Execute stage - 1 CPU RAM (c) 2018 The memory address is copied from the CIR to the Memory Address Register (MAR) It is then passed along the address bus to main memory (RAM) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - Data Bus 4 1 C U M D R - C I R - LOAD 4 LOAD 4 LOAD 4 4 A L U Control Bus A C C - (c) 2018

Execute stage - 2 CPU RAM (c) 2018 The data at that memory address is passed to the Memory Data Register (MDR) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4  25  5  6 M A R - P C - Data Bus 4 1 C U M D R - C I R - LOAD 4 LOAD 4 A L U Control Bus A C C - 4 25 (c) 2018

Execute stage - 3 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The instruction from the Current Instruction Register is then executed on the data in the MDR In this example, 25 is loaded from the Memory Data Register (MDR) to the Accumulator (ACC) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1    2  3  4 25  5  6 M A R - P C - Data Bus 4 1 C U M D R - C I R - 25 25 LOAD 4 LOAD A L U Control Bus A C C - (c) 2018

Cycle completed The first fetch-execute cycle is now completed With a 2 GHz processor, that took just half a billionth of a second (c) 2018

Textbook reading Read pages 9-10 of Chapter 1 – Computer Systems from The Ultimate GCSE Computer Science Textbook (c) 2018

Cycle 2 The clock can now tick again for the next fetch-execute cycle (c) 2018

Fetch stage - 1 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The address in memory of the next instruction is already stored in the Program Counter (PC) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R 4 P C - Data Bus 1 C U M D R 25 C I R LOAD 4 A L U Control Bus A C C 25 (c) 2018

Fetch stage - 2 CPU RAM (c) 2018 The address in the Program Counter (PC) is copied to the Memory Address Register (MAR) The Control Unit sends the contents of the Memory Address Register to RAM RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R 4 P C - Data Bus 1 C U M D R 25 C I R LOAD 4 A L U Control Bus A C C 25 (c) 2018

Fetch stage - 3 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The instruction is now retrieved from memory and sent along the data bus to the Memory Data Register (MDR) The instruction is then copied from the Memory Data Register (MDR) to the Current Instruction Register (CIR) Finally the value of the Program Counter is increased by one ready for the next instruction after the fetch execute cycle RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R - P C - Data Bus 1 1 2 C U ADD 5 M D R - C I R LOAD 4 ADD 5 A L U Control Bus A C C 25 (c) 2018

Decode stage CPU RAM (c) 2018 The instruction in the Memory Data Register (MDR) is decoded by the Control Unit (CU) add is recognised as the op-code (instruction) and 5 as the operand (memory location) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R - P C - Data Bus 1 2 C U M D R - C I R - ADD 5 ADD 5 ADD 5 A L U Control Bus A C C 25 (c) 2018

Execute stage - 1 CPU RAM (c) 2018 The memory address is copied from the CIR to the Memory Address Register (MAR) It is then passed along the address bus to main memory (RAM) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R - P C - Data Bus 1 5 2 C U M D R - C I R - LOAD 4 ADD 5 5 A L U Control Bus A C C 25 (c) 2018

Execute stage - 2 CPU RAM (c) 2018 The data at that memory address is passed to the Memory Data Register (MDR) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4  25  5 12  6 M A R - P C - Data Bus 5 2 C U M D R - C I R - ADD 5 ADD 5 A L U Control Bus A C C 25 5 12 (c) 2018

Execute stage - 3 CPU RAM (c) 2018 Address Bus C U Data Bus A L U The instruction from the Current Instruction Register is then executed on the data in the MDR In this example, 12 is added from the Memory Data Register (MDR) to the Accumulator (ACC) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R - P C - Data Bus 5 2 C U M D R - C I R ADD 5 12 12 ADD 5 ADD A L U Control Bus A C C 25 25 (c) 2018

Execute stage - 4 CPU RAM (c) 2018 The calculation is carried out by the Arithmetic Logic Unit (ALU) The result of the calculation is stored in the Accumulator (ACU) RAM   CPU   Address Bus Address Contents  0 LOAD 4  1 ADD 5  2    3  4 25  5 12  6 M A R - P C - Data Bus 5 2 C U M D R - C I R ADD 5 12 ADD 5 A L U Control Bus A C C 25 25 37 12 ADD (c) 2018

Textbook reading Read pages 11-14 of Chapter 1 – Computer Systems from The Ultimate GCSE Computer Science Textbook (c) 2018

Activity – fetch-execute cycle When prompted, click on “I recognise this content” Follow this animation from www.tiny.cc/fetchexecuteanimation (requires flash)

Activity – fetch-execute cycle Complete question 2 of the activity on the fetch-execute cycle from The Ultimate GCSE Computer Science Textbook (c) 2018

Performance of the CPU (c) 2018

Performance of the CPU (c) 2018 Performance Cache Type Performance Factors affecting performance of the CPU include: Clock speed Number of processor cores Cache size Cache type Cache Size Cores Clock Speed (c) 2018

Textbook reading Read pages 16-18 of Chapter 1 – Computer Systems from The Ultimate GCSE Computer Science Textbook (c) 2018

Clock speed (c) 2018 Number of clock cycles per second Measured in Hz eg 3 GHz (gigahertz) = 3 billion ticks per second more ticks = more instructions per second Overclocking Increasing CPU speed in the BIOS Can cause overheating Some processes may not complete before next instruction starts Results in corrupted data (c) 2018

http://tiny.cc/cpuperformance - factors beyond CPU Clock Speeds that affect Performance

Number of processor cores Core = processing unit which receives instructions and performs calculations More cores do not make the processor faster More cores do allow more instructions to run at the same time BUT only if a program or operating system support it Performance will improve through: parallel processing multitasking Term Number of cores Single-core 1 Dual-core 2 Quad-core 4 Octa-core 8 Tip: avoid using number of cores as an answer in an exam (c) 2018

Parallel processing and multi-tasking different instructions from the same program run at the same time more cores = more instructions from the same program running at the same time Multitasking instructions from many programs run at the same time more cores = more instructions from many programs running at the same time 7 1 6 9 4 5 3 2 8 (c) 2018

Single core processor (c) 2018 Instructions happen one at a time in sequence for 1 Hz, this would be up to 1 instruction every second: 8 7 9 1 6 4 2 3 5 (c) 2018

Dual core processor (c) 2018 With a multitasking operating system or software that supports parallel processing: two instructions can be run in parallel at a time for 1 Hz, this would be up to 2 instructions per second: what happened with the 9th instruction? 7 1 9 5 3 Answers to the question could include: It was the last instruction with no more left It was different software that doesn’t support parallel processing 2 8 4 6 (c) 2018

Quad core processor (c) 2018 8 7 9 1 6 4 2 3 5 We already know: with a multitasking operating system or software that supports parallel processing: two instructions can be run in parallel at a time for 1 Hz, this would be up to 2 instructions per second BUT without a multitasking operating system or without software that supports parallel processing: only one core will be used for 1 Hz, this would be up to 1 instruction every second, not 4 instructions per second: 8 7 9 1 6 4 2 3 5 (c) 2018

http://tiny.cc/cores - How the Number of Cores affects Performance

Cache (c) 2018 Super fast memory Built into the CPU Stores recently used instructions Improves performance because: frequently used instructions can be retrieved from cache instead of RAM eg: the instructions in a loop will be stored in cache cache can be accessed more quickly than RAM (c) 2018

Cache example (c) 2018 Main Memory CACHE CPU print(“Start of loop”) for i = 1 to 5 print(“Hello“) end for print(“End of loop”) New instructions are retrieved from memory If they are in the cache, they are retrieved directly from cache print(“Hello”) print(“Hello”) CACHE print(“End of loop”) print(“End of loop”) print(“Start of loop”) print(“Hello”) print(“Hello”) print(“Hello”) print(“Hello”) print(“Hello”) CPU print(“End of loop”) (c) 2018

Levels of cache - 1 (c) 2018 3 Levels of cache Level 1 is closest to CPU Level 3 is furthest away from CPU Level 1 stores most frequently used instructions (c) 2018

Levels of cache - 2 When Level 1 is full, Level 2 will be used When Level 2 is full, Level 3 will be used Most frequently used instructions are stored Level 1 Level Part of CPU Access Time Distance from CPU Size 1 Yes Fastest Closest Smallest 2 Can be Medium Middle 3 No Slowest but faster than RAM Furthest Largest (c) 2018

http://tiny.cc/cachememory - What Cache Does

http://tiny.cc/cacheperformance - How Cache affects Performance

Cache effect on performance of CPU More cache = faster performance Closer level of cache = faster performance (c) 2018

Questions YOUR TURN! (c) 2018 Answer the questions on pages 18 and 19 of The Ultimate GCSE Computer Science Textbook (c) 2018