Please have a look at this Single Cycle Data Path
in MIPS
. The 26 bits
of J type instruction
are being Bit Extended to 28
. I don't get the point. Shouldn't it be extended to 31 so it makes 32
bits overall. Please help me out to clear the concept.
Thanks
Asked
Active
Viewed 1,126 times
0
1 Answers
3
This is really no sign extension. Recall that the instructions in MIPS are 4-byte aligned.
This means that you can start an instruction at addresses which are 0 modulus 4 (i.e. 0, 4, 8, 12, ...)
Now, doing a shift left of 2 two bits is like multiplying by 4, which yields numbers which are always 0 modulus 4.
The actual address will be formed with: - the 4 most significant bits of the nPC (that is PC+4) (lets call them PPPP) - the 26 bits of the address field specified in the instruction, (lets call them AAA....AA) - 00 as the two least significant bits (which yields the required instruction alignment)
Thus the address will be (binary) PPPPAAAAAAAAAAAAAAAAAAAAAAAAAA00

gusbro
- 22,357
- 35
- 46
-
If you did the shift 6 bits instead of two, you would get addresses of the form (binary) AAAAAAAAAAAAAAAAAAAAAAAAAA000000. Note that this would be really unuseful as you would be only allowed to jump to addresses which where 0 modulus 64 (i.e. 0, 64, 128, 192, 256, ...) – gusbro Sep 15 '11 at 20:04