Concepts Introduced in Chapter 3

Similar documents
Chapter 3. Instructions:

Chapter 2. Instructions:

MIPS (SPIM) Assembler Syntax

Chapter 2: Instructions:

1 5. Addressing Modes COMP2611 Fall 2015 Instruction: Language of the Computer

MACHINE LANGUAGE. To work with the machine, we need a translator.

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from:

ECE 486/586. Computer Architecture. Lecture # 7

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

Course Administration

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

Processor design - MIPS

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Instructions: Language of the Computer

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

Computer Systems Laboratory Sungkyunkwan University

CS222: MIPS Instruction Set

ECE 486/586. Computer Architecture. Lecture # 8

Chapter 2. Instruction Set Architecture (ISA)

Lecture Topics. Branch Condition Options. Branch Conditions ECE 486/586. Computer Architecture. Lecture # 8. Instruction Set Principles.

Lecture 4: Instruction Set Design/Pipelining

CS3350B Computer Architecture MIPS Introduction

EECS Computer Organization Fall Based on slides by the author and prof. Mary Jane Irwin of PSU.

CS3350B Computer Architecture MIPS Instruction Representation

Topic Notes: MIPS Instruction Set Architecture

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.

IC220 SlideSet #2: Instructions (Chapter 2)

Instructions: Language of the Computer

What is Computer Architecture?

CS 430 Computer Architecture. C/Assembler Arithmetic and Memory Access William J. Taffe. David Patterson

CS3350B Computer Architecture

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

CPU Architecture and Instruction Sets Chapter 1

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Operations, Operands, and Instructions

Chapter 2A Instructions: Language of the Computer

Computer Architecture. Chapter 2-2. Instructions: Language of the Computer

EE 361 University of Hawaii Fall

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

(Refer Slide Time: 1:40)

Thomas Polzer Institut für Technische Informatik

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

EC 413 Computer Organization

Instruction Set Architecture

Code Generation. The Main Idea of Today s Lecture. We can emit stack-machine-style code for expressions via recursion. Lecture Outline.

We can emit stack-machine-style code for expressions via recursion

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Computer Architecture

Instructions: Language of the Computer

Systems Architecture I

Lecture 4: Instruction Set Architecture

Two processors sharing an area of memory. P1 writes, then P2 reads Data race if P1 and P2 don t synchronize. Result depends of order of accesses

UCB CS61C : Machine Structures

Architecture I. Computer Systems Laboratory Sungkyunkwan University

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

CS4617 Computer Architecture

Chapter 4. The Processor

EEC 581 Computer Architecture Lecture 1 Review MIPS

CSEE 3827: Fundamentals of Computer Systems

MODULE 4 INSTRUCTIONS: LANGUAGE OF THE MACHINE

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

COSC 6385 Computer Architecture. Instruction Set Architectures

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

MIPS History. ISA MIPS Registers

Lecture 4: RISC Computers

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

Chapter 2. Instructions: Language of the Computer

LECTURE 2: INSTRUCTIONS

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.)

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

ECE232: Hardware Organization and Design

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Hardware Level Organization

COMPUTER ORGANIZATION AND DESIGN

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

ADD R Operation : ACC = ACC + R SIZE : 1 byte, 8 bit Time : 3 T Cycle Work : Read R, Read ACC, Add, Write Result to ACC

Instruction Set Principles and Examples. Appendix B

Communicating with People (2.8)

Lecture Outline. Code Generation. Lecture 30. Example of a Stack Machine Program. Stack Machines

CENG3420 L03: Instruction Set Architecture

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.

Instruction Set Architectures. CS301 Prof. Szajda

ISA: The Hardware Software Interface

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

History of the Intel 80x86

Transcription:

Concepts Introduced in Chapter 3 basic instruction set design principles subset of the MIPS assembly language correspondence between high-level language constructs and MIPS assembly code how MIPS assembly instructions are represented in machine language stored-program concept process of transforming a high-level language program into a program that can execute on a computer Chapter 3: Instructions: Language of the Machine - 1 of 35

Instructions for a Machine High-Level Language Statement is typically represented by several assembly instructions Assembly Instruction is generally a symbolic representation of a machine instruction Machine Instruction a sequence of bits representing a basic operation that a machine can perform Instruction Set is the set of possible machine instructions for a specific machine Chapter 3: Instructions: Language of the Machine - 2 of 35

Figure 3.21: A translation hierarchy. Chapter 3: Instructions: Language of the Machine - 3 of 35

Goals When Designing an Instruction Set Make hardware easy to build. Make the compiler easy to construct. Maximize performance. Minimize cost. Chapter 3: Instructions: Language of the Machine - 4 of 35

Memory Chapter 3: Instructions: Language of the Machine - 5 of 35

Registers Chapter 3: Instructions: Language of the Machine - 6 of 35

