Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. for (i=0; i<128; i++)
  2.  
  3. { a[i] = b[i] - c[i] + 5; }
  4.  
  5. add $t4, $zero, $zero # I1 i is initialized to 0, $t4 = 0
  6. Loop:
  7. add $t5, $t4, $t1 # I2 temp reg $t5 = address of b[i]
  8. lw $t6, 0($t5) # I3 temp reg $t6 = b[i]
  9. add $t5, $t4, $t2 # I4 temp reg $t5 = address of c[i]
  10. lw $t7, 0($t5) # I5 temp reg $t7 = c[i] + 5
  11. sub $t6, $t6, $t7 # I6 temp reg $t6 = b[i] - c[i] + 5
  12. add $t5, $t4, $t0 # I7 temp reg $t5 = address of a[i]
  13. sw $t6, 0($t5) # I8 a[i] = b[i] - c[i] + 5
  14. addi $t4, $t4, 4 # I9 i = i + 1
  15. slti $t5, $t4, 256 # I10 $t5 = 1 if $t4 < 128, i.e. i < 10
  16. bne $t5, $zero, Loop # I11 go to Loop if $t4 < 128
  17. exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement