Each instruction in the MIPS language is 4 bytes long (32 bits). The
offset in the immediate part of the instruction says jump ahead this many
instructions... not how many bytes to jump ahead. So to covert from
instructions to bytes we need to multiply by 2, or shift left by 2.
Dave
On Wed, 26 Oct 2005, CS 251 Tutor wrote:
> Hi,
>
> Each instruction in the MIPS language is 4 bytes long (32 bits). The
> offset in the immediate part of the instruction says jump ahead this many
> instructions... not how many bytes to jump ahead. So to covert from
> instructions to bytes we need to multiply by 2, or shift left by 2.
when conveting from an instruction to Byte, dont we need to multiply by
4? (Since each shift is a multiply by 2)
> On Wed, 26 Oct 2005, CS 251 Tutor wrote:
>
> > Hi,
> >
> > Each instruction in the MIPS language is 4 bytes long (32 bits). The
> > offset in the immediate part of the instruction says jump ahead this many
> > instructions... not how many bytes to jump ahead. So to covert from
> > instructions to bytes we need to multiply by 2, or shift left by 2.
>
> when conveting from an instruction to Byte, dont we need to multiply by
> 4? (Since each shift is a multiply by 2)
>
Yep. Shift left by two == multiply by four == convert word to byte count
Richard
Hi,
Sorry about the confusion. I meant 4, but apparently typed 2.
Dave.