Advertisement
vim_fans

Untitled

Dec 4th, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. /*
  2.  * Translate the following MIPS code to C. Assume that the variables f, h, i, and j are assigned to registers
  3.  * $s0, $s1,$s2,$s3, and $s4, respectivly. Assume that the base address of the arrays A and B are in registers $s6
  4.  *  and $s7, respectively.
  5.  *  addi $t0, $s6, 4
  6.  *  add $t1, $s6, $s0
  7.  *  sw  $t1, 0($t0)
  8.  *  lw  $t0, 0($t0)
  9.  *  add $s0, $t1, $t0
  10.  * */
  11.  
  12.  
  13. int main()
  14. {
  15.     // $s0 = f  $s6 = A[]  $s7=B[]
  16.     int f,A[100],B[100];
  17.     A[1] = A[f];
  18.     f = A[f]+A[f];
  19.  
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement