Search code examples
assemblymipsinstructions

MIPS/Assembly: How do I find register value by hand after an instruction is executed?


I was hoping someone could point me in the right direction. I have an instruction to find the content of a register after an executed instruction. The instruction:

add $s1, $s5, $t9

Register $s1 contents before the instruction: 0x00000457

How would I go about doing this by hand?

I know the instruction converted into binary is (based on register numbers, which is probably wrong. But I tried it considering I had no values):

0000 0010 1011 1000 1000 1000 0010 0000

But I don't really understand how to figure out what the value after that instruction would be.


Solution

  • $s1 is the write-only destination for add $s1, $s5, $t9. It does

    $s1 = $s5 + $t9
    

    The starting value of $s1 is completely irrelevant and tells you nothing; the instruction has no dependency on it.

    You need the values of the source operands, $s5 and $t9.