Sunday 16 December 2012

topic 3 - sub 3 : J type and addressing

Jump Type (J-Type)


  • A jump type also known as J-type consists of the two direct jump instructions (j and jal).
  • These instructions require a memory address to specify their operand.
  • J-type instructions use opcodes 00001x.
  • B31-26                 B25-0
      opcode                       target                     


  • These instructions require a 26-bit coded address field to specify the target of the jump.
  • When a J-type instruction is executed, a full 32-bit jump target address is formed by concatenating the high order four bits of the PC (the address of the instruction following the jump), the 26 bits of the target field, and two 0 bits.



Instruction Opcode Target
j       label    000010      coded address of label
jal    label    000011      coded address of label



Jump Instructions

1.  Jump instructions jump to labels (at least, j and jal). The assembler also figures out the
     appropriate addresses. However, it does so using pseudo-direct addressing.

2.  Pseudo-direct addressing has one disadvantage compared to PC-relative addressing. It's
     harder to relocate the code. Relocating the code means to place code at a different address in
     memory.

3.  Typically, a loader program would have to rewrite instructions that use direct addressing
     because the instruction it jumps to might not be in a particular location in memory.



These are the list of instructions :
  • beq   - Branches if the quantities of two registers are equal.
  • bne   - Branches if the quantities of two registers are NOT equal.
  • bgtz   - Branches if a quantity in a register is greater than zero (quantity is 32 bit, 2C).
  • bgez  - Branches if a quantity in a register is greater than or equal to zero (quantity is 32 bit,
                2C).
  • bltz    - Branches if a quantity in a register is less than zero (quantity is 32 bit, 2C).
  • blez   - Branches if a quantity in a register is less than or equal to zero (quantity is 32 bit,  
                2C).
  • j         - Jump to an address
  • jr       - Jump to an address stored in a register
  • jal      - Jump to an address, and store the return address in a register.
  • jalr    - Jump to an address stored in a register, and store the return address in another
                 register.





GOH MENNING
B031210149

2 comments:

  1. I can understand the uses of those instructions ;)

    ReplyDelete
  2. i can understand well.^^

    ReplyDelete