CS 350 INTRODUCTION TO MIPS ASSEMBLY LANGUAGE
Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions
Memory Instructions
C Version:
g = h + A[8]
[where g and h assigned to registers $s1, $s2, t registers are temporary registers]
MIPS Version:
lw $t0, 8($s3)
add $s1, $s2, $t0
C Version:
A[12] = h + A[8]
[where h = $s2]
MIPS Version:
lw $t0, 32($s3)
add $t0, $s2, $t0
sw $t0, 48($s3)
C Version:
g = h + A[i]
[where g = $s1; h = $s2, i = $s4, A = $s3]
MIPS Version:
add $t1, $s4, $s4
add $t1, $t1, $t1
add $t1, $t1, $s3
lw $t0, 0($t1)
add $s1, $s2, $t0
Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions