CPU How It Works. 2 Generic Block Diagram CPU MemoryInputOutput Address Bus Data Bus.

Slides:



Advertisements
Similar presentations
MICRO PROCESSER The micro processer is a multipurpose programmable, clock driven, register based, electronic integrated device that has computing and decision.
Advertisements

The Von Neumann Architecture Odds and Ends
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Chapter 5: Computer Systems Organization Invitation to Computer Science, C++ Version, Third Edition Added to by S. Steinfadt - Spring 2005 Additional source.
The Von Neumann Architecture
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Elements of the Computer (How a processor works)
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
Computer Systems CS208. Major Components of a Computer System Processor (CPU) Runs program instructions Main Memory Storage for running programs and current.
6. The CPU and Memory Chapt. 7.
0 What is a computer?  Simply put, a computer is a sophisticated electronic calculating machine that:  Accepts input information,  Processes the information.
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
Invitation to Computer Science 5th Edition
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Computer Science 210 Computer Organization The von Neumann Architecture.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 2.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Advanced Computer Architecture 0 Lecture # 1 Introduction by Husnain Sherazi.
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
Invitation to Computer Science 6th Edition Chapter 5 Computer Systems Organization.
INTRODUCTION TO COMPUTING CHAPTER NO. 05. Computer System Organization The Von Neumann Architecture Memory and Cache Input/Output and Storage devices.
General Concepts of Computer Organization Overview of Microcomputer.
Computer Architecture And Organization UNIT-II General System Architecture.
Computer Science 101 Computer Systems Organization.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
Indira Gandhi National Open University presents. A Video Lecture Course: Computer Platforms.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Machine Instructions.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
Dale & Lewis Chapter 5 Computing components
Invitation to Computer Science 6 th Edition Chapter 5 Computer Systems Organization.
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
Overview von Neumann Architecture Computer component Computer function
C HAPTER 4 OS: C OMPUTER O RGANIZATION TOPICS: The Von Neumann Architecture The CPU.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Chapter 5: Computer Systems Organization Invitation to Computer Science,
Von Neumann Machines. 3 The Von Neumann Architecture Model for designing and building computers, based on the following three characteristics: 1)The.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Computer Architecture Adapted from CS10051 originally by Professor: Johnnie Baker Computer Science Department Kent State University von Neuman model.
Computer Architecture and Number Systems
Rocky K. C. Chang, 12 September 2017 Version 0.1
Computer Organization and Architecture
Computer Architecture
Chapter 4 The Von Neumann Model
The Processor and Machine Language
Functional Units.
COMS 161 Introduction to Computing
Computer Systems Organization
The Von Neumann Model Basic components Instruction processing
MARIE: An Introduction to a Simple Computer
Chapter 5: Computer Systems Organization
Computer Architecture
The Von Neumann Architecture Odds and Ends
The Von Neumann Architecture
The Stored Program Computer
GCSE OCR 1 The CPU Computer Science J276 Unit 1
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.
Chapter 4 The Von Neumann Model
Presentation transcript:

CPU How It Works

2 Generic Block Diagram CPU MemoryInputOutput Address Bus Data Bus

Hardware

The Von Neumann Architecture Von Neumann Architecture

5 Designing Computers All computers more or less based on the same basic design, the Von Neumann Architecture! All computers more or less based on the same basic design, the Von Neumann Architecture!

6 The Von Neumann Architecture Model for designing and building computers, based on the following three characteristics: Model for designing and building computers, based on the following three characteristics: 1) The computer consists of four main sub-systems: Memory Memory ALU (Arithmetic/Logic Unit) ALU (Arithmetic/Logic Unit) Control Unit Control Unit Input/Output System (I/O) Input/Output System (I/O) 2) Program is stored in memory during execution. 3) Program instructions are executed sequentially.

7 The Von Neumann Architecture Memory Processor (CPU) Input-Output Control Unit ALU Store data and program Execute program Do arithmetic/logic operations requested by program Communicate with "outside world", e.g. Screen Screen Keyboard Keyboard Storage devices Storage devices Bus

