MIPS: J-format Instructions and Address Encoding -
I am skeptical when it comes to address encoding for J-format instructions. Class notes from
Let's assume that L1 is at position 41 9 4340 in decimal, which is 400024 in hexadecimal. We fill the target field as an address in the instructions (0x100009) instead of bytes (0x400024)
Can anyone tell me why is this?
j
directions jumps to the target
However, because the instruction set is limited to 32 bits, and 6 is used for the option code, only 26 can be used for the target goal.
This means that distance can travel to a j
direction is limited because it works by adding its target to some of the important bits of the current IPC.
The MIPS instructions set could have been set by saying that when a j
instruction is given, you can specify the first 6 bit of the IPC to j
26bit targets are added, but instead it was instructed that a program can junk always "align the word" means that this address is always a respect of 4 and hence the last 2 bit of the address is always 0 Are there.
This does not allow us to encode the last 2 bit in our jump target and instead encodes bits 3 -28. This means that to achieve the goal of a j
directive, you take the first 4 bits of the PC, add the jump targets, and then add two zeros.
Hopefully with this explanation, the way it is understood that the target 0x400024
is passed to j
bits 0x100009
That is, 0x400024 & gt; & Gt; ; 2
. Because the last two bit is not needed.
Comments
Post a Comment