CS 350 INTRODUCTION TO MIPS ASSEMBLY LANGUAGE


Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions

In-Lab Exercise


 MIPS IN-LAB EXERCISE

 

Translate the following C code to MIPS:

1)

A[300] = h + A[300]

[A = $s1; h = $s2]

 

2)

while (save[i] == k)

    i = i + j;

[where i, j, and k correspond to registers $s3, $s4, and $s5, respectively, and the base of the array is in $s6]

 

3)

Loop:        g = g + A[i];

                 i = i + j;

                 if ( i != h ) go to Loop;

[where g, h, i, and j correspond to the registers $s1, $s2, $s3, and $s4, respectively]

 

SEE SOLUTIONS

 


Types of MIPS | Memory Instructions | Arithmetic Instructions | Branch/Jump Instructions

In-Lab Exercise