{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MIPS - 3 register operands addi $s1 $s2 20 s1 = s2 20 Used...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
MIPS InStruction set MIPS Instructions Name Format Pseudo MIPS Name Format add add R move move R add immediate addi I multiply mult R subtract sub R load immediate li I load word lw I branch less blt I load upper immed lui I branch less/equal ble I store word sw I branch greater bgt I and and R branch greater/equal bge I or or R nor nor R shift L logical sll R shift R logical srl R branch on equal beq I branch on not equal bne I set less than slt R jump j J jump register jr R jump and link jal J MIPS operands Name Example Comments 32 registers $s0-$s7, $t0-$t9, Fast locations for data. $at is $zero, $a0-$a3, reserved for the assembler to $v0-$v1, $gp, $fp, handle large constants. $sp, $ra, $at 2^30 memory words Memory[0], Mem[4], Accessed only by DT instructions. …Memory[4294967292] MIPS uses byte addresses, so sequential word addresses differ by 4. Memory holds data structs, arrays, and spilled registers.
Image of page 1

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

View Full Document Right Arrow Icon
MIPS assembly language Category Example Meaning Comments arithmetic add $s1, $s2, $s3 s1 = s2 + s3 3 register operands sub $s1, $s2, $s3 s1 = s2 - s3
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3 register operands addi $s1, $s2, 20 s1 = s2 + 20 Used to add constants data transfer lw $s1, 20($s2) s1 = Mem[s2 + 20] Word from memory to register sw $s1, 20($s2) Mem[s2 + 20] = s1 Word from register to memory lui $s1, 20 s1 = 20 * 2^16 Loads const into upper 16 bits logical and $s1, $s2, $s3 s1 = s2 & s3 Bit-by-bit AND or $s1, $s2, $s3 s1 = s2 | s3 Bit-by-bit OR nor $s1, $s2, $s3 s1 ~= (s2 | s3) Bit-by-bit NOR sll $s1, $s2, 10 s1 = s2 << 10 Shift left by constant srl $s1, $s2, 10 s1 = s2 >> 10 Shift right by constant conditional beq $s1, $s2, 25 if = go PC+4+100 PC relative branch branch bne $s1, $s2, 25 if ~ go PC+4+100 PC relative branch slt $s1, $s2, $s3 s1 = 1 if true : 0 Compare less than for beq, bne unconditional j 25 go to 100 Jump to target jump jr $ra go to return addr Procedure return jal 25 ra=PC+4; go to 100 For procedure call...
View Full Document

{[ snackBarMessage ]}