1 CS232: Computer Architecture II Fall 2010 AMD dual-core Opteron.

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

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.
Branches Two branch instructions:
Syllabus Instructor: Dr. Wesam Ashour
B1010 Assembly ENGR xD52 Eric VanWyk Fall Today Context of Assembly Your First Assembly Programs.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
Systems Architecture Lecture 5: MIPS Instruction Set
Chapter 2.
1 Nested Procedures Procedures that don't call others are called leaf procedures, procedures that call others are called nested procedures. Problems may.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 1: Bits, bytes and a simple processor dr.ir. A.C. Verschueren.
Assembly Language II CPSC 321 Andreas Klappenecker.
CS 61C L06 MIPS Intro (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #6: Intro to MIPS
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
Intro to Computer Architecture
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
RISC Concepts, MIPS ISA and the Mini–MIPS project
CS1104 Assembly Language: Part 1
CS 61C L08 Introduction to MIPS Assembly Language: Arithmetic (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
Fall 2003SYCS-401 Operating Systems Instruction Set Architecture An overview of MIPS R3000 assembly language.
Implementation of a Stored Program Computer
1 Today  Finish-up procedures/stack  strlen example  Machine language, the binary representation for instructions. —We’ll see how it is designed for.
9/29: Lecture Topics Memory –Addressing (naming) –Address space sizing Data transfer instructions –load/store on arrays on arrays with variable indices.
CDA 3101 Fall 2012 Introduction to Computer Organization Instruction Set Architecture MIPS Instruction Format 04 Sept 2013.
Linked Lists in MIPS Let’s see how singly linked lists are implemented in MIPS on MP2, we have a special type of doubly linked list Each node consists.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
1 Basics of MIPS ISA Pavel Kryukov 8 November 2014.
1 CS232: Computer Architecture II Fall 2011 Intel i7 Quad-core.
Lecture 19: 11/7/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Lecture 4: MIPS Instruction Set Reminders: –Homework #1 posted: due next Wed. –Midterm #1 scheduled Friday September 26 th, 2014 Location: TODD 430 –Midterm.
Lecture 4: MIPS Instruction Set
CWRU EECS 3221 Language of the Machine EECS 322 Computer Architecture Instructor: Francis G. Wolff Case Western Reserve University.
CHAPTER 6 Instruction Set Architecture 12/7/
CS2100 Computer Organisation MIPS Part I: Introduction (AY2015/6) Semester 1.
December 21, 2015©2006 Craig Zilles (adapted from slides by Howard Huang) 1 CS232: Computer Architecture II Spring 2009.
CS232: Computer Architecture II
COMPUTER ORGANIZATION LECTURE 3: ISA YASSER MOHAMMAD.
1 Lecture 6: Assembly Programs Today’s topics:  Large constants  The compilation process  A full example  Intro to the MARS simulator.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Review of RISC CPU Designs Lecturer :吳安宇 Date : 2005/3/4.
1 CS232 Exam 1 Solutions February 20, 2004 Name:  This exam has 5 pages, including this cover.  There are three questions, worth a total of 100 points.
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2003 Topic4: Procedures José Nelson Amaral.
June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 1 CS232: Computer Architecture II Fall 2011 Nvidia Fermi GPU.
Assembly Language Basic job of a CPU: execute lots of instructions. Instructions are the primitive operations that the CPU may execute. Different CPUs.
CS2100 Computer Organisation
Assembly language.
Instruction Set Architecture
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Assembly Programming using MIPS R3000 CPU
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
Systems Architecture Lecture 5: MIPS Instruction Set
The University of Adelaide, School of Computer Science
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
MIPS History MIPS is a computer family
MIPS Assembly.
Computer Instructions
Introduction to Microprocessor Programming
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Instructions in Machine Language
COMS 361 Computer Organization
Assembly Programming using MIPS R3000 CPU
MIPS Assembly.
MIPS History MIPS is a computer family
CPU Structure CPU must:
Lecture 4: Instruction Set Design/Pipelining
9/27: Lecture Topics Memory Data transfer instructions
Instruction Set Architecture
August 31 addresses Drop box Questions? 31 August 2004
Presentation transcript:

1 CS232: Computer Architecture II Fall 2010 AMD dual-core Opteron

2 Who we are  Lecturer: Prof. Viraj Visiting Lecturer Office hours: Wed/Fri 3pm to 4pm and by appt., 2211 SC  Teaching Assistants/Section Instructor: Room 0212 SC Rajesh 4-6pm Samer 2-4pm Jungyoon  MP 1 released this Friday, due next Friday

3 Graded work  6 MPs, 25% of grade —You can work individually, or in groups of 2 or 3 —You will submit your code + three test cases —If your code fails your test case: 0 —If your code fails someone else’s test case: small penalty —If your code fails our test case: larger penalty —If your test breaks our code: 100%  Three Wednesday Midterms 7pm to 8:30pm, 15% each —Exam 1: 9/22 ; Exam 2: 10/20 ; Exam 3: 11/17  Final, cumulative, Friday 12/17, 1:30pm to 4:30pm: 25%  Section attendance: 5%

4  Computer architecture is about building and analyzing computer systems  Instruction Set Architecture is bridge between hardware and software —Study the MIPS ISA in detail —Learn what compilers do when they translate high-level code into assembly (we won’t learn how they do it) —Learn how HLL program constructs are represented to the machine  Key techniques: Pipelining, Caching, Virtual Memory  Tuning complex code for performance (course project)  Exploiting parallelism What is computer architecture about? Memory Processor Input/Output Compiler HLLASM Hey Prof. Kumar, Today I interviewed at Microsoft. I referenced spimbot and used concepts learned in class multiple times. I just wanted to say THANKS!

5  The ISA is an interface between software and hardware —the hardware “promises” to implement all ISA instructions —the software uses ISA primitives to build complex programs  The instruction set architecture affects the hardware design —simple ISAs require simpler, cheaper processors  Also affects software design —simple ISAs result in longer programs Instruction set architectures Software Hardware ISA

6  We study the MIPS instruction set architecture to illustrate concepts in assembly language and machine organization —concepts are not MIPS-specific —MIPS is just convenient because it is real, yet simple (unlike x86)  MIPS ISA is used in many places, primarily in embedded systems —routers from CiscoCisco —game machines like the Nintendo 64 and Sony Playstation 2Nintendo 64Sony Playstation 2 Why MIPS?

7 What you will need to learn for Exam 1  You must become “fluent” in MIPS assembly: —Translate from C++ to MIPS and MIPS to C++  Example: Translate the following recursive C++ function into MIPS int pow(int n, int m) { if (m == 1) return n; return n * pow(n, m-1); } How are arguments passed? How are values returned? How are complex expressions broken into simple instructions? How is recursion done?

8 MIPS: register-to-register, three address  MIPS is a register-to-register, or load/store, architecture —destination and sources of instructions must all be registers —special instructions to access main memory (later)  MIPS uses three-address instructions for data manipulation —each ALU instruction contains a destination and two sources  For example, an addition instruction (a = b + c) has the form: add a, b, c operation destinationsources operands

9 MIPS register file  MIPS processors have 32 registers, each of which holds a 32-bit value —register addresses are 5 bits long  More registers might seem better, but there is a limit to the goodness: —more expensive: because of registers themselves, plus extra hardware like muxes to select individual registers —instruction lengths may be affected D data Write D address A addressB address A dataB data 32  32 Register File

10 MIPS register names  MIPS register names begin with a $. There are two naming conventions: —by number: $0 $1 $2 … $31 —by (mostly) two-character names, such as: $a0-$a3 $s0-$s7 $t0-$t9 $sp $ra  Not all of the registers are equivalent: —e.g., register $0 or $zero always contains the value 0 —some have special uses, by convention ( $sp holds “stack pointer”)  You have to be a little careful in picking registers for your programs —for now, stick to the registers $t0-$t9

11 Basic arithmetic and logic operations  The basic integer arithmetic operations include the following: add sub mul div  And here are a few bitwise operations: and or xor nor  Remember that these all require three register operands; for example: add $t0, $t1, $t2# $t0 = $t1 + $t2 mul$s1, $s1, $a0# $s1 = $s1 x $a0

12  Complex arithmetic expressions may require multiple MIPS operations  Example: t0  (t1  t2)  (t3  t4) add$t0, $t1, $t2# $t0 contains $t1 + $t2 sub$t6, $t3, $t4# temp value $t6 = $t3 - $t4 mul$t0, $t0, $t6# $t0 contains the final product  Temporary registers may be necessary, since each MIPS instructions can access only two source registers and one destination —in this example, we could re-use $t3 instead of introducing $t6 —must be careful not to modify registers that are needed again later Larger expressions

13 How are registers initialized?  Special MIPS instructions allow you to specify a signed constant, or “immediate” value, for the second source instead of a register —e.g., here is the immediate add instruction, addi: addi $t0, $t1, 4# $t0 = $t1 + 4  Immediate operands can be used in conjunction with the $zero register to write constants into registers: addi $t0, $0, 4# $t0 = 4 Shorthand: li $t0, 4# $t0 = 4  MIPS is still considered a load/store architecture, because arithmetic operands cannot be from arbitrary memory locations. They must either be registers or constants that are embedded in the instruction. (pseudo-instruction)

14 Our first MIPS program  Let’s translate the following C++ program into MIPS: void main() { int i = 516; int j = i*(i+1)/2; i = i + j; } main: # start of main li $t0, 516 # i = 516 addi $t1, $t0, 1 # i + 1 mul $t1, $t0, $t1 # i * (i + 1) li $t2, 2 div $t1, $t1, $t2 # j = i*(i+1)/2 add $t0, $t0, $t1 # i = i + j jr $ra # return