8 Memory Subsystem Memory, also called RAM (Random Access Memory), Memory, also called RAM (Random Access Memory), Consists of many memory cells (storage units) of a fixed size. Each cell has an address associated with it: 0, 1, … Consists of many memory cells (storage units) of a fixed size. Each cell has an address associated with it: 0, 1, … All accesses to memory are to a specified address. A cell is the minimum unit of access (fetch/store a complete cell). All accesses to memory are to a specified address. A cell is the minimum unit of access (fetch/store a complete cell). The time it takes to fetch/store a cell is the same for all cells. The time it takes to fetch/store a cell is the same for all cells. When the computer is running, both When the computer is running, both Program Program Data (variables) are stored in the memory. Data (variables) are stored in the memory.

9 Memory Size / Speed Typical memory in a personal computer (PC): Typical memory in a personal computer (PC): 64MB - 256MB 64MB - 256MB Memory sizes: Memory sizes: Kilobyte (KB)= 2 10 =1,024 bytes ~ 1 thousand Kilobyte (KB)= 2 10 =1,024 bytes ~ 1 thousand Megabyte(MB)= 2 20 =1,048,576 bytes ~ 1 million Megabyte(MB)= 2 20 =1,048,576 bytes ~ 1 million Gigabyte(GB)= 2 30 = 1,073,741,824 bytes ~ 1 billion Gigabyte(GB)= 2 30 = 1,073,741,824 bytes ~ 1 billion Memory Access Time (read from/ write to memory) Memory Access Time (read from/ write to memory) nanoseconds (1 nsec. = sec.) nanoseconds (1 nsec. = sec.) RAM is RAM is volatile (can only store when power is on) volatile (can only store when power is on) relatively expensive relatively expensive

10 Operations on Memory Fetch (address): Fetch (address): Fetch a copy of the content of memory cell with the specified address. Fetch a copy of the content of memory cell with the specified address. Non-destructive, copies value in memory cell. Non-destructive, copies value in memory cell. Store (address, value): Store (address, value): Store the specified value into the memory cell specified by address. Store the specified value into the memory cell specified by address. Destructive, overwrites the previous value of the memory cell. Destructive, overwrites the previous value of the memory cell. The memory system is interfaced via: The memory system is interfaced via: Memory Address Register (MAR) Memory Address Register (MAR) Memory Data Register (MDR) Memory Data Register (MDR) Fetch/Store signal Fetch/Store signal

11 Structure of the Memory Subsystem Fetch(address) Fetch(address) Load address into MAR. Load address into MAR. Decode the address in MAR. Decode the address in MAR. Copy the content of memory cell with specified address into MDR. Copy the content of memory cell with specified address into MDR. Store(address, value) Store(address, value) Load the address into MAR. Load the address into MAR. Load the value into MDR. Load the value into MDR. Decode the address in MAR Decode the address in MAR Copy the content of MDR into memory cell with the specified address. Copy the content of MDR into memory cell with the specified address. MARMDR... Memory decoder circuit Fetch/Store controller F/S

12 Input/Output Subsystem Handles devices that allow the computer system to: Handles devices that allow the computer system to: Communicate and interact with the outside world Communicate and interact with the outside world Screen, keyboard, printer,... Screen, keyboard, printer,... Store information (mass-storage) Store information (mass-storage) Hard-drives, floppies, CD, tapes, … Hard-drives, floppies, CD, tapes, … Mass-Storage Device Access Methods: Mass-Storage Device Access Methods: Direct Access Storage Devices (DASDs) Direct Access Storage Devices (DASDs) Hard-drives, floppy-disks, CD-ROMs,... Hard-drives, floppy-disks, CD-ROMs,... Sequential Access Storage Devices (SASDs) Sequential Access Storage Devices (SASDs) Tapes (for example, used as backup devices) Tapes (for example, used as backup devices)

13 I/O Controllers Speed of I/O devices is slow compared to RAM Speed of I/O devices is slow compared to RAM RAM ~ 50 nsec. RAM ~ 50 nsec. Hard-Drive ~ 10msec. = (10,000,000 nsec) Hard-Drive ~ 10msec. = (10,000,000 nsec) Solution: Solution: I/O Controller, a special purpose processor: I/O Controller, a special purpose processor: Has a small memory buffer, and a control logic to control I/O device (e.g. move disk arm). Has a small memory buffer, and a control logic to control I/O device (e.g. move disk arm). Sends an interrupt signal to CPU when done read/write. Sends an interrupt signal to CPU when done read/write. Data transferred between RAM and memory buffer. Data transferred between RAM and memory buffer. Processor free to do something else while I/O controller reads/writes data from/to device into I/O buffer. Processor free to do something else while I/O controller reads/writes data from/to device into I/O buffer.