Instruction Set Design Principles Simplicity favors regularity. Smaller is faster. Good design demands good compromises. Make the common case fast. Chapter 3: Instructions: Language of the Machine - 7 of 35

Who Programs in Assembly Language? Most programming today is done in a high-level language (e.g. C++). However, there are some programs that are written in assembly code. critical parts of an operating system (e.g. device drivers) run-time library routines (e.g. printf) embedded applications Chapter 3: Instructions: Language of the Machine - 8 of 35

Why Learn Assembly Language? to understand concepts in computer organization to understand how high-level language constructs are actually implemented control constructs (if, while-do, etc.) parameter passing (pass-by-value, pass-by-reference, etc.) pointers to help understand performance implications Chapter 3: Instructions: Language of the Machine - 9 of 35

MIPS Introduction The MIPS is a RISC (Reduced Instruction Set Computer) instruction set. It was introduced in the early 1980 s. Many instruction sets designed since that time are very similar. The MIPS architecture has been used by SGI, NEC, Nintendo, etc. Chapter 3: Instructions: Language of the Machine - 10 of 35

General Classes of MIPS Assembly Instructions Arithmetic perform arithmetic operations (+, -, *, /) Logical perform logical operations (&,, <<, >>) Data Transfer loads from memory or stores to memory Transfers of Control transfers control from one portion of the program to another Chapter 3: Instructions: Language of the Machine - 11 of 35

MIPS Instruction Operands Integer Constants generally represented in 16 bits or less Registers $0 hardwired to contain the value zero $1,$26-$29 reserved by the assembler or the operating system (don t use them) $2-$25, $30, $31, $f0-$f31 for use by the compiler or assembly language programmer Memory [0..2**32-1] bytes or [0..2**30-1] words Chapter 3: Instructions: Language of the Machine - 12 of 35

General Form of a MIPS Assembly Language Program Chapter 3: Instructions: Language of the Machine - 13 of 35

General Form of a MIPS Instruction Chapter 3: Instructions: Language of the Machine - 14 of 35

General Forms of a MIPS Arithmetic or Logical Instruction Chapter 3: Instructions: Language of the Machine - 15 of 35

General Form of a MIPS Data Transfer Instruction Chapter 3: Instructions: Language of the Machine - 16 of 35

Example of Using Arithmetic/Logical and Data Transfer Instructions Chapter 3: Instructions: Language of the Machine - 17 of 35

Another Example Using Arithmetic/Logical and Data Transfer Instructions Chapter 3: Instructions: Language of the Machine - 18 of 35

Memory Access Issues There are alignment restrictions based on the size of the data being accessed. Byte xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Half xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0 Word xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx00 Double xxxxxxxxxxxxxxxxxxxxxxxxxxxxx000 Chapter 3: Instructions: Language of the Machine - 19 of 35

Memory Access Issues (cont.) Chapter 3: Instructions: Language of the Machine - 20 of 35

General Form of MIPS Transfer of Control Instructions Chapter 3: Instructions: Language of the Machine - 21 of 35

Translating an If-Then-Else Statement into MIPS Assembly Instructions Chapter 3: Instructions: Language of the Machine - 22 of 35

Translating a For Statement into MIPS Assembly Instructions Chapter 3: Instructions: Language of the Machine - 23 of 35

Instruction Formats Chapter 3: Instructions: Language of the Machine - 24 of 35

Figure 3.37: The MIPS instruction set covered so far. Chapter 3: Instructions: Language of the Machine - 25 of 35

Examples of Encoding Instructions Chapter 3: Instructions: Language of the Machine - 26 of 35

Encoding the Branch Displacement Chapter 3: Instructions: Language of the Machine - 27 of 35

lui Instruction Chapter 3: Instructions: Language of the Machine - 28 of 35

Figure 3.17: Illustration of the five MIPS addressing modes. Chapter 3: Instructions: Language of the Machine - 29 of 35

Figure 3.7: The stored-program concept. Chapter 3: Instructions: Language of the Machine - 30 of 35

Figure 3.21: A translation hierarchy. Chapter 3: Instructions: Language of the Machine - 31 of 35

Figure 3.22: The MIPS memory allocation for program and data. Chapter 3: Instructions: Language of the Machine - 32 of 35

Figure 3.12: Illustration of the stack allocation (a) before, (b) during, and (c) after the procedure call. Chapter 3: Instructions: Language of the Machine - 33 of 35

Figure 3.13: MIPS register convention. Chapter 3: Instructions: Language of the Machine - 34 of 35

Fallacies and Pitfalls Fallacy: More powerful instructions mean higher performance. Fallacy: Write in assembly language to obtain the highest performance. Pitfall: Forgetting that sequential word addresses in machines with byte addressing do not differ by one. Pitfall: Using a pointer to an automatic variable outside its defining procedure. Chapter 3: Instructions: Language of the Machine - 35 of 35