CPU Organisation & Operation

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
CSE115: Introduction to Computer Science I
CSE111: Great Ideas in Computer Science Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
LAB 9 Simulator Chap 14 REED. Datapath Simulator accompanying the text is a datapath simulator a.k.a. the Knob & Switch Computer developed by Grant Braught.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Henry Hexmoor1 Chapter 10- Control units We introduced the basic structure of a control unit, and translated assembly instructions into a binary representation.
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
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.
Design and Synthesis of a RISC Stored-Program Machine
Computer Systems Organization CS 1428 Foundations of Computer Science.
CPU Design. Introduction – The CPU must perform three main tasks: Communication with memory – Fetching Instructions – Fetching and storing data Interpretation.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
A Simple Computer Architecture Digital Logic Design Instructor: Kasım Sinan YILDIRIM.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
Little Man Computer When your program gets “translated to machine code” all 0’s & 1’s The translator must know the language of the program (java) as well.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Fetch-execute cycle.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Dale & Lewis Chapter 5 Computing components
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Chapter 5 Computer Organization TIT 304/TCS 303. Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can.
Types of Micro-operation  Transfer data between registers  Transfer data from register to external  Transfer data from external to register  Perform.
Addressing Modes in Microprocessors
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Chapter 4 The Von Neumann Model
Lecture on Microcomputer
Computer Organization and Design
Computer Architecture
Computer Science 210 Computer Organization
פרק 2: חיווט, זיכרונות בנקים זוגיים ואי-זוגיים
The fetch-execute cycle
The Processor and Machine Language
THE sic mACHINE CSCI/CMPE 3334 David Egle.
Number Representations and Basic Processor Architecture
Computer Science 210 Computer Organization
Functional Units.
CS149D Elements of Computer Science
CSCE Fall 2013 Prof. Jennifer L. Welch.
Topic 6 LC-3.
CSCE 121: Simple Computer Model Spring 2015
COMP 1321 Digital Infrastructure
The Little Man Computer
PZ01C - Machine architecture
Chapter 4 The Von Neumann Model
The Von Neumann Architecture Odds and Ends
CSCE Fall 2012 Prof. Jennifer L. Welch.
The Stored Program Computer
Program Execution.
The Von Neumann Machine
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
Basic components Instruction processing
A Top-Level View Of Computer Function And Interconnection
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.
Hmmm Assembly Language
Instruction execution and ALU
Computer Architecture Assembly Language
Computer Architecture
COMPUTER ARCHITECTURE
Sec (2.3) Program Execution.
Presentation transcript:

CPU Organisation & Operation Professor Kin K. Leung kin.leung@imperial.ac.uk www.commsp.ee.ic.ac.uk/~kkleung/ Heavily based on materials by Dr. Naranker Dulay

Fetch-Execute Cycle Fetch the Instruction Increment the Program Counter Decode the Instruction Fetch the Operands Perform the Operation Store the Results Repeat Forever

High-Level/Low-Level Languages, Machine Code High-Level Language (e.g. Java, C++, Haskell) A = B + C Assignment Statement Low-Level Language -> Assembly Language (e.g. Pentium, PowerPC, ARM etc, Java Bytecode) LOAD R2, B Assembly Language ADD R2, C Instructions STORE R2, A (Binary) Machine Code 0001101000000001 Machine Code 0011101000000010 Instructions 0010101000000000

The Toy1 Architecture Maximum of 1024 x 16-bit memory words Memory is Word Addressed Two’s Complement Integer Representation 4 General Purpose Registers (16-bit) : R0, R1, R2, R3 Upto 16 “Instructions”, e.g. LOAD, ADD, STORE

Toy1 Instruction Set LOAD Register , [MemoryAddress] Register = Memory [MemoryAddress] STORE Register , [MemoryAddress] Memory [MemoryAddress] = Register ADD Register , [MemoryAddress] Register = Register + Memory [MemoryAddress] SUB Register , [MemoryAddress] Register = Register - Memory [MemoryAddress]

Toy1 Instruction Format ADD R2, C Assembly Instruction e.g. Machine Code 4-bit OPCODE 2-bit REG ADDRESS 10-bit Instruction Fields OPeration CODE (Selects CPU Instruction) REGister (Specifies 1st Operand for Instruction) ADDRESS (Specifies 2nd Operand for Instruction)

Other Possibilities for the Format OPCODE ADDRESS REG ADD R2, C 4-bit 10-bit 2-bit REG ADDRESS OPCODE 2-bit 10-bit 4-bit ADD R2, R3 REG 4-bit 2-bit OPCODE

Instruction Field Encoding OPCODE REG ADDRESS 4-bit 2-bit 10-bit 16-bit Instruction OPCODE LOAD 0001 (4-bit) STORE 0010 ADD 0011 SUB 0100 REG Register 0 00 (2-bit) Register 1 01 Register 2 10 Register 3 11 ADDRESS 10-bit Memory Word Address

Memory Placement (Program) Assembly Instruction Machine Instruction OP REG ADDRESS 0 8 0 H Memory Address LOAD R2, [201H] 0001 10 10 0000 0001 00 1000 0000 1 A 1 ADD R2, [202H] 0011 10 10 0000 0010 00 1000 0001 0 8 1 H 3 A 2 STORE R2, [200H] 00 1000 0010 0 8 2 H 0010 10 10 0000 0000 2 A MEMORY

Memory Placement (Data) Assembly Instruction Data Memory Address MEMORY A = 0 0000 0000 0000 0000 0 0 0 0 10 0000 0000 2 0 0 H 10 0000 0001 2 0 1 H 0000 0000 0000 1001 0 0 0 9 B = 9 10 0000 0010 2 0 2 H C = 6 0000 0000 0000 0110 0 0 0 6

CPU Organisation CPU RAM R0 R1 R2 R3 I n t e r n a l B u s Address Bus 000 001 002 003 3FD 3FE 3FF R0 R1 R2 R3 I n t e r n a l B u s Address Bus ALU Output Reg Input Reg1 Input Reg2 Data Bus Control Bus Program Counter Instr. Decoder Instr. Register Control Unit

LOAD R2, [201H] R2=Memory[201H] CPU RAM 080H R2 ALU 080H 080H PC 080H 000 001 002 003 3FD 3FE 3FF 080H R2 ALU 080H 080H PC 080H Instr. Decoder Control Unit 1

LOAD R2, [201H] R2=Memory[201H] CPU RAM 080H R2 ALU PC 080H + 1 000 001 002 003 3FD 3FE 3FF 080H R2 ALU PC 080H + 1 Instr. Decoder Control Unit 2

LOAD R2, [201H] R2=Memory[201H] CPU RAM 080H R2 ALU PC 081H 000 001 002 003 3FD 3FE 3FF 080H R2 ALU PC 081H Instr. Decoder Control Unit 3

LOAD R2, [201H] R2=Memory[201H] CPU 080H R2 ALU RAM PC 081H 000 001 080H R2 1A01 3A02H 2A00H 0000 0009 0006 080 081 082 200 201 202 1A01H ALU RAM PC 081H Instr. Decoder 3FD 3FE 3FF Control Unit 4

LOAD R2, [201H] R2=Memory[201H] CPU 201H R2 ALU 201H RAM 1A01H PC 081H 000 001 201H R2 080 081 082 1A01H 3A02H ALU 201H 2A00H 1A01H 1A01 RAM 1A01H 200 201 202 0000 0009 PC 081H 0006 1A01H 1A01H 1A01H 3FD 3FE 3FF 1, 2, 201H 201H 1, 2, 201H 5

LOAD R2, [201H] R2=Memory[201H] CPU 201H 201H R2 0009 ALU 0009 0009 000 001 201H 201H 0009 R2 0009 080 081 082 1A01H 3A02H ALU 0009 2A00H 0009 0009 RAM 200 201 202 0000 0009 0009 PC 081H 0006 1A01H 3FD 3FE 3FF 1, 2, 201H 6

ADD R2, [202H] R2=R2+Memory[202H] CPU 000 001 081H R2 0009 080 081 082 1A01H 3A02H ALU 081H 2A00H RAM 200 201 202 0000 081H 0009 PC 081H 0006 3FD 3FE 3FF 7

ADD R2, [202H] R2=R2+Memory[202H] CPU 000 001 081H R2 0009 080 081 082 1A01H 3A02H ALU 2A00H RAM 200 201 202 0000 0009 PC 081H + 1 0006 3FD 3FE 3FF 8

ADD R2, [202H] R2=R2+Memory[202H] CPU 000 001 081H 202H 0009 R2 0009 0009 080 081 082 0009 1A01H 3A02H 3A02 ALU 0009 2A00H 0009 202H 3A02H 3A02H RAM 3A02H 200 201 202 0000 0009 PC 082H 0006 3A02H 3A02H 3A02H 3FD 3FE 3FF 3, 2, 202H 202H 3, 2, 202H 9

ADD R2, [202H] R2=R2+Memory[202H] CPU 000 001 202H 202H 000FH R2 000FH 0009 080 081 082 1A01 000FH 3A02 ALU 2A00 0009 0006 0006 000FH ADD RAM 0006 000FH 0006 000FH 200 201 202 0000 0009 PC 082H 0006 0006 3A02H 3FD 3FE 3FF 3, 2, 202H 10

STORE R2, [200H] Memory[200H]=R2 CPU 000 001 082H R2 000FH 080 081 082 1A01H 3A02H ALU 082H 2A00H RAM 200 201 202 0000 082H 0009 PC 082H 0006 3FD 3FE 3FF 11

STORE R2, [200H] Memory[200H]=R2 CPU 000 001 082H R2 000FH 080 081 082 1A01H 3A02H ALU 2A00H RAM 200 201 202 0000 0009 PC 082H + 1 0006 3FD 3FE 3FF 12

STORE R2, [200H] Memory[200H]=R2 CPU 000 001 082H 1 200H 000FH R2 000FH 000F 000FH 080 081 082 1A01H 3A02H ALU 2A00H 2A00 200H 000FH 2A00H RAM 2A00H 200 201 202 0000 0009 PC 083H 1 0006 2A00H 2A00H 2A00H 1 3FD 3FE 3FF 2, 2, 200H 200H 2, 2, 200H 1 13

STORE R2, [200H] Memory[200H]=R2 CPU 000 001 00FH 200H 1 00FH 200H 1 R2 000FH 080 081 082 1A01H 3A02H ALU 2A00H RAM 200 201 202 000FH 0000 0009 PC 083H 0006 3FD 3FE 3FF 14

Think About Fetch-Execute Cycle Assembly Languages Program Representation: Instructions, Instruction Fields, Instruction Formats CPU Components: Registers, ALU, Control Unit Registers: General Purpose Registers, Program Counter (PC), Instruction Register (IR), ALU Registers Buses: Internal, Address, Data, Control Next Topic TOY1 Assembly Programming