Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I tried to reason about each instruction best I could, but I don\'t know if I\'m

ID: 3788150 • Letter: I

Question

I tried to reason about each instruction best I could, but I don't know if I'm correct.

1. Move address into R2 -> R2: 0x100
2. Load value of R2 into R1 -> R1: 00
3. Load value of R2 with offset of 4 into R3 -> R3: 12
4. Store address of R3 into R1 -> R1: 0X104
5. Load value of R1 with offset of 3 into R3 -> R3: CD
6. Load the value of R2 with an offset of 5 into R3 -> R3: AB

After all six instructions complete I came up with R1: 0x104, R2: 0x100 and R3: AB

Assume an ISA has the following properties: -3 Registers size 32 bits Word size: 32 bits Little endian memory storage format Let's say part of data memory looks like: 0x107 CD 0x106 AB 0x105 34 0x104 12 0x103 00 0x102 AB 0x101 00 0x100 00 What are the contents of R1, R2, R3, and data memory after the following sequence of instructions? List data in all known addresses. MOV R2 0x100 LDW R1 (R2) LDW R3 4(R2) STW (R1) R3 LDB R3 3(R1) STB 5(R2) R3 Note: STW store word STB store byte LDW load word LDB load byte

Explanation / Answer

1.After first instruction R2=0x100 which is a memory location.

2.After second instruction R1=0000 store word from memory location 0x100 to 0x101 stored in R2.

3.After this instruction R3=12 which is content of 0x104 since 4(R2)=0x100+4=0x104.

4.Store the content of R3 into R1.Now R1 also pointing to memory location 0x104

5.R3=CD which is content of memory location 0x107 since 3(R1)=3(Ox104)=Ox104+3=Ox107

6.Store the byte from R3 which is 12 into 5(R2)=5(Ox100)=Ox100+5=Ox105 memory location.