Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. add rd, rs, rt # signed addition of integers
  2. # GPR[rd] <-- GPR[rs] + GPR[rt]
  3. addi rt, rs, imm16 # signed addition with 16-bit immediate
  4. # GPR[rt] <-- GPR[rs] + imm16
  5. addiu rt, rs, imm16 # unsigned addition with 16-bit immediate
  6. # GPR[rt] <-- GPR[rs] + imm16
  7. and rd, rs, rt # bitwise logical AND
  8. # GPR[rd] <-- GPR[rs] AND GPR[rt]
  9. andi rt, rs, imm16 # bitwise logical AND with 16-bit immediate
  10. # GPR[rd] <-- GPR[rs] AND imm16
  11. mul rd, rs, rt # signed multiplication of integers
  12. # GPR[rd] <-- GPR[rs] * GPR[rt]
  13. nop # no operation
  14. # executed as: sll $zero, $zero, 0
  15. nor rd, rs, rt # bitwise logical NOR
  16. # GPR[rd] <-- !(GPR[rs] OR GPR[rt])
  17. or rd, rs, rt # bitwise logical OR
  18. # GPR[rd] <-- GPR[rs] OR GPR[rt]
  19. ori rt, rs, imm16 # bitwise logical OR with 16-bit immediate
  20. # GPR[rd] <-- GPR[rs] OR imm16
  21. sll rd, rt, sa # logical shift left a fixed number of bits
  22. # GPR[rd] <-- GPR[rs] <<l sa
  23. slt rd, rs, rt # set register to result of comparison
  24. # GPR[rd] <-- (GPR[rs] < GPR[rt] ? 0 : 1)
  25. CS 2506 Computer Organization II C Programming 5: Simple MIPS Assembler
  26. Version 5.00 This is a purely individual assignment! 3
  27. slti rs, rt, imm16 # set register to result of comparison
  28. # GPR[rd] <-- (GPR[rs] < imm16 ? 0 : 1)
  29. sra rd, rt, sa # arithmetic shift right a fixed number of bits
  30. # GPR[rd] <-- GPR[rs] >>a sa
  31. sub rd, rs, rt # signed subtraction of integers
  32. # GPR[rd] <-- GPR[rs] - GPR[rt]
  33. Your assembler must support the following basic control-of-flow instructions:
  34. beq rs, rt, offset # conditional branch if rs == rt
  35. # PC <-- (rs == rt ? PC + 4 + offset <<l 2)
  36. # : PC + 4)
  37. blez rs, offset # conditional branch if rs <= 0
  38. # PC <-- (rs <= 0 ? PC + 4 + offset <<l 2)
  39. # : PC + 4)
  40. bltz rs, offset # conditional branch if rs < 0
  41. # PC <-- (rs < 0 ? PC + 4 + offset <<l 2)
  42. # : PC + 4)
  43. bne rs, rt, offset # conditional branch if rs != rt
  44. # PC <-- (rs != rt ? PC + 4 + offset <<l 2)
  45. # : PC + 4)
  46. j target # unconditional branch
  47. # PC <-- ( (PC+4)(31:28) || (target <<l 2))
  48. syscall # invoke exception handler, which examines $v0
  49. # to determine appropriate action; if it returns,
  50. # returns to the succeeding instruction; see the
  51. # MIPS32 Instruction Reference for format
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement