1

I know this is not a programming question but I am struggling to understand how to get the solution to this problem. I'm not sure how this is figured out and I can't find a explained solution. enter image description here

Janeson00
  • 113
  • 9

1 Answers1

2

The only change in the table is at address x3406. That tells us it was a store instruction as no other is capable of writing into memory.

The available store instructions are ST, STI and STR. ST uses a 9 bit signed offset from PC which is given as x3010 in the question and is therefore out of range. STI could work but we are not provided with a memory location usable for the indirect address. That leaves STR for which the encoding allows for a 6 bit offset so to make the address x3406 we need a base from x33E6 to x3427 which leaves only a single possibility: R4 for which the offset is 6.

The new value is xe373 which must have come from R2 since again that's the only option.

Jester
  • 56,577
  • 4
  • 81
  • 125
  • 1
    (And LC3 doesn't have store-immediate or store with an absolute address embedded in the instruction, because it's a fixed-width ISA. And it doesn't have stuff like memory-destination ADD; I think the only instruction that writes memory is `str`) – Peter Cordes Dec 13 '18 at 13:27
  • @PeterCordes thank you I have updated the answer with `ST` and `STI`. – Jester Dec 13 '18 at 13:36