Sunday 16 December 2012

Topic 3 - subtopic 5 : Pseudo-direct addressing

Pseudo direct addressing

In direct addressing, an address is specified in the instruction. The J-type instruction ideally would use direct addressing to specify a 32-bit jump target address (JTA) to indicate the instruction address to execute next. However, the J-type instruction encoding does not have enough bits to specify a full 32-bit JTA.

J-type Instructions
  • jr uses register addressing: it’s an R-type instruction
            –jr $31 ($ra)

           

  • j and jal use pseudo-direct addressing: J-type
                  – Looks like immediate addressing in assembler
                   – allows 26 bits instead of 16
  • For example: j 10000 and jal 10000:



Addressing for jump




Pseudo-Direct addressing is specifically used for J-type instructions, j and jal. The instruction format is 6 bits of opcode and 26 bits for the immediate value or target.



The effective address is calculated by taking the upper 4 bits of the Program Counter (PC), concatenated to the 26 bit immediate value, and the lower 2 bit are 00.

The  new effective address, any operand to an instruction which references memory
is always be word aligned (means an address must be multiple of 4) and only have ( 0 0 ) 2-bit target address of jump instruction to create a complete 32-bit address. Take the top 4 bits of the PC, concatenate that with the 26 bits that make up the target, and concatenate that with 00. The jump target is constrained to anywhere within 256MB block of code (1/16 of the total 4GB address space) with the R-type instruction jr and jalr are used, where complete 32-bit target address is specified in a register since the upper 4 bits of the PC is used. The new 32-bit address of the PC is produced.

For example: J label





implementation of Pseudo-direct Addressing



                   


LIEW JUN JIE
B031210374

2 comments: