1 / 3

MIPS instructions

MIPS instructions. These are some of the most common MIPS instructions and pseudo-instructions, and should be all you need. However, you are free to use any valid MIPS instructions or pseudo-instruction in your programs.

cady
Download Presentation

MIPS instructions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MIPS instructions These are some of the most common MIPS instructions and pseudo-instructions, and should be all you need. However, you are free to use any valid MIPS instructions or pseudo-instruction in your programs. • The second source operand of the arithmetic, logical, and branch instructions may be a constant. • Register Conventions • The caller is responsible for saving any of the following registers that it needs, before invoking a function. • $t0-$t9 $a0-$a3 $v0-$v1 • The callee is responsible for saving and restoring any of the following registers that it uses. • $s0-$s7 $ra • Pointers in C: • Declarartion: either char *char_ptr -or- char char_array[] for char c • Dereference: c = c_array[i] -or- c =*c_pointer • Take address of: c_pointer = &c 1

  2. Hexadecimal Notation C and languages with a similar syntax (such as C++, C# and Java) prefix hexadecimal numerals with "0x", e.g. "0x5A3". The leading "0" is used so that the parser can simply recognize a number, and the "x" stands for hexadecimal. 2

  3. Getting calling conventions right! (This will NOT be on the exam cheat-sheet) • Assign an s register to each variable in the C function (incl. arguments) • First thing your code does: grow stack to accommodate all your s-registers PLUS $ra • Second thing: move each argument (a-register) into chosen s-register • Single exit point: • restore all s-registers AND $ra • shrink stack • jr $ra • Use s-registers just like C variables • Don’t touch $sp, $ra within the body of the code 3

More Related