Reputation: 1495
Assume that the processor is executing the following instruction:
lb $t3,-7($s0)
Moreover, assume that the instruction above is located at address 0x004000f0
,
register $t3
contains value 0x20040144
, and that register $s0
contains value
0x305502db
. What value has registers $t3
after that the instruction has finished executing?
From my calculation:
The format of the instruction is:
lb RegDest, Offset(RegSource)
we know $s0
contains value 0x305502db
, which leads to 0x305502db - 7 = 0x305502d4
and this value will be loaded in $t3
. I am confused here now because the correct answer says $t3 = unknown
, how come?
Upvotes: 0
Views: 1843
Reputation: 18523
0x305502db - 7 = 0x305502d4
... so the lb
instruction will load the byte from the memory (for example: RAM) at address 0x305502d4
, sign-extend it and write it into the register $t3
.
If the RAM contains the value 0x5A
at address 0x305502d4
, $t3
will contain the value 0x0000005A
. If it contains the value 0xA5
, $t3
will contain the value 0xFFFFFFA5
.
... the correct answer says
$t3 = unknown
, how come?
Your exercise does not contain any information about the content of the RAM at address 0x305502d4
.
Therefore you cannot say which value $t3
will contain.
Upvotes: 3