Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add rd, rs, rt # signed addition of integers
- # GPR[rd] <-- GPR[rs] + GPR[rt]
- addi rt, rs, imm16 # signed addition with 16-bit immediate
- # GPR[rt] <-- GPR[rs] + imm16
- addiu rt, rs, imm16 # unsigned addition with 16-bit immediate
- # GPR[rt] <-- GPR[rs] + imm16
- and rd, rs, rt # bitwise logical AND
- # GPR[rd] <-- GPR[rs] AND GPR[rt]
- andi rt, rs, imm16 # bitwise logical AND with 16-bit immediate
- # GPR[rd] <-- GPR[rs] AND imm16
- mul rd, rs, rt # signed multiplication of integers
- # GPR[rd] <-- GPR[rs] * GPR[rt]
- nop # no operation
- # executed as: sll $zero, $zero, 0
- nor rd, rs, rt # bitwise logical NOR
- # GPR[rd] <-- !(GPR[rs] OR GPR[rt])
- or rd, rs, rt # bitwise logical OR
- # GPR[rd] <-- GPR[rs] OR GPR[rt]
- ori rt, rs, imm16 # bitwise logical OR with 16-bit immediate
- # GPR[rd] <-- GPR[rs] OR imm16
- sll rd, rt, sa # logical shift left a fixed number of bits
- # GPR[rd] <-- GPR[rs] <<l sa
- slt rd, rs, rt # set register to result of comparison
- # GPR[rd] <-- (GPR[rs] < GPR[rt] ? 0 : 1)
- CS 2506 Computer Organization II C Programming 5: Simple MIPS Assembler
- Version 5.00 This is a purely individual assignment! 3
- slti rs, rt, imm16 # set register to result of comparison
- # GPR[rd] <-- (GPR[rs] < imm16 ? 0 : 1)
- sra rd, rt, sa # arithmetic shift right a fixed number of bits
- # GPR[rd] <-- GPR[rs] >>a sa
- sub rd, rs, rt # signed subtraction of integers
- # GPR[rd] <-- GPR[rs] - GPR[rt]
- Your assembler must support the following basic control-of-flow instructions:
- beq rs, rt, offset # conditional branch if rs == rt
- # PC <-- (rs == rt ? PC + 4 + offset <<l 2)
- # : PC + 4)
- blez rs, offset # conditional branch if rs <= 0
- # PC <-- (rs <= 0 ? PC + 4 + offset <<l 2)
- # : PC + 4)
- bltz rs, offset # conditional branch if rs < 0
- # PC <-- (rs < 0 ? PC + 4 + offset <<l 2)
- # : PC + 4)
- bne rs, rt, offset # conditional branch if rs != rt
- # PC <-- (rs != rt ? PC + 4 + offset <<l 2)
- # : PC + 4)
- j target # unconditional branch
- # PC <-- ( (PC+4)(31:28) || (target <<l 2))
- syscall # invoke exception handler, which examines $v0
- # to determine appropriate action; if it returns,
- # returns to the succeeding instruction; see the
- # MIPS32 Instruction Reference for format
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement