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

5. Track the contents of stack. The Address Data (4 bytes) SP memory block to th

ID: 3349095 • Letter: 5

Question

5. Track the contents of stack. The Address Data (4 bytes) SP memory block to the right shows values0x2000.x in stack after executing the code below LDR R0, 0xFFEEDDCC LDR R1, -0x11223344 LDR R2, 0xA9B8C7D6 LDR R3, =0x20003000 MOV SP, R3 PUSH IRO PUSH R1 PUSH IR2 2FF4D6 2FF8 44 2FFCCC 3000 33 22 Create a table similar to that above to sketch the values in stack memory (down to address 0x2000.2FFF) after the code segment below is executed. Indicate the position of the Stack Pointer (SP) at the end of this code segment a. POP R4 PUSH IR2 PUSH R1} POP (R2) POP (R5) PUSH IRO PUSH IR4) b. What values are in RO - R5 after executing the code in (a)?

Explanation / Answer

The following shows step by step explanation of the contents of registers R0 - R5 and stack after each code line is executed:

Instruction

Explanation

Contents of registers

Contents of stack

POP {R4}

Contents from top of stack are copied to R4 register.

Stack Pointer (SP) is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF4

2FF8

44

33

22

11

<--

2FFC

CC

DD

EE

FF

3000

PUSH {R2}

SP is incremented and contents of R2 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF4

D6

C7

B8

A9

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

PUSH {R1}

SP is incremented and contents of R1 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

44

33

22

11

<--

2FF4

D6

C7

B8

A9

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

POP {R2}

Contents from top of stack are copied to R2 register.

SP is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

D6

C7

B8

A9

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

POP {R5}

Contents from top of stack are copied to R5 register.

SP is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

2FF8

44

33

22

11

<--

2FFC

CC

DD

EE

FF

3000

PUSH {R0}

SP is incremented and contents of R0 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

CC

DD

EE

FF

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

PUSH {R4}

SP is incremented and contents of R4 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

D6

C7

B8

A9

<--

2FF4

CC

DD

EE

FF

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

The following is the final solution:

a. Table showing content of stack

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

D6

C7

B8

A9

<--

2FF4

CC

DD

EE

FF

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

b. Values of R0 to R5

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Instruction

Explanation

Contents of registers

Contents of stack

POP {R4}

Contents from top of stack are copied to R4 register.

Stack Pointer (SP) is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF4

2FF8

44

33

22

11

<--

2FFC

CC

DD

EE

FF

3000

PUSH {R2}

SP is incremented and contents of R2 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF4

D6

C7

B8

A9

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

PUSH {R1}

SP is incremented and contents of R1 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0XA9B8C7D6

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

44

33

22

11

<--

2FF4

D6

C7

B8

A9

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

POP {R2}

Contents from top of stack are copied to R2 register.

SP is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = NOT AVAILABLE

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

D6

C7

B8

A9

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

POP {R5}

Contents from top of stack are copied to R5 register.

SP is decremented.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

2FF8

44

33

22

11

<--

2FFC

CC

DD

EE

FF

3000

PUSH {R0}

SP is incremented and contents of R0 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

2FF4

CC

DD

EE

FF

<--

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

PUSH {R4}

SP is incremented and contents of R4 are copied to top of stack.

R0 = 0XFFEEDDCC

R1 = 0X11223344

R2 = 0X11223344

R3 = 0X20003000

R4 = 0XA9B8C7D6

R5 = 0XA9B8C7D6

Address (0x2000.x)

Data (4 bytes)

SP

2FF0

D6

C7

B8

A9

<--

2FF4

CC

DD

EE

FF

2FF8

44

33

22

11

2FFC

CC

DD

EE

FF

3000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote