27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.

Slides:



Advertisements
Similar presentations
29 October 2013Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Advertisements

Chapter 2: Data Manipulation
Introduction to Computer Systems
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
Programming 68HC11.
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.
Computer Architecture and Data Manipulation Chapter 3.
TK 2633 Microprocessor & Interfacing
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Chapter.
Lecture 14: Review Intro to IT COSC1078 Introduction to Information Technology Lecture 14 Revision and Review James Harland
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Computer Processing CSCE 110 J. Michael Moore.
Stored Program Concept: The Hardware View
Chapter 2.2 Machine Language.
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.
J. Michael Moore Computer Processing CSCE 110. J. Michael Moore ProcessorInputOutput Memory Storage.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Lecture 3. Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data.
1 Programming in Machine Language SCSC 311 Spring 2011.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Data manipulation, Part one Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Chapter 4 MARIE: An Introduction to a Simple Computer.
6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Ch. 2 Data Manipulation 4 The central processing unit. 4 The stored-program concept. 4 Program execution. 4 Other architectures. 4 Arithmetic/logic instructions.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
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.
Chapter 2 Data Manipulation Yonsei University 1 st Semester, 2015 Sanghyun Park.
Important Concepts  Parts of the CPU  Arithmetic/Logic Unit  Control Unit  Registers  Program Counter  Instruction Register  Fetch/Decode/Execute.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Lecture 7: 9/17/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Computer Architecture Lecture 03 Fasih ur Rehman.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Manipulation Brookshear, J.G. (2012) Computer Science: an Overview.
20 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Dale & Lewis Chapter 5 Computing components
Data Manipulation, part two Introduction to computer, 2 nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
3 November 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Our programmer needs to do this !
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
© 2015 Pearson Education Limited 2015 Quiz in last 15 minutes Midterm 1 is next Sunday Assignment 1 due today at 4pm Assignment 2 will be up today; due.
Programming in Machine Language
CPU Organisation & Operation
Chapter 4 The Von Neumann Model
CHAPTER 6: The Little Man Computer
The fetch-execute cycle
The Processor and Machine Language
CS149D Elements of Computer Science
CSCE Fall 2013 Prof. Jennifer L. Welch.
MIPS Instruction Encoding
MIPS Instruction Encoding
CSCE Fall 2012 Prof. Jennifer L. Welch.
Program Execution.
Computer Concept and Practice
CS 111 – Sept. 16 Machine language examples Instruction execution
Sec (2.3) Program Execution.
Presentation transcript:

27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems Autumn 2015 Week 5b: Types of Instruction

27 October 2015 Brookshear, Section 2.22 Machine Architecture Address | Cells FF Arithmetic/ logic unit Registers F 1 Program counter Instruction register Bus Main memory Central processing unit Control unit

27 October 2015 Brookshear, Section 2.23 Machine Language Concepts Registers (R, S, T…) Memory addresses Number of bytes in a memory cell Instruction Sequence of instructions Branching (choice of next instruction)

Properties of the Illustrative Machine No. memory cells: 256 No. bits in a memory cell: 8 (1 byte) No. registers: 16 No. bits in a register: 8 (1 byte) No. bits in the programme counter: 8 (1 byte) No. bits in the instruction register: 16 (2 bytes) 27 October 2015 Birkbeck College, U. London4

27 October 2015 Brookshear, Appendix C5 Illustrative Machine Language Op-codeOperanddescription 1RXYLOAD R from memory location XY 2RXYLOAD R with the bit pattern XY 3RXYSTORE R at memory location XY 40RSMove bit pattern in R to S 5RSTAdd (2s comp) contents of S,T. Put result in R 6RSTAdd (fp) contents of S,T.Put result in R

27 October 2015 Brookshear, Appendix C6 Illustrative Machine Language Op-codeOperandDescription 7RSTOR contents of S, T. Put result in R 8RSTAND contents of S, T. Put result in R 9RSTXOR contents of S, T. Put result in R AR0XRotate right contents of R for X times. BRXYIf contents R=contents register 0, then jump to instruction at address XY, otherwise continue as normal. C000Halt

27 October 2015 Brookshear, Section 2.27 Types of Instruction Data transfer LOAD, STORE, MOVE Arithmetic/Logic ADD, OR, AND, XOR, ROTATE Control JUMP, HALT

27 October 2015 Brookshear, Section 2.28 Format of an Instruction Instruction=op-code field+operand field Op-code: identifies the elementary operation, e.g. STORE, SHIFT, XOR, JUMP. Operand: additional information, e.g. data or a register address.

27 October 2015 Brookshear, Section 2.39 Instruction 156C 156C Op-code 1: load Register with bit pattern in memory at the given address register memory address

27 October 2015 Brookshear, Section Op Code 7 (OR) st register 2 nd register 3 rd register OR =

27 October 2015 Brookshear, Section Op Code A (Rotate right) register rotate right 1 rotate right 2

27 October 2015 Brookshear, Section Instruction B258 B258 Op-code B: change value of program counter if contents of indicated register = contents of register 0 Indicated register New contents of program counter Brookshear, Fig. 2.9.

Translate into Machine Language 1. Load register number 3 with the hexadecimal value Rotate register number 5 three bits to the right 3. AND the contents of register A with the contents of register 5 and leave the result in register 0 25 October 2015 Brookshear, Section 2.213

Brookshear, Section Machine Cycle Fetch next instruction from memory to the CPU Decode the instruction Execute the instruction 27 October 2015 Fetch Decode Execute

27 October 2015 Brookshear, Section First Part of the Fetch Step of the Machine Cycle bus CPU Main memory program counter A0 instruction register 156C addresscells A0 A1 A2 A3 15 6C 16 6D

27 October 2015 Brookshear, Section Completion of the Fetch Step bus CPU Main memory program counter A2 instruction register 156C addresscells A0 A1 A2 A3 15 6C 16 6D

27 October 2015 Brookshear, Section Updating the Program Counter Fixed length instructions (2 bytes). Instructions stored consecutively in main memory. Each memory cell holds 1 byte. Then pc  pc + 2 at the end of each Fetch. … … pc=7 memory

Example The machine is started with 00 in the program counter. Describe the actions of the CPU if the memory contains the following bit patterns. 27 October 2015 Brookshire, Section Address Contents C0 0500

27 October 2015 Brookshear, Section Program to Add Two Values 1. Get the first value from memory and place it in a register S. 2. Get the second value from memory and place it in another register T. 3. Add the contents of S, T and place the result in a register R. 4. Store the result in R in memory 5. Stop

27 October 2015 Brookshear, Section Encoded Program C. Load register 5 with the contents of memory cell 6C D. Load register 6 with the contents of memory cell 6D Add (2s comp) contents of registers 5, 6. Put result in register E. Store the contents of Register 0 at memory cell 6E. 5. C000. Halt.

27 October 2015 Birkbeck College, U. London21 Without Instruction B  A program containing n instructions would run for n-1 machine cycles.  The program would be unable to respond to changes in the data.

27 October 2015 Birkbeck College, U. London22 Fibonacci Numbers  0,1,1,2,3,5,8,13,21,34,55, …  N(1)=0, N(2)=1  N(i+1)=N(i)+N(i-1) for i=2,3,4, …

27 October 2015 Birkbeck College, U. London23 Program to Find the 10 th Fibonacci Number // load register 0 with // load register 1 with // load register 2 with // load register 4 with FF // load register 5 with -1 (Two’s Comp) Address Instruction Comment R0 R2 R3 R4 R1 R ** FF

27 October 2015 Birkbeck College, U. London24 Program to Find the 10 th Fibonacci Number 2A 5312 // Add contents of R1, R2. Put result in R3 3C 4021 // Move bit pattern in R2 to R1 2E 4032 // Move bit pattern in R3 to R // Add contents of R4, R5. Put result in R4 32 B436 // If contents R4=contents R0, go to B02A // If contents R0=contents R0, go to 2A 36 C000 // Halt. Result is in R2. Address Instruction Comment

27 October 2015 Brookshear, Section Assembly Language Mnemonic system for representing machine language Machine language 156C 166D E C000 Assembly language LD R5, Price LD R6, ShippingCharge ADDI R0, R5, R6 St R0, TotalCost HLT