Central Processing Unit (CPU)



Similar documents
LSN 2 Computer Processors

PROBLEMS. which was discussed in Section

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

(Refer Slide Time: 00:01:16 min)

CPU Organisation and Operation

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

MICROPROCESSOR AND MICROCOMPUTER BASICS

CSCI 4717 Computer Architecture. Function. Data Storage. Data Processing. Data movement to a peripheral. Data Movement

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Central Processing Unit

CHAPTER 7: The CPU and Memory

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

CPU Organization and Assembly Language

Computer Organization and Architecture

1 Classical Universal Computer 3

Computer Organization. and Instruction Execution. August 22

EC 362 Problem Set #2

Chapter 2 Logic Gates and Introduction to Computer Architecture

İSTANBUL AYDIN UNIVERSITY

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

MACHINE ARCHITECTURE & LANGUAGE

Microprocessor & Assembly Language

Computer organization

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Administrative Issues

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

COMPUTER ORGANIZATION AND ARCHITECTURE. Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Summary of the MARIE Assembly Language

A3 Computer Architecture

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Instruction Set Architecture

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Chapter 5 Instructor's Manual

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

Processor Architectures

Chapter 1 Computer System Overview

Microprocessor and Microcontroller Architecture

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

TIMING DIAGRAM O 8085

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

Instruction Set Design

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Instruction Set Architecture (ISA)

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

Notes on Assembly Language

Unit A451: Computer systems and programming. Section 2: Computing Hardware 1/5: Central Processing Unit

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

PROBLEMS #20,R0,R1 #$3A,R2,R4

Intel 8086 architecture

Chapter 9 Computer Design Basics!

Chapter 5, The Instruction Set Architecture Level

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: COMPUTER ORGANIZATION AND ARCHITECTURE (Code: )

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Basic Computer Organization

Week 1 out-of-class notes, discussions and sample problems

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

Computer Architectures

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 7D The Java Virtual Machine

PART B QUESTIONS AND ANSWERS UNIT I

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

CSC 2405: Computer Systems II

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

CISC, RISC, and DSP Microprocessors

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

BASIC COMPUTER ORGANIZATION AND DESIGN

Systems I: Computer Organization and Architecture

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

The Central Processing Unit:

Pentium vs. Power PC Computer Architecture and PCI Bus Interface

TYPES OF COMPUTERS AND THEIR PARTS MULTIPLE CHOICE QUESTIONS

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Systems I: Computer Organization and Architecture

Quiz for Chapter 1 Computer Abstractions and Technology 3.10

Computer Systems Design and Architecture by V. Heuring and H. Jordan

OVERVIEW OF MICROPROCESSORS

Memory Elements. Combinational logic cannot remember

Computer Organization and Components

Computer Architecture Basics

612 CHAPTER 11 PROCESSOR FAMILIES (Corrisponde al cap Famiglie di processori) PROBLEMS


A SystemC Transaction Level Model for the MIPS R3000 Processor

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Compilers I - Chapter 4: Generating Better Code

An Introduction to the ARM 7 Architecture

Transcription:

Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following lectures, we will learn: Instruction representation Data transfer mechanism between MM and CPU The internal functional units of two different CPU architectures How these units are interconnected How a processor executes instructions

Instruction Representation CPU operation is determined by the instruction it executes Collection of these instructions that a CPU can execute forms its Instruction Set An instruction is represented as sequence of bits, for example: Instruction is divided into fields 1001 0010 0000 0011 1011 1011 1000 0001 9 2 0 3 B B 8 1 Opcode Operand1 Operand2 Opcode indicates the operation to be performed, eg., 92 above indicates a copy operation we need two operands one source and other destination Opcode represents nature of operands (data or address), operand 1 is address and operand 2 is data mode (register or memory), operand 1 is memory, and operand 2 is immediate data

Basic Instruction Types Not all instructions require two operands 3-address instructions Operation Source1, Source2, Destination e.g. Add A, B, C ; C = A + B 2-address instructions Operation Source, Destination e.g. Move B, C ; C = B Add A, C ; C = C + A Here Source2 is implicitly the destination 1-address instructions e.g. Load A Store C 0-address instructions e.g. Stop

Simple Instruction Set Assume we have a processor whose Instruction Set consists of four machine language instructions Move from a memory location to a data register in CPU Move from a data register in CPU to a memory location Add the contents of a memory location to a data register Stop Suppose our program for Z = X + Y looks like: Move X, D0 Add Y, D0 Move D0, Z Stop move $0000 0000 This program is coded into machine instruction and suppose is loaded into memory starting at location $0000 0000 add move stop

How does the CPU know which instruction to execute? There is a dedicated register in CPU called Program Counter (PC) that points to the memory location where next instruction is stored Therefore, at start PC = $0000 0000 Instruction is in Main Memory it is to be transferred (fetched) to CPU to be executed CPU has an Instruction Register (IR) that holds the instruction What kind of instruction is to be executed? CPU has its own Instruction Interpreter (Decoder) Followed by Instruction execution Next instruction follows. PC is incremented by length of instruction just completed

Mechanism of Transferring Data from MM to CPU CPU has an external bus that connects it to the Memory and I/O devices. The data lines are connected to the processor via the Memory Data Register (MDR) The address lines are connected to the processor via the Memory Address Register (MAR) Memory address from where the instruction/data is to be accessed is copied into MAR Contents of MAR are loaded onto address bus Corresponding memory location accessed Contents of this location put onto data bus Data on data bus loaded into MDR MAR MDR Address bus Data bus CPU Control bus R/W MM

