Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shifting left 2 for "beq"

2,142 views
Skip to first unread message

Yubo Luo

unread,
Oct 26, 2005, 2:30:38 AM10/26/05
to
Could I have more details for why we need to shift offset field by left 2?

CS 251 Tutor

unread,
Oct 26, 2005, 10:08:27 AM10/26/05
to
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.

Dave

Jose Daniel Rosales Lopez

unread,
Oct 26, 2005, 3:44:56 PM10/26/05
to CS 251 Tutor

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)

Ma...@uwaterloo.ca

unread,
Oct 26, 2005, 3:54:47 PM10/26/05
to
Jose Daniel Rosales Lopez <jdro...@student.cs.uwaterloo.ca> writes:

> 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

CS 251 Tutor

unread,
Oct 26, 2005, 8:28:43 PM10/26/05
to
> Yep. Shift left by two == multiply by four == convert word to byte count

Hi,

Sorry about the confusion. I meant 4, but apparently typed 2.

Dave.

shujaa...@gmail.com

unread,
May 8, 2017, 1:26:49 PM5/8/17
to
0 new messages