COMS 361 Computer Organization

Slides:



Advertisements
Similar presentations
Henk Corporaal TUEindhoven 2011
Advertisements

Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Goal: Write Programs in Assembly
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Instruction Set-Intro
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
CS3350B Computer Architecture Winter 2015 Lecture 4
Systems Architecture Lecture 5: MIPS Instruction Set
Chapter 2 Instructions: Language of the Computer
Chapter 2.
1 Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow Very restrictive e.g., MIPS Arithmetic.
CS 536 Spring Code generation I Lecture 20.
331 W02.1Spring 05 Announcements  HW1 is due on this Friday  Appendix A (on CD) is very helpful to HW1.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
331 W02.1Fall 2003 Announcements  HW1 is due on this Friday (Sept 12 th )  Appendix A is very helpful to HW1. Check out system calls on Page A-48. 
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
CMPT 334 Computer Organization Chapter 2 Instructions: Language of the Computer [Adapted from Computer Organization and Design 5 th Edition, Patterson.
MIPS assembly. Computer What’s in a computer? Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
CDA 3101 Fall 2012 Introduction to Computer Organization Instruction Set Architecture MIPS Instruction Format 04 Sept 2013.
Lecture 4: MIPS Instruction Set Reminders: –Homework #1 posted: due next Wed. –Midterm #1 scheduled Friday September 26 th, 2014 Location: TODD 430 –Midterm.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
Chapter 2 Instructions: Language of the Computer Part I.
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
CWRU EECS 3221 Language of the Machine EECS 322 Computer Architecture Instructor: Francis G. Wolff Case Western Reserve University.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA.
Chapter 2 CSF 2009 The MIPS Assembly Language. Stored Program Computers Instructions represented in binary, just like data Instructions and data stored.
EE472 – Spring 2007P. Chiang, with Slide Help from C. Kozyrakis (Stanford) ECE472 Computer Architecture Lecture #3—Oct. 2, 2007 Patrick Chiang TA: Kang-Min.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
MIPS assembly. Computer  What’s in a computer?  Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
1  1998 Morgan Kaufmann Publishers Instructions: Language of the Machine More primitive than higher level languages e.g., no sophisticated control flow.
CHAPTER 2 Instruction Set Architecture 3/21/
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Architecture & Operations I
Computer Architecture & Operations I
MIPS Assembly.
Instruction Set Architecture
Morgan Kaufmann Publishers
Lecture 4: MIPS Instruction Set
ECE3055 Computer Architecture and Operating Systems MIPS ISA
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
MIPS Assembly.
CS170 Computer Organization and Architecture I
CSCI206 - Computer Organization & Programming
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
The University of Adelaide, School of Computer Science
Systems Architecture Lecture 5: MIPS Instruction Set
MIPS assembly.
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Chapter 2 Instructions: Language of the Computer
COMS 361 Computer Organization
Computer Instructions
Computer Architecture
September 17 Test 1 pre(re)view Fang-Yi will demonstrate Spim
3.
COMS 361 Computer Organization
COMS 361 Computer Organization
UCSD ECE 111 Prof. Farinaz Koushanfar Fall 2018
COMS 361 Computer Organization
Instructions in Machine Language
MIPS Assembly.
Review In last lecture, done with unsigned and signed number representation. Introduced how to represent real numbers in float format.
CPU Structure CPU must:
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Presentation transcript:

COMS 361 Computer Organization Title: Instructions Date: 9/14/2004 Lecture Number: 6

Announcements Homework 3 Due 9/21/04

Review MIPS, MOPS, FLOPS SPEC Benchmarks

Outline Instructions MIPS arithmetic instruction format Design principles Registers Memory organization MIPS load and store instructions and format Addressing MIPS branch instructions and format

Instructions Instructions: Instruction set: Words of a computers language More primitive than higher level languages No sophisticated control flow Essentially a goto is the only mechanism to alter sequential program execution Very restrictive MIPS Arithmetic Instructions Instruction set: Vocabulary of the language

Instructions MIPS instruction set architecture Similar to other architectures developed since the 1980's Used by NEC, Nintendo, Silicon Graphics, Sony Design goals for all ISA’s Maximize performance Minimize cost Reduce design time Machine languages for different machines are similar as common tasks must be performed

MIPS arithmetic All arithmetic instructions have 3 operands Example: Fixed operand order (destination first) Example: C/C++ code: a = b + c MIPS code: add $s0, $s1, $s2 means $s0 <= $s1 + $S2 Rigid arithmetic instruction format MIPS arithmetic instruction Performs one operation Has exactly three variables Destination (a) One source (b) The other source (c)

MIPS arithmetic Natural: add two numbers and put the result somewhere else Less flexibility => simpler hardware C/C++ code: a = b + c + d MIPS code: add $s0, $s1, $s2 add $s0, $s0, $s3 To add three numbers requires two MIPS instructions There can be only one instruction per line The regularity of arithmetic instructions make implementation simpler than hardware for a variable number of operands

Design Principle 1 Simplicity favors regularity Regularity complicates some things C/C++ code: a = b + c + d; e = f - a; MIPS code: add $t0, $s1, $s2 add $s0, $t0, $s3 sub $s4, $s5, $s0

MIPS arithmetic Operands must be registers in the MIPS ISA Registers are fast memory units on the processor MIPS has 32 registers, each containing 32 bits Assembler names for some of the registers $zero: constant 0 $at: reserved for the assembler $v0 - $v1: function results $a0 - $a3: function arguments $t0 - $t9: temporary (not preserved) $s0 - $s7: temporary (preserved) $k0 - $k1: reserved for the OS kernel $gp, $sp, $fp, $ra: special purpose registers

Design Principle 2 Smaller is faster Compiler associates program variables with registers What about programs with lots of variables? More variables than the number of registers Spilled to memory Processor I/O Control Datapath Memory Input Output

Registers and Memory Data Transfer Instructions MIPS provides a mechanism to transfer data between memory and registers Must contain a memory address More on this later

Memory Organization Viewed as a large, single-dimension array, with an address A memory address is an index into the array "Byte addressing" means that the index points to a byte of memory 1 2 3 4 5 6 ... 8 bits of data

Memory Organization Bytes are nice, but bigger is better (right?) A byte holds a small amount of information Group bytes into a word For MIPS, a word is 32 bits or 4 bytes 4 8 12 32 bits of data Each registers holds 32 bits of data

Memory Organization 232 bytes with byte addresses from 0 to 232-1 230 words with byte addresses 0, 4, 8, ... 232-4 Words are aligned (alignment restriction) Sequential word addresses differ by 4 What are the least two significant bits of each word address?

Memory Organization Two choices for the order the bytes fill a word Leftmost byte in a word Big-end: Big Endian MIPS Rightmost byte in a word Little-end: Little Endian Intel byte 0 byte 1 byte 2 byte 3 4 byte 4 byte 5 byte 6 byte 7 byte 3 byte 2 byte 1 byte 0 4 byte 7 byte 6 byte 5 byte 4

Data Transfer Instructions Transfer data between registers and memory Load and store instructions Only way for MIPS to read/save data from/in memory Must specify the address in memory of the word load Move data from memory into a register store Move data from a register into memory

Data Transfer Instructions Example C/C++ code: A[8] = h + A[8]; Add the contents of a register to the contents of a memory location MIPS: operands must be registers load operands into registers perform the add store sum

Data Transfer Instructions Example C/C++ code: A[8] = h + A[8]; MIPS code: lw $t0, 32($s3) add $t0, $s2, $t0 sw $t0, 32($s3) One simple high-level language statement results in three MIPS instructions

Data Transfer Instructions base address The address of the first element of the array A Stored in $s3 called the base register offset Amount added to the base register to index a specific element in the array Add an amount to access the 8th array element MIPS is byte addressed and words are 4 bytes add 32 to the base address of the array

Data Transfer Instructions Store word (sw) has destination (memory address) last Store the word in a register to a memory location Arithmetic operands are registers, not memory!

So far MIPS Loading words but addressing bytes Arithmetic on registers only Instruction Meaning add $s1, $s2, $s3 $s1 = $s2 + $s3 sub $s1, $s2, $s3 $s1 = $s2 – $s3 lw $s1, 100($s2) $s1 = Memory[$s2+100] sw $s1, 100($s2) Memory[$s2+100] = $s1