{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# MIPS - ABC 1 SoFar We have learnt about how numbers are...

This preview shows pages 1–13. Sign up to view the full content.

ABC 1 MIPS Assembly Language

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 So Far…. We have learnt about how numbers are represented in computers We have learnt Integer Representation both positive and negative IEEE 754 Floating Point Representation
3 What next? We would like to know what fundamental operations or instructions can a computer execute on these numbers

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Instruction Set Different CPUs implement different sets of instructions. The set of instructions a particular CPU implements is called Instruction Set . Goals of Instruction Set: Must be able to compute anything in a reasonable number of steps Must be implementable
5 Instruction Set Architectures Early trend was to add more and more instructions to new CPUs to do elaborate operations RISC (Reduced Instruction Set Computing) philosophy (Cocke IBM, Patterson, Hennessy, 1980s) Keep the instruction set small and simple, makes it easier to build fast hardware. Let software do complicated operations by composing simpler ones.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 MIPS Architecture MIPS – semiconductor company that built one of the first commercial RISC architectures Used in Sony Playstation, Cisco routers, HP Laser Printers, PDAs, Nintendo, … We will study the MIPS architecture in some detail in this class Why MIPS instead of Intel 80x86? MIPS is simple, elegant. Don’t want to get bogged down in gritty details.
7 Below the Program High-level language program (in C) swap (int v[], int k) (int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp;) Assembly language program (for MIPS) swap: sll \$2, \$5, 2 add \$2, \$4,\$2 lw \$15, 0(\$2) lw \$16, 4(\$2) sw \$16, 0(\$2) sw \$15, 4(\$2) jr \$31 Machine (object) code (for MIPS) 000000 00000 00101 0001000010000000 000000 00100 00010 0001000000100000 . . . C compiler assembler

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 Assembly Variables: Registers Unlike HLL like C or Java, assembly language cannot use variables Why not? Keep Hardware Simple Assembly Operands are registers limited number of special locations built directly into the hardware operations can only be performed on these! Benefit: Since registers are directly in hardware, they are very fast
9 Assembly Variables: Registers Drawback: Since registers are in hardware, there are a predetermined number of them Solution: MIPS code must be very carefully put together to efficiently use registers 32 registers in MIPS Why just 32? Smaller is faster Can be addressed using smaller number of bits Each MIPS register is 32 bits wide Groups of 32 bits called a word in MIPS

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10 Assembly Variables: Registers Registers are numbered from 0 to 31 Each register can be referred to by number or name Number references: \$0, \$1, \$2, … \$30, \$31
11 Assembly Variables: Registers By convention, each register also has a name to make it easier to code For now: \$16 - \$23 \$s0 - \$s7 (correspond to C variables) \$8 - \$15 \$t0 - \$t7 (correspond to temporary variables) Later will explain other 16 register names In general, use names to make your code more readable

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
12 C, Java variables vs. registers In C (and most High Level Languages)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}