mips quick tutorial - MIPS Architecture and Assembly...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
MIPS Architecture and Assembly Language Overview Adapted from: http://edge.mcs.dre.g.el.edu/GICL/people/sevy/architecture/MIPSRef(SPIM).html [ Register Description ] [ I/O Description ] Data Types and Literals Data types: Instructions are all 32 bits byte(8 bits), halfword (2 bytes), word (4 bytes) a character requires 1 byte of storage an integer requires 1 word (4 bytes) of storage Literals: numbers entered as is. e.g. 4 characters enclosed in single quotes. e.g. 'b' strings enclosed in double quotes. e.g. "A string" Registers 32 general-purpose registers register preceded by $ in assembly language instruction two formats for addressing: using register number e.g. $0 through $31 using equivalent names e.g. $t1, $sp special registers Lo and Hi used to store result of multiplication and division not directly addressable; contents accessed with special instruction mfhi ("move from Hi") and mflo ("move from Lo") stack grows from high memory to low memory Register Number Alternative Name Description 0 zero the value 0 1 $at ( a ssembler t emporary) reserved by the assembler 2-3 $v0 - $v1 ( v alues) from expression evaluation and function results 4-7 $a0 - $a3 ( a rguments) First four parameters for subroutine.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Not preserved across procedure calls
Background image of page 2
8-15 $t0 - $t7 ( t emporaries) Caller saved if needed. Subroutines can use w/out saving. Not preserved across procedure calls
Background image of page 3

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

View Full DocumentRight Arrow Icon
16-23 $s0 - $s7 ( s aved values) - Callee saved. A subroutine using one of these must save original and restore it before exiting. Preserved across procedure calls 24-25 $t8 - $t9 ( t emporaries) Caller saved if needed. Subroutines can use w/out saving. These are in addition to $t0 - $t7 above. Not preserved across procedure calls. 26-27 $k0 - $k1 reserved for use by the interrupt/trap handler 28 $gp g lobal p ointer. Points to the middle of the 64K block of memory in the static data segment. 29 $sp s tack p ointer Points to last location on the stack. 30 $s8/$fp s aved value / f rame p ointer Preserved across procedure calls 31 $ra r eturn a ddress See also Britton section 1.9, Sweetman section 2.21, Larus Appendix section A.6 Program Structure just plain text file with data declarations, program code (name of file should end in suffix .s to be used with SPIM simulator) data declaration section followed by program code section Data Declarations placed in section of program identified with assembler directive .data declares variable names used in program; storage allocated in main memory (RAM) Code placed in section of text identified with assembler directive .text contains program code (instructions) starting point for code e.g.ecution given label
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/09/2010 for the course CS 216 taught by Professor Ziang during the Spring '10 term at American College of Computer & Information Sciences.

Page1 / 11

mips quick tutorial - MIPS Architecture and Assembly...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online