CISC and RISC Reduced Instruction Set Computers (RISC) Performs simple instructions that require small number of basic steps to execute (smaller S) Requires large number of instructions to perform a given task large code size (larger N) more RAM is needed to store the assembly level instructions Advantage: Low cycles per second each instruction is executed faster in one clock cycle (smaller R) Example: Advanced RISC Machines (ARM) processor Complex Instruction Set Computers (CISC) Complex instructions that involve large number of steps (larger S) Fewer instructions needed (smaller N) small code size Commands represent more closely to high-level languages Less RAM required to store the program Disadvantage: High cycles per second Example: Motorola 68000 processor, Intel x86

General Purpose Register (GPR)Architecture Its functional units are: Data Registers: D0, D1, D2,..., D7 for arithmetic operations holds any kind of data Address Registers: A0, A1, A2,..., A7 serve as pointers to memory addresses Working Registers: several such registers serve as scratch pads for CPU Program Counter (PC) holding the address in memory of the next instruction to be executed. After an instruction is fetched from memory, the PC is automatically incremented to hold the address of, or point to, the next instruction to be executed. Instruction Register (IR) holds the most recently read instruction from memory while it is being decoded by the Instruction Interpreter. Memory Address Register (MAR) holds the address of the next location to be accessed in memory. Memory Buffer Register (MBR or MDR) holds the data just read from memory, or the data which is about to be written to memory. Buffer is referring to temporarily holding data. Status Register (SR) to record status information

GPR CPU 0 1 2 3 Register File IR MBR Data bus MAR Address bus ALU Interpreter PC Memory Control CPU 16 bit 8 bit Increment Memory

Program Execution Fetch Cycle: Processor fetches one instruction at a time from successive memory locations until a branch/jump occurs. Instructions are located in the memory location pointed to by the PC Instruction is loaded into the IR Increment the contents of the PC by the size of an instruction Decode Cycle: Instruction is decoded/interpreted, opcode will provide the type of operation to be performed, the nature and mode of the operands Decoder and control logic unit is responsible to select the registers involved and direct the data transfer. Execute Cycle: Carry out the actions specified by the instruction in the IR

Execution for add D1,D2 in a GPR processor MAR PC MDR M[MAR] PC PC + 2 Fetch IR MDR Decode D2 D1 + D2 Execute

GPR CPU 0 1 2 3 Register File IR MBR Data bus Type equation here. MAR Address bus ALU Interpreter PC Memory Control CPU 16 bit 8 bit Increment Memory

Execution for add X,D0 in a GPR processor MAR PC MDR M[MAR] PC PC + 2 Fetch IR MDR Decode Address X extracted from IR MAR IR (X) Contents of Address X transferred to MDR Contents of Address X added to D0 MDR M[MAR] D0 MDR + D0 Execute

GPR CPU 0 1 2 3 Register File IR MBR Data bus Type equation here. MAR Address bus ALU Interpreter PC Memory Control CPU 16 bit 8 bit Increment Memory

Instruction Execution Time Clock Cycles (P) regular time intervals defined by the CPU clock Clock Rate, R = 1/P cycles per second (Hz) 500 MHz => P = 2ns 1.25 GHz => P = 0.8ns For each instruction: Fetch: Total 12 clock cycles MAR PC 1 MDR M[MAR] 10 IR MBR 1 Decode: 2 clock cycles Execute: depends on instruction Micro Step Number of Clock Cycles Register Transfer 1 Decoding 2 Add 2 Multiply 5 Memory Access 10

Accumulator (Acc)Architecture Its functional units are same as GPR architecture, except there is only ONE register accumulator (Acc) instead of the Register File Ex: Z = X + Y Move contents of location X to Acc Add contents of location Y to Acc Move from Acc to location Z Stop All operations and data movements are on this single register Most of the instructions in the instruction set require only one Operand Destination and Source are implicitly Acc Leads to shorter instructions but program may be slower to execute since there are more moves to memory for intermediate results (to free Acc) May lead to inefficiency

Accumulator Architecture CPU Acc MBR Data bus IR MAR Address bus ALU Interpreter PC Memory Control CPU 16 bit 10 bit Increment Memory

Execution for Add Y in an Acc Architecture MAR PC MDR M[MAR] PC PC + 2 Fetch IR MDR Decode Address X extracted from IR MAR IR (X) Contents of Address X transferred to MDR Contents of Address X added to Accumulator MDR M[MAR] Acc MDR + Acc Execute

GPR vs Acc Let the following instructions be allowed: For GPR machine (with 4 data reg) Move R i, R j Move R i, M[X] Move M[X], R i Add R i, M[X] Add R i, R j Sub R i, M[X] ; R i R j ; R i M[X] ; M[X] R i ; R i R i + M[X] ; R i R i + R j ; R i R i M[X] For Accumulator machine Add x Sub x Mult x LD x ST x Stop ; Acc Acc + M[X] ; Acc Acc M[X] ; Acc Acc M[X] ; Acc M[X] ; M[X] Acc Sub R i, R j Mult R i, R j Stop ; R i R i R j ; R i R i R j Note that M[X] = x

GPR vs Acc Assembly Program for a <- (x + y) * (x y) For GPR machine (with 4 data reg) Move D0, X Add D0, Y Move D1, X Sub D1, Y Mult D0, D1 Move A, D0 Stop For Accumulator machine LD X ADD Y ST C LD X SUB Y MULT C ST A STOP