Lecture 4: MIPS Subroutines and x86 Architecture Professor Mike Schulte Computer Architecture ECE 201.

Slides:



Advertisements
Similar presentations
CH10 Instruction Sets: Characteristics and Functions
Advertisements

CEG3420 Lec2.1 ©UCB Fall 1997 ISA Review CEG3420 Computer Design Lecture 2.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
EECC551 - Shaaban #1 Lec # 2 Fall Instruction Set Architecture (ISA) “... the attributes of a [computing] system as seen by the programmer,
©UCB CS 161 Lecture 4 Prof. L.N. Bhuyan
ECE 232 L6.Assemb.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 6 MIPS Assembly.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
ELEN 468 Advanced Logic Design
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
Procedure call frame: Hold values passed to a procedure as arguments
COMP381 by M. Hamdi 1 Instruction Set Architectures.
CIS429/529 ISA - 1 Instruction Set Architectures Classification Addressing Modes Types of Instructions Encoding Instructions MIPS64 Instruction Set.
ENEE350 Spring07 1 Ankur Srivastava University of Maryland, College Park Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005.”
331 W02.1Spring 05 Announcements  HW1 is due on this Friday  Appendix A (on CD) is very helpful to HW1.
1 CSE SUNY New Paltz Chapter 3 Machine Language Instructions.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
Recap.
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. 
331 Practice Exam.1Fall 2003 Naming Conventions for Registers 0$zero constant 0 (Hdware) 1$atreserved for assembler 2$v0expression evaluation & 3$v1function.
©UCB CPSC 161 Lecture 5 Prof. L.N. Bhuyan
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
1  2004 Morgan Kaufmann Publishers Instructions: bne $t4,$t5,Label Next instruction is at Label if $t4≠$t5 beq $t4,$t5,Label Next instruction is at Label.
13/02/2009CA&O Lecture 04 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
1 Appendix B Classifying Instruction Set Architecture Memory addressing mode Operations in the instruction set Control flow instructions Instruction format.
Homework Problems 1. M1 runs the program P in 1.4 * 9 * ns or ns M2 runs the program P in 1.6*9800*10ns or ns Hence M2 is faster by.
CSE331 W02.1Irwin Fall 2001 PSU Computer Architecture Discussion Lecture # 2 MIPS Programming.
Classifying GPR Machines TypeNumber of Operands Memory Operands Examples Register- Register 30 SPARC, MIPS, etc. Register- Memory 21 Intel 80x86, Motorola.
1 CS/EE 362 Hardware Fundamentals Lecture 10 (Chapter 3: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
MicroComputer Engineering IntroLab1 page 1 Introduction Lab1  A crash course in assembler programming  Learn how a processor works!  Decode a coded.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
Computer Architecture EKT 422
Chapter 4 Instruction Set Examples Advanced Computer Architecture COE 501.
Oct. 25, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Alternative Instruction Sets * Jeremy R. Johnson Wed. Oct. 25, 2000.
Csci 136 Computer Architecture II – Summary of MIPS ISA Xiuzhen Cheng
Lecture 04: Instruction Set Principles Kai Bu
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
EEL5708/Bölöni Lec 8.1 9/19/03 September, 2003 Lotzi Bölöni Fall 2003 EEL 5708 High Performance Computer Architecture Lecture 5 Intel 80x86.
COMPUTER ORGANIZATION LECTURE 3: ISA YASSER MOHAMMAD.
© G. Drew Kessler and William M. Pottenger1 Subroutines, Part 2 CSE 262, Spring 2003.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
Computer Organization Instructions Language of The Computer (MIPS) 2.
MIPS Lab CMPE 142 – Operating Systems. MIPS Simulator First Time Startup Setting Options.
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 12 Procedure Calling.
Computer Architecture & Operations I
Overview of Instruction Set Architectures
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Advanced Computer Architecture 5MD00 / 5Z032 Instruction Set Design
Instructions - Type and Format
CS170 Computer Organization and Architecture I
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
MIPS Instructions.
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
The University of Adelaide, School of Computer Science
ECEG-3202 Computer Architecture and Organization
ECEG-3202 Computer Architecture and Organization
Instruction Set Principles
Other Processors Having learnt MIPS, we can learn other major processors. Not going to be able to cover everything; will pick on the interesting aspects.
Lecture 4: Instruction Set Design/Pipelining
Computer Organization
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

Lecture 4: MIPS Subroutines and x86 Architecture Professor Mike Schulte Computer Architecture ECE 201

MIPS Subroutine Calls When making a subroutine (procedure) call, it is necessary to –Place inputs where they can be accessed by subroutine –Transfer control to subroutine –Peform the desired task –Place the result value(s) where the calling program can access it –Return control to the point of origin –The subroutine caller or callee should save and restore registers used by the subroutine MIPS –Provides instructions to assist in subroutine calls (jal) and returns (jr) –Uses software conventions to » place subroutine input and output values »control which registers are saved/restored by caller and callee –Uses a software stack to save/restore values

Subroutine Calls Stacking of Subroutine Calls & Returns and Environments: A: CALL B CALL C C: RET B: A AB ABC AB A Some machines provide a memory stack as part of the architecture (e.g., VAX) Sometimes stacks are implemented via software convention (e.g., MIPS)

0zero constant 0 1atreserved for assembler 2v0expression evaluation & 3v1function results 4a0arguments 5a1 6a2 7a3 8t0temporary: caller saves...(callee can clobber) 15t7 MIPS: Software conventions for registers 16s0callee saves... 23s7 24t8 temporary (cont’d) 25t9 26k0reserved for OS kernel 27k1 28gpPointer to global area 29spstack pointer 30fpframe pointer 31raReturn Address (HW)

Call-Return Linkage: Stack Frames FP Saved argument registers SP High Mem Low Mem Saved return address Saved saved registers Local arrays and structures

History of the Intel 80x : Intel invents microprocessor : 8080 introduced –8-bit microprocessor –Accumulator machine 1978: 8086 introduced –16 bit microprocessor –Accumulator plus dedicated registers 1980: IBM selects 8088 as basis for IBM PC –8088 is 8-bit external bus version of : 8087 floating point coprocessor –adds 60 floating point instructions –80 bit floating point registers –uses hybrid stack/register scheme

History of the Intel 80x : introduced –24-bit address –memory mapping & protection 1985: introduced –32-bit address –32-bit GP registers 1989: introduced 1992: Pentium introduced 1995: Pentium Pro introduced 1996: Pentium with MMX extensions –57 new instructions –Primarily for multimedia applications 1997: Pentium II (Pentium Pro with MMX)

History of the Intel 80x : Pentium III Introduced Supports Intel’s Internet Streaming SIMD technology –Additional multimedia instructions –Four 32-bit floating point operations in parallel –Average, absolute difference, packed maximum/minimum –Useful in speech recognition, video encoding/decoding 2000: Intanium introduced –Release of IA-64 (RISC-like) architecture –Explicitly Parallel Instruction Computing (EPIC) –128-bit bundle with three instructions and a template –128 general purpose registers and 128 floating point registers –Done by a partnership between HP and Intel –Able to run both UNIX and Microsoft windows Intel architecture was due to the desire for backward compatability –Highly irregular architecture –Over 50 million sold per year

Intel 80x86 Integer Registers

X86 Operand Types x86 instructions typically have two operands, where one operand is both a source and a destination operand. Possible combinations include Source/destination typeSecond source typeRegister RegisterImmediate RegisterMemory MemoryRegister MemoryImmediate No memory-memory or immediate-immediate Immediates can be 8, 16, or 32 bits

80x86 Instructions Data movement (move, push, pop) Arithmetic and logic (logic ops, tests CCs, shifts, integer and decimal arithmetic) Control flow (branches, jumps, calls, returns) String instructions (move and compare) FP data movement (load, load const., store) Arithmetic instructions (add, subtract, multiply, divide, square root, absolute value) Comparisons (can send result to ALU) Transcendental functions (sin, cos, log, etc.)

Top 10 80x86 Instructions °RankinstructionInteger Average Percent total executed 1load22% 2conditional branch20% 3compare16% 4store12% 5add8% 6and6% 7sub5% 8move register-register4% 9call1% 10return1% Total96% ° Simple instructions dominate instruction frequency - support these.

Addressing modes The x86 offers several different addressing modes for accessing memory Register indirectAddress in register (mem[R1]) Base with displacement (8, 16, or 32-bit displacement) Base plus scaled index (8, 16, or 32-bit displacement) Address in base register plus displacement (mem[R1+100]) Address is Base + 2 scale x Index scale = 0, 1, 2 or 3 Base plus scaled index with displacement (8, 16, or 32-bit displacement) Address is Base + 2 scale x Index + disp. scale = 0, 1, 2 or 3

80x86 Instruction Format Instructions sizes vary from 1 to 17 bytes

80x86 Length Distribution

Performance Comparison Pentium Pro vs. MIPS R10000 Benchmark Pro MIPSMIIPS÷Pro SPECint SPECfp The Pentium Pro and MIPS R1000 have comparable performance on integer computations. The MIPS R10000 has much better performance than the Pentium Pro for floating point computations.

Comparison How would you expect the x86 and MIPS architectures to compare on the following. –CPI on SPEC benchmarks –Ease of design and implementation –Ease of writing assembly language & compilers –Code density –Overall performance What other advantages/disadvantages are there to the two architectures.