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

lbu & lhu

47 views
Skip to first unread message

David Se Jun Lee

unread,
May 7, 2006, 10:23:42 PM5/7/06
to
Hi,
Reviewing notes, I found lbu and lhu without much description. I searched
the web and found out that lbu means load unsigned byte, and lhu means
load unsigned halfword. The same goes for addiu and addu. What exactly
does "unsigned" mean? Does it mean that it is positive (thus unsigned)?
Or is there some alternate meaning to it?

Thanks


David

Brad Lushman

unread,
May 7, 2006, 10:44:23 PM5/7/06
to

(This was part of Thursday's lecture.) For load commands that don't load a
full word, we must answer the question of what to do with the leftover bits.
The default action, so-called "signed mode", is to sign-extend the value, i.e.,
fill the remaining bits with the left-most bit of the loaded value. This works
fine as long as numbers whose left-most bit is 1 are meant to be negative
integers. However, it's possible that we mean such numbers to actually be
really large *positive* integers. In such cases, sign-extension is not
appropriate, as it will not preserve the value of the loaded byte/halfword.
What you want to do in these cases is zero-extension, i.e., fill the remaining
bits with 0. This is what the "unsigned mode" operations do.

However, note that not all of the advertised unsigned-mode MIPS instructions
are actually available in the implementation you're using. The course web
page lists the differences between our MIPS implementation and the "real"
MIPS language.

Brad

0 new messages