14 I/O controller Structure of the I/O Subsystem I/O Buffer Control/Logic I/O device Data from/to memory Interrupt signal (to processor)

15 The ALU Subsystem The ALU (Arithmetic/Logic Unit) performs The ALU (Arithmetic/Logic Unit) performs mathematical operations (+, -, x, /, …) mathematical operations (+, -, x, /, …) logic operations (=,, and, or, not,...) logic operations (=,, and, or, not,...) In today's computers integrated into the CPU In today's computers integrated into the CPU Consists of: Consists of: Circuits to do the arithmetic/logic operations. Circuits to do the arithmetic/logic operations. Registers (fast storage units) to store intermediate computational results. Registers (fast storage units) to store intermediate computational results. Bus that connects the two. Bus that connects the two.

16 Structure of the ALU Registers: Registers: Very fast local memory cells, that store operands of operations and intermediate results. Very fast local memory cells, that store operands of operations and intermediate results. CCR (condition code register), a special purpose register that stores the result of operations CCR (condition code register), a special purpose register that stores the result of operations ALU circuitry: ALU circuitry: Contains an array of circuits to do mathematical/logic operations. Contains an array of circuits to do mathematical/logic operations. Bus: Bus: Data path interconnecting the registers to the ALU circuitry. Data path interconnecting the registers to the ALU circuitry. ALU circuitry GTEQLT R0 R1 R2 Rn

17 The Control Unit Program is stored in memory Program is stored in memory as machine language instructions, in binary as machine language instructions, in binary The task of the control unit is to execute programs by repeatedly: The task of the control unit is to execute programs by repeatedly: Fetch from memory the next instruction to be executed. Fetch from memory the next instruction to be executed. Decode it, that is, determine what is to be done. Decode it, that is, determine what is to be done. Execute it by issuing the appropriate signals to the ALU, memory, and I/O subsystems. Execute it by issuing the appropriate signals to the ALU, memory, and I/O subsystems. Continues until the HALT instruction Continues until the HALT instruction

18 Machine Language Instructions A machine language instruction consists of: A machine language instruction consists of: Operation code, telling which operation to perform Operation code, telling which operation to perform Address field(s), telling the memory addresses of the values on which the operation works. Address field(s), telling the memory addresses of the values on which the operation works. Example: ADD X, Y (Add content of memory locations X and Y, and store back in memory location Y). Example: ADD X, Y (Add content of memory locations X and Y, and store back in memory location Y). Assume: opcode for ADD is 9, and addresses X=99, Y=100 Assume: opcode for ADD is 9, and addresses X=99, Y= Opcode (8 bits) Address 1 (16 bits) Address 2 (16 bits)

19 How does this all work together? Program Execution: Program Execution: PC is set to the address where the first program instruction is stored in memory. PC is set to the address where the first program instruction is stored in memory. Repeat until HALT instruction or fatal error Repeat until HALT instruction or fatal error Fetch instruction Fetch instruction Decode instruction Decode instruction Execute instruction Execute instruction End of loop End of loop

20 Program Execution (cont.) Fetch phase Fetch phase PC --> MAR(put address in PC into MAR) PC --> MAR(put address in PC into MAR) Fetch signal(signal memory to fetch value into MDR) Fetch signal(signal memory to fetch value into MDR) MDR --> IR(move value to Instruction Register) MDR --> IR(move value to Instruction Register) PC > PC (Increase address in program counter) PC > PC (Increase address in program counter) Decode Phase Decode Phase IR -> Instruction decoder (decode instruction in IR) IR -> Instruction decoder (decode instruction in IR) Instruction decoder will then generate the signals to activate the circuitry to carry out the instruction Instruction decoder will then generate the signals to activate the circuitry to carry out the instruction

21 Program Execution (cont.) Execute Phase Execute Phase Differs from one instruction to the next. Differs from one instruction to the next. Example: Example: LOAD X (load value in addr. X into register) LOAD X (load value in addr. X into register) IR_address -> MAR IR_address -> MAR Fetch signal Fetch signal MDR --> R MDR --> R ADD X ADD X left as an exercise left as an exercise