Thursday, June 16, 2011

3.8 Other Styles of MIPS Addressing

  • Two more ways of accessing operands
    1. Make it faster to access small constant
    2. Make branches more efficient
  • Constant or Immediate Operands
    • add instruction that has one constant operand is called add immediate or add i
  • The MIPS field containing the constant is 16 bits long
  • The op field for addi is 8
  • Constant operands occur frequently, and by making constants part of arithmetic instructions, they are much faster than if they were loaded from memory
  • Instruction load upper immediate (lui) specifically to set the upper 16 bits of a constant in a register, allowing a subsequent instruction to specify the lower 16 bits of the constant. ie lui $t0, 255
  • Addressing in Branches and Jumps
  • To allow program as large as 2^32, a branch instruction is calculate the following: Program counter = Register + Branch Address
  • MIPS Addressing Mode:
    • Register addressing: where the operand is a register
    • Base addressing: where the operand is at the memory location whose address is the sum of a register and a constant in the instruction
    • Immediate addressing: where the operand is a constant within the instruction itself
    • PC-relative addressing: where the address is the sum of the PC and a constant in the instruction
    • Pseudodirect addressing, where the jump address is the 26 bits of instruction concatenated with the upper bits of the PC

No comments:

Post a